/* ════════════════════════════════════════════════════════════════
   FY SAT MATH GUIDE — Unified Stylesheet
   Navigation shell + teaching design language components.
   Source of truth: Brand Guide §17 (teaching design language)
                    Brand Guide §17.29 (navigation shell)
   ════════════════════════════════════════════════════════════════ */


/* ════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ════════════════════════════════════════════════════ */
:root {
  /* Palette (brand guide) */
  --bone:    #F5F5F2;
  --ink:     #162144;
  --magenta: #EE3292;
  --cream:   #EEEEEB;
  --stone:   #E5E5E2;
  --white:   #FFFFFF;
  --pink:    #F9C9D4;
  --lilac:   #D6C8E8;
  --sage:    #C8D6C0;
  --mustard: #E8B84A;

  /* Type families */
  --sans:  'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --mono:  'DM Mono', ui-monospace, Menlo, monospace;

  /* Teaching-specific tokens */
  --radius: 4px;
  --border: 1px solid rgba(22,33,68,0.25);
  --border-light: 1px solid rgba(22,33,68,0.18);
  --container-bg: var(--white);
  --page-bg: var(--bone);

  /* Shell layout */
  --sidebar-w: 280px;
}


/* ════════════════════════════════════════════════════
   2. RESET & BASE
   ════════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--white);
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: rgba(238,50,146,0.15); color: var(--ink); }
strong { font-weight: 600; }
em { font-style: italic; }

/* KaTeX font-size override (default is 1.21em). */
.katex { font-size: 1.1em; }

/* Answer choices containing stacked fractions need extra vertical gap
   between consecutive choices. (Prose paragraphs handled per-case via
   display-math restructure rather than a universal rule.) */
.tc-answer-choice:has(.katex .mfrac) {
  margin: 14px 0;
}


/* ════════════════════════════════════════════════════
   3. TYPOGRAPHY
   ════════════════════════════════════════════════════ */
h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}
h1 {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--ink);
}
h2 {
  font-size: 32px;
  letter-spacing: -0.01em;
  margin: 80px 0 24px;
}
h3 {
  font-size: 23px;
  margin: 52px 0 16px;
}
h4 {
  font-size: 19px;
  margin: 24px 0 8px;
}
p { margin-bottom: 16px; }
ul, ol { margin-bottom: 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Inline code */
code {
  font-family: var(--mono);
  font-size: 15px;
  background: var(--cream);
  padding: 2px 6px;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: var(--border-light);
  margin: 40px 0;
}


/* ════════════════════════════════════════════════════
   4. SIDEBAR
   ════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bone);
  border-right: 1px solid var(--ink);
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(22,33,68,0.2); }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(22,33,68,0.35); }

/* Sidebar header */
.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(22,33,68,0.15);
  flex-shrink: 0;
}
.sidebar-logo {
  display: block;
  max-width: 200px;
  height: auto;
  width: auto;
  margin: 0 auto 6px;
}
.sidebar-subtitle {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
}

/* TOC navigation */
.toc-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 0 120px;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Category group wrapper (for sticky containment) */
.toc-group { display: block; }
.toc-group + .toc-group { margin-top: 0; }

/* Category headers — sticky */
.toc-category {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--cream);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(22,33,68,0.45);
  padding: 10px 20px 8px;
  box-shadow: 0 1px 0 rgba(22,33,68,0.08);
}

/* Chapter links (L1) */
.toc-l1 { margin: 0; }
.toc-l1 > a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 20px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-l1 > a:hover {
  color: var(--magenta);
  border-left-color: var(--magenta);
  text-decoration: none;
}
.toc-l1 > a .ch-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: rgba(22,33,68,0.4);
  min-width: 20px;
  flex-shrink: 0;
}

/* Active chapter — clean: bold magenta text + magenta left-anchor, no background */
.toc-l1 > a.active {
  color: var(--magenta);
  font-weight: 600;
  border-left-color: var(--magenta);
}
.toc-l1 > a.active .ch-num {
  color: var(--magenta);
}

/* Section links (L2) */
.toc-l2-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.toc-l1.expanded .toc-l2-list {
  max-height: 600px;
  padding: 6px 0 8px;
}
/* Hide subsection list when only one section */
.toc-l2-list:has(> .toc-l2:only-child) {
  display: none;
}
.toc-l2 a {
  display: block;
  padding: 4px 20px 4px 53px;
  font-size: 13px;
  color: rgba(22,33,68,0.55);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.toc-l2 a:hover {
  color: var(--ink);
  border-left-color: rgba(22,33,68,0.2);
  text-decoration: none;
}
.toc-l2 a.active {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--ink);
}
.toc-l3 a {
  padding-left: 65px;
  font-size: 12px;
  font-style: italic;
}

/* Sidebar collapse toggle */
.sidebar-toggle {
  position: fixed;
  bottom: 20px;
  left: calc(var(--sidebar-w) - 18px);
  z-index: 210;
  width: 24px;
  height: 24px;
  background: var(--bone);
  border: 1px solid var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ink);
  transition: left 0.25s ease, background 0.12s ease;
}
.sidebar-toggle:hover {
  background: var(--ink);
  color: var(--bone);
}
body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-w)));
}
body.sidebar-collapsed .sidebar-toggle {
  left: 12px;
}
body.sidebar-collapsed .main-content {
  margin-left: 0;
}

/* Mobile hamburger */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 300;
  width: 36px;
  height: 36px;
  background: var(--bone);
  border: 1px solid var(--ink);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(22,33,68,0.3);
  z-index: 190;
}


/* ════════════════════════════════════════════════════
   5. MAIN CONTENT AREA
   ════════════════════════════════════════════════════ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  justify-content: center;
  transition: margin-left 0.25s ease;
}
.content-wrapper {
  width: 100%;
  max-width: 936px;
  padding: 64px 48px 160px;
}


/* ════════════════════════════════════════════════════
   6. EMOJI BAR
   ════════════════════════════════════════════════════ */
/* ── Right-edge controls: three zones ── */
/* Top right: emoji reactions */
.emoji-bar {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.emoji-btn {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(22,33,68,0.15);
  background: var(--bone);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}
.emoji-btn:hover {
  border-color: var(--ink);
  transform: scale(1.08);
}
.emoji-btn.tapped {
  transform: scale(1.15);
}
.emoji-btn.confetti:hover,
.emoji-btn.confetti.tapped { background: #FFF4E0; border-color: #E8B84A; }
.emoji-btn.crying:hover,
.emoji-btn.crying.tapped { background: #E8F0FF; border-color: #6495ed; }

/* Middle right: Desmos trigger */
.desmos-trigger {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bone);
  border: 1px solid var(--ink);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}
.desmos-trigger svg {
  stroke: var(--ink);
  flex-shrink: 0;
  transition: stroke 0.12s ease;
}
.desmos-trigger:hover {
  background: var(--ink);
  color: var(--bone);
  transform: translateY(-50%) scale(1.05);
}
.desmos-trigger:hover svg {
  stroke: var(--bone);
}


/* ════════════════════════════════════════════════════
   7. DESMOS PANEL
   ════════════════════════════════════════════════════ */
.desmos-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 40vw;
  height: 100vh;
  background: var(--white);
  border-left: 1px solid var(--ink);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.desmos-panel.open {
  transform: translateX(0);
}
.desmos-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(22,33,68,0.15);
  background: var(--bone);
}
.desmos-panel-header h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0;
  border: none;
  padding: 0;
}
.desmos-panel-subtitle {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
  opacity: 0.5;
  margin-top: 2px;
}
.desmos-panel-close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(22,33,68,0.15);
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.desmos-panel-close:hover {
  background: var(--ink);
  color: var(--bone);
}
.desmos-panel-body {
  flex: 1;
  overflow: hidden;
}
.desmos-panel-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}
body.desmos-open .emoji-bar { right: calc(40vw + 28px); }
body.desmos-open .desmos-trigger { right: calc(40vw + 28px); }
body.desmos-open .chapter-nav { right: calc(40vw + 28px); }
body.desmos-open .main-content { margin-right: 40vw; }


/* ════════════════════════════════════════════════════
   8. BOTTOM NAVIGATION
   ════════════════════════════════════════════════════ */
/* Bottom right: chapter navigation */
.chapter-nav {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chapter-nav a,
.chapter-nav .scroll-top {
  height: 32px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bone);
  border: 1px solid rgba(22,33,68,0.15);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.chapter-nav a:hover,
.chapter-nav .scroll-top:hover {
  background: var(--ink);
  color: var(--bone);
  border-color: var(--ink);
  text-decoration: none;
}
.chapter-nav .nav-spacer {
  display: none;
}


/* ════════════════════════════════════════════════════
   9. LABELS
   ════════════════════════════════════════════════════ */
.tc-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 10px;
}
.tc-label-action {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 10px;
}


/* ════════════════════════════════════════════════════
   9b. QUICK NAV
   ════════════════════════════════════════════════════ */
.tc-quick-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 24px 0 40px;
  border: 1px solid rgba(22,33,68,0.15);
  padding: 20px 24px;
  max-width: 320px;
}
.tc-quick-nav-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.45;
  margin-bottom: 12px;
}
.tc-quick-nav a {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  padding: 7px 0;
  border-bottom: 1px solid rgba(22,33,68,0.12);
  transition: color 0.12s ease;
}
.tc-quick-nav a:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.tc-quick-nav a:first-of-type {
  padding-top: 0;
}
.tc-quick-nav a:hover {
  color: var(--magenta);
  text-decoration: none;
}


/* ════════════════════════════════════════════════════
   10. CARD
   ════════════════════════════════════════════════════ */
.tc-card {
  background: var(--container-bg);
  padding: 28px 32px;
  margin: 40px 0 16px;
  border-radius: var(--radius);
  border: var(--border);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-card > *:first-child { margin-top: 0; }
.tc-card > *:last-child { margin-bottom: 0; }
.tc-card p { margin-bottom: 10px; }

/* ── Key Takeaway ── */
.tc-takeaway {
  background: var(--container-bg);
  padding: 28px 32px;
  margin: 40px 0 16px;
  border-radius: var(--radius);
  border: var(--border);
}
.tc-takeaway > *:last-child { margin-bottom: 0; }
.tc-takeaway p { margin-bottom: 10px; }


/* ════════════════════════════════════════════════════
   11. CALLOUTS
   ════════════════════════════════════════════════════ */
.tc-callout {
  background: transparent;
  border: none;
  border-left: 3px solid var(--ink);
  padding: 0 0 0 18px;
  margin: 24px 0 16px;
}
.tc-callout.tip { border-left-color: var(--ink); }
.tc-callout.warning { border-left-color: var(--magenta); }
.tc-callout.pitfall { border-left-color: var(--magenta); }
.tc-callout.remember { border-left-color: var(--lilac); }
.tc-callout-type {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.tc-callout-type.tip { color: var(--ink); }
.tc-callout-type.warning { color: var(--magenta); }
.tc-callout-type.pitfall { color: var(--magenta); }
.tc-callout-type.remember { color: #7B5EA7; }
.tc-callout-body { font-size: 17px; line-height: 1.7; }
.tc-callout-body p { margin-bottom: 0; }
.tc-callout-body p + p { margin-top: 12px; }

/* Optional icon for longer callouts (pairs with the eyebrow label) */
.tc-callout-type .tc-callout-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  margin-right: 7px;
}

/* Example beat inside a longer callout — mini-section with dashed rule */
.tc-callout-ex {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(22,33,68,0.22);
}
.tc-callout-ex-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(22,33,68,0.55);
  margin-bottom: 8px;
}


/* ════════════════════════════════════════════════════
   11.4 RULE EXAMPLES (grammar guide — inline ✓/✗ illustrations)
   ════════════════════════════════════════════════════ */
.tc-rule-example {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 14px;
  align-items: baseline;
  padding-left: 4px;
  margin: 10px 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.tc-rule-example::before {
  content: '';
  font-family: var(--mono); font-weight: 600; font-size: 16px;
  text-align: center;
}
.tc-rule-example.correct::before { content: '✓'; color: #5a8a3a; }
.tc-rule-example.incorrect::before { content: '✗'; color: var(--magenta); }
.tc-rule-example p { margin: 0; }
.tc-rule-example p + p { margin-top: 6px; }
.tc-rule-example mark {
  background: rgba(232,184,74,0.35);
  color: inherit;
  padding: 1px 3px;
}
/* When two rule-examples are adjacent siblings, tighten spacing so
   they read as a paired comparison. */
.tc-rule-example + .tc-rule-example { margin-top: 4px; }

/* Muted caption span below the example sentence — used for reasons,
   explanations, "why this is wrong/right" text. */
.tc-example-caption {
  display: block;
  font-size: 14px;
  color: rgba(22, 33, 68, 0.6);
  margin-top: 2px;
}

/* Color-coded list items — for visually distinguishing items in a
   complex list (e.g., semicolons-in-complex-lists examples). */
.tc-list-1 { background-color: rgba(249, 201, 212, 0.5); padding: 1px 3px; }
.tc-list-2 { background-color: rgba(232, 184, 74, 0.35); padding: 1px 3px; }
.tc-list-3 { background-color: rgba(110, 178, 235, 0.35); padding: 1px 3px; }


/* ════════════════════════════════════════════════════
   11.5 PAUSE (grammar guide — "STOP, try this yourself")
   ════════════════════════════════════════════════════ */
.tc-pause {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px dashed rgba(22,33,68,0.3);
  background: var(--bone);
}
.tc-pause-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--magenta);
  padding-top: 2px;
  flex-shrink: 0;
}
.tc-pause-body {
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
}


/* ════════════════════════════════════════════════════
   12. STRATEGY
   ════════════════════════════════════════════════════ */
.tc-strategy {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
}
.tc-strategy-header {
  padding: 20px 20px 16px;
  background: transparent;
  color: var(--ink);
  border-bottom: 1px solid rgba(22,33,68,0.12);
}
.tc-strategy-header .tc-label {
  color: var(--ink);
  opacity: 0.45;
  margin-bottom: 0;
}
.tc-strategy-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 4px;
}
.tc-strategy-body {
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
}
.tc-strategy-body p { margin-bottom: 10px; }
.tc-strategy-body p:last-child { margin-bottom: 0; }


/* ════════════════════════════════════════════════════
   12a. CONCEPT (unified landmark: subsumes Definition,
                 Formula reference, Strategy, Key takeaway)
   ════════════════════════════════════════════════════ */
.tc-concept {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
.tc-concept-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  background: transparent;
  line-height: 1.35;
  letter-spacing: -0.01em;
  padding: 20px 20px 16px;
  margin: 0;
  border-bottom: 1px solid rgba(22,33,68,0.12);
}
.tc-concept-body {
  padding: 20px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-concept-body > *:first-child { margin-top: 0; }
.tc-concept-body > *:last-child { margin-bottom: 0; }
.tc-concept-body p { margin-bottom: 10px; }
.tc-concept-body p:last-child { margin-bottom: 0; }
.tc-concept-body ol,
.tc-concept-body ul {
  padding-left: 20px;
  margin: 0 0 10px 0;
}
.tc-concept-body ol:last-child,
.tc-concept-body ul:last-child { margin-bottom: 0; }
.tc-concept-body li { margin-bottom: 6px; }
.tc-concept-body li:last-child { margin-bottom: 0; }

/* Secondary Concept variant (§17.12) — compressed ink header with DM Mono
   label. Same ink-family silhouette as primary; reduced visual weight via
   thinner bar and mono-uppercase title. Use for supporting Concepts
   (guidelines, quick reminders). Title must be short and categorical. */
.tc-concept.secondary .tc-concept-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 14px 20px 10px;
  line-height: 1.3;
  background: var(--white);
  color: var(--ink);
  border-bottom: 1px solid rgba(22,33,68,0.12);
}

/* Concept group (§17.10c) — single container with internal sub-sections.
   Use when a single Concept body would be too long to scan but the
   sub-skills aren't independent enough to warrant their own Concepts. */
.tc-concept-group {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
.tc-concept-group-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
  background: transparent;
  line-height: 1.35;
  letter-spacing: -0.01em;
  padding: 20px 20px 16px;
  margin: 0;
  border-bottom: 1px solid rgba(22,33,68,0.12);
}
.tc-concept-group-body {
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-group-section { margin-bottom: 20px; }
.tc-group-section:last-child { margin-bottom: 0; }
.tc-group-section-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--magenta);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(22,33,68,0.15);
}
.tc-group-section p { margin: 0 0 10px; }
.tc-group-section p:last-child { margin-bottom: 0; }

/* Method comparison variant for worked examples (§17.11b) — two-column
   side-by-side worked solution. Each column is a self-contained method
   with eyebrow, name, steps, and an OPTIONAL verdict line at the bottom.
   The vertical column divider is also optional (default: on). */
/* .tc-worked-methods grid works inside ANY reveal content
   (.tc-worked-content, .tc-example-reveal-content, .tc-answer-content)
   — wherever you'd show two answer explanations side by side. */
.tc-worked-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.tc-worked-methods.no-divider {
  /* divider off variant — no border-right on the first column */
}
.tc-worked-methods > .tc-worked-method {
  padding: 4px 20px;
}
.tc-worked-methods:not(.no-divider) > .tc-worked-method:first-child {
  border-right: 1px solid var(--rule);
  padding-right: 20px;
}
.tc-worked-methods:not(.no-divider) > .tc-worked-method:last-child {
  padding-left: 20px;
}
.tc-worked-method-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--magenta);
  margin: 0 0 8px;
}
.tc-worked-method-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 12px;
  line-height: 1.3;
}
.tc-worked-method-verdict {
  font-style: italic;
  color: var(--muted, #6c6a5e);
  font-size: 13px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(22,33,68,0.10);
}
@media (max-width: 720px) {
  .tc-worked-methods {
    grid-template-columns: 1fr;
  }
  .tc-worked-methods:not(.no-divider) > .tc-worked-method:first-child {
    border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-right: 0;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .tc-worked-methods:not(.no-divider) > .tc-worked-method:last-child {
    padding-left: 0;
  }
}

/* Expandable worked example (sibling of .tc-concept).
   Mirrors .tc-answer-reveal's visual pattern. */
.tc-worked-reveal {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
.tc-concept:has(+ .tc-worked-reveal) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tc-concept + .tc-worked-reveal { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; }

.tc-worked-reveal summary {
  background: var(--cream);
  color: var(--magenta);
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--mono);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.tc-worked-reveal summary::-webkit-details-marker { display: none; }
.tc-worked-reveal summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.2s;
}
.tc-worked-reveal[open] summary::before { transform: rotate(90deg); }
.tc-worked-reveal summary:hover { background: var(--bone); }

.tc-worked-content {
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
}
.tc-worked-content > *:first-child { margin-top: 0; }
.tc-worked-content > *:last-child { margin-bottom: 0; }
.tc-worked-content p { margin-bottom: 10px; }
.tc-worked-content p:last-child { margin-bottom: 0; }


/* ════════════════════════════════════════════════════
   12c. EXAMPLE (standalone, visible worked example)
   Sibling-tier landmark to .tc-concept. Used when ONE
   labeled demonstration IS the teaching for a section
   whose technique is too lightweight to earn a Concept's
   procedural ceremony but still wants a visible, anchored
   "here's what doing this looks like" beat.

   Decision rule (COMPONENT_AUDIT.md Test 2): if you'd
   write a Concept whose body is 3 trivial steps that
   already appear in the H2 intro paragraph, you don't
   have a procedure — you have one demonstration disguised
   as steps. Drop the Concept; use .tc-example.

   NOT collapsible itself (the .tc-example-reveal that
   follows IS collapsible). When directly adjacent to a
   .tc-concept, visually attaches to it as a continuation
   of the rule (Concept states the rule; example walks it
   through). For a fully collapsible attached walkthrough,
   use .tc-worked-reveal — §17.11.

   Naming/visual note: this is the TEACHING-system variant
   (rounded corners, soft border, cream eyebrow band per
   the chapter design language). The marketing/reference
   variant uses .example (no tc- prefix, sharp 90° corners,
   no answer shown, deployed in cheat sheets like
   fy-math-guide). Different visual systems by design.
   ════════════════════════════════════════════════════ */
.tc-example {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
/* .tc-example.attached — explicit modifier that visually attaches
   the example to the .tc-concept directly above it. Use when the
   Concept states a rule and the example walks it through, as one
   connected teaching unit (Flavor C). Plain .tc-example (no .attached)
   stays standalone, even when adjacent to a Concept. */
.tc-concept:has(+ .tc-example.attached),
.tc-concept-group:has(+ .tc-example.attached) {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.tc-concept + .tc-example.attached,
.tc-concept-group + .tc-example.attached {
  margin-top: -1px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.tc-example-label {
  background: var(--cream);
  color: var(--magenta);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(22,33,68,0.12);
}
.tc-example-body {
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-example-body > *:first-child { margin-top: 0; }
.tc-example-body > *:last-child { margin-bottom: 0; }
.tc-example-body p { margin-bottom: 10px; }
.tc-example-body p:last-child { margin-bottom: 0; }
.tc-example-body ol,
.tc-example-body ul {
  padding-left: 20px;
  margin: 0 0 10px 0;
}
.tc-example-body ol:last-child,
.tc-example-body ul:last-child { margin-bottom: 0; }
.tc-example-body li { margin-bottom: 6px; }
.tc-example-body li:last-child { margin-bottom: 0; }

/* .tc-example-reveal — collapsed walkthrough sibling of .tc-example.
   Mirrors the §17.7 question + answer reveal pattern. The example shows
   the problem; the reveal hides the walkthrough behind "Show how it's
   done." Visually joined to the example above (no gap, shared border). */
.tc-example-reveal {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: -1px 0 16px 0;
  overflow: hidden;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.tc-example:has(+ .tc-example-reveal) {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.tc-example-reveal summary {
  background: var(--cream);
  color: var(--magenta);
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--mono);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.tc-example-reveal summary::-webkit-details-marker { display: none; }
.tc-example-reveal summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.2s;
}
.tc-example-reveal[open] summary::before { transform: rotate(90deg); }
.tc-example-reveal summary:hover { background: var(--bone); }
.tc-example-reveal-content {
  padding: 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-example-reveal-content > *:first-child { margin-top: 0; }
.tc-example-reveal-content > *:last-child { margin-bottom: 0; }
.tc-example-reveal-content p { margin-bottom: 10px; }
.tc-example-reveal-content p:last-child { margin-bottom: 0; }


/* ════════════════════════════════════════════════════
   13. STEPS
   ════════════════════════════════════════════════════ */
.tc-steps {
  margin: 40px 0 16px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--container-bg);
  overflow: hidden;
}
.tc-steps-header {
  padding: 9px 20px;
  background: var(--ink);
  color: var(--bone);
  border-bottom: 1px solid rgba(22,33,68,0.15);
}
.tc-steps-title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--bone);
}
.tc-step {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 20px;
  border-bottom: var(--border-light);
  align-items: start;
}
.tc-step:last-child { border-bottom: none; }
.tc-step-num {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 600;
  color: var(--magenta);
  line-height: 1.1;
}
.tc-step-body { font-size: 16px; line-height: 1.7; }
.tc-step-body strong { font-weight: 600; }

/* Steps nested inside a Concept inherit the Concept's horizontal padding.
   Drop the step's own left/right padding and tighten the number column
   so body text doesn't sit ~120px from the Concept's left edge. */
.tc-concept-body .tc-step {
  padding: 16px 0;
  grid-template-columns: 28px 1fr;
  gap: 14px;
}
.tc-concept-body .tc-step:first-child { padding-top: 0; }
.tc-concept-body .tc-step:last-child { padding-bottom: 0; }



/* Image max-width safety: any image inside a question or figure caps at container width.
   Prevents 1000+px source images from blowing out the 684px content column. */
.tc-question img,
.tc-figure img,
figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ════════════════════════════════════════════════════
   14. TABLES
   ════════════════════════════════════════════════════ */
.tc-table {
  width: auto;            /* size to content (was 100%); cap with max-width and center via margin */
  max-width: 100%;        /* don't overflow the content column */
  border-collapse: collapse;
  margin: 24px auto 16px; /* auto horizontal margins → center the table */
  font-size: 15px;
  border: var(--border);
}
.tc-table th {
  background: var(--ink);
  color: var(--bone);
  padding: 12px 18px;
  text-align: left;
  font-weight: 600;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tc-table td {
  padding: 12px 18px;
  border-bottom: var(--border-light);
  background: var(--white);
  font-size: 17px;
  line-height: 1.55;
}
.tc-table tr:last-child td { border-bottom: none; }

/* Divided variant (vertical rules) */
.tc-table.divided td,
.tc-table.divided th { border-right: var(--border-light); }
.tc-table.divided th { border-right-color: rgba(248,246,241,0.2); }
.tc-table.divided td:last-child,
.tc-table.divided th:last-child { border-right: none; }

/* Math practice variant (§17.20 / §17.26) — no header shading,
   full-weight ink internal borders to match SAT formatting. */
.tc-table.math-practice th,
.tc-table.tc-data th {
  background: var(--white);
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  font-size: 15px;
  border-bottom: var(--border);
}
.tc-table.math-practice td,
.tc-table.math-practice th,
.tc-table.tc-data td,
.tc-table.tc-data th { border-right: var(--border); }
.tc-table.math-practice td,
.tc-table.tc-data td { border-bottom: var(--border); }
.tc-table.math-practice td:last-child,
.tc-table.math-practice th:last-child,
.tc-table.tc-data td:last-child,
.tc-table.tc-data th:last-child { border-right: none; }
.tc-table.math-practice tr:last-child td,
.tc-table.tc-data tr:last-child td { border-bottom: none; }
/* Compact font for SAT-style data tables — prevents wide multi-column tables
   from blowing out the 684px content column. */
.tc-table.math-practice td,
.tc-table.tc-data td { font-size: 15px; }

/* Compact variant — for inline use inside answer choices.
   Use with .math-practice to get the ink-on-white header (no fill, no uppercase). */
.tc-table.tc-table--compact {
  width: auto;
  min-width: 120px;
  margin: 6px 0 0;
  font-size: 14px;
}
.tc-table.tc-table--compact th {
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}
.tc-table.tc-table--compact td {
  padding: 6px 14px;
  font-size: 14px;
}

/* Answer choices that contain a table — break flow,
   stack vertically with extra spacing between them */
.tc-answer-choice.tc-answer-choice--with-table {
  display: block;
  margin: 14px 0;
  padding: 0;
  background: none;
  border: none;
}
.tc-answer-choice.tc-answer-choice--with-table > .tc-table {
  margin-top: 6px;
  margin-left: 22px;
}

/* Answer choices that contain a graph image — block layout,
   constrained width, thin border to define edges. */
.tc-answer-choice.tc-answer-choice--with-image {
  display: block;
  margin: 14px 0;
  padding: 0;
  background: none;
  border: none;
}
.tc-answer-choice.tc-answer-choice--with-image > img {
  display: block;
  max-width: 360px;
  width: 100%;
  margin: 6px 0 0 22px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

/* Answer choices containing a system of equations — stack the equations vertically
   so the second equation aligns under the first, not under the letter label. */
.tc-answer-choice.tc-answer-choice--system {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  margin: 10px 0;
}
.tc-answer-choice.tc-answer-choice--system .tc-choice-eqs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}


/* ════════════════════════════════════════════════════
   15. QUESTION BOX
   ════════════════════════════════════════════════════ */
.tc-question {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 40px 0 16px;
}
.tc-question p {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.tc-question p:last-child { margin-bottom: 0; }

/* Answer choices */
.tc-answer-choice {
  display: block;
  margin-bottom: 4px;
  padding: 2px 0;
  font-size: 17px;
  line-height: 1.7;
}
.tc-answer-choice:first-of-type { margin-top: 8px; }

/* Answer reveal (details/summary) */
.tc-answer-reveal {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
.tc-question:has(+ .tc-answer-reveal) { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tc-question + .tc-answer-reveal { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; }

.tc-answer-reveal summary {
  background: var(--cream);
  color: var(--magenta);
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--mono);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.tc-answer-reveal summary::-webkit-details-marker { display: none; }
.tc-answer-reveal summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.2s;
}
.tc-answer-reveal[open] summary::before { transform: rotate(90deg); }
.tc-answer-reveal summary:hover { background: var(--bone); }

.tc-answer-content {
  padding: 20px;
  font-size: 17px;
  line-height: 1.7;
}
.tc-answer-content p {
  margin-bottom: 10px;
}
.tc-answer-content p:last-child { margin-bottom: 0; }


/* ════════════════════════════════════════════════════
   16. MATH DISPLAY
   ════════════════════════════════════════════════════ */
.math-display {
  margin: 16px 0;
  text-align: center;
}


/* ════════════════════════════════════════════════════
   17. BADGE
   ════════════════════════════════════════════════════ */
.tc-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 4px 10px;
  margin-bottom: 12px;
}
.tc-badge.easy {
  background: var(--white);
  color: var(--ink);
  border: 1px solid rgba(22,33,68,0.12);
}
.tc-badge.medium {
  background: var(--cream);
  color: var(--ink);
  border: 1px solid rgba(22,33,68,0.12);
}
.tc-badge.hard {
  background: var(--magenta);
  color: white;
}
.tc-badge.challenge {
  background: var(--magenta);
  color: white;
}

/* Method/tool badges (used inline at the start of a question prompt
   to flag whether Desmos is allowed). Sharp pill, DM Mono, all-caps. */
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: 2px;
}
.badge--no-desmos {
  background: var(--ink);
  color: var(--cream);
}
.badge--desmos {
  background: var(--gold);
  color: var(--ink);
}
.badge--challenge {
  background: var(--magenta);
  color: white;
}


/* ════════════════════════════════════════════════════
   18. TOOL MOCK
   ════════════════════════════════════════════════════ */
.tc-tool-mock {
  background: var(--container-bg);
  border: var(--border);
  border-radius: var(--radius);
  margin: 24px 0 16px;
  overflow: hidden;
}
.tc-tool-mock-header {
  background: var(--ink);
  color: var(--bone);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tc-tool-mock-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 120px;
}
.tc-tool-mock-input {
  padding: 10px 0;
  border-right: var(--border-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tc-tool-mock-expr {
  display: flex;
  align-items: baseline;
  padding: 10px 20px;
  gap: 10px;
  border-bottom: 1px solid rgba(22,33,68,0.10);
}
.tc-tool-mock-expr:last-child { border-bottom: none; }
.tc-tool-mock-line-num {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(22,33,68,0.35);
  min-width: 16px;
  text-align: right;
  flex-shrink: 0;
}
.tc-tool-mock-line-color {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.tc-tool-mock-line-text {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  line-height: 1.7;
}
.tc-tool-mock-output {
  padding: 20px 24px;
  background: var(--cream);
  font-size: 14px;
  line-height: 1.6;
  color: rgba(22,33,68,0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tc-tool-mock-output p { margin: 0 0 10px; }
.tc-tool-mock-output p:last-child { margin-bottom: 0; }
.tc-tool-mock-result {
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 8px;
  color: var(--ink);
  opacity: 0.7;
}

/* Legacy desmos-mockup class names (ch01 compatibility) */
.desmos-mockup {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  margin: 28px 0;
  overflow: hidden;
}
.desmos-mockup-header {
  background: var(--ink);
  color: var(--bone);
  padding: 10px 20px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.desmos-mockup-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 160px;
}
.desmos-expr-line {
  padding: 20px 24px;
  font-size: 15px;
  line-height: 1.8;
}
.desmos-expr-line.red,
.desmos-expr-line.blue {
  border-right: var(--border-light);
  color: var(--ink);
}


/* ════════════════════════════════════════════════════
   19. FLOWCHART
   ════════════════════════════════════════════════════ */
.tc-flow {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 24px 0 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.tc-flow-box {
  background: var(--container-bg);
  padding: 20px 24px;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
  min-width: 160px;
  border-radius: var(--radius);
  border: var(--border);
}
.tc-flow-box.primary { background: var(--ink); color: var(--bone); }
.tc-flow-box.accent { background: var(--magenta); color: var(--white); }
.tc-flow-box.muted { background: var(--cream); color: var(--ink); }
.tc-flow-box small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  margin-top: 4px;
  opacity: 0.8;
}
.tc-flow-branch { display: flex; flex-direction: column; gap: 16px; }
.tc-flow-branch-row { display: flex; align-items: center; gap: 16px; }
.tc-flow-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}
.tc-flow-arrow-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.55;
  margin-bottom: 4px;
}
.tc-flow-arrow-line {
  width: 80px;
  height: 2px;
  background: var(--ink);
  position: relative;
}
.tc-flow-arrow-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  border: 5px solid transparent;
  border-left-color: var(--ink);
}


/* ════════════════════════════════════════════════════
   20. PIE CHARTS
   ════════════════════════════════════════════════════ */
.tc-pie-row {
  display: flex;
  gap: 24px;
  margin: 24px 0 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.tc-pie-card {
  background: var(--container-bg);
  padding: 24px;
  text-align: center;
  flex: 1;
  min-width: 200px;
  border-radius: var(--radius);
  border: var(--border);
}
.tc-pie-card h5 {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 16px;
}
.tc-pie-chart {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
}
.tc-pie-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}


/* ════════════════════════════════════════════════════
   21. DRILL
   ════════════════════════════════════════════════════ */
.tc-training {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  margin: 40px 0 16px;
  overflow: hidden;
}
.tc-training-header {
  padding: 14px 20px;
  background: var(--bone);
  border-bottom: 1px solid rgba(22,33,68,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tc-training-title {
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink);
}
.tc-training-instructions {
  padding: 12px 20px;
  font-size: 14px;
  line-height: 1.55;
  color: rgba(22,33,68,0.7);
  border-bottom: 1px solid rgba(22,33,68,0.10);
  background: var(--white);
}
.tc-training-instructions strong { color: var(--ink); }
.tc-training-item {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(22,33,68,0.10);
  position: relative;
}
.tc-training-item:last-child { border-bottom: none; }
.tc-training-question {
  display: flex;
  gap: 12px;
  align-items: baseline;
}
/* When a no-Desmos badge is in the question, reserve space on the right
   so it doesn't overlap the prompt text. */
.tc-training-item:has(.badge--no-desmos) .tc-training-text {
  padding-right: 96px;
}
/* Hide the inline badge inside the prompt; we render a top-right copy via CSS. */
.tc-training-text .badge--no-desmos {
  position: absolute;
  top: 14px;
  right: 16px;
  margin: 0;
}
.tc-training-num {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--magenta);
  line-height: 1.7;
  flex-shrink: 0;
  width: 20px;
}
.tc-training-text {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  flex: 1;
}
.tc-training-reveal {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--magenta);
  background: none;
  border: 1px solid var(--magenta);
  border-radius: var(--radius);
  padding: 5px 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s, color 0.15s;
}
.tc-training-reveal:hover {
  background: var(--magenta);
  color: var(--white);
}
.tc-training-reveal.used {
  color: var(--ink);
  border-color: rgba(22,33,68,0.25);
}
.tc-training-reveal.used:hover {
  background: rgba(22,33,68,0.06);
  color: var(--ink);
}
.tc-training-answer {
  margin-top: 14px;
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: none;
}
.tc-training-answer.revealed { display: block; }
.tc-training-answer-cap {
  background: transparent;
  color: var(--ink);
  padding: 8px 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  border-bottom: 1px solid rgba(22,33,68,0.12);
}
.tc-training-answer-body {
  padding: 16px 20px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.tc-training-answer-body > *:first-child { margin-top: 0; }
.tc-training-answer-body > *:last-child { margin-bottom: 0; }
.tc-training-answer-body p { margin: 0 0 10px; }
.tc-training-answer-body p:last-child { margin: 0; }
.tc-training-answer-body .tc-answer-choice { margin: 2px 0; }


/* ════════════════════════════════════════════════════
   22. QUESTION FIGURE (images in questions)
   ════════════════════════════════════════════════════ */
.question-figure {
  background: var(--white);
  padding: 0.5em;
  margin: 16px 0;
}
.question-figure img {
  max-width: 100%;
  display: block;
}


/* ════════════════════════════════════════════════════
   23. LEGACY COMPATIBILITY
   Old class names from the v2 monolith. Keep these
   so unreformatted chapters still render. Remove once
   all chapters are restyled.
   ════════════════════════════════════════════════════ */

/* Old question-box (blockquote style) */
.question-box {
  background: var(--cream);
  border-left: 4px solid var(--magenta);
  padding: 24px 28px;
  margin: 28px 0;
}
.question-box p { margin-bottom: 14px; }
.question-box p:last-child { margin-bottom: 0; }

/* Old answer-choice */
.answer-choice {
  display: block;
  margin-bottom: 8px;
  padding: 8px 12px;
  font-size: 16px;
}

/* Old training-question */
.training-question {
  background: var(--cream);
  border-left: 4px solid var(--ink);
  padding: 24px 28px;
  margin: 28px 0;
}

/* Old solution-box */
.solution-box {
  background: var(--bone);
  border: var(--border-light);
  padding: 24px 28px;
  margin: 28px 0;
}

/* Old quick-nav (bottom buttons — legacy chapters) */
.quick-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
}
.quick-nav button,
.quick-nav a {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--ink);
  padding: 10px 20px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.quick-nav button:hover,
.quick-nav a:hover {
  background: var(--ink);
  color: var(--bone);
  text-decoration: none;
}


/* ════════════════════════════════════════════════════
   23b. EMOJI PARTICLES
   ════════════════════════════════════════════════════ */
.emoji-particle {
  position: fixed;
  font-size: 28px;
  pointer-events: none;
  z-index: 9999;
  animation: emojifall 2.5s ease-out forwards;
}
@keyframes emojifall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg) scale(0.2);
  }
}


/* ════════════════════════════════════════════════════
   24. RESPONSIVE
   ════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.visible {
    display: block;
  }
  .sidebar-toggle { display: none; }
  .hamburger { display: flex; }
  .main-content {
    margin-left: 0;
  }
  .content-wrapper {
    padding: 80px 24px 120px;
  }
  .emoji-bar {
    right: 12px;
    top: 12px;
  }
  .desmos-trigger {
    right: 12px;
  }
  .chapter-nav {
    right: 12px;
    bottom: 12px;
  }
  .desmos-panel { width: 100%; }
  body.desmos-open .main-content { margin-right: 0; }
  body.desmos-open .emoji-bar { right: 12px; }
  body.desmos-open .desmos-trigger { right: 12px; }
  body.desmos-open .chapter-nav { right: 12px; }
}

@media print {
  .sidebar, .sidebar-toggle, .hamburger, .emoji-bar,
  .desmos-trigger, .desmos-panel, .sidebar-overlay, .chapter-nav,
  .quick-nav { display: none !important; }
  .main-content { margin: 0 !important; }
  .content-wrapper { max-width: 100%; padding: 0; }
}

/* ════════════════════════════════════════════════════════════════
   R&W extensions (appended 2026-05-19) — components Grammar lacks.
   Per RW_RESTYLE_AUDIT.md.
   ════════════════════════════════════════════════════════════════ */

/* Short teaching example — choiceless illustrative sentence in lesson body.
   NOT a practice question (.tc-question) and NOT Grammar's heavier bordered
   .tc-example block (which is a Concept-rule walkthrough container). Just an
   indented sentence + muted caption for the reason. Reuses Grammar's
   pre-existing .tc-example-caption (line ~758) for the muted "why" text.
   Markup:
     <div class="tc-example-mini">
       <p>{example with ______}<span class="tc-example-caption">why</span></p>
     </div>
*/
.tc-example-mini {
  margin: 0.6em 0 1em 1.75em;
  max-width: 64ch;
  border: 0;
  padding: 0;
  background: transparent;
}
.tc-example-mini > p { margin: 0; }

/* ════════════════════════════════════════════════════════════════
   .tc-training-item — R&W lesson Training item wrapper.
   Groups `.tc-question` + `.tc-pause` + `.tc-answer-reveal` into
   one teaching unit. Each inner component keeps its own brand
   styling exactly as elsewhere in the guide; the wrapper only
   tightens the vertical spacing between siblings so the three
   pieces read as one connected unit (same kind of spatial
   proximity that connects `.tc-question` + reveal in a Practice
   Questions item). (D27, R&W-specific.)
*/
.tc-training-item {
  margin: 32px 0;
}
.tc-training-item > .tc-question,
.tc-training-item > .tc-pause,
.tc-training-item > .tc-answer-reveal {
  margin-top: 0;
  margin-bottom: 0;
}
.tc-training-item > .tc-question + .tc-pause,
.tc-training-item > .tc-pause + .tc-answer-reveal,
.tc-training-item > .tc-question + .tc-answer-reveal {
  margin-top: 8px;
}

/* .tc-passage-quote — embedded passage citation inside a reveal (D20).
   Bone-tinted blockquote with ink left rule. Only legitimate place where a
   "landmark-like" block sits inside another landmark (.tc-answer-content). */
.tc-passage-quote {
  background: var(--bone);
  border-left: 3px solid var(--ink);
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 2px;
  font-style: italic;
}
.tc-passage-quote > p { margin: 0; }

/* ════════════════════════════════════════════════════════════════
   .tc-dual-text / .tc-passage / .tc-passage-label — R&W Cross-Text
   dual-passage display (D-row 3). One .tc-question contains one
   .tc-dual-text containing TWO .tc-passage blocks. Each passage:
   NO background, NO border, NO box — just the DM-Mono "Text 1" /
   "Text 2" eyebrow above the passage content. Distinct from
   .tc-callout (which IS a box treatment). Passages render as
   plain reading content with a label, not as sidebar-style asides.
   (D31 — Sam-ratified at the ch04 proving ground.)
*/
.tc-dual-text {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tc-passage {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
}
.tc-passage > .tc-passage-label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 6px;
}
.tc-passage > p {
  margin: 0;
}
.tc-passage > p + p {
  margin-top: 10px;
}

/* ════════════════════════════════════════════════════════════════
   Verdict cells for reveal tables (D16). Colored ✓/✗ markers
   inside .tc-table cells. Multi-column verdict tables permitted
   (ch04 Q1 = 3-col Text 1?/Text 2?; ch05 Cougar 3-col; ch05 Store
   Layout 5-col). R2 voice rule still binds: every verdict cell
   must cite the passage span/answer-choice phrase that justifies
   it — bare ✓/✗ are content gaps, not styling targets.
*/
td.verdict-yes {
  color: #2d7a3a;        /* green */
  font-weight: 600;
}
td.verdict-no {
  color: var(--magenta);
  font-weight: 600;
}
td.verdict-partial {
  color: #b08800;        /* amber */
  font-weight: 600;
}
td.verdict-irrelevant {
  color: rgba(22, 33, 68, 0.40);   /* muted ink (gray) */
  font-style: italic;
}
