/* ce-academy.css — the complete stylesheet for every /academy/ page, layered ON TOP of
 * assets/mobile.css only. It keeps the calculator family's component vocabulary (.wrap/.grid/.panel/
 * .ctrl/.chartcard/...) so the Academy reads as part of the same product rather than a bolted-on
 * sub-site, on the same theme tokens (--ce-*, from mobile.css; docs/design/THEME.md).
 *
 * The header and footer are the shared chrome (scripts/markets/chrome.mjs, stamped into each page by
 * scripts/growth/sync-chrome.mjs), styled only in mobile.css. The page title area sits at the top of
 * <main> on the page background (.pagehead), as on every other page. */

/* Legacy names, kept as aliases of the theme tokens for the pages' scripts that write inline styles
   against them (e.g. color:var(--ink-soft)). New rules use the --ce-* tokens directly. */
:root {
  --navy:var(--ce-primary); --navy-soft:var(--ce-primary-hover); --blue:var(--ce-link); --blue-bright:var(--ce-cyan);
  --blue-ghost:var(--ce-info-bg); --paper:var(--ce-surface-2); --paper-raised:var(--ce-surface); --ink:var(--ce-ink);
  --ink-soft:var(--ce-muted); --ink-faint:var(--ce-dim); --rule:var(--ce-border); --amber:var(--ce-warn);
  --amber-soft:var(--ce-warn-bg); --good:var(--ce-good); --bad:var(--ce-bad);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ce-bg); color: var(--ce-ink); font-family: var(--ce-font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* ---- page top: breadcrumb 28px below the header, eyebrow, title, lede (as on a city page) ---- */
.pagehead { margin: 0 0 28px; }
.crumbs { font-size: 12px; line-height: 1.5; color: var(--ce-dim); margin: 0 0 18px; }
.crumbs a { color: var(--ce-muted); }
.crumbs a:hover { color: var(--ce-ink); }
.crumbs .sep { margin: 0 6px; color: var(--ce-dim); }
.crumbs [aria-current] { color: var(--ce-ink); }
.kicker { font-family: var(--ce-mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ce-cyan); margin: 0 0 14px; }
.pagehead h1 { font: 600 var(--ce-h1)/1.12 var(--ce-display); letter-spacing: -.02em; color: var(--ce-ink); margin: 0; }
.pagehead .tagline { margin: 12px 0 0; font-size: 16px; line-height: 1.6; color: var(--ce-muted); max-width: 64ch; }

/* ---- layout: the one app frame (1160px, 24px gutters); Build-a-Block reads as one centred column ---- */
.wrap { max-width: var(--ce-frame); margin: 0 auto; padding: 28px var(--ce-gutter) 0; }
.grid { display: grid; grid-template-columns: 340px 1fr; gap: 24px; align-items: start; }
/* A grid item's min-width defaults to its content: the Simulated path's horizontally scrolling
   timeline strip (min-width:max-content) widened the results column to ~5,800px and the whole page
   with it. min-width:0 keeps the column in the frame so the strip scrolls inside its own box. */
.grid > * { min-width: 0; }
.panel { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-radius); padding: 6px 20px 18px; }
.ctrl { padding: 15px 0; border-bottom: 1px solid var(--ce-border); }
.ctrl:last-child { border-bottom: none; }
.ctrl > label { display: block; font-size: 13px; font-weight: 600; color: var(--ce-ink); margin-bottom: 8px; }
.ctrl .hint { font-weight: 400; color: var(--ce-dim); font-size: 12px; }
.inputline { display: flex; align-items: center; gap: 8px; border: 1px solid var(--ce-border-input); border-radius: var(--ce-radius-sm); padding: 10px 13px; background: var(--ce-surface-2); color: var(--ce-ink); transition: border-color .14s, box-shadow .14s; }
.inputline:hover:not(:focus-within) { border-color: var(--ce-dim); }
.inputline:focus-within { border-color: var(--ce-focus); box-shadow: 0 0 0 1px var(--ce-focus), 0 0 0 4px var(--ce-info-bg); }
.inputline .aff { font-family: var(--ce-mono); color: var(--ce-dim); font-size: 14px; }
.inputline input, .inputline select { border: none; outline: none; background: transparent; font-family: var(--ce-mono); font-size: 15.5px; color: var(--ce-ink); width: 100%; text-align: right; }
select.inputline { font: 500 15px var(--ce-font); }
select.inputline option { background: var(--ce-surface-2); color: var(--ce-ink); }
input[type="range"] { accent-color: var(--ce-primary); }
.seclabel { font-family: var(--ce-display); font-weight: 600; font-size: 13.5px; color: var(--ce-ink); margin: 4px 0 2px; }
.secnote { font-size: 11.5px; color: var(--ce-muted); line-height: 1.5; margin: 0 0 2px; }
.costsec { padding-top: 6px; border-top: 1px solid var(--ce-border); margin-top: 2px; }
.results { display: flex; flex-direction: column; gap: 16px; }
.headline { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-radius); padding: 20px 24px; }
.hl-label { font-family: var(--ce-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ce-muted); }
.figure { font-family: var(--ce-mono); font-weight: 600; font-size: 40px; line-height: 1.04; color: var(--ce-warn); display: inline-block; margin-top: 4px; font-feature-settings: 'tnum' 1; }
.loanline { font-family: var(--ce-mono); font-size: 12.5px; color: var(--ce-muted); margin-top: 7px; line-height: 1.5; }
.showwork { background: none; border: none; color: var(--ce-link); font-size: 12px; cursor: pointer; padding: 8px 0 0; min-height: 24px; text-decoration: underline; text-underline-offset: 2px; }
.showwork:focus-visible { outline: 3px solid var(--ce-focus); outline-offset: 2px; }
.csvbtn { appearance: none; border: 1px solid var(--ce-border-strong); background: transparent; color: var(--ce-ink); font-family: var(--ce-font); font-size: 13px; font-weight: 500; padding: 11px 16px; border-radius: var(--ce-radius-sm); cursor: pointer; transition: .14s; display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; margin-right: 8px; }
.csvbtn:hover { border-color: var(--ce-link); background: var(--ce-surface-2); }
.csvbtn:focus-visible { outline: 3px solid var(--ce-focus); outline-offset: 2px; }
.chartcard { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-radius); padding: 18px 20px 12px; }
.ct-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.ct-title { font-family: var(--ce-display); font-weight: 600; font-size: 14px; color: var(--ce-ink); }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.breakdown { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-radius); padding: 18px 24px; }
.bd-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--ce-border); font-size: 14px; gap: 12px; }
.bd-row:last-child { border-bottom: none; }
.bd-row .k { color: var(--ce-muted); display: flex; align-items: center; gap: 8px; }
.bd-row .v { font-family: var(--ce-mono); font-weight: 500; font-feature-settings: 'tnum' 1; text-align: right; color: var(--ce-ink); }
.nextstep { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: var(--ce-radius); padding: 16px 20px; margin-top: 14px; }
.nextstep .ns-l { font-family: var(--ce-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ce-cyan); }
.nextstep p { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: var(--ce-muted); }
.nextstep a { color: var(--ce-link); font-weight: 600; }
.nextstep a:hover { color: var(--ce-link-hover); }
.disclaimer { max-width: var(--ce-frame); margin: 18px auto 0; padding: 0 var(--ce-gutter); font-size: 11.5px; color: var(--ce-dim); line-height: 1.6; }

@media (max-width: 880px) { .grid { grid-template-columns: 1fr; } .figure { font-size: 32px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- hub (academy/index.html) ---- */
.ac-hub { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 0 0 30px; }
.ac-hubcard {
  background: var(--ce-surface); border: 1px solid var(--ce-border); border-top: 3px solid var(--ce-cyan); border-radius: var(--ce-radius); padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.ac-hubcard .ac-icon { font-size: 28px; line-height: 1; }
.ac-hubcard h2 { font: 600 19px/1.3 var(--ce-display); color: var(--ce-ink); margin: 0; }
.ac-hubcard p { font-size: 14px; color: var(--ce-muted); line-height: 1.55; margin: 0; flex: 1; }
.ac-hubcard .ac-tag { display: inline-flex; width: fit-content; font: 600 11px var(--ce-mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ce-cyan); background: var(--ce-info-bg); padding: 4px 9px; border-radius: 999px; }
.ac-hubcard a.ac-cta { font: 600 14px var(--ce-display); color: var(--ce-primary-ink); background: var(--ce-primary); text-decoration: none; padding: 11px 16px; border-radius: var(--ce-radius-sm); text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center; }
.ac-hubcard a.ac-cta:hover { background: var(--ce-primary-hover); }

/* ---- chip-style pickers (goal, horizon, path) — same interaction language as calc-kit's .seg,
 * sized for 3-5 options rather than 2: raised, the chosen one in primary ---- */
.ac-chipgroup { display: flex; flex-wrap: wrap; gap: 6px; }
.ac-chip {
  font: 600 13px var(--ce-display); padding: 9px 14px; border-radius: var(--ce-radius-sm); border: 1px solid var(--ce-border-strong);
  background: var(--ce-surface-2); color: var(--ce-muted); cursor: pointer; min-height: 40px;
}
.ac-chip[aria-pressed="true"] { background: var(--ce-primary); border-color: var(--ce-primary); color: var(--ce-primary-ink); }
.ac-chip:hover:not([aria-pressed="true"]) { border-color: var(--ce-link); color: var(--ce-ink); }

/* ---- assumptions panel: every non-obvious number, tagged where it came from ---- */
.ac-assumptions { display: grid; gap: 6px; margin: 10px 0; }
.ac-assump-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--ce-border); }
.ac-assump-row:last-child { border-bottom: none; }
.ac-assump-row .k { color: var(--ce-muted); }
.ac-assump-row .v { font-family: var(--ce-mono); color: var(--ce-ink); font-variant-numeric: tabular-nums; }
.ac-tag-sourced, .ac-tag-edu {
  font: 600 10px var(--ce-mono); letter-spacing: .03em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; margin-left: 8px;
}
.ac-tag-sourced { background: var(--ce-good-bg); color: var(--ce-good); }
.ac-tag-edu { background: var(--ce-warn-bg); color: var(--ce-warn); }

/* ---- illustrative-scenario banner: mandatory, prominent, on every result ---- */
.ac-banner {
  background: var(--ce-info-bg); border: 1px solid var(--ce-border-strong); border-left: 4px solid var(--ce-cyan); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; color: var(--ce-ink); line-height: 1.5; margin-bottom: 16px;
}
.ac-banner strong { color: var(--ce-cyan); }

/* ---- timeline: horizontally scrollable strip of per-year event cards ---- */
.ac-timeline-wrap { overflow-x: auto; padding-bottom: 6px; margin: 4px 0 18px; }
.ac-timeline { display: flex; gap: 10px; min-width: max-content; }
.ac-eventcard {
  min-width: 190px; max-width: 210px; background: var(--ce-surface-2); border: 1px solid var(--ce-border);
  border-left: 4px solid var(--ce-dim); border-radius: 10px; padding: 12px 13px; font-size: 12.5px;
}
.ac-eventcard .yr { font: 700 12px var(--ce-mono); color: var(--ce-dim); margin-bottom: 4px; }
.ac-eventcard .lbl { font: 600 13.5px var(--ce-display); color: var(--ce-ink); margin-bottom: 4px; }
.ac-eventcard .note { color: var(--ce-muted); line-height: 1.45; }
.ac-eventcard.ev-positive { border-left-color: var(--ce-good); }
.ac-eventcard.ev-negative { border-left-color: var(--ce-bad); }
.ac-eventcard.ev-neutral { border-left-color: var(--ce-link); }
.ac-timeline-empty { font-size: 13px; color: var(--ce-muted); padding: 10px 0; }

/* ---- "what changed the outcome?" ---- */
.ac-contrib { display: grid; gap: 8px; margin-top: 6px; }
.ac-contrib-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; align-items: center; }
.ac-contrib-row .lbl { color: var(--ce-ink); }
.ac-contrib-row .amt { font-family: var(--ce-mono); font-variant-numeric: tabular-nums; text-align: right; }
.ac-contrib-row .amt.pos { color: var(--ce-good); }
.ac-contrib-row .amt.neg { color: var(--ce-bad); }
.ac-contrib-bar { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--ce-surface-2); overflow: hidden; }
.ac-contrib-bar > span { display: block; height: 100%; border-radius: 4px; }
.ac-contrib-note { grid-column: 1 / -1; font-size: 11.5px; color: var(--ce-dim); margin-top: -2px; }

/* ---- city picker combobox (Compounder + Three-Engine allocation rows) ---- */
.ac-citypick { position: relative; }
.ac-citypick input {
  width: 100%; min-height: 44px; padding: 10px 13px; border: 1px solid var(--ce-border-input); border-radius: var(--ce-radius-sm);
  background: var(--ce-surface-2); color: var(--ce-ink); font: 400 14px var(--ce-font);
}
.ac-citypick input::placeholder { color: var(--ce-dim); opacity: 1; }
.ac-citypick input:focus-visible { outline: none; border-color: var(--ce-focus); box-shadow: 0 0 0 1px var(--ce-focus), 0 0 0 4px var(--ce-info-bg); }
.ac-citypick-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--ce-surface-2);
  border: 1px solid var(--ce-border-strong); border-radius: 10px; box-shadow: var(--ce-shadow); max-height: 260px;
  overflow-y: auto; display: none;
}
.ac-citypick-results.open { display: block; }
.ac-citypick-results button {
  display: flex; justify-content: space-between; width: 100%; padding: 9px 12px; border: none; background: none;
  text-align: left; cursor: pointer; font-size: 13px; color: var(--ce-ink); border-bottom: 1px solid var(--ce-border); min-height: 40px;
}
.ac-citypick-results button:last-child { border-bottom: none; }
.ac-citypick-results button:hover, .ac-citypick-results button:focus-visible { background: var(--ce-surface-3); }
.ac-citypick-results .meta { font-family: var(--ce-mono); font-size: 11px; color: var(--ce-muted); }
.ac-city-chosen { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
/* author display beats the UA [hidden] rule (CLAUDE.md): without this the empty chip showed before a city was picked */
.ac-city-chosen[hidden] { display: none; }
.ac-city-chosen .badge { font: 700 11px var(--ce-mono); background: var(--ce-primary); color: var(--ce-primary-ink); border-radius: 6px; padding: 3px 7px; }

/* ---- Three-Engine allocation rows + score grid ---- */
.ac-alloc-row { display: grid; grid-template-columns: 1fr 90px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--ce-border); }
.ac-alloc-row input[type="range"] { width: 100%; }
.ac-alloc-pct { font-family: var(--ce-mono); text-align: right; font-variant-numeric: tabular-nums; color: var(--ce-ink); }
.ac-alloc-sum { font-size: 12.5px; margin-top: 6px; color: var(--ce-muted); }
.ac-alloc-sum.bad { color: var(--ce-bad); font-weight: 600; }
.ac-scoregrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.ac-score-cell { background: var(--ce-surface-2); border: 1px solid var(--ce-border); border-radius: 10px; padding: 12px; }
.ac-score-cell .k { font: 600 11px var(--ce-mono); text-transform: uppercase; letter-spacing: .03em; color: var(--ce-dim); }
.ac-score-cell .v { font: 700 22px var(--ce-display); color: var(--ce-ink); margin-top: 3px; }
.ac-score-bar { height: 6px; border-radius: 4px; background: var(--ce-bg); margin-top: 8px; overflow: hidden; }
.ac-score-bar > span { display: block; height: 100%; background: var(--ce-chart-1); border-radius: 4px; }
.ac-tradeoff { font-size: 13.5px; line-height: 1.55; color: var(--ce-ink); background: var(--ce-warn-bg); border: 1px solid var(--ce-border); border-left: 4px solid var(--ce-warn); border-radius: 10px; padding: 12px 14px; }

/* ---------------------------------------------------------------------------------------------
 * BUILD-A-BLOCK (kids game): a friendlier, bigger-control skin. Same tokens, larger everything,
 * one centred reading-width column. */
.bab-wrap, .bab-wrap ~ .disclaimer { max-width: calc(var(--ce-read) + 2 * var(--ce-gutter)); margin-inline: auto; }
.bab-banner { background: var(--ce-warn-bg); border: 2px dashed var(--ce-warn); border-radius: var(--ce-radius); padding: 14px 16px; font-size: 14px; color: var(--ce-ink); margin-bottom: 18px; }
.bab-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 20px; }
.bab-stat { background: var(--ce-surface); border: 2px solid var(--ce-border); border-radius: var(--ce-radius); padding: 14px; text-align: center; }
.bab-stat .emoji { font-size: 26px; }
.bab-stat .num { font: 700 24px var(--ce-display); color: var(--ce-ink); }
.bab-stat .lbl { font-size: 12px; color: var(--ce-muted); }
.bab-properties { display: grid; gap: 14px; margin-bottom: 20px; }
.bab-property { background: var(--ce-surface); border: 2px solid var(--ce-border); border-radius: 16px; padding: 16px; }
.bab-property h3 { margin: 0 0 8px; font: 700 17px var(--ce-display); color: var(--ce-ink); }
.bab-condition-bar { height: 16px; border-radius: 8px; background: var(--ce-bg); overflow: hidden; border: 1px solid var(--ce-border-strong); }
.bab-condition-bar > span { display: block; height: 100%; border-radius: 8px; transition: width .25s ease; }
.bab-condition-label { font-size: 12px; color: var(--ce-muted); margin-top: 4px; }
.bab-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.bab-action {
  font: 700 15px var(--ce-display); padding: 18px 12px; border-radius: 16px; border: 2px solid var(--ce-border-strong);
  background: var(--ce-surface-2); cursor: pointer; min-height: 76px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; color: var(--ce-ink);
}
.bab-action .emoji { font-size: 24px; }
.bab-action:hover:not(:disabled) { border-color: var(--ce-link); background: var(--ce-surface-3); }
.bab-action:disabled { opacity: .45; cursor: not-allowed; }
.bab-log { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.bab-log-entry { background: var(--ce-surface); border: 1px solid var(--ce-border); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ce-muted); }
.bab-log-entry .turn { font: 700 11px var(--ce-mono); color: var(--ce-dim); text-transform: uppercase; }
.bab-summary { background: var(--ce-surface); border: 2px solid var(--ce-border); border-radius: 16px; padding: 22px; text-align: center; }
.bab-summary h2 { font: 700 22px var(--ce-display); margin: 0 0 10px; color: var(--ce-ink); }
.bab-lessons { text-align: left; display: grid; gap: 8px; margin-top: 16px; }
.bab-lessons li { font-size: 14px; line-height: 1.5; color: var(--ce-muted); }
.bab-restart { font: 700 15px var(--ce-display); padding: 14px 22px; border-radius: 12px; background: var(--ce-primary); color: var(--ce-primary-ink); border: none; cursor: pointer; margin-top: 14px; min-height: 48px; }
.bab-restart:hover { background: var(--ce-primary-hover); }

@media (max-width: 640px) {
  .ac-alloc-row { grid-template-columns: 1fr 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .bab-condition-bar > span { transition: none; }
}

/* Print stays light (THEME.md): white paper, dark ink, by redefining the tokens. */
@media print {
  :root {
    color-scheme: light;
    --ce-bg: #fff; --ce-surface: #fff; --ce-surface-2: #fff; --ce-surface-3: #f2f2f2;
    --ce-border: #ccc; --ce-border-strong: #999; --ce-border-input: #999;
    --ce-ink: #111; --ce-muted: #333; --ce-dim: #555; --ce-link: #111; --ce-cyan: #333;
    --ce-primary: #ddd; --ce-primary-ink: #111; --ce-warn: #7a4a0f; --ce-good: #1d5e3f; --ce-bad: #8c302b;
    --ce-good-bg: transparent; --ce-bad-bg: transparent; --ce-warn-bg: transparent; --ce-info-bg: transparent;
  }
  html, body { background: #fff; color: #111; }
}
