.categories {
    max-width: 95%;
    min-width: 75%;
    margin: 1rem auto;
    padding: 1rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.1rem 0.3rem rgba(0, 0, 0, 0.2);
    flex: 1;
}

.categories * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.categories .container {
    width: 100%;
    padding: 0.5rem;
}


/* Topic sections as true vertical columns */
.categories .topic-section {
  background-color: #fff;
  border-radius: 0.3rem;
  box-shadow: 0 0.05rem 0.1rem rgba(0,0,0,0.05);
  margin-bottom: 0.75rem;
  overflow: hidden;
  align-items: left;

  column-count: 1;   /* default: 1 column */
  column-gap: 1rem;  /* spacing between columns */
}

@media (min-width: 600px) {
  .categories .topic-section {
    column-count: 2; /* 2 columns on medium screens */
  }
}

@media (min-width: 900px) {
  .categories .topic-section {
    column-count: 3; /* 3 columns on large screens */
  }
}

/* Subtopics should flow vertically inside columns */
.categories .subtopic {
  break-inside: avoid;
  display: block;
  margin-bottom: 1rem;
}
.subtopic {
  display: block;
  margin-bottom: 1rem;
  margin-top: .1rem;
  padding: 1rem;
  background-color: #f9f9f9; 
  border: 1px solid #ddd;   
  border-radius: 8px;  
  color: #004080;    
}

.categories .topic-header {
  column-span: all;  /* spans across all multi-columns */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  border-radius: 8px;  
}

.categories .topic-header h2 {
    margin-left: 1rem;
    flex-grow: 1;
    font-size: clamp(1.1rem, 2.25vw, 1.5rem);
    min-width: 40%; /* Ensures text doesn't get too squished */    
}

.container .topic-header {
  /* Light pastel background (10% grade color + 90% white) */
  background-color: color-mix(in srgb, var(--grade-color) 10%, white 90%);
  
  /* Strong grade-colored text */
  color: var(--grade-color);
  
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.heading-title {
  display: block;
  margin-bottom: 10px; /* space between heading and list */
  font-size: clamp(1rem, 2vw, 1.1rem);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.link-list {
  counter-reset: item;
  list-style: none;
  padding-left: 0;
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.1rem);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.link-list li {
  counter-increment: item;
  margin-bottom: 0.4rem;
  position: relative;
  padding-left: 1.4rem; /* reduced from 2rem */
}

.link-list li::before {
  content: counter(item) ".";
  position: absolute;
  left: 0;
  top: 0;
  line-height: 1.5;
  font-weight: bold;
  color: #555;
}


.link-list li a {
  display: block;
  padding: 4px 6px;
  color: #004080;
  text-decoration: none;
  background-color: #f9f9f9;
  border-radius: 6px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  word-wrap: break-word;
}


.link-list li a:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background-color: #eaeaea;
}


html {
  scroll-padding-top: 120px; /* height of your navbar */
}


/* Navbar */
.edu-navbar {
  background: var(--neutral-bg);
  padding: 0.8rem 1rem 0.8rem 2rem; /* top right bottom left */
  display: flex;
  justify-content: flex-start;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.edu-container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Dropdown */
.dropdown {
  position: relative;  
}

.dropdown-btn {
  background: var(--neutral-bg);
  border: 2px solid currentColor;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-weight: 600;
  cursor: pointer;
  color: inherit;
  transition: 0.3s;
  min-width: 130px;
}

.dropdown-btn:hover {
  opacity: 0.85;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 110%;
  left: 0;
  background: var(--neutral-bg);
  border: 2px solid currentColor;
  border-radius: 6px;
  width: max-content;
  max-width: 90vw; /* keeps inside screen */
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  flex-direction: column;
  z-index: 1000;
}

.dropdown-menu a {
  padding: 0.6rem 1rem;
  display: block;
  text-decoration: none;
  color: inherit;
  font-size: clamp(0.9rem, 2vw, 1rem);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
}

.dropdown-menu a:hover {
  background: rgba(0,0,0,0.05);
}

.dropdown-menu .active {
  font-weight: bold;
  background: rgba(0,0,0,0.05);
}

/* Show Menu on Click */
.dropdown.open .dropdown-menu {
  display: flex;
}

/* Subject Header */
.subject-header {
  padding: 0.8rem 1rem 0.8rem 2rem; /* top right bottom left */
}

.subject-title {
  font-size: clamp(1.2rem, 4vw, 2.2rem);
  margin-bottom: 1rem;
  font-weight: 600;
}

/* Default: desktop styles remain */
.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.8rem 1rem 0.8rem 0.5rem;
}

.section-link {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  text-decoration: none;
  font-size: clamp(0.8rem, 2vw, 1rem);
  font-weight: 600;
  transition: 0.3s;
  border: 2px solid currentColor;
  color: currentColor;
  background: transparent;
}

@media (max-width: 600px) {
  .section-links {
    display: flex;
    flex-wrap: nowrap;       /* prevent wrapping on mobile */
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    overflow-x: auto;        /* horizontal scroll if needed */
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
    scrollbar-width: none;   /* hide scrollbar for Firefox */
  }

  /* hide scrollbar for Chrome, Safari, Edge */
  .section-links::-webkit-scrollbar {
    display: none;
  }

  .section-link {
    flex: 0 0 auto;          /* keep intrinsic width, do not shrink */
    padding: 0 0.3rem;       /* smaller padding for mobile */
    border-radius: 0;
    border: none;
    font-size: clamp(0.7rem, 3vw, 0.85rem);
    text-decoration: none;
    color: currentColor;
    white-space: nowrap;     /* prevent text wrap */
    position: relative;
  }

  /* separator between items */
  .section-link:not(:last-child)::after {
    content: "|";
    margin-left: 0.3rem;
    color: currentColor;
    position: relative;
  }
}

/* === Grade Colors === */

.container {
  --grade-color: #3498db; /* default */
}

.container.grade-pre-k { --grade-color: #9440dd; }
.container.grade-kindergarten { --grade-color: #cc007e; }
.container.grade-1 { --grade-color: #00687a; }
.container.grade-2 { --grade-color: #cc0000; }
.container.grade-3 { --grade-color: #457a00; }
.container.grade-4 { --grade-color: #0025cc; }
.container.grade-5 { --grade-color: #007a3f; }
.container.adult-learning { --grade-color: #8f1eae; }

:root {
  --pre-k: #9440dd;          /* coral */
  --kindergarten: #cc007e;   /* orange */
  --grade-1: #00687a;        /* yellow */
  --grade-2: #cc0000;        /* green */
  --grade-3: #457a00;        /* blue */
  --grade-4: #0025cc;        /* purple */
  --grade-5: #007a3f;        /* pink */
  --adult: #8f1eae;          /* dark slate */
  --neutral-bg: #ffffff;
  --neutral-border: #ddd;
  --neutral-text: #222;
}


/* === Grade Theme Application === */
.grade-pre-k,
.grade-pre-k .dropdown-btn,
.grade-pre-k .dropdown-menu,
.grade-pre-k .subject-title,
.grade-pre-k .section-link { color: var(--pre-k); }

.grade-kindergarten,
.grade-kindergarten .dropdown-btn,
.grade-kindergarten .dropdown-menu,
.grade-kindergarten .subject-title,
.grade-kindergarten .section-link { color: var(--kindergarten); }

.grade-1,
.grade-1 .dropdown-btn,
.grade-1 .dropdown-menu,
.grade-1 .subject-title,
.grade-1 .section-link { color: var(--grade-1); }

.grade-2,
.grade-2 .dropdown-btn,
.grade-2 .dropdown-menu,
.grade-2 .subject-title,
.grade-2 .section-link { color: var(--grade-2); }

.grade-3,
.grade-3 .dropdown-btn,
.grade-3 .dropdown-menu,
.grade-3 .subject-title,
.grade-3 .section-link { color: var(--grade-3); }

.grade-4,
.grade-4 .dropdown-btn,
.grade-4 .dropdown-menu,
.grade-4 .subject-title,
.grade-4 .section-link { color: var(--grade-4); }

.grade-5,
.grade-5 .dropdown-btn,
.grade-5 .dropdown-menu,
.grade-5 .subject-title,
.grade-5 .section-link { color: var(--grade-5); }

.grade-adult,
.grade-adult .dropdown-btn,
.grade-adult .dropdown-menu,
.grade-adult .subject-title,
.grade-adult .section-link { color: var(--adult); }


/* Default: show long text, hide short */
.long { display: inline; }
.short { display: none; }

/* On small screens: hide long, show short */
@media (max-width: 600px) {
  .long { display: none; }
  .short { display: inline; }
}



