/* ===========================================================================
 * shared-chrome.css — the APP-WIDE rules the vocab sheet used to smuggle
 * ===========================================================================
 * Split out of subjects/vocab/styles.css (usability finding C6). Everything
 * here is selected by markup OUTSIDE the vocab app — the static shell in
 * index.html (`header.topbar`, the `.icon-btn` topbar buttons), the shared
 * <ModeHeader> in shared-app-shell.jsx (`.mode-header*`, `.home-link-*`,
 * `.progress-bar-*`, `.mode-progress-chip`), every `.mode-screen` sub-surface
 * (editing lab, guided math, practice home, admin queue, why-lessons, year
 * tests), and the document-level element rules. It used to load LAST (after
 * every component sheet) purely because it rode along with the vocab styles;
 * it now loads right after app-surface.css, BEFORE every subject/component
 * sheet.
 *
 * CASCADE NOTE — the move is order-preserving. These rules previously beat
 * index.html's inline <style> (`.icon-btn`, `header.topbar`'s padding/gap,
 * `:root` tokens) and they still do: the inline block is in <head> above the
 * app-surface.css link, so it is still earlier in document order. No selector
 * in this file collides at equal specificity with anything in the sheets that
 * load between here and the vocab sheet (reading, math, tool-btn, hint,
 * mc-grid, mc-item, analogy-item, passage-item, passage-edit-item,
 * anchor-paper, focus-rings, editing) — verified sheet by sheet.
 *
 * The :root block is the app's TOKEN source, not vocab decoration:
 * --radius / --radius-sm / --radius-lg / --shadow* / --font-mono have no
 * other definition anywhere, and mc-item.css, analogy-item.css,
 * passage-item.css, passage-edit-item.css, mc-grid.css, hint.css and
 * tool-btn.css all consume them. foundation.js's activateTheme() re-binds most
 * of the colour tokens as inline styles on <html> at runtime; these values are
 * the pre-paint fallback plus the sole source for the ones it doesn't set.
 *
 * Anything vocab-only lives on in subjects/vocab/styles.css, scoped under
 * :where(.vocab-app) (the class on VocabApp's root in subjects/vocab/app.jsx).
 * :where() is used deliberately: it adds ZERO specificity, so scoping changed
 * only what those rules MATCH, never which rule wins a tie.
 * ========================================================================= */
:root {
  /* Bookish — warm paper, deep ink, warm brown accent (from reference projects) */
  --cream: #F4EFE6;
  --cream-2: #EDE5D6;
  --cream-3: #E4D9C3;
  --surface: #FBF8F2;
  --surface-2: #EDE5D6;
  --ink: #2A2620;
  --ink-soft: #6B6355;
  --ink-faint: #A39A88;
  --ink-70: rgba(42, 38, 32, 0.72);
  --ink-50: rgba(42, 38, 32, 0.5);
  --ink-30: rgba(42, 38, 32, 0.3);
  --ink-10: rgba(42, 38, 32, 0.1);
  --ink-5: rgba(42, 38, 32, 0.05);

  --accent-coral: #C96F4A;
  --accent-coral-tint: #F1E0D3;
  --accent-coral-ink: #8A3F21;

  --accent-lavender: #7A5A3A;
  --accent-lavender-tint: #E9DEC9;
  --accent-lavender-ink: #5A3E1F;

  --accent-sage: #5B7A4A;
  --accent-sage-tint: #DDE6CF;
  --accent-sage-ink: #3D5630;

  --accent-marigold: #C89C4A;
  --accent-marigold-tint: #EFE1C1;
  --accent-marigold-ink: #7A5A26;

  --bg: var(--cream);

  --radius-inset: 4px;   /* read-only panes — near-square, see CLAUDE.md */
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(42,38,32,0.04), 0 2px 6px rgba(42,38,32,0.04);
  --shadow: 0 1px 2px rgba(42,38,32,0.03), 0 8px 24px rgba(42,38,32,0.05);
  --shadow-lg: 0 2px 4px rgba(42,38,32,0.04), 0 16px 40px rgba(42,38,32,0.08);

  --font-display: "Lexend", -apple-system, system-ui, sans-serif;
  --font-serif-body: "Iowan Old Style", "Charter", Georgia, serif;
  --font-ui: "Geist", -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}


* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font-ui); color: var(--ink);
  background: var(--cream-2); /* page frame color behind the mobile shell */
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}


::-webkit-scrollbar { width: 0; height: 0; }


/* ---------- SHARED: TOPBAR + CARDS ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 12px;
}


.icon-btn {
  background: var(--surface); border: 1px solid var(--ink-10); border-radius: 999px;
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink); transition: background .15s;
}

.icon-btn:hover { background: var(--cream-2); }

.icon-btn.small { width: 28px; height: 28px; }


/* ================= MODE SCREENS (shared) ================= */
/* No `min-height: 100vh` here: .mode-screen lives inside main.stage, which
   carries the text-size `zoom`, so a vh resolved in layout px and was THEN
   painted ×1.1 — every mode screen in the app grew a phantom tenth of a page.
   It painted nothing either way; the cream fill is `.shell`'s (and
   `.shell-body`'s at desktop), both outside the zoom. */
.mode-screen { padding: 0 0 40px; }


.mode-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px 10px;
}

.home-link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: transparent; border: none; padding: 0; cursor: pointer;
  color: var(--accent-coral); font-size: 15px; font-weight: 600;
  font-family: var(--font-ui, inherit);
  flex-shrink: 0;
}

.home-link-btn:hover { opacity: 0.8; }

/* Destination label next to the ‹ chevron (e.g. "Home", "Rules"). */
.home-link-label { font-size: 15px; font-weight: 600; line-height: 1; }

/* Legacy inline title — kept for any un-migrated caller, but the canonical
   placement is now the below-bar eyebrow (.mode-header-eyebrow). */
.mode-header-title {
  flex: 1; font-family: var(--font-display);
  font-size: 18px; font-weight: 600; line-height: 1.1;
  text-align: left; padding-left: 4px;
}

/* Activity title — below-bar eyebrow (small-caps), generalized from the
   exam screen's .exam-qtype so every surface labels its activity the same
   way without crowding the top bar. */
.mode-header-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-soft); font-weight: 700;
  font-family: var(--font-ui, inherit);
  padding: 0 20px; margin-bottom: 14px;
}

/* In-bar variant (PracticeHeader inlineTitle): occupies the bar's flex space
   instead of its own row below. */
.mode-header-eyebrow--inline {
  flex: 1; min-width: 0; padding: 0; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.mode-header-right { display: flex; align-items: center; gap: 8px; }

.mode-header-meta { display: flex; gap: 6px; }

.mode-progress-chip {
  background: var(--ink); color: var(--cream); font-variant-numeric: tabular-nums;
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
}


/* When an eyebrow follows the bar, keep them tight (10px); the eyebrow adds
   its own 14px below. When the bar is the last header child (no eyebrow),
   restore the original 18px breathing room. */
.progress-bar-track {
  height: 5px; background: var(--ink-5); border-radius: 99px; overflow: hidden;
  margin: 0 20px 10px;
}

.progress-bar-track:last-child { margin-bottom: 18px; }

.progress-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent-coral), var(--accent-marigold));
  transition: width .4s ease;
}


.mode-body { padding: 0 20px; }

input, select, textarea {
  font-family: inherit; font-size: 13px; padding: 8px 12px; border: 1px solid var(--ink-10);
  border-radius: 10px; background: var(--bg); color: var(--ink); width: 100%;
}

textarea { font-family: var(--font-mono); font-size: 11px; resize: vertical; }

input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-coral); outline-offset: -1px; border-color: transparent; }

/* An animation name is global and cannot be scoped, so any name the shell
   animates with has to live here. index.html's mobile bottom sheet
   (`animation: fadeIn 0.3s`) and `.confirm-scrim.open` both reference this and
   nothing else defines it — the vocab sheet was their only source. The
   vocab-only names (slideUp / pop) stayed behind: mc-item.css and
   analogy-item.css have their own `mc-shake`/`an-shake` and index.html its
   own `focus-ask-pop`, so none of them collide. */
@keyframes fadeIn { from { opacity: 0; } }
