/* Model landing pages (templates/models/*.html). Loads after landing.css, whose
 * report frame (masthead, sections, buttons, figures, sources, close) it reuses.
 * <html data-model> selects the model's colour roles from theme.css, so the same
 * rules give Solow green and New Keynesian violet. The model's colour is the only
 * colour on the page.
 */
.landing { --masthead-rule: var(--model-accent); --accent: var(--model-accent); --accent-strong: var(--model-strong); --accent-soft: var(--model-soft); }
.button-model { background: var(--model-accent); border-color: var(--model-accent); }
.button-model:hover { background: var(--model-accent-hover); border-color: var(--model-accent-hover); }
.site-bar-links a[aria-current="page"] { color: var(--ink); background: var(--model-soft); font-weight: 700; }

/* ---------- Hero ---------- */
.model-hero h1 { font-size: clamp(3rem, 7vw, 5.25rem); }
/* The model's central lesson as a statement, not a boxed callout. */
.big-lesson { max-width: 26em; margin: 32px 0 0; color: var(--ink); font-size: var(--t-lead); font-weight: 500; line-height: 1.4; }
.big-lesson span { display: block; margin-bottom: 4px; color: var(--accent-strong); font-size: 0.9375rem; font-weight: 700; }

.live-card { margin: 0; padding-top: 14px; border-top: 3px solid var(--ink); }
.live-card h2 { margin: 0 0 12px; font-size: var(--t-lead); font-weight: 700; letter-spacing: -0.015em; }
.country-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.country-picker button, .shock-picker button { min-height: 38px; padding: 0 14px; border: 2px solid var(--tone-2); border-radius: var(--radius); background: var(--paper); color: var(--ink-2); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: background 160ms var(--ease-out), color 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.country-picker button:hover, .shock-picker button:hover { border-color: var(--accent); color: var(--ink); }
.country-picker button[aria-pressed="true"], .shock-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--model-on-accent); }

.live-chart { position: relative; margin: 10px -4px 0; }
.live-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.live-chart svg:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 4px; }
.live-chart .grid line { stroke: var(--tone-2); stroke-width: 1; }
.live-chart .grid line.zero, .live-chart .zero { stroke: var(--ink-3); stroke-width: 1.25; }
.live-chart .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.live-chart .axis-title { fill: var(--ink-2); font-size: 11.5px; font-weight: 600; }
.live-chart .curve { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; transition: opacity 200ms var(--ease-out), stroke-width 200ms var(--ease-out); }
.live-chart .curve-investment { stroke: var(--accent); }
.live-chart .curve-break-even { stroke: var(--ink); stroke-dasharray: 7 5; stroke-width: 2.25; }
.live-chart .curve-label { font-size: 11px; font-weight: 700; }
.live-chart .label-investment { fill: var(--accent-strong); }
.live-chart .label-break-even { fill: var(--ink); }
.live-chart .net-gap { stroke: var(--accent); stroke-width: 6; opacity: 0.22; stroke-linecap: round; }
.live-chart .direction-arrow { stroke: var(--accent-strong); stroke-width: 2.5; }
.live-chart .arrow-head { fill: var(--accent-strong); }
.live-chart .steady-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.live-chart .today-dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2.5; }
.live-chart .point-label { fill: var(--ink-2); font-size: 11px; font-weight: 700; }
.live-chart .point-today { fill: var(--accent-strong); }
.live-chart .long-run { stroke: var(--accent-strong); stroke-width: 1.5; stroke-dasharray: 3 5; }
.live-chart .long-run-label { fill: var(--accent-strong); font-size: 11.5px; font-weight: 700; }
/* The equation explorer emphasises the line of the chosen term. */
#phaseCard[data-focus="investment"] .curve-break-even, #phaseCard[data-focus="break_even"] .curve-investment { opacity: 0.3; }
#phaseCard[data-focus="investment"] .curve-investment, #phaseCard[data-focus="break_even"] .curve-break-even { stroke-width: 4.5; }
#phaseCard[data-focus="change"] .net-gap { opacity: 0.5; }

.live-readout { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin: 12px 0 0; }
.live-readout div { padding: 12px 14px; background: var(--tone); }
.live-readout dt { color: var(--ink-2); font-size: var(--t-small); font-weight: 600; }
.live-readout dd { margin: 2px 0 0; font-size: var(--t-h3); font-weight: 800; letter-spacing: -0.03em; }
.live-readout dd::first-letter { text-transform: uppercase; }
.live-readout small { display: block; color: var(--ink-3); font-size: 0.75rem; font-weight: 600; letter-spacing: 0; }
.live-headline { min-height: 1.5em; margin: 14px 0 0; font-weight: 600; line-height: 1.45; }
.live-caution { margin: 10px 0 0; padding: 10px 14px; background: #fff4dc; color: #5c4100; font-size: var(--t-small); line-height: 1.5; }
.live-caution[hidden] { display: none; }

/* ---------- The equation (Solow): one large line whose terms are buttons ---------- */
.equation-explorer { display: grid; gap: 20px; }
.equation { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: clamp(1.75rem, 4vw, 2.75rem); font-weight: 700; letter-spacing: -0.02em; }
.operator { color: var(--ink-3); font-weight: 400; }
.term { padding: 2px 4px; border: 0; border-bottom: 4px solid var(--tone-2); border-radius: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out); }
.term:hover { border-bottom-color: var(--accent); }
.term[aria-pressed="true"] { border-bottom-color: var(--accent); background: var(--accent-soft); }
.term-panel { max-width: 40em; }
.term-panel h3 { margin: 0 0 6px; font-size: var(--t-lead); letter-spacing: -0.015em; }
.term-panel p { margin: 0; color: var(--ink-2); }
.term-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 2px; margin: 16px 0 0; }
.term-values div { padding: 10px 14px; background: var(--tone); }
.term-values dt { color: var(--ink-2); font-size: var(--t-small); font-weight: 600; }
.term-values dd { margin: 2px 0 0; font-size: var(--t-lead); font-weight: 800; }

/* ---------- Key ideas: a glossary in two columns ---------- */
.concept-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px clamp(24px, 4vw, 48px); margin: clamp(40px, 5vw, 56px) 0 0; padding: 0; list-style: none; }
.concept { display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; align-items: baseline; }
.concept-symbol { grid-row: span 2; min-width: 3.25rem; color: var(--accent-strong); font-size: var(--t-lead); font-weight: 800; letter-spacing: -0.02em; }
.concept h3 { margin: 0; font-size: var(--t-body); font-weight: 700; }
.concept p { margin: 0; color: var(--ink-2); font-size: 0.9375rem; }

/* ---------- Experiment (Solow) ---------- */
.experiment-card { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.4fr); gap: 24px clamp(24px, 4vw, 48px); align-items: start; padding-top: 14px; border-top: 3px solid var(--ink); }
.experiment-controls { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 12px; }
.experiment-controls label { color: var(--ink-2); font-size: 0.9375rem; font-weight: 600; }
.experiment-controls output { color: var(--accent-strong); font-size: var(--t-h3); font-weight: 800; }
.experiment-controls input { grid-column: 1 / -1; width: 100%; height: 32px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.experiment-controls input:disabled { cursor: progress; opacity: 0.5; }
.experiment-note { grid-column: 1 / -1; margin: 0; color: var(--ink-3); font-size: var(--t-small); }
.experiment-readout { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin: 10px 0 0; }
.experiment-readout div { padding: 10px 12px; background: var(--tone); }
.experiment-readout div:last-child { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.experiment-readout dt { color: var(--ink-2); font-size: var(--t-small); font-weight: 600; line-height: 1.3; }
.experiment-readout dd { margin: 4px 0 0; font-size: var(--t-lead); font-weight: 800; }
.experiment-controls .live-headline { grid-column: 1 / -1; }

/* ---------- Three equations (New Keynesian): full width, the hit one in colour ---------- */
#equations { grid-template-columns: minmax(0, 1fr); }
#equations > .section-head { grid-column: 1; grid-row: auto; position: static; max-width: 720px; }
#equations > * { grid-column: 1; }
.shock-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.shock-picker button { min-height: 44px; padding: 0 18px; font-size: 0.9375rem; }
.equation-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); margin: 8px 0 0; padding: 0; list-style: none; }
.equation-card { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 6px solid var(--tone-2); transition: border-color 240ms var(--ease-out); }
.equation-card h3 { margin: 0; font-size: var(--t-h3); letter-spacing: -0.02em; }
.equation-card p { margin: 0; color: var(--ink-2); }
.equation-card code { margin-top: auto; padding: 10px 12px; background: var(--tone); color: var(--ink); font-family: inherit; font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
/* KaTeX equations (NewKeynesian/overview.py): the surprise term is coloured, and filled
   when its surprise is the one chosen. Before KaTeX loads, the plain formula shows. */
.equation-math { display: flex; align-items: center; min-height: 3.6em; margin-top: auto; padding: 8px 12px; overflow-x: auto; background: var(--tone); color: var(--ink); font-weight: 600; }
.equation-math .katex { font-size: 1.08em; }
.equation-math .katex-display { margin: 0; text-align: left; }
.equation-math .katex-display > .katex { text-align: left; }
.surprise { color: var(--accent-strong); }
.equation-card.is-hit .surprise { padding: 0 0.15em; border-radius: 3px; background: var(--accent); color: var(--model-on-accent); }
.symbol-key { margin: clamp(20px, 3vw, 32px) 0 0; padding-top: 14px; border-top: 1px solid var(--tone-2); }
.symbol-key-title { margin: 0 0 10px; color: var(--ink-3); font-size: var(--t-small); font-weight: 700; letter-spacing: 0.02em; }
.symbol-key dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px clamp(16px, 2.5vw, 32px); margin: 0; }
.symbol-key dl > div { display: grid; grid-template-columns: 3.8em 1fr; align-items: baseline; gap: 10px; }
.symbol-key dt { color: var(--ink); font-weight: 700; white-space: nowrap; }
.symbol-key dd { margin: 0; color: var(--ink-2); font-size: var(--t-small); line-height: 1.45; }
.symbol-key .is-surprise dt { color: var(--accent-strong); }
.equation-hit { display: none; color: var(--accent-strong); font-size: var(--t-small); font-weight: 700; }
.equation-card.is-hit { border-top-color: var(--accent); }
.equation-card.is-hit .equation-hit { display: block; }
.response-card { margin-top: 8px; padding-top: 14px; border-top: 3px solid var(--ink); }
.response-headline { min-height: 1.5em; margin: 0 0 14px; font-size: var(--t-lead); font-weight: 700; letter-spacing: -0.015em; }
#equations .concept-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ---------- Evidence chart (New Keynesian) ---------- */
.evidence-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--t-small); }
.evidence-legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 4px; }
.swatch-inflation { background: var(--accent); }
.swatch-rate { background: var(--ink); }
.swatch-band { height: 10px; background: color-mix(in srgb, var(--accent) 16%, transparent); }
.live-chart .target-band { fill: var(--accent); opacity: 0.1; }
.live-chart .target-line { stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 4 4; }
.live-chart .line-inflation { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; }
.live-chart .line-rate { fill: none; stroke: var(--ink); stroke-width: 1.75; stroke-linejoin: round; }
.live-chart .reading-guide line { stroke: var(--ink); stroke-width: 1; opacity: 0.4; }
.live-chart .dot-inflation { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.live-chart .dot-rate { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
#evidenceChart { cursor: crosshair; touch-action: pan-y; }
.live-chart .annotation text { font-size: 11px; font-weight: 700; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.live-chart .annotation-inflation circle { fill: var(--paper); stroke: var(--accent); stroke-width: 2; }
.live-chart .annotation-inflation text { fill: var(--accent-strong); }
.live-chart .annotation-rate circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.live-chart .annotation-rate text { fill: var(--ink); }

/* ---------- Lab pages: a list of links ---------- */
.lab-page-grid { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.lab-page { position: relative; display: grid; grid-template-columns: minmax(10rem, 0.8fr) minmax(0, 1.6fr); align-items: baseline; gap: 4px 24px; padding: 16px 52px 16px 20px; background: var(--tone); transition: background 160ms var(--ease-out); }
.lab-page:hover { background: var(--tone-2); }
.lab-page-title { font-size: var(--t-lead); font-weight: 700; letter-spacing: -0.015em; }
.lab-page-question { color: var(--ink-2); }
.lab-page-arrow { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--accent-strong); font-weight: 700; transition: transform 160ms var(--ease-out); }
.lab-page:hover .lab-page-arrow { transform: translate(3px, -50%); }

/* ---------- Assumptions: a report table ---------- */
.assumption-grid { display: grid; gap: 2px; margin: 0 0 clamp(32px, 5vw, 48px); }
.assumption-grid div { display: grid; grid-template-columns: minmax(9rem, 0.7fr) minmax(7rem, 0.6fr) minmax(0, 1.4fr); align-items: baseline; gap: 4px 20px; padding: 14px 20px; background: var(--tone); }
.assumption-grid dt { font-weight: 700; }
.assumption-grid dd { margin: 0; color: var(--accent-strong); font-size: var(--t-lead); font-weight: 800; }
.assumption-grid dd.assumption-note { color: var(--ink-2); font-size: 0.9375rem; font-weight: 500; }
/* A value with several parts (the policy rule's two numbers) gives each its own unbroken line. */
.assumption-line { display: block; white-space: nowrap; }

/* ---------- Motion and narrow screens ---------- */
@media (prefers-reduced-motion: reduce) {
    .live-chart .curve, .equation-card, .lab-page, .lab-page-arrow, .term, .country-picker button, .shock-picker button { transition: none; }
}
@media (max-width: 960px) {
    .experiment-card { grid-template-columns: 1fr; }
    .equation-cards, #equations .concept-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .concept-grid { grid-template-columns: 1fr; }
    .lab-page { grid-template-columns: 1fr; }
    .assumption-grid div { grid-template-columns: 1fr auto; }
    .assumption-grid dd.assumption-note { grid-column: 1 / -1; }
    .live-readout dd { font-size: 1.25rem; }
}
@media (max-width: 560px) {
    .live-chart .tick, .live-chart .curve-label, .live-chart .point-label, .live-chart .long-run-label { font-size: 15px; }
    .live-chart .axis-title { font-size: 14px; }
}

/* Portfolio landing page (models/portfolio.html): the five-year preview, its News item and table,
   the two-asset mix and the CAPM comparison row. Company colours come from the lab's ASSET_COLORS
   (set by the script), so each company keeps its colour everywhere. */
.preview-brief { margin: 4px 0 10px; color: var(--ink-2); font-size: var(--t-small); }
.live-chart .preview-line { stroke: var(--ink-3); stroke-width: 1.75; opacity: 0.6; }
.live-chart .preview-line.is-chosen { stroke: var(--accent); stroke-width: 3.5; opacity: 1; }
.live-chart .preview-reference { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 6 5; }
.live-chart .preview-label { fill: var(--ink-3); font-size: 11px; font-weight: 600; }
.live-chart .preview-label.is-chosen { fill: var(--accent-strong); font-weight: 800; }
.live-chart .preview-reference-label { fill: var(--ink-2); }
.live-chart .preview-year { stroke: var(--tone-2); stroke-width: 1.5; }
.live-chart .preview-dot, .live-chart .mix-dot { fill: var(--accent-strong); stroke: var(--paper); stroke-width: 2; }
.live-chart .mix-asset circle { stroke: var(--paper); stroke-width: 1.5; }
.live-chart .mix-asset text { fill: var(--ink-2); font-size: 11px; font-weight: 700; }
.preview-key { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; color: var(--ink-2); font-size: var(--t-small); }
.preview-key-dash { flex: none; width: 26px; border-top: 2px dashed var(--ink-2); }
.preview-comparison { margin: 6px 0 0; color: var(--ink-2); font-size: var(--t-small); }
.preview-again { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; }
.preview-again .lab-error { margin: 0; }
.preview-news { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--tone-2); }
.preview-news-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.preview-news-head h3 { margin: 0; font-size: var(--t-body); }
.year-picker { display: flex; gap: 4px; }
.year-picker button { min-width: 34px; min-height: 32px; border: 2px solid var(--tone-2); border-radius: var(--radius); background: var(--paper); color: var(--ink-2); font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer; }
.year-picker button:hover { border-color: var(--accent); color: var(--ink); }
.year-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--model-on-accent); }
.news-item { margin-top: 8px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--tone); font-size: var(--t-small); line-height: 1.5; }
.news-item p { margin: 0 0 4px; }
.news-when { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); }
.news-when span { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.75rem; }
.news-headline { color: var(--ink); font-weight: 700; }
.news-story { font-style: italic; }
.news-lines { margin: 4px 0; padding-left: 18px; color: var(--ink-2); }
.news-result { color: var(--accent-strong); font-weight: 700; }
.preview-table { margin-top: 12px; font-size: var(--t-small); }
.preview-table summary { color: var(--ink-2); font-weight: 600; cursor: pointer; }
.preview-table table { width: 100%; margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.preview-table th, .preview-table td { padding: 4px 6px; border-bottom: 1px solid var(--tone-2); text-align: right; }
.preview-table th[scope="row"], .preview-table thead th:first-child { text-align: left; }
.mix-ends { display: flex; justify-content: space-between; }
.mix-readout div:last-child { display: block; grid-column: auto; }
#mixLeast { grid-column: 1 / -1; justify-self: start; }
.section-note { max-width: 46em; margin: 18px 0 0; color: var(--ink-2); }
.equation-word { font-weight: 700; }
.equation-symbols { margin: 8px 0 14px; color: var(--ink-3); font-size: var(--t-small); }
.term-rf { color: #138667; }
.term-beta { color: var(--accent-strong); font-weight: 800; }
.term-premium { color: #1f5fa8; }
.capm-example { margin-top: 14px; }
.capm-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; margin-top: 18px; }
.capm-company { padding: 14px 16px; border-top: 4px solid var(--asset-color, var(--accent)); background: var(--tone); }
.capm-company h3 { margin: 0 0 8px; font-size: var(--t-body); }
.capm-ticker { padding: 1px 6px; border-radius: 2px; background: var(--asset-color, var(--accent)); color: #ffffff; font-size: 0.75rem; letter-spacing: 0.04em; }
.capm-company dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.capm-company dt { color: var(--ink-2); font-size: var(--t-small); font-weight: 600; }
.capm-company dd { margin: 2px 0 0; font-size: var(--t-lead); font-weight: 800; }
@media (max-width: 720px) {
    .capm-compare { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .live-chart .preview-label, .live-chart .mix-asset text { font-size: 15px; }
}
@media print {
    .country-picker, .year-picker, #mixLeast, .equation .term { border: 0; }
    .preview-table { display: block; }
}
