/* ==========================================================================
   Curriculum Hub — visual polish layer.
   Loaded LAST (after curriculum-enhancements.css + curriculum-sidebar.css) so it
   refines the existing look without changing markup, JS, routes, or class names.
   Scoped to the curriculum page only (linked solely from curriculum/index.html).

   Goal: a clean, modern, professional academic UI. Crisp white surfaces, a calm
   slate palette, layered soft shadows, a defined control panel, a tinted unit
   header band, and clean activity cards. Pairs with the active `light-theme`.
   ========================================================================== */

:root {
  --p-bg: #eef2f8;
  --p-surface: #ffffff;
  --p-surface-2: #f6f9fc;
  --p-ink: #14233d;
  --p-muted: #56657d;
  --p-faint: #5d6c80; /* AA on white + #f6f9fc */
  --p-line: #e4eaf2;
  --p-line-strong: #d3dde9;
  --p-navy: #143a6b;
  --p-blue: #1f5fa6;
  --p-blue-soft: #e9f1fb;
  --p-blue-line: #d2e2f5;
  --p-green: #1c7a64;
  --p-green-soft: #e6f4ef;
  --p-radius: 16px;
  --p-radius-sm: 11px;
  --p-shadow-sm:
    0 1px 2px rgba(17, 38, 71, 0.05), 0 2px 6px rgba(17, 38, 71, 0.05);
  --p-shadow-md:
    0 4px 10px rgba(17, 38, 71, 0.06), 0 18px 36px -20px rgba(17, 38, 71, 0.3);
  --p-shadow-lg:
    0 8px 18px rgba(17, 38, 71, 0.08), 0 30px 60px -28px rgba(17, 38, 71, 0.38);
}

/* ---- Calmer, modern page background ----------------------------------- */
body.light-theme {
  background: var(--p-bg);
  font-size: 16.5px;
}
body.light-theme::before {
  background:
    radial-gradient(
      820px 420px at 94% -12%,
      rgba(28, 122, 100, 0.07),
      transparent 62%
    ),
    radial-gradient(
      1000px 520px at -10% -6%,
      rgba(31, 95, 166, 0.09),
      transparent 60%
    ),
    var(--p-bg) !important;
}

.wrap {
  max-width: 1160px;
}

/* ---- Masthead ----------------------------------------------------------- */
header.hub {
  margin-bottom: 30px;
}
header.hub .eyebrow {
  display: inline-block;
  color: var(--p-blue);
  background: var(--p-blue-soft);
  border: 1px solid var(--p-blue-line);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
header.hub h1 {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--p-navy);
  margin: 18px 0 14px;
  line-height: 1.02;
}
header.hub p.lede {
  color: var(--p-muted);
  font-size: 17px;
  max-width: 70ch;
}

/* ==========================================================================
   Control panel — gather the stacked rows into one defined white card
   ========================================================================== */
#hub-toolbar-sticky {
  background: var(--p-surface);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius);
  box-shadow: var(--p-shadow-md);
  padding: 18px 20px 16px;
  margin: 0 0 26px;
}
body.light-theme #hub-toolbar-sticky {
  background: var(--p-surface);
}
/* When it sticks, keep it readable with a frosted fallback */
#hub-toolbar-sticky.is-stuck,
#hub-toolbar-sticky {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Primary search — clearly the focal control */
.controls {
  margin: 0 0 14px;
}
body.light-theme .search {
  border: 1.5px solid var(--p-line-strong);
  border-radius: 13px;
  background: var(--p-surface-2);
  box-shadow: none;
  min-height: 54px;
  padding: 0 18px;
}
.search:focus-within {
  border-color: var(--p-blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(31, 95, 166, 0.12);
}
.search label {
  color: var(--p-faint);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.search input {
  font-size: 16px;
}

/* Secondary controls (Show only problems / Status) — quiet, inline */
.audit-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--p-line);
  font-size: 13.5px;
  color: var(--p-muted);
}
.audit-controls label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.audit-controls select {
  border: 1px solid var(--p-line-strong);
  background: var(--p-surface);
  color: var(--p-ink);
  border-radius: 8px;
  padding: 6px 9px;
  font: inherit;
  font-size: 13px;
}

/* Mode toggle + dashboard link */
body.light-theme .hub-mode-toggle {
  min-height: 44px;
  border-radius: 11px;
  border-color: var(--p-line-strong);
  background: var(--p-surface);
  font-weight: 700;
}
body.light-theme .hub-mode-toggle[aria-pressed="true"] {
  background: var(--p-navy);
  border-color: var(--p-navy);
  color: #fff;
}
.hub-enhance-controls {
  margin-bottom: 16px;
}

/* Category filter chips — clean pills, solid navy active state */
.hub-filter-chips {
  gap: 9px;
  margin-bottom: 16px;
}
body.light-theme .hub-filter-chip {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--p-line-strong);
  background: var(--p-surface);
  color: var(--p-muted);
  font-weight: 700;
  box-shadow: none;
}
body.light-theme .hub-filter-chip:hover,
body.light-theme .hub-filter-chip:focus-visible {
  border-color: var(--p-blue);
  color: var(--p-blue);
  background: var(--p-blue-soft);
}
body.light-theme .hub-filter-chip[aria-pressed="true"] {
  background: var(--p-navy);
  border-color: var(--p-navy);
  color: #fff;
}

/* Browse by standard — its own light sub-panel */
.hub-standards {
  gap: 9px 11px;
  padding: 14px 16px;
  background: var(--p-surface-2);
  border: 1px solid var(--p-line);
  border-radius: var(--p-radius-sm);
  box-shadow: none;
  margin-bottom: 0;
}
.hub-standards-lead {
  padding-top: 9px;
  color: var(--p-faint);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 11.5px;
  font-weight: 800;
}
.hub-standard-chip {
  border: 1.5px solid var(--p-line-strong);
  border-radius: 999px;
  background: var(--p-surface);
}
.hub-standard-chip:hover,
.hub-standard-chip:focus-visible {
  background: var(--p-green-soft);
  border-color: var(--p-green);
}
.hub-substd-select {
  border: 1px solid var(--p-line-strong);
  border-radius: 8px;
}

.hub-progress-summary {
  margin: 14px 2px 4px;
  font-size: 13.5px;
}

/* ==========================================================================
   Master/detail shell
   ========================================================================== */
.curr-shell {
  gap: 30px;
}
.curr-rail {
  gap: 8px;
}
.curr-rail-item {
  position: relative;
  border-radius: 12px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--p-line);
  background: var(--p-surface);
  box-shadow: var(--p-shadow-sm);
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}
.curr-rail-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16%;
  bottom: 16%;
  width: 4px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s;
}
.curr-rail-item:hover,
.curr-rail-item:focus-visible {
  border-color: var(--p-line-strong);
  box-shadow: var(--p-shadow-md);
  transform: none;
}
.curr-rail-item[aria-current="true"] {
  background: var(--p-blue-soft);
  border-color: var(--p-blue-line);
  box-shadow: var(--p-shadow-md);
}
.curr-rail-item[aria-current="true"]::before {
  background: var(--p-navy);
}
.cri-num {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 14.5px;
  color: var(--p-ink);
}
.curr-rail-item[aria-current="true"] .cri-num {
  color: var(--p-navy);
}
.cri-name {
  color: var(--p-muted);
  font-size: 12px;
}

/* ==========================================================================
   Unit detail card — premium white panel with a tinted header band
   ========================================================================== */
body.light-theme .unit-card {
  border: 1px solid var(--p-line);
  border-radius: 20px;
  padding: 0;
  box-shadow: var(--p-shadow-lg);
  gap: 0;
  overflow: hidden;
}
body.light-theme .unit-card:hover {
  transform: none;
  box-shadow: var(--p-shadow-lg);
  border-color: var(--p-line);
}
/* Header band */
.unit-card-header {
  align-items: flex-start;
  padding: 26px 30px 22px;
  margin: 0;
  background: linear-gradient(180deg, var(--p-blue-soft), #f4f8fd);
  border-bottom: 1px solid var(--p-blue-line);
}
.unit-card-num {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 28px;
  color: var(--p-navy);
  letter-spacing: -0.025em;
}
.unit-card-name {
  color: var(--p-blue);
  font-size: 15.5px;
  font-weight: 700;
}
.unit-card-blurb {
  color: var(--p-muted);
  font-size: 12.5px;
}
.unit-progress-bar {
  background: #d8e3f1;
}

/* Everything below the header gets body padding via the direct children.
   The unit-card is a flex column; pad each non-header block. */
body.light-theme .unit-card > *:not(.unit-card-header) {
  margin-left: 30px;
  margin-right: 30px;
}
body.light-theme .unit-card > .unit-resources-row {
  margin-top: 22px;
}
body.light-theme .unit-card > *:last-child {
  margin-bottom: 28px;
}

/* Standard badges row */
.lesson-standard-badge {
  border-radius: 999px;
  padding: 3px 11px;
  font-weight: 800;
}

/* Unit-resource chips (graphic novel / game / tests / print) */
body.light-theme .unit-resource-btn {
  background: var(--p-blue-soft);
  color: var(--p-blue);
  border: 1px solid var(--p-blue-line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
}
body.light-theme .unit-resource-btn:hover {
  background: var(--p-navy);
  border-color: var(--p-navy);
  color: #fff;
}
.unit-resources-row {
  gap: 9px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--p-line);
}

/* Phase selectors (Pre / Lesson / Post) */
.selector-label {
  color: var(--p-faint);
  font-weight: 800;
}
body.light-theme .select-control {
  border: 1.5px solid var(--p-line-strong);
  border-radius: 11px;
  background: var(--p-surface);
  padding: 12px 36px 12px 14px;
  box-shadow: none;
  font-size: 14.5px;
}
body.light-theme .select-control:focus {
  border-color: var(--p-blue);
  box-shadow: 0 0 0 4px rgba(31, 95, 166, 0.12);
}

/* Launch button */
body.light-theme .btn-launch {
  border-radius: 11px;
  padding: 13px 24px;
  font-weight: 700;
  box-shadow: 0 8px 18px -8px rgba(20, 58, 107, 0.5);
}

/* Lesson info / objective / real-world callout */
body.light-theme .lesson-info {
  background: var(--p-surface-2);
  border: 1px solid var(--p-line);
  border-radius: 14px;
  padding: 20px;
}
.lesson-info-obj {
  border-left: 3px solid var(--p-blue);
  color: var(--p-muted);
  font-size: 14px;
}
body.light-theme .lesson-real-world {
  border-radius: 12px;
}

/* ---- Activity menu: clean grouped cards ------------------------------- */
.lesson-outline-group {
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--p-line);
}
.lesson-outline-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.lesson-outline-group-title {
  color: var(--p-faint);
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 800;
}
.lesson-outline-list {
  gap: 10px;
}
.lesson-outline-item {
  gap: 7px;
}
body.light-theme .lesson-outline-item a {
  border: 1.5px solid var(--p-line-strong);
  border-radius: 11px;
  background: var(--p-surface);
  color: var(--p-ink);
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 14px;
  box-shadow: var(--p-shadow-sm);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    color 0.15s,
    transform 0.1s;
}
body.light-theme .lesson-outline-item a:hover {
  border-color: var(--p-blue);
  color: var(--p-blue);
  box-shadow: var(--p-shadow-md);
  transform: translateY(-1px);
}
.progress-check {
  width: 27px;
  height: 27px;
  border-radius: 8px;
  border: 1.5px solid var(--p-line-strong);
}
.progress-check[aria-pressed="true"] {
  background: var(--p-green-soft);
  border-color: var(--p-green);
  color: var(--p-green);
}

/* Copy-link */
.lesson-copy-link {
  border-radius: 11px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.wrap > footer,
footer.hub-footer {
  color: var(--p-faint);
  margin-top: 8px;
}

/* ---- Responsive: drop the header-band side padding offsets on mobile --- */
@media (max-width: 820px) {
  .curr-shell {
    gap: 18px;
  }
}
@media (max-width: 560px) {
  .unit-card-header {
    padding: 20px 18px 16px;
  }
  body.light-theme .unit-card > *:not(.unit-card-header) {
    margin-left: 18px;
    margin-right: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .curr-rail-item,
  .lesson-outline-item a {
    transition: none;
  }
}

/* ==========================================================================
   Larger, clearer type — a more legible, professional scale
   ========================================================================== */
body.light-theme {
  font-size: 17.5px;
  line-height: 1.62;
}
header.hub p.lede {
  font-size: 18px;
  line-height: 1.6;
}
.search input,
.search input::placeholder {
  font-size: 16.5px;
}
.search label,
.audit-controls,
.hub-progress-summary {
  font-size: 14px;
}
body.light-theme .hub-filter-chip {
  font-size: 14px;
}
.hub-standard-chip,
.hub-standard-chip .hsc-code,
.hub-standard-chip .hsc-label {
  font-size: 13.5px;
}
.cri-num {
  font-size: 15px;
}
.cri-name {
  font-size: 12.5px;
}
.unit-card-name {
  font-size: 16px;
}
.lesson-info-obj {
  font-size: 14.5px;
}
.lesson-real-world {
  font-size: 14px !important;
}
body.light-theme .select-control {
  font-size: 15px;
}
body.light-theme .lesson-outline-item a {
  font-size: 14px;
}
.lesson-outline-group-title,
.selector-label {
  font-size: 11.5px;
}
/* Slightly stronger muted contrast for accessibility */
body.light-theme {
  --muted: #4d5b72;
}

/* ==========================================================================
   Two-pane layout — static intro/controls on the left, scrolling units right
   Engages only on wide screens; below 1080px it stays single-column (mobile).
   ========================================================================== */
@media (min-width: 1080px) {
  .wrap {
    max-width: 1340px;
    display: grid;
    grid-template-columns: minmax(360px, 400px) minmax(0, 1fr);
    column-gap: 40px;
    align-items: start;
    padding-top: clamp(28px, 4vw, 52px);
  }

  /* Left pane: pinned, scrolls internally if taller than the viewport */
  .hub-side {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 10px 24px 2px;
    margin: -4px 0 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  /* Thin, unobtrusive scrollbar for the left pane */
  .hub-side::-webkit-scrollbar {
    width: 8px;
  }
  .hub-side::-webkit-scrollbar-thumb {
    background: #cdd8e6;
    border-radius: 999px;
  }

  /* Right pane: the curriculum, scrolls with the page */
  #interactive-hub {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
  .wrap > .no-results,
  .wrap > .result-count,
  .wrap > #hub-print-header {
    grid-column: 2;
  }
  .wrap > footer.hub {
    grid-column: 1 / -1;
    margin-top: 24px;
  }

  /* The control panel no longer needs its own sticky — the whole side is pinned */
  #hub-toolbar-sticky {
    position: static;
    margin-bottom: 0;
  }

  /* Reset per-item margins/spacing inside the flex side column */
  .hub-side > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  /* Compact masthead in the narrow column */
  header.hub h1 {
    font-size: clamp(2rem, 3vw, 2.6rem);
    margin: 14px 0 10px;
  }
  header.hub p.lede {
    font-size: 15.5px;
  }

  /* Feature cards become compact link cards: icon + title + buttons only.
     The long descriptions are hidden in the narrow sidebar so the search and
     filters below stay within easy reach. */
  .features-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
  .mailbox-feature,
  .ai-hub-feature {
    padding: 16px 18px !important;
  }
  .mailbox-feature .mf-text,
  .ai-hub-feature .ahf-text,
  .mailbox-feature .mf-sub,
  .ai-hub-feature .ahf-sub {
    display: none !important;
  }
  .mailbox-feature h2,
  .ai-hub-feature h2 {
    font-size: 1.18rem !important;
    margin: 2px 0 10px !important;
  }
  .mailbox-feature .mf-icon,
  .ai-hub-feature .ahf-icon {
    width: 40px !important;
    height: 40px !important;
  }
  .mailbox-feature .mf-btn,
  .ai-hub-feature .ahf-btn {
    font-size: 13px !important;
    min-height: 40px !important;
  }

  /* Tighten the secondary blocks so controls stay reachable */
  .eoy-callout {
    padding: 13px 15px !important;
  }
  .eoy-callout .eoy-text {
    font-size: 13.5px !important;
  }

  /* Compact the control panel inside the narrow sidebar */
  #hub-toolbar-sticky {
    padding: 16px 16px 14px !important;
  }
  .hub-filter-chip {
    min-height: 34px;
    padding: 0 14px !important;
  }
  .hub-standards {
    padding: 11px 12px;
    gap: 7px 8px;
  }
  .hub-standard-chip {
    min-height: 32px;
    padding: 0 10px;
  }
  .hub-substd-select {
    min-height: 30px;
    max-width: none;
  }
  .hub-mode-toggle {
    min-height: 40px !important;
  }
}

/* In two-pane mode the unit rail sits inside the right pane beside the detail;
   keep the shell from feeling cramped. */
@media (min-width: 1080px) {
  .curr-shell {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 24px;
  }
}
