/* Model colour themes (UI decision D09; rules in docs/design/model-color-system.md).
 *
 * Each model supplies the same roles. model-theme.js sets <html data-model="…">
 * before the page draws, and navigation.js keeps it in step with the open panel; a
 * page without a model (the error page, which draws in ink) or a model without a palette gets the
 * fallback blue. Stylesheets use these roles instead of literal accent colours;
 * which uses change with the model is listed in docs/implemented/model-color-inventory.md.
 *
 * Chart colours (COLORS in common.js), warnings, errors, and analytical labels do
 * not change with the model. Every pair below is contrast-checked by
 * tests/test_model_theme.py.
 */
:root {
    /* Fixed per-model identities, also used by the model chooser in the site menu. */
    --theme-fallback-accent: #0c4a94;
    --theme-fallback-accent-hover: #163f79;
    --theme-fallback-accent-pressed: #0a3a75;
    --theme-fallback-strong: #1d4f8c;
    --theme-fallback-soft: #e4edf8;
    --theme-fallback-page: #f4f7fb;
    --theme-fallback-border: #a9c3e5;
    --theme-fallback-helper: #8fb0d9;

    --theme-solow-accent: #1d7a52;
    --theme-solow-accent-hover: #186845;
    --theme-solow-accent-pressed: #145c3d;
    --theme-solow-strong: #145c3d;
    --theme-solow-soft: #e6f3ec;
    --theme-solow-page: #f3f8f5;
    --theme-solow-border: #a9d4bd;
    --theme-solow-helper: #7cc3ac;

    --theme-new-keynesian-accent: #6b3fbf;
    --theme-new-keynesian-accent-hover: #5b33a6;
    --theme-new-keynesian-accent-pressed: #4f2c91;
    --theme-new-keynesian-strong: #4f2c91;
    --theme-new-keynesian-soft: #f0eafb;
    --theme-new-keynesian-page: #f6f4fb;
    --theme-new-keynesian-border: #c9b8ea;
    --theme-new-keynesian-helper: #b39ddf;

    /* Intertemporal Foundations: warm yellow. A bright yellow cannot carry white text,
       so buttons and text use a deep gold; the yellow shows in tints, borders and helpers. */
    --theme-intertemporal-accent: #8a5d00;
    --theme-intertemporal-accent-hover: #764f00;
    --theme-intertemporal-accent-pressed: #644300;
    --theme-intertemporal-strong: #664500;
    --theme-intertemporal-soft: #fdf3d2;
    --theme-intertemporal-page: #fdf9ec;
    --theme-intertemporal-border: #ecd27a;
    --theme-intertemporal-helper: #e7c14b;

    /* Portfolio Choice & CAPM: warm orange, with a burnt-orange accent for white text. */
    --theme-portfolio-accent: #b0470f;
    --theme-portfolio-accent-hover: #973c0c;
    --theme-portfolio-accent-pressed: #80330a;
    --theme-portfolio-strong: #83350b;
    --theme-portfolio-soft: #fde9dc;
    --theme-portfolio-page: #fdf5ef;
    --theme-portfolio-border: #f2bd98;
    --theme-portfolio-helper: #ee9f6a;

    /* Text on any filled accent, and the shared keyboard focus outline. */
    --model-on-accent: #ffffff;
    --focus-ring: #10233f;

    /* The report palette (D20, docs/design/design-direction.md), shared by the public pages
       (landing.css) and the lab (lab-report.css): ink for text and figure rules, two
       greys for secondary text, and two cool tones for bands. */
    --ink: #101418;
    --ink-2: #3a434e;
    --ink-3: #59636f;
    --tone: #f1f3f5;
    --tone-2: #e3e7ec;

    /* Active-model roles: fallback blue unless a model palette applies. */
    --model-accent: var(--theme-fallback-accent);
    --model-accent-hover: var(--theme-fallback-accent-hover);
    --model-accent-pressed: var(--theme-fallback-accent-pressed);
    --model-strong: var(--theme-fallback-strong);
    --model-soft: var(--theme-fallback-soft);
    --model-page: var(--theme-fallback-page);
    --model-border: var(--theme-fallback-border);
    --model-helper: var(--theme-fallback-helper);
}

:root[data-model="solow"] {
    --model-accent: var(--theme-solow-accent);
    --model-accent-hover: var(--theme-solow-accent-hover);
    --model-accent-pressed: var(--theme-solow-accent-pressed);
    --model-strong: var(--theme-solow-strong);
    --model-soft: var(--theme-solow-soft);
    --model-page: var(--theme-solow-page);
    --model-border: var(--theme-solow-border);
    --model-helper: var(--theme-solow-helper);
}

:root[data-model="new-keynesian"] {
    --model-accent: var(--theme-new-keynesian-accent);
    --model-accent-hover: var(--theme-new-keynesian-accent-hover);
    --model-accent-pressed: var(--theme-new-keynesian-accent-pressed);
    --model-strong: var(--theme-new-keynesian-strong);
    --model-soft: var(--theme-new-keynesian-soft);
    --model-page: var(--theme-new-keynesian-page);
    --model-border: var(--theme-new-keynesian-border);
    --model-helper: var(--theme-new-keynesian-helper);
}

:root[data-model="intertemporal"] {
    --model-accent: var(--theme-intertemporal-accent);
    --model-accent-hover: var(--theme-intertemporal-accent-hover);
    --model-accent-pressed: var(--theme-intertemporal-accent-pressed);
    --model-strong: var(--theme-intertemporal-strong);
    --model-soft: var(--theme-intertemporal-soft);
    --model-page: var(--theme-intertemporal-page);
    --model-border: var(--theme-intertemporal-border);
    --model-helper: var(--theme-intertemporal-helper);
}

:root[data-model="portfolio"] {
    --model-accent: var(--theme-portfolio-accent);
    --model-accent-hover: var(--theme-portfolio-accent-hover);
    --model-accent-pressed: var(--theme-portfolio-accent-pressed);
    --model-strong: var(--theme-portfolio-strong);
    --model-soft: var(--theme-portfolio-soft);
    --model-page: var(--theme-portfolio-page);
    --model-border: var(--theme-portfolio-border);
    --model-helper: var(--theme-portfolio-helper);
}

/* One keyboard focus treatment on every model: a real outline (kept in Windows
   forced-colors mode, where system colours replace it) with a 2px gap, so it sits
   on the surrounding surface rather than on a coloured button. Low specificity
   (:where) so a component can adjust the gap without restating the colour. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}
