/*
 * Django serves this file as is: keep it plain CSS. A renamed or removed token
 * breaks every site that uses ui/. Components use the semantic tokens, never the
 * palette steps.
 */

:root {
    /* ===================================================================
     * Fluid Type Scale (Utopia)
     *
     * 320px/16px (1.2) → 1200px/18px (1.25), steps -2..5
     * =================================================================== */
    --step--2: clamp(0.6944rem, calc(0.6852rem + 0.0465vw), 0.72rem);
    --step--1: clamp(0.8333rem, calc(0.8091rem + 0.1212vw), 0.9rem);
    --step-0: clamp(1rem, calc(0.9545rem + 0.2273vw), 1.125rem);
    --step-1: clamp(1.2rem, calc(1.125rem + 0.375vw), 1.4063rem);
    --step-2: clamp(1.44rem, calc(1.3244rem + 0.5778vw), 1.7578rem);
    --step-3: clamp(1.728rem, calc(1.5574rem + 0.8532vw), 2.1973rem);
    --step-4: clamp(2.0736rem, calc(1.8289rem + 1.2236vw), 2.7466rem);
    --step-5: clamp(2.4883rem, calc(2.1447rem + 1.718vw), 3.4332rem);

    /* ===================================================================
     * Fluid Space Scale (Utopia)
     * =================================================================== */
    --space-3xs: clamp(0.25rem, calc(0.2386rem + 0.0568vw), 0.2813rem);
    --space-2xs: clamp(0.5rem, calc(0.4773rem + 0.1136vw), 0.5625rem);
    --space-xs: clamp(0.75rem, calc(0.7159rem + 0.1705vw), 0.8438rem);
    --space-s: clamp(1rem, calc(0.9545rem + 0.2273vw), 1.125rem);
    --space-m: clamp(1.5rem, calc(1.4318rem + 0.3409vw), 1.6875rem);
    --space-l: clamp(2rem, calc(1.9091rem + 0.4545vw), 2.25rem);
    --space-xl: clamp(3rem, calc(2.8636rem + 0.6818vw), 3.375rem);
    --space-2xl: clamp(4rem, calc(3.8182rem + 0.9091vw), 4.5rem);
    --space-3xl: clamp(6rem, calc(5.7273rem + 1.3636vw), 6.75rem);

    /* One-up pairs */
    --space-3xs-2xs: clamp(0.25rem, calc(0.1364rem + 0.5682vw), 0.5625rem);
    --space-2xs-xs: clamp(0.5rem, calc(0.375rem + 0.625vw), 0.8438rem);
    --space-xs-s: clamp(0.75rem, calc(0.6136rem + 0.6818vw), 1.125rem);
    --space-s-m: clamp(1rem, calc(0.75rem + 1.25vw), 1.6875rem);
    --space-m-l: clamp(1.5rem, calc(1.2273rem + 1.3636vw), 2.25rem);
    --space-l-xl: clamp(2rem, calc(1.5rem + 2.5vw), 3.375rem);
    --space-xl-2xl: clamp(3rem, calc(2.4545rem + 2.7273vw), 4.5rem);
    --space-2xl-3xl: clamp(4rem, calc(3rem + 5vw), 6.75rem);

    /* Custom pairs */
    --space-s-l: clamp(1rem, calc(0.5455rem + 2.2727vw), 2.25rem);

    /* ===================================================================
     * Typography
     * =================================================================== */
    --font-body: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.75;

    --weight-light: 300;
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    /* Tracking (letter-spacing) — used heavily by mono labels */
    --tracking-tight: -0.02em;
    --tracking-normal: 0;
    --tracking-wide: 0.08em;
    --tracking-wider: 0.18em;

    /* ===================================================================
     * Base Palette — HSL ladders (theme-agnostic raw values).
     *
     * Direction: 50 = lightest, 950 = darkest (matches Tailwind / our
     * existing convention). Section components reference SEMANTIC tokens
     * below, not these palette steps directly.
     * =================================================================== */

    /* Blue — anchored on brand #183b78 ≈ hsl(216 67% 28%) at -800 */
    --color-blue-50: hsl(214 100% 97%);
    --color-blue-100: hsl(214 95% 93%);
    --color-blue-200: hsl(214 86% 84%);
    --color-blue-300: hsl(214 80% 72%);
    --color-blue-400: hsl(215 72% 58%);
    --color-blue-500: hsl(216 72% 47%);
    --color-blue-600: hsl(216 72% 39%);
    --color-blue-700: hsl(216 70% 33%);
    --color-blue-800: hsl(216 67% 28%); /* brand anchor #183b78 */
    --color-blue-900: hsl(216 65% 23%);
    --color-blue-950: hsl(217 63% 15%);

    /* Gray — warm-tinted at the light end, near-black at the dark end.
     * Extended versus app/frontend so the dark surface ladder has the
     * stops we need (-950, -975) without inventing custom hues. */
    --color-gray-50: hsl(60 18% 96%); /* ≈ #f7f7f2 (light page bg) */
    --color-gray-100: hsl(55 12% 91%);
    --color-gray-200: hsl(50 8% 82%);
    --color-gray-300: hsl(45 6% 70%);
    --color-gray-400: hsl(45 5% 56%);
    --color-gray-500: hsl(40 5% 46%);
    --color-gray-600: hsl(40 4% 38%);
    --color-gray-700: hsl(35 5% 28%);
    --color-gray-800: hsl(30 6% 20%);
    --color-gray-900: hsl(30 6% 15%);
    --color-gray-950: hsl(220 14% 7%); /* dark surface */
    --color-gray-975: hsl(220 18% 4%); /* dark page background */

    /* ===================================================================
     * Borders, Radii, Shadows, Motion — shared across themes
     * =================================================================== */
    --border-thin: 1px;
    --border-thick: 2px;

    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.05);
    --shadow-md: 0 4px 6px hsl(0 0% 0% / 0.07);
    --shadow-lg: 0 10px 15px hsl(0 0% 0% / 0.1);

    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;

    /* ===================================================================
     * Measures (max-width constraints for page-level content)
     * =================================================================== */
    --measure-prose: 40rem; /* ~640px — optimal reading line length */
    --measure-form: 48rem; /* ~768px — forms, compact UIs */
    --measure-content: 72rem; /* ~1152px — data tables, dashboards */
    --measure-wide: 80rem; /* ~1280px — page wrap */

    /* WhatsApp's own green, the same in every theme: only behind its white mark. */
    --color-whatsapp-brand: #25d366;
}

/* =====================================================================
 * Semantic tokens — Dark theme (DEFAULT for marketing)
 *
 * `:where(:root)` keeps the dark block at zero specificity at the root,
 * so a `.light` ancestor wins by class specificity without `!important`.
 * The marketing BaseLayout mounts `class="dark"` explicitly on <html>;
 * the root selector here is a safety net so tokens resolve even if the
 * class is ever absent.
 * ===================================================================== */
:where(:root),
.dark {
    /* Page & surfaces */
    --color-background: var(--color-gray-975);
    --color-surface: var(--color-gray-950);
    --color-surface-raised: var(--color-gray-900);

    /* Text — four tones, matching the design's hierarchy.
     *
     * All four pass WCAG AA (4.5:1 minimum for normal text) on the
     * default --color-background. text-faint is the lowest contrast
     * tier and should only be used for short, large-ish labels
     * (mono uppercase, --step--2 or larger).
     *
     * Computed ratios on background (gray-975, L=4%):
     *   normal  ~14.0:1
     *   muted   ~9.0:1
     *   subtle  ~5.7:1
     *   faint   ~4.6:1   (was 2.2:1 before the lift)
     */
    --color-text-normal: hsl(220 16% 92%);
    --color-text-muted: hsl(220 10% 70%);
    --color-text-subtle: hsl(220 10% 62%);
    --color-text-faint: hsl(220 8% 52%);

    /* Links */
    --color-link: var(--color-blue-300);
    --color-link-hover: var(--color-blue-200);

    /* Borders */
    --color-border-muted: hsl(220 10% 18%);
    --color-border-accent: hsl(220 10% 28%);

    /* Neutral role */
    --color-neutral-fill-muted: var(--color-gray-950);
    --color-neutral-fill-accent: var(--color-gray-900);
    --color-neutral-fill-vivid: var(--color-gray-100);
    --color-neutral-border-muted: hsl(220 10% 18%);
    --color-neutral-border-accent: hsl(220 10% 28%);
    --color-neutral-on-muted: hsl(220 16% 92%);
    --color-neutral-on-accent: hsl(220 16% 92%);
    --color-neutral-on-vivid: var(--color-gray-950);

    /* Primary role — electric blue on dark */
    --color-primary-fill-muted: hsl(216 72% 12%);
    --color-primary-fill-accent: hsl(216 72% 22%);
    --color-primary-fill-vivid: var(--color-blue-400);
    --color-primary-border-muted: hsl(216 72% 22%);
    --color-primary-border-accent: var(--color-blue-500);
    --color-primary-on-muted: var(--color-blue-200);
    --color-primary-on-accent: var(--color-blue-100);
    --color-primary-on-vivid: var(--color-gray-975);

    /* Focus ring */
    --focus-ring-width: 2px;
    --focus-ring-offset: 2px;
    --focus-ring-color: var(--color-primary-fill-vivid);

    /* Aperture (engine chamber optical core) — see EngineSection.astro.
     * Faint = static outer/middle rings; active = breathing reactive
     * ring + iris + core glow; tick = chamber chrome calibration marks. */
    --color-aperture-ring-faint: var(--color-blue-300);
    --color-aperture-ring-active: var(--color-blue-400);
    --color-aperture-tick: var(--color-primary-border-accent);

    /* Aperture housing — recessed-lens portal background.
     * Translucent so the section's surface-sunken bleeds through; the
     * blend is what reads as "inside an instrument" rather than "opaque
     * panel." */
    --color-aperture-housing-inner: hsl(216 60% 14% / 0.55);
    --color-aperture-housing-outer: hsl(216 45% 5% / 0.85);

    /* Categorical data palette — ordered ramp for distinguishing
     * adjacent series in diagrams (cohort lanes, risk tiers). */
    --color-data-1: hsl(216 85% 76%);
    --color-data-2: hsl(216 75% 62%);
    --color-data-3: hsl(216 65% 48%);
    --color-data-4: hsl(216 48% 36%);

    /* Coloured outer glow — focal-element ambient shadow. Distinct
     * from --shadow-* drop shadows: large radius, no offset, primary
     * hue, low alpha for atmospheric bleed. */
    --shadow-glow-primary: 0 0 48px hsl(216 65% 25% / 0.4);

    /* Code snippets */
    --color-code-fill: var(--color-gray-950);
    --color-code-border: hsl(220 10% 18%);
    --color-code-on: hsl(220 16% 92%);

    /* ===================================================================
     * Risk-band tokens — owned by marketing for now.
     * TODO: promote to app/frontend tokens when the product side
     * consumes them.
     * =================================================================== */
    --color-risk-critical: hsl(0 70% 55%);
    --color-risk-high: hsl(15 70% 55%);
    --color-risk-medium: hsl(40 65% 55%);
    --color-risk-low: hsl(140 50% 45%);

    /* On-tone overlays — text colour to use when sitting on top of the
     * risk-band fills above. Critical/High/Medium are bright enough to
     * need dark on-tone; Low (green) reads better with light on-tone. */
    --color-on-risk-critical: var(--color-gray-975);
    --color-on-risk-high: var(--color-gray-975);
    --color-on-risk-medium: var(--color-gray-975);
    --color-on-risk-low: var(--color-gray-50);

    /* Categorical-data step 5 — extends data-1..4 for the population
     * scatter visualisation on /como-funciona. */
    --color-data-5: hsl(216 35% 30%);

    /* Preliminary-data marker — used to flag figures from the in-flight
     * prospective study (e.g. the −19% intervention reduction).
     *
     * Opaque fill (was translucent) so the contrast doesn't depend on
     * the surface underneath. Computed ratio of preliminary-on (L=90%)
     * on preliminary-fill (L=22%) ≈ 8.4:1 — clears WCAG AA for normal
     * text. */
    --color-preliminary-fill: hsl(40 55% 22%);
    --color-preliminary-border: hsl(40 60% 50%);
    --color-preliminary-on: hsl(40 90% 90%);

    /* Sticky anchor-nav height — used by /como-funciona's hero anchor
     * links to offset scroll position so jump-links don't land under
     * the bar. */
    --anchor-nav-height: 3rem;
}

/* =====================================================================
 * Semantic tokens — Light theme. The user can toggle into this via the
 * theme switch in SiteHeader; preference is persisted in localStorage
 * and bootstrapped synchronously in BaseLayout to avoid a flash.
 * ===================================================================== */
.light {
    --color-background: var(--color-gray-50);
    --color-surface: hsl(0 0% 100%);
    --color-surface-raised: hsl(0 0% 100%);

    --color-text-normal: var(--color-gray-900);
    --color-text-muted: var(--color-gray-600);
    --color-text-subtle: var(--color-gray-500);
    --color-text-faint: var(--color-gray-400);

    --color-link: var(--color-blue-700);
    --color-link-hover: var(--color-blue-800);

    --color-border-muted: var(--color-gray-200);
    --color-border-accent: var(--color-gray-400);

    --color-neutral-fill-muted: var(--color-gray-50);
    --color-neutral-fill-accent: var(--color-gray-100);
    --color-neutral-fill-vivid: var(--color-gray-900);
    --color-neutral-border-muted: var(--color-gray-200);
    --color-neutral-border-accent: var(--color-gray-400);
    --color-neutral-on-muted: var(--color-gray-900);
    --color-neutral-on-accent: var(--color-gray-700);
    --color-neutral-on-vivid: white;

    --color-primary-fill-muted: var(--color-blue-50);
    --color-primary-fill-accent: var(--color-blue-100);
    --color-primary-fill-vivid: var(--color-blue-800);
    --color-primary-border-muted: var(--color-blue-200);
    --color-primary-border-accent: var(--color-blue-600);
    --color-primary-on-muted: var(--color-blue-900);
    --color-primary-on-accent: var(--color-blue-900);
    --color-primary-on-vivid: white;

    --focus-ring-color: var(--color-primary-fill-vivid);

    /* Aperture (engine chamber) — anchored to the deep brand blue so
     * the optic still reads as an instrument on the white surface. */
    --color-aperture-ring-faint: var(--color-blue-600);
    --color-aperture-ring-active: var(--color-blue-700);
    --color-aperture-tick: var(--color-primary-border-accent);
    --color-aperture-housing-inner: hsl(216 60% 92% / 0.85);
    --color-aperture-housing-outer: hsl(216 45% 80% / 0.6);

    /* Categorical data palette — same hue ramp, darker steps for
     * adequate contrast against the white surface. */
    --color-data-1: hsl(216 75% 32%);
    --color-data-2: hsl(216 70% 44%);
    --color-data-3: hsl(216 60% 58%);
    --color-data-4: hsl(216 45% 70%);
    --color-data-5: hsl(216 30% 82%);

    --shadow-glow-primary: 0 0 36px hsl(216 70% 60% / 0.25);

    --color-code-fill: var(--color-gray-100);
    --color-code-border: var(--color-gray-200);
    --color-code-on: var(--color-gray-900);

    /* Risk bands — saturation lifted slightly so they pop on light. */
    --color-risk-critical: hsl(0 75% 48%);
    --color-risk-high: hsl(15 75% 48%);
    --color-risk-medium: hsl(40 70% 45%);
    --color-risk-low: hsl(140 55% 38%);
    --color-on-risk-critical: white;
    --color-on-risk-high: white;
    --color-on-risk-medium: var(--color-gray-975);
    --color-on-risk-low: white;

    /* Preliminary marker — muted sand on light. */
    --color-preliminary-fill: hsl(40 80% 92%);
    --color-preliminary-border: hsl(40 60% 55%);
    --color-preliminary-on: hsl(40 60% 22%);

    --anchor-nav-height: 3rem;
}

/* =====================================================================
 * Semantic tokens — Nutri. Stone and ink: the page is a warm grey, the
 * primary role is the text's own ink, and colour is kept for what a day
 * says about its target (the risk tones), never for decoration. The class
 * goes on <html> beside `light` or `dark`. Ratios on the page: text-normal
 * 14.0:1, muted 7.6:1, subtle 5.4:1, faint 4.6:1; the alert and the three
 * tones stay above 3:1 as marks, and say it in words too.
 * ===================================================================== */
.nutri {
    --font-body: "Hanken Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Many of Nutri's readers are older: its two small steps are 13 and 15 px,
     * where the scale's are 11 and 13. */
    --step--2: 0.8125rem;
    --step--1: 0.9375rem;

    --color-background: #ecebe8;
    --color-surface: #f6f5f2;
    --color-surface-raised: #f6f5f2;

    --color-text-normal: #1e1e1c;
    --color-text-muted: #4a4945;
    --color-text-subtle: #605f5a;
    --color-text-faint: #6b6963;

    /* A link is the ink, underlined. */
    --color-link: #1e1e1c;
    --color-link-hover: #4a4945;

    --color-border-muted: #d6d4ce;
    --color-border-accent: #9d9b94;

    --color-neutral-fill-muted: #e3e1dc;
    --color-neutral-fill-accent: #d9d7d1;
    --color-neutral-fill-vivid: #1e1e1c;
    --color-neutral-border-muted: #d6d4ce;
    --color-neutral-border-accent: #9d9b94;
    --color-neutral-on-muted: #1e1e1c;
    --color-neutral-on-accent: #1e1e1c;
    --color-neutral-on-vivid: #f6f5f2;

    --color-primary-fill-muted: #dedcd6;
    --color-primary-fill-accent: #d2d0c9;
    --color-primary-fill-vivid: #1e1e1c;
    --color-primary-border-muted: #c5c3bc;
    --color-primary-border-accent: #4a4945;
    --color-primary-on-muted: #1e1e1c;
    --color-primary-on-accent: #1e1e1c;
    --color-primary-on-vivid: #f6f5f2;

    --focus-ring-color: var(--color-primary-fill-vivid);

    --color-risk-critical: #b3261e;
    --color-risk-high: #c2452a;
    --color-risk-medium: #a8720b;
    --color-risk-low: #2f7d4f;

    /* The three macros, the same on the day and on every recipe: greys, so the
     * tones above stay the only colour on the page. */
    --color-macro-protein: #1e1e1c;
    --color-macro-fat: #77756f;
    --color-macro-carbs: #b4b2ab;

    color-scheme: light;
}

.nutri.dark {
    --color-background: #121211;
    --color-surface: #1b1b19;
    --color-surface-raised: #232321;

    --color-text-normal: #ecebe6;
    --color-text-muted: #c2c0b9;
    --color-text-subtle: #a3a19a;
    --color-text-faint: #86847d;

    --color-link: #ecebe6;
    --color-link-hover: #c2c0b9;

    --color-border-muted: #2e2d2a;
    --color-border-accent: #5a5853;

    --color-neutral-fill-muted: #1f1f1d;
    --color-neutral-fill-accent: #2a2a27;
    --color-neutral-fill-vivid: #ecebe6;
    --color-neutral-border-muted: #2e2d2a;
    --color-neutral-border-accent: #5a5853;
    --color-neutral-on-muted: #ecebe6;
    --color-neutral-on-accent: #ecebe6;
    --color-neutral-on-vivid: #121211;

    --color-primary-fill-muted: #2c2c29;
    --color-primary-fill-accent: #3a3936;
    --color-primary-fill-vivid: #ecebe6;
    --color-primary-border-muted: #45443f;
    --color-primary-border-accent: #c2c0b9;
    --color-primary-on-muted: #ecebe6;
    --color-primary-on-accent: #ecebe6;
    --color-primary-on-vivid: #121211;

    --focus-ring-color: var(--color-primary-fill-vivid);

    --color-risk-critical: #ff8a80;
    --color-risk-high: #f0806a;
    --color-risk-medium: #e0b04f;
    --color-risk-low: #6cc491;

    --color-macro-protein: #ecebe6;
    --color-macro-fat: #8d8b85;
    --color-macro-carbs: #55544f;

    color-scheme: dark;
}

/* =====================================================================
 * Semantic tokens — Tutus (B2C home). Clara a propósito: Caritas es
 * oscura y las dos casas se distinguen al primer vistazo. El rol `accent`
 * (ámbar) es exclusivo de esta página: se gasta en el precio y en lo que
 * se quiere que la persona mire, nunca en texto corrido.
 * ===================================================================== */
.tutus {
    --color-background: hsl(48 27% 96%); /* papel */
    --color-surface: hsl(0 0% 100%);
    --color-surface-raised: hsl(0 0% 100%);

    /* subtle a 41 % de luminosidad: 4,5:1 también sobre las superficies
     * neutras (marfil), no solo sobre el papel. */
    --color-text-normal: var(--color-blue-900);
    --color-text-muted: hsl(216 20% 32%);
    --color-text-subtle: hsl(216 12% 41%);
    --color-text-faint: hsl(216 8% 52%);

    --color-link: var(--color-blue-700);
    --color-link-hover: var(--color-blue-800);

    --color-border-muted: hsl(45 12% 86%);
    --color-border-accent: hsl(216 30% 70%);

    --color-neutral-fill-muted: hsl(48 20% 93%);
    --color-neutral-fill-accent: hsl(48 16% 89%);
    --color-neutral-fill-vivid: var(--color-blue-900);
    --color-neutral-border-muted: hsl(45 12% 86%);
    --color-neutral-border-accent: hsl(216 30% 70%);
    --color-neutral-on-muted: var(--color-blue-900);
    --color-neutral-on-accent: var(--color-blue-900);
    --color-neutral-on-vivid: white;

    --color-primary-fill-muted: var(--color-blue-50);
    --color-primary-fill-accent: var(--color-blue-100);
    --color-primary-fill-vivid: var(--color-blue-800);
    --color-primary-border-muted: var(--color-blue-200);
    --color-primary-border-accent: var(--color-blue-600);
    --color-primary-on-muted: var(--color-blue-900);
    --color-primary-on-accent: var(--color-blue-900);
    --color-primary-on-vivid: white;

    /* Accent role — ámbar. Texto oscuro para contraste AA sobre papel;
     * relleno vivo para trazos y marcas, nunca para texto. */
    --color-accent-text: hsl(32 87% 32%);
    --color-accent-fill-vivid: hsl(38 75% 52%);
    --color-accent-fill-muted: hsl(38 80% 94%);
    --color-accent-border: hsl(38 70% 66%);
    --color-accent-on-vivid: var(--color-blue-950);

    /* WhatsApp's green, darkened to stand out on paper; only for its mark. */
    --color-whatsapp: hsl(142 70% 29%);

    --focus-ring-color: var(--color-primary-fill-vivid);
    --shadow-glow-primary: 0 0 36px hsl(216 70% 60% / 0.18);

    --color-code-fill: var(--color-gray-100);
    --color-code-border: var(--color-gray-200);
    --color-code-on: var(--color-gray-900);

    --color-data-1: hsl(216 75% 32%);
    --color-data-2: hsl(216 70% 44%);
    --color-data-3: hsl(216 60% 58%);
    --color-data-4: hsl(216 45% 70%);
    --color-data-5: hsl(216 30% 82%);

    --color-risk-critical: hsl(0 75% 48%);
    --color-risk-high: hsl(15 75% 48%);
    --color-risk-medium: hsl(40 70% 45%);
    --color-risk-low: hsl(140 55% 38%);
    --color-on-risk-critical: white;
    --color-on-risk-high: white;
    --color-on-risk-medium: var(--color-gray-975);
    --color-on-risk-low: white;

    --color-preliminary-fill: hsl(40 80% 92%);
    --color-preliminary-border: hsl(40 60% 55%);
    --color-preliminary-on: hsl(40 60% 22%);

    /* The closing band: navy on the paper. */
    --color-band-fill: var(--color-primary-fill-vivid);
    --color-band-on: var(--color-primary-on-vivid);

    /* The new page's sheets and its glass, light only (the dark theme doesn't redefine them).
     * Mist is the ground of "7 enfermedades"; night is the hero's, the exact colour the baked
     * renders end in, so a render has no edge on it. */
    --color-mist-fill: hsl(214 42% 93%);
    --color-mist-border: hsl(214 26% 83%);
    --color-night-fill: rgb(14 32 63);
    --color-night-on-muted: hsl(214 32% 82%);
    --color-night-on-faint: hsl(214 20% 66%);
    --color-night-border: hsl(0 0% 100% / 0.14);
    --color-night-accent: hsl(199 72% 76%);
    --color-border-hairline: hsl(216 65% 23% / 0.09);
    --color-folder-fill: hsl(43 32% 91%);
    --color-folder-border: hsl(40 20% 82%);
    --color-glass-blue-fill: hsl(212 72% 95%);
    --color-glass-blue-border: hsl(212 50% 84%);
    --color-backlight: hsl(204 78% 87%);

    /* "Lo que recibes": the sample cards' soft greens (a line of the report's page, the optimal band of an exam
     * and its edge) and the pale blue of the doctor's tag and the kidney's stage, with its text. */
    --color-risk-low-muted: hsl(140 40% 92%);
    --color-range-fill: hsl(140 38% 84%);
    --color-range-border: hsl(140 32% 70%);
    --color-vein-fill-muted: hsl(212 52% 91%);
    --color-vein-on-muted: hsl(213 52% 30%);

    /* "El mismo chequeo por otra ruta": the folders' empty squares, the rule between a glass folder's cells, and
     * the shadow that lifts the glass one. The paper folders' own rule is `--color-folder-border`. */
    --color-folder-fill-muted: hsl(40 18% 84%);
    --color-glass-blue-fill-muted: hsl(212 40% 88%);
    --color-glass-blue-border-muted: hsl(212 40% 85%);
    --color-glass-blue-shadow: hsl(214 60% 35% / 0.4);

    /* The hero's night sheet: white on it, the light a lit organ takes, the shadow under a paper
     * button laid on it, and the red cell's dot. */
    --color-night-on: white;
    --color-night-lit: hsl(356 85% 74%);
    --color-night-shadow: hsl(220 80% 4%);
    --color-artery-fill: hsl(357 60% 49%);
    --color-artery-fill-muted: hsl(358 61% 91%);
    --color-artery-fill-faint: hsl(356 70% 98%); /* the ground of a chosen answer */

    /* What the lift shadow of a card laid on the paper is made of. */
    --color-lift-shadow: hsl(216 50% 20%);

    /* The page's booking button: navy with relief and a gold disc. */
    --color-cta-fill-top: hsl(216 67% 33%);
    --color-cta-fill-bottom: hsl(217 65% 21%);
    --color-cta-disc-top: hsl(40 82% 60%);
    --color-cta-disc-bottom: hsl(36 78% 48%);

    /* The page's geometry: sheets are laid on the paper 12 px from the window's edges (flush on a
     * phone), with their own corners; content keeps this gutter from a sheet's edge. */
    --sheet-inset: 0.75rem;
    --sheet-radius: 2.25rem;
    --sheet-radius-phone: 1.75rem;
    --page-gutter: 3rem;

    /* "Así es tu chequeo": the soft green of the WhatsApp line and of the person's own messages, and
     * the deep red of the text on the artery's tint (the report's PDF tag). */
    --color-whatsapp-fill-muted: hsl(120 40% 93%);
    --color-artery-on-muted: hsl(355 71% 36%);

    --anchor-nav-height: 3rem;
    --header-height: 3.5rem;

    color-scheme: light;
}

/* =====================================================================
 * Semantic tokens — Tutus, dark. Night navy, not Corpus's near-black, so
 * the two houses still tell apart; the paper becomes the text and the
 * amber keeps its role. The class comes from the bootstrap in TutusLayout
 * and the toggle in TutusHeader; without it (no JavaScript) Tutus is light.
 * ===================================================================== */
.tutus.dark {
    --color-background: hsl(218 42% 8%);
    --color-surface: hsl(218 36% 12%);
    --color-surface-raised: hsl(218 32% 15%);

    --color-text-normal: hsl(48 27% 93%);
    --color-text-muted: hsl(216 22% 80%);
    --color-text-subtle: hsl(216 14% 70%);
    --color-text-faint: hsl(216 10% 60%);

    --color-link: var(--color-blue-300);
    --color-link-hover: var(--color-blue-200);

    --color-border-muted: hsl(218 26% 21%);
    --color-border-accent: hsl(216 22% 38%);

    --color-neutral-fill-muted: hsl(218 34% 14%);
    --color-neutral-fill-accent: hsl(218 30% 19%);
    --color-neutral-fill-vivid: hsl(48 27% 93%);
    --color-neutral-border-muted: hsl(218 26% 21%);
    --color-neutral-border-accent: hsl(216 22% 38%);
    --color-neutral-on-muted: hsl(48 27% 93%);
    --color-neutral-on-accent: hsl(48 27% 93%);
    --color-neutral-on-vivid: var(--color-blue-950);

    --color-primary-fill-muted: hsl(216 55% 17%);
    --color-primary-fill-accent: hsl(216 55% 24%);
    --color-primary-fill-vivid: var(--color-blue-300);
    --color-primary-border-muted: hsl(216 50% 28%);
    --color-primary-border-accent: var(--color-blue-200);
    --color-primary-on-muted: var(--color-blue-100);
    --color-primary-on-accent: var(--color-blue-50);
    --color-primary-on-vivid: var(--color-blue-950);

    --color-accent-text: hsl(38 85% 62%);
    --color-accent-fill-vivid: hsl(38 80% 55%);
    --color-accent-fill-muted: hsl(34 40% 14%);
    --color-accent-border: hsl(38 50% 38%);
    --color-accent-on-vivid: var(--color-blue-950);

    --color-whatsapp: hsl(142 60% 48%);

    --focus-ring-color: var(--color-primary-fill-vivid);
    --shadow-lg: 0 10px 24px hsl(220 50% 2% / 0.5);
    --shadow-glow-primary: 0 0 36px hsl(216 70% 40% / 0.3);

    --color-code-fill: hsl(218 36% 12%);
    --color-code-border: hsl(218 26% 21%);
    --color-code-on: hsl(48 27% 93%);

    --color-data-1: hsl(216 85% 76%);
    --color-data-2: hsl(216 75% 62%);
    --color-data-3: hsl(216 65% 48%);
    --color-data-4: hsl(216 48% 36%);
    --color-data-5: hsl(216 35% 30%);

    --color-risk-critical: hsl(0 70% 55%);
    --color-risk-high: hsl(15 70% 55%);
    --color-risk-medium: hsl(40 65% 55%);
    --color-risk-low: hsl(140 50% 45%);
    --color-on-risk-critical: var(--color-gray-975);
    --color-on-risk-high: var(--color-gray-975);
    --color-on-risk-medium: var(--color-gray-975);
    --color-on-risk-low: var(--color-gray-50);

    --color-preliminary-fill: hsl(40 55% 22%);
    --color-preliminary-border: hsl(40 60% 50%);
    --color-preliminary-on: hsl(40 90% 90%);

    /* A deeper navy than the page, so the band still closes it. */
    --color-band-fill: hsl(216 60% 15%);
    --color-band-on: hsl(48 27% 93%);

    color-scheme: dark;
}

/* =====================================================================
 * Semantic tokens — Tutus Performance, the page for athletes. It takes the
 * new page's design and recolours it: always dark, on a night ground with
 * one accent, volt. It sits after `.tutus` and `.tutus.dark` and is one
 * class stronger than them (`:root`), so it wins whatever their order. The
 * page's `dark` class is what makes the shared components' own dark styles
 * apply (the header's light logo); what is declared here is what the page
 * changes of that dark.
 * ===================================================================== */
:root.tutus.tutus-performance {
    /* The ground and its two sheets, as exact hex: images are composited over them
     * with `mix-blend-mode: screen`, and a fractional HSL rounds differently by one level. */
    --color-ground-fill: #050a16;
    --color-sheet-fill: #0a1121;
    --color-sheet-fill-raised: #121a2c;
    --color-background: var(--color-ground-fill);
    --color-surface: var(--color-sheet-fill);
    --color-surface-raised: var(--color-sheet-fill-raised);

    --color-text-normal: hsl(220 30% 95%);
    --color-text-muted: hsl(220 16% 72%);
    --color-text-subtle: hsl(220 12% 60%);
    --color-text-faint: var(--color-text-subtle);

    --color-link: var(--color-text-normal);
    --color-link-hover: var(--color-accent-text);

    /* Two hairlines, white at 10 % and 17 %. */
    --color-border-hairline: hsl(0 0% 100% / 0.1);
    --color-border-hairline-strong: hsl(0 0% 100% / 0.17);
    --color-border-muted: var(--color-border-hairline);
    --color-border-accent: var(--color-border-hairline-strong);

    /* Volt, the accent: the italic of a title, the button, the focus ring. What sits on it is the ground. */
    --color-accent-text: #d8ff4f;
    --color-accent-fill-vivid: #d8ff4f;
    --color-accent-on-vivid: var(--color-ground-fill);
    --color-accent-fill-muted: hsl(74 100% 65% / 0.16);
    --color-accent-border: hsl(74 100% 72% / 0.4);

    /* The hero's scanner: the beam is a pale volt core with a volt halo, and the heart's glow runs from orange to hot pink. */
    --color-beam-core: #f1ffc2;
    --color-beam-halo: #dbff66;
    --color-heart-glow-warm: #ff8b47;
    --color-heart-glow-hot: #ff2977;

    /* The results' drawings, in white at a few strengths: the grid of an electrocardiogram strip (a fine line and a heavier one
     * every fifth), the empty track of a bar or a ring, the healthy range of an exam, and the volt glow of the ring and the trace
     * drawn on the phone. */
    --color-chart-grid-minor: hsl(0 0% 100% / 0.06);
    --color-chart-grid-major: hsl(0 0% 100% / 0.13);
    --color-chart-track: hsl(0 0% 100% / 0.14);
    --color-chart-band: hsl(0 0% 100% / 0.24);
    --color-chart-glow: hsl(74 100% 60% / 0.55);

    /* The shared components read the primary role for their button: it is volt here too. */
    --color-primary-fill-vivid: var(--color-accent-fill-vivid);
    --color-primary-on-vivid: var(--color-accent-on-vivid);
    --color-primary-border-accent: hsl(74 100% 78%);
    --color-neutral-fill-muted: var(--color-sheet-fill);
    --color-neutral-fill-accent: var(--color-sheet-fill-raised);
    --focus-ring-color: var(--color-accent-fill-vivid);

    /* The booking button: a flat volt body, and a disc of the ground's colour. */
    --color-cta-fill-top: var(--color-accent-fill-vivid);
    --color-cta-fill-bottom: var(--color-accent-fill-vivid);
    --color-cta-disc-top: var(--color-ground-fill);
    --color-cta-disc-bottom: var(--color-ground-fill);

    /* The WhatsApp question link reads as text, as the prototype has it; the round button keeps WhatsApp's own green. */
    --color-whatsapp: var(--color-text-normal);

    /* What the bar's shadow is made of on the dark. */
    --color-lift-shadow: var(--color-night-shadow);

    color-scheme: dark;
}
