/* ===========================================================================
   Design tokens - the ONLY file in the site allowed to contain a colour literal.

   Everything visual (site.css, view markup, chart partials) reads these custom
   properties. Changing the look means changing a value here, never hunting hex codes
   through views. tests/Arnarsson_1.Tests/DesignGuardTests enforces that.

   Theme model - three states, the same one the charts already used:
     - bare :root                        light palette (the complete set, always defined)
     - prefers-color-scheme: dark        dark palette, unless <html data-theme="light">
     - <html data-theme="dark">          dark palette regardless of the OS
   Only token VALUES change between themes; no component rule lives in a theme block,
   so a component can never end up with one theme's text on the other theme's ground.

   The design reasoning (why fjord, why the signal gradient is rationed, etc.) lives in
   .claude/skills/site-design/SKILL.md. Rendered specimen: /Admin/Design.
   =========================================================================== */

/* ---- Fonts ---------------------------------------------------------------
   Self-hosted, Latin subset (covers æøå). See wwwroot/fonts/README.txt for why these
   are not loaded from Google's CDN. font-display: swap so text is never invisible. */

@font-face {
    font-family: "Bricolage Grotesque";
    font-style: normal;
    font-weight: 300 700;
    font-stretch: 100%;
    font-display: swap;
    src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Instrument Sans";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
}

:root {
    /* ---- Colour: grounds ------------------------------------------------- */
    --a-paper: #F6F8F7;          /* page ground - a faint green bias, picked, not default grey */
    --a-surface: #EAEFED;        /* grouped content: cards, chart panels, pickers */
    --a-surface-2: #DFE6E3;      /* hover/selected fill on a surface */
    --a-raised: #FFFFFF;         /* things that float: header, menus, modals, inputs */

    /* ---- Colour: text ---------------------------------------------------- */
    --a-ink: #15201F;            /* headings, primary text, primary button */
    --a-ink-2: #4B5A58;          /* body copy, ledes */
    --a-ink-3: #5E6C68;          /* captions, sources, muted - 4.5:1 on paper AND surface */
    --a-on-ink: #F6F8F7;         /* text on an ink-filled control */

    /* ---- Colour: lines --------------------------------------------------- */
    --a-rule: #D5DDDA;           /* borders, table rules, dividers */
    --a-rule-strong: #B7C3BF;    /* input borders, chart baseline */

    /* ---- Colour: accent ("fjord") ----------------------------------------
       The logo gradient deepened until it passes AA as text. This is the colour of
       links, the active nav item and the selected state - nothing decorative. */
    --a-accent: #0F6B63;
    --a-accent-hover: #0A524C;
    --a-accent-tint: #DCEBE8;    /* selected-card fill, pill background */
    --a-bar: var(--a-accent-tint);  /* magnitude bar behind a list label (.a-barlist), sparkline fill */

    /* ---- Colour: signal - the logo gradient, verbatim ---------------------
       Rationed: the page-title data line, the logo mark, focus rings. Never text,
       never a fill behind text, never a button. */
    --a-signal-1: #60F8FF;
    --a-signal-2: #55B9C7;
    --a-signal-3: #55C782;
    --a-signal: linear-gradient(90deg, var(--a-signal-1), var(--a-signal-2) 50%, var(--a-signal-3) 90%);
    --a-focus: #2E9FB0;          /* focus ring: signal-2 darkened enough to show on paper */

    /* The rising data line under a page title's bold word. A background image rather
       than inline SVG so it wraps with the text (box-decoration-break: clone) instead of
       forcing the phrase onto one line. %23 is an escaped # inside the data URI. */
    --a-signal-line: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' x2='1'%3E%3Cstop offset='0' stop-color='%2360F8FF'/%3E%3Cstop offset='.5' stop-color='%2355B9C7'/%3E%3Cstop offset='.9' stop-color='%2355C782'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M1 8 L14 7 L26 8.4 L38 5.6 L52 6.6 L64 3.8 L78 4.6 L90 2 L99 2.4' fill='none' stroke='url(%23g)' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

    /* ---- Colour: semantic - verdicts, separate from the accent ------------ */
    --a-good: #1E7A3C;
    --a-bad: #B3261E;
    --a-warn-bg: #FFF3D6;
    --a-warn-ink: #6B4A00;
    --a-info-bg: #E3EEF3;
    --a-info-ink: #1E4A5C;
    --a-danger-bg: #FBE5E3;
    --a-danger-ink: #7A1A14;
    --a-success-bg: #E1F1E6;
    --a-success-ink: #17532B;

    /* ---- Colour: charts --------------------------------------------------
       Chrome only. Series colours are data and come from ReportsController.Palette. */
    --a-chart-surface: var(--a-raised);
    --a-chart-grid: #E3E8E6;
    --a-chart-baseline: var(--a-rule-strong);
    --a-chart-axis: var(--a-ink-3);
    --a-chart-crosshair: rgba(102, 116, 111, 0.6);
    /* Series colours for the partials whose model carries no colour (_StepChart, _ColumnChart):
       Palette's first two hues, the orange darkened to pass 3:1 on the panel. Validated with
       the dataviz checker in both themes. Identity never rests on colour alone there - the
       second series is also dashed or hatched, and labelled. */
    --a-chart-series-1: #2A78D6;
    --a-chart-series-2: #D45A26;
    --a-chart-band: rgba(15, 107, 99, 0.09);     /* a marked time window or category */

    /* ---- Colour: maps ----------------------------------------------------
       One-hue ordinal ramp, lowest fifth to highest (_KommuneMap). Validated with the
       dataviz checker: monotone lightness, visible steps, lightest step >= 2:1 on the chart
       surface. The dark blocks flip the anchor - low recedes into the dark ground, high lifts
       out of it - rather than reusing these steps. Same hue as the first chart series. */
    --a-map-1: #86B6EF;
    --a-map-2: #5598E7;
    --a-map-3: #2A78D6;
    --a-map-4: #1C5CAB;
    --a-map-5: #0D366B;
    --a-map-none: #D3DAD7;

    /* ---- Backdrop grid (page head) --------------------------------------- */
    --a-grid-line: rgba(15, 107, 99, 0.07);

    /* ---- Shadows - only on things that are interactive or float ---------- */
    --a-shadow-sm: 0 1px 2px rgba(21, 32, 31, 0.06);
    --a-shadow: 0 1px 2px rgba(21, 32, 31, 0.06), 0 8px 24px rgba(21, 32, 31, 0.07);
    --a-shadow-lg: 0 12px 40px rgba(21, 32, 31, 0.18);
    --a-backdrop: rgba(10, 16, 15, 0.5);

    /* ---- Theme-dependent chrome ------------------------------------------ */
    --a-header-bg: rgba(246, 248, 247, 0.86);   /* paper, translucent under the sticky header blur */
    --a-focus-ring: 0 0 0 3px rgba(46, 159, 176, 0.35);
    --a-icon-filter: none;                        /* Bootstrap ships black SVG icons (close, toggler) */
    --a-select-caret: url("data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27%3e%3cpath fill=%27none%27 stroke=%27%235E6C68%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M2 5l6 6 6-6%27/%3e%3c/svg%3e");

    /* ---- Type ------------------------------------------------------------ */
    --a-font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
    --a-font-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --a-font-mono: "IBM Plex Mono", ui-monospace, Consolas, "Liberation Mono", monospace;

    --a-text-xs: 0.75rem;     /* eyebrows, sources */
    --a-text-sm: 0.875rem;    /* captions, meta */
    --a-text-base: 1rem;      /* body */
    --a-text-md: 1.125rem;    /* ledes */
    --a-text-lg: 1.375rem;    /* h3, card titles */
    --a-text-xl: 1.875rem;    /* h2, stat values */
    --a-text-2xl: clamp(2rem, 1.4rem + 2.4vw, 3.25rem);        /* page title */
    --a-text-display: clamp(2.5rem, 1.5rem + 4vw, 4.75rem);    /* home hero only */

    --a-measure: 66ch;        /* running text width */

    /* ---- Space: 4px base ------------------------------------------------- */
    --a-space-1: 0.25rem;
    --a-space-2: 0.5rem;
    --a-space-3: 0.75rem;
    --a-space-4: 1rem;
    --a-space-5: 1.5rem;
    --a-space-6: 2rem;
    --a-space-7: 3rem;
    --a-space-8: 4.5rem;
    --a-space-9: 6rem;

    /* ---- Shape ----------------------------------------------------------- */
    --a-radius-sm: 6px;       /* buttons, inputs, callouts */
    --a-radius: 12px;         /* cards, panels */
    --a-radius-lg: 20px;      /* hero image, header bar */
    --a-radius-pill: 999px;

    /* ---- Motion ---------------------------------------------------------- */
    --a-ease: cubic-bezier(0.3, 0.7, 0.2, 1);
    --a-dur-fast: 0.15s;
    --a-dur: 0.3s;

    /* ---- Bootstrap 5.1 bridge --------------------------------------------
       5.1 reads these for body text and font stacks; component colours it does not
       expose as variables are overridden in site.css section 2. */
    --bs-font-sans-serif: var(--a-font-body);
    --bs-font-monospace: var(--a-font-mono);
    --bs-body-font-family: var(--a-font-body);
    --bs-body-color: var(--a-ink);
    --bs-body-bg: var(--a-paper);
    --bs-primary: var(--a-accent);
}

/* ---- Dark palette -----------------------------------------------------------
   Written twice on purpose: once for "follow the OS" and once for an explicit
   data-theme="dark", so an explicit choice wins in both directions. Keep the two
   blocks identical. Not a naive inversion: the accent lifts to stay AA on the
   dark ground, and surfaces step UP in lightness as they come forward. */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --a-paper: #101615;
        --a-surface: #19211F;
        --a-surface-2: #222C2A;
        --a-raised: #1F2826;
        --a-ink: #E4ECEA;
        --a-ink-2: #AEBBB8;
        --a-ink-3: #8C9A96;
        --a-on-ink: #101615;
        --a-rule: #2C3836;
        --a-rule-strong: #3E4C49;
        --a-accent: #5FD0C4;
        --a-accent-hover: #8BE3D9;
        --a-accent-tint: #173532;
        --a-focus: #60F8FF;
        --a-good: #6BCB8B;
        --a-bad: #F2867D;
        --a-warn-bg: #3A2F12;
        --a-warn-ink: #F3D48A;
        --a-info-bg: #16303A;
        --a-info-ink: #A9D8EA;
        --a-danger-bg: #3D1B18;
        --a-danger-ink: #F6B4AD;
        --a-success-bg: #15321F;
        --a-success-ink: #A6DDB6;
        --a-chart-grid: #29332F;
        --a-chart-crosshair: rgba(174, 187, 184, 0.6);
        --a-chart-series-1: #3987E5;
        --a-chart-series-2: #E0703F;
        --a-chart-band: rgba(95, 208, 196, 0.10);
        --a-map-1: #256ABF;
        --a-map-2: #3987E5;
        --a-map-3: #6DA7EC;
        --a-map-4: #9EC5F4;
        --a-map-5: #CDE2FB;
        --a-map-none: #4A5754;
        --a-grid-line: rgba(95, 208, 196, 0.06);
        --a-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
        --a-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
        --a-backdrop: rgba(0, 0, 0, 0.6);
        --a-header-bg: rgba(16, 22, 21, 0.86);
        --a-focus-ring: 0 0 0 3px rgba(96, 248, 255, 0.35);
        --a-icon-filter: invert(1) grayscale(1) brightness(1.6);
        --a-select-caret: url("data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27%3e%3cpath fill=%27none%27 stroke=%27%238C9A96%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M2 5l6 6 6-6%27/%3e%3c/svg%3e");
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --a-paper: #101615;
    --a-surface: #19211F;
    --a-surface-2: #222C2A;
    --a-raised: #1F2826;
    --a-ink: #E4ECEA;
    --a-ink-2: #AEBBB8;
    --a-ink-3: #8C9A96;
    --a-on-ink: #101615;
    --a-rule: #2C3836;
    --a-rule-strong: #3E4C49;
    --a-accent: #5FD0C4;
    --a-accent-hover: #8BE3D9;
    --a-accent-tint: #173532;
    --a-focus: #60F8FF;
    --a-good: #6BCB8B;
    --a-bad: #F2867D;
    --a-warn-bg: #3A2F12;
    --a-warn-ink: #F3D48A;
    --a-info-bg: #16303A;
    --a-info-ink: #A9D8EA;
    --a-danger-bg: #3D1B18;
    --a-danger-ink: #F6B4AD;
    --a-success-bg: #15321F;
    --a-success-ink: #A6DDB6;
    --a-chart-grid: #29332F;
    --a-chart-crosshair: rgba(174, 187, 184, 0.6);
    --a-chart-series-1: #3987E5;
    --a-chart-series-2: #E0703F;
    --a-chart-band: rgba(95, 208, 196, 0.10);
    --a-map-1: #256ABF;
    --a-map-2: #3987E5;
    --a-map-3: #6DA7EC;
    --a-map-4: #9EC5F4;
    --a-map-5: #CDE2FB;
    --a-map-none: #4A5754;
    --a-grid-line: rgba(95, 208, 196, 0.06);
    --a-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --a-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --a-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
    --a-backdrop: rgba(0, 0, 0, 0.6);
    --a-header-bg: rgba(16, 22, 21, 0.86);
    --a-focus-ring: 0 0 0 3px rgba(96, 248, 255, 0.35);
    --a-icon-filter: invert(1) grayscale(1) brightness(1.6);
    --a-select-caret: url("data:image/svg+xml,%3csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27%3e%3cpath fill=%27none%27 stroke=%27%238C9A96%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27 stroke-width=%272%27 d=%27M2 5l6 6 6-6%27/%3e%3c/svg%3e");
}
