/* base.css — shared design system for every READScore page.
   Header, footer, buttons, and the marketing hero/features layout used
   to be copy-pasted into every single page's own stylesheet (11 byte-
   identical copies). That's consolidated here now: every template loads
   this file first, then its own page-specific stylesheet for whatever
   is unique to that page. Change a color or the header once, it updates
   everywhere. */

:root {
  --max-width: 1200px;

  /* The default light theme -- same "Midnight Code" structure as the dark
     theme below (monospace everywhere, sharp radii, same component shapes)
     but with the earlier "Slate Minimal" blue color scheme instead of a
     recolored green -- --panel is the recessed page background; --paper
     is the elevated card surface sitting on top of it (lighter than
     panel, same elevation logic dark mode uses in reverse). */
  --font-sans: 'JetBrains Mono', 'Courier New', monospace;
  --font-display: 'JetBrains Mono', 'Courier New', monospace;
  --ink:#0F172A;
  --ink-soft:#5B6472;
  --blue:#0369A1;
  --blue-deep:#075985;
  --blue-rgb:3, 105, 161;
  --gold:#D97706;
  --paper:#FFFFFF;
  --panel:#F8FAFC;
  --line:#E2E8F0;
  --line-soft:#EAEEF3;
  --danger:#DC2626;
  --danger-rgb:220, 38, 38;
  --success:#16A34A;
  --success-rgb:22, 163, 74;
  --warning:#D97706;
  --warning-rgb:217, 119, 6;
  --warning-bg:#FDF4E3;
  --radius:6px;
  --radius-sm:4px;
  --radius-lg:8px;
  --radius-pill:6px;

  /* Component-level tokens that can't be derived from the palette above --
     dark mode doesn't just darken these, it changes their character (solid
     pastel tints become translucent accent-tints, opaque glass surfaces
     become dark-navy ones, etc). See the [data-theme="dark"] block below. */
  --surface-rgb:255,255,255;
  --glass-border:rgba(255,255,255,0.75);
  --glass-border-strong:rgba(255,255,255,0.85);
  --muted-grad-from:rgba(255,255,255,0.9);
  --muted-grad-to:rgba(226,229,234,0.6);
  --card-banner-from:#C7CBD3;
  --card-banner-to:#B7BCC6;
  --card-pattern-rgb:0,0,0;

  /* Class card accent presets -- Classroom.accent_color picks one of
     these pairs via a [data-accent] override on .test-card/.sc-test-card
     (see classroom_shell.css). Only the banner gradient varies; the
     pattern overlay stays theme-default black/white for every accent. */
  --accent-slate-from:#C7CBD3;
  --accent-slate-to:#B7BCC6;
  --accent-blue-from:#BFDBFE;
  --accent-blue-to:#93C5FD;
  --accent-green-from:#BBF7D0;
  --accent-green-to:#86EFAC;
  --accent-purple-from:#DDD6FE;
  --accent-purple-to:#C4B5FD;
  --accent-amber-from:#FDE68A;
  --accent-amber-to:#FCD34D;
  --accent-rose-from:#FBCFE8;
  --accent-rose-to:#F9A8D4;
}

/* "Midnight Code" -- the dark/schematic option, selected via the theme
   toggle (data-theme="dark" on <html>, persisted in localStorage). Every
   value here is unchanged from the dark-only build this was before the
   toggle existed. */
:root[data-theme="dark"] {
  --font-sans: 'JetBrains Mono', 'Courier New', monospace;
  --font-display: 'JetBrains Mono', 'Courier New', monospace;
  --ink:#F8FAFC;
  --ink-soft:#94A3B8;
  --blue:#22C55E;
  --blue-deep:#16A34A;
  --blue-rgb:34, 197, 94;
  --gold:#22C55E;
  --paper:#1B2336;
  --panel:#0F172A;
  --line:#2C3650;
  --line-soft:#243049;
  --danger:#F87171;
  --danger-rgb:248, 113, 113;
  --success:#22C55E;
  --success-rgb:34, 197, 94;
  --warning:#FBBF24;
  --warning-rgb:251, 191, 36;
  --warning-bg:rgba(251,191,36,0.12);
  --radius:6px;
  --radius-sm:4px;
  --radius-lg:8px;
  --radius-pill:6px;

  --surface-rgb:27,35,54;
  --glass-border:rgba(255,255,255,0.12);
  --glass-border-strong:rgba(255,255,255,0.18);
  --muted-grad-from:rgba(44,54,80,0.9);
  --muted-grad-to:rgba(27,35,54,0.6);
  --card-banner-from:#2C3650;
  --card-banner-to:#1B2336;
  --card-pattern-rgb:255,255,255;

  --accent-slate-from:#2C3650;
  --accent-slate-to:#1B2336;
  --accent-blue-from:#1E3A5C;
  --accent-blue-to:#16293F;
  --accent-green-from:#1E3D2E;
  --accent-green-to:#16291F;
  --accent-purple-from:#332C52;
  --accent-purple-to:#241F3D;
  --accent-amber-from:#4A3820;
  --accent-amber-to:#342615;
  --accent-rose-from:#452534;
  --accent-rose-to:#301A25;
}

/* ---------- Bootstrap theming bridge ----------
   Bootstrap 5.3 reads its own look from --bs-* custom properties on :root
   (and on individual components). Overriding them here — after Bootstrap's
   own stylesheet has loaded, so these win — points Bootstrap at this app's
   actual palette/radius/shadow scale instead of its stock blue/defaults.
   No Sass build step involved; this is plain CSS, same mechanism as the
   rest of this file. Component-scoped variants Bootstrap bakes at its own
   build time (e.g. .btn-success's internal --bs-btn-bg) aren't reached by
   a root-level override like this — those get their own explicit rule,
   only once/if that specific variant is actually adopted somewhere. */
:root {
  --bs-primary: var(--blue);
  --bs-primary-rgb: var(--blue-rgb);
  --bs-secondary: var(--ink-soft);
  --bs-success: var(--success);
  --bs-danger: var(--danger);
  --bs-warning: var(--warning);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-body-font-family: var(--font-sans);
  --bs-link-color: var(--blue);
  --bs-link-hover-color: var(--blue-deep);
  --bs-link-color-rgb: var(--blue-rgb);
  --bs-link-hover-color-rgb: var(--blue-rgb);
  --bs-border-color: var(--line);
  --bs-border-radius: var(--radius);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-border-radius-xl: var(--radius-lg);
  --bs-border-radius-xxl: var(--radius-lg);
  /* Baked from Bootstrap's default $primary at its own build time, not
     wired through var(--bs-primary) -- has to be set explicitly or the
     focus-ring glow on Bootstrap form controls stays stock blue. */
  --bs-focus-ring-color: rgba(var(--blue-rgb), 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* No background here on purpose: body already supplies the marketing
     white background, and the app/dashboard pages set their own gradient
     background on body too — an opaque background here would paint over
     it on every page. */
}

/* ---------- HEADER ---------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 16px 32px;
}

.logo {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}
.logo .logo-score {
  color: var(--blue);
}
.logo .logo-sub {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 15px;
}

nav.main-nav {
  display: flex;
  gap: 36px;
  margin-left: auto;
  margin-right: 36px;
}

nav.main-nav a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  padding-bottom: 4px;
  position: relative;
  transition: color 0.15s ease;
}
nav.main-nav a:hover { color: var(--blue); }

nav.main-nav a.active {
  color: var(--ink);
  border-bottom: 2px solid var(--blue);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.signin-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--blue);
}

.signin-link svg { width: 16px; height: 16px; }

/* Register/Log In in the header -- icon + text on desktop, icon-only
   below the nav's own collapse breakpoint (aria-label + title carry the
   accessible name/tooltip once the text disappears there). A separate
   class from .btn so the hero's own full-size Log In/Register buttons
   elsewhere on the page are never affected by this. */
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.header-icon-btn:active { transform: translateY(1px); }
.header-icon-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.header-icon-btn-ghost {
  color: var(--blue);
  border: 1px solid var(--line);
  background: transparent;
}
.header-icon-btn-ghost:hover { background: var(--panel); }
.header-icon-btn-primary {
  background: var(--blue);
  color: #ffffff;
}
.header-icon-btn-primary:hover { background: var(--blue-deep); }

@media (max-width: 860px) {
  /* Icons only below here -- same breakpoint nav.main-nav already
     collapses at. */
  .header-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }
  .header-icon-btn span { display: none; }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14.5px;
  font-weight: 600;
  padding: 9px 22px;
  border-radius:var(--radius-pill);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--blue);
  color: #ffffff;
}
.btn-primary:hover { background: var(--blue-deep); }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1px solid var(--blue);
}
.btn-outline:hover { background: rgba(34, 197, 94, 0.12); }

/* ---------- MAIN ----------
   Every page shares the same header + footer, but the centered
   marketing layout (flex/background) is scoped to main.marketing-main
   specifically (used only by home/about/faq/contact). The dashboards,
   classrooms, login, and register pages have plain <main> elements and
   fully own their own background/layout via their own stylesheets, so
   this rule is written to never touch them.

   min-height:100vh forces main to always fill the full viewport
   regardless of content, so the footer sits below the fold and
   requires a scroll to reach. */
main.marketing-main {
  flex: 1;
  min-height: 100vh;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- HERO ---------- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 88px 32px 140px;
  text-align: center;
  /* Sized against the viewport MINUS the sticky header (~75px rendered),
     not a flat 90vh -- a flat fraction left a leftover gap below the
     hero whose size depended on window height, and on taller windows
     that gap was just tall enough to show the next section's (About)
     heading cut off mid-letter at the very bottom edge on first load,
     before any scrolling. Matching the header's actual height keeps the
     hero filling the first screen exactly, so nothing below it is
     visible until the user actually scrolls. */
  min-height: calc(100vh - 75px);
  min-height: calc(100dvh - 75px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* .detail-section (About/FAQ/Contact, detail.css) already sets this --
     #home is the one anchor target that didn't have it, so clicking "Home"
     while already on the page (native browser #hash jump, not the JS
     scrollIntoView() detail.js only runs on a fresh page load) scrolled
     the hero's top to the very top of the document, which the sticky
     header then covers -- revealing that same ~75px of extra content at
     the BOTTOM of the viewport instead (the top sliver of the About
     heading), the same symptom as the earlier "About peeks on load" bug
     but triggered by in-page navigation this time. */
  scroll-margin-top: 75px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  margin-bottom: 32px;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.hero h1 {
  font-size: 96px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 auto 28px;
  max-width: 100%;
  text-align: center;
  color: var(--ink);
}

.hero p.subtitle {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 640px;
  margin: 0 auto 36px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.hero-actions .btn {
  padding: 11px 28px;
  font-size: 15px;
}

/* ---------- FEATURES ---------- */
.features {
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.features-inner {
  /* Column count/reflow now comes from Bootstrap's row-cols-* utilities on
     this same element (see _site_footer.html) -- this rule only still
     owns the centered max-width wrapper and its padding. */
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 32px;
}

.footer-features {
  padding: 0;
  margin-bottom: 32px;
}

.feature-card {
  text-align: left;
}

.feature-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--warning);
  margin-bottom: 10px;
}

.feature-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}

.feature-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- FOOTER ---------- */
footer.site-footer {
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 56px 32px 40px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 40px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 900px) {
  .hero h1 { font-size: 56px; }
}

@media (max-width: 860px) {
  nav.main-nav { display: none; }
  .header-inner { padding: 14px 20px; }
  /* nav.main-nav normally carries the margin-left:auto that pushes
     everything after the logo to the right edge -- once it's hidden at
     this width, that auto margin disappears with it, so header-actions
     collapses back to sitting right after the logo instead of staying
     pinned to the right. */
  .header-actions { margin-left: auto; }
}

@media (max-width: 560px) {
  .hero { padding: 56px 20px 48px; }
  .hero h1 { font-size: 36px; }
  .hero-actions { flex-direction: column; align-items: center; }
  .features-inner { padding: 40px 20px; }
  /* Same fix already proven correct on the classroom pages' header
     (class_detail.css) -- without it, "for Comprehension Scoring" wraps
     into the header-actions buttons at narrow widths. */
  .logo .logo-sub { display: none; }
}

/* ---------- Theme toggle ----------
   Fixed-position floating button so it works identically on every page
   regardless of that page's own header markup -- base.html's marketing
   header and the classroom app's many standalone-<html> page shells
   (teacher_classroom.html, student_dashboard.html, etc.) don't share one
   header structure, but every page can drop in the same include. */
.theme-toggle {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 500;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.theme-toggle:hover { color: var(--blue); border-color: var(--blue); transform: translateY(-1px); }
.theme-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.theme-toggle-icon { width: 20px; height: 20px; }
.theme-toggle-icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle-icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle-icon-moon { display: none; }

@media (max-width: 560px) {
  .theme-toggle { bottom: 16px; right: 16px; width: 40px; height: 40px; }
}
