/* ==========================================================================
   Truesum design tokens · v1.1 · 4 December 2026
   Derived from brandkit/hero/index.html (the live hero). Names and values the
   hero already uses (--ledger --lime --paper --ink --paper-85 --paper-72 --m
   --nav-h --lean) are kept exactly, so the hero can adopt this file later.
   Never define --rise, --p, --z, --cx, --cy, --cr, --cw here: the hero uses
   those as per-element properties and would inherit them.

   Layers
   1. Fonts          4. Space and layout   7. Glass       10. Surfaces (semantic)
   2. Palette        5. Radii              8. Motion
   3. Type           6. Shadows            9. Z and targets
   ========================================================================== */

/* 1. Fonts: self-hosted, latin subset (SIL OFL 1.1), byte-identical to the hero's.
   Figtree ships at 800 only. Inter is variable (100-900); we use 400, 500, 600. */
@font-face { font-family: "Figtree"; src: url(fonts/figtree-latin.woff2) format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url(fonts/inter-latin.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  /* 2. Palette -------------------------------------------------------------
     Approved (brand-lock): Ledger, Total Lime, Paper, Ink, Fern.
     Lime is only ever the one highlight bar and the primary button fill.
     It is never text, never a border, never a tint, never decoration.
     Measured: Lime on Paper 1.15:1, on white 1.28:1, on Ledger 9.75:1. */
  --ledger: #0D3B2E;
  --lime: #C5F36A;
  --paper: #F6F3EA;
  --ink: #0E1A14;
  --fern: #2F7A5B;
  --white: #FFFFFF;
  --paper-85: rgba(246, 243, 234, .85);   /* hero: sub and disclosure on Ledger, 8.57:1 */
  --paper-72: rgba(246, 243, 234, .72);   /* hero: 6.61:1 on Ledger */

  /* Derived tones (not new colours: Paper and Ledger shifted) */
  --paper-2: #EEE9DC;        /* alternate section ground, table head */
  --ledger-2: #12463A;       /* raised panels on Ledger (menu, toasts on dark) */
  --lime-hover: #B9EA58;     /* primary hover on dark: lime pressed slightly deeper (Ledger on it 8.90:1) */
  --lime-press: #ADDE4C;     /* 7.92:1 */

  /* Functional colours. PROPOSED, not in the approved palette: used only for
     form states and alerts, never for brand moments. Measured contrast:
     red #B3261E 5.89:1 on Paper, 6.54:1 on white; amber #8A5300 5.70:1 / 6.33:1;
     Fern 4.67:1 / 5.18:1. The on-dark versions are for Ledger grounds. */
  --red: #B3261E;
  --red-tint: #FBEDEA;
  --red-on-dark: #FFA494;
  --amber: #8A5300;
  --amber-tint: #FFF5DB;
  --amber-on-dark: #F3C77A;
  --green: var(--fern);
  --green-tint: #EAF3EE;
  --green-on-dark: #A6DCBD;
  --info-tint: #E9EFE9;

  /* 3. Type ------------------------------------------------------------------
     Figtree 800 for display, headings H1-H3 and the key figures. Below 22px
     headings switch to Inter 600 (Figtree exists only at 800).
     Inter 400/500/600 for everything else. Figures are always tabular lining. */
  --font-display: Figtree, Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --num: tabular-nums lining-nums;

  --fs-display: clamp(40px, 6vw, 104px);  --lh-display: .98;  --ls-display: -.035em;   /* the hero H1 */
  --fs-h1: clamp(38px, 4.6vw, 76px);      --lh-h1: 1;          --ls-h1: -.032em;       /* page titles */
  --fs-h2: clamp(32px, 3.6vw, 56px);      --lh-h2: 1.02;       --ls-h2: -.03em;        /* section titles */
  --fs-h3: clamp(22px, 1.7vw, 28px);      --lh-h3: 1.15;       --ls-h3: -.015em;       /* card and block titles */
  --fs-h4: 18px;                          --lh-h4: 1.35;                               /* Inter 600 */
  --fs-lead: clamp(17px, 1.4vw, 20px);    --lh-lead: 1.5;
  --fs-body: 16px;                        --lh-body: 1.55;
  --fs-body-lg: 17px;                                                                  /* form values, list answers */
  --fs-small: 14px;                       --lh-small: 1.45;
  --fs-caption: 12.5px;                   --lh-caption: 1.45;                          /* card footnotes */
  --fs-micro: 12px;                                                                    /* card top line; the floor */
  --fs-fig-xl: clamp(48px, 5.2vw, 76px);  /* the true sum on a result page */
  --fs-fig-l: 40px;                       /* the true sum on a card (hero: 40px) */
  --fs-fig-m: 30px;                       /* secondary figures (hero APR card) */
  --fs-fig-s: 20px;                       /* inline figures (hero "You receive £20,000") */
  --ls-fig: -.02em;

  /* 4. Space and layout --------------------------------------------------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-7: 32px; --s-8: 40px; --s-9: 48px; --s-10: 64px; --s-11: 80px; --s-12: 96px; --s-13: 128px;
  --m: clamp(20px, 4.45vw, 96px);          /* page margin: 20 at 390, 37 at 834, 64 at 1440 (hero) */
  --nav-h: 76px;                           /* 64px under 640px, set below (hero) */
  --page-max: 1760px;                      /* content stops widening here; the hero is full bleed */
  --section-y: clamp(64px, 8.5vw, 128px);  /* vertical padding of a page section */
  --gap: clamp(16px, 2.2vw, 32px);         /* grid gutter */
  --measure: 34em;                         /* longest comfortable text line */
  --form-w: 560px;                         /* single-column form width */
  --lean: -9.49deg;                        /* the wordmark's lean: the highlight bar only, once per view */

  /* 5. Radii ---------------------------------------------------------------- */
  --r-xs: 4px;        /* small square tags, the placeholder marker */
  --r-hl: 3px;        /* the highlight bar (hero) */
  --r-sm: 10px;       /* skip link, icon buttons (hero) */
  --r-input: 12px;    /* fields, small buttons (hero .btn-sm) */
  --r-btn: 14px;      /* buttons (hero .btn) */
  --r-card: 18px;     /* cards and glass (hero) */
  --r-card-sm: 15px;  /* cards under 640px (hero) */
  --r-panel: 24px;    /* large panels: result page, comparison */

  /* 6. Shadows -------------------------------------------------------------- */
  --sh-glass: inset 0 1px 0 rgba(255, 255, 255, .95), 0 26px 50px -20px rgba(2, 16, 11, .5), 0 3px 8px rgba(2, 16, 11, .16);   /* hero */
  --sh-card: 0 1px 2px rgba(14, 26, 20, .06), 0 14px 34px -18px rgba(14, 26, 20, .24);
  --sh-raised: 0 2px 6px rgba(14, 26, 20, .07), 0 28px 56px -24px rgba(14, 26, 20, .34);
  --sh-nav: 0 1px 0 rgba(246, 243, 234, .08), 0 10px 30px rgba(4, 22, 15, .18);        /* hero, solid header */
  --sh-sticky: 0 -1px 0 rgba(246, 243, 234, .1), 0 -12px 30px rgba(4, 22, 15, .28);     /* hero, phone sticky bar */
  --sh-toast: 0 2px 6px rgba(4, 22, 15, .18), 0 22px 44px -18px rgba(4, 22, 15, .45);

  /* 7. Glass: white frosted glass, only over photographs or Ledger imagery ---- */
  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, .8), rgba(250, 248, 242, .66));
  --glass-blur: blur(20px) saturate(1.5);
  --glass-edge: rgba(255, 255, 255, .7);
  --glass-fallback: rgba(251, 250, 246, .95);   /* no backdrop-filter: near-opaque white */

  /* 8. Motion (hero curves, named) ------------------------------------------ */
  --ease-out: cubic-bezier(.2, .8, .25, 1);     /* cards rising, panels, sticky bar */
  --ease-expo: cubic-bezier(.16, 1, .3, 1);     /* photos settling, large reveals */
  --ease-pen: cubic-bezier(.3, .7, .2, 1);      /* the highlight sweep */
  --ease-count: cubic-bezier(.2, .7, .2, 1);    /* figures counting up */
  --ease-in: cubic-bezier(.4, 0, 1, 1);         /* things leaving */
  --dur-press: .12s;    /* button press, arrow nudge (hero) */
  --dur-fast: .18s;     /* colour and border changes */
  --dur-base: .25s;     /* header turning solid (hero) */
  --dur-panel: .28s;    /* menu, sticky bar, toasts, accordion (hero sticky bar) */
  --dur-pen: .4s;       /* the highlight sweep (hero) */
  --dur-rise: .6s;      /* a card frosting in (hero) */
  --dur-count: .9s;     /* a figure counting up (hero) */
  --rise-by: 14px;      /* how far a card rises in (hero); named so it never shadows the hero's --rise */

  /* 9. Z-index and targets ---------------------------------------------------- */
  --z-header: 10; --z-menu: 20; --z-sticky: 30; --z-toast: 40; --z-skip: 50;
  --target: 44px;       /* minimum touch target, every control */
  --ctl-h: 56px;        /* default button and field height (hero .btn) */
  --ctl-h-md: 50px;     /* compact: the sticky bar (hero), dense forms */
  --ctl-h-sm: 44px;     /* small: the header button (hero .btn-sm) */
  --focus-w: 3px;
  --focus-off: 3px;
}

@media (max-width: 639px) {
  :root { --nav-h: 64px; }   /* hero */
}

/* 10. Surfaces: semantic tokens ------------------------------------------------
   Components read only these, so the same markup works on Paper, white and Ledger.
   Light is the default. Put data-surface="ledger" (or the .ts-dark class) on any dark
   container: header, hero, footer, dark sections, the sticky bar. Cards, glass and
   fields are always light inside and set their own surface.
   Measured on Paper / white: fg 16.09 / 17.85; muted (Ink 72%) 6.75 / 7.11;
   subtle (Ink 64%) 5.16 / 5.37; control line (Ink 50%) 3.32 / 3.41.
   Measured on Ledger: fg 11.25; muted (Paper 85%) 8.57; subtle (Paper 72%) 6.61;
   control line (Paper 55%) 4.53. */
:root,
[data-surface="paper"],
[data-surface="white"],
.ts-light,
.ts-surface-paper, .ts-surface-paper-2, .ts-surface-white,   /* light grounds, even inside a dark page */
.ts-card, .ts-glass, .ts-file, .ts-errors {                   /* always light inside */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-heading: var(--ledger);
  --fg-muted: rgba(14, 26, 20, .72);
  --fg-subtle: rgba(14, 26, 20, .64);
  --fg-disabled: rgba(14, 26, 20, .42);       /* exempt from contrast minimums, still legible */
  --line: rgba(14, 26, 20, .12);              /* decorative hairline */
  --line-strong: rgba(14, 26, 20, .22);       /* section and list rules */
  --line-control: rgba(14, 26, 20, .5);       /* control edges: 3:1 */
  --line-control-hover: rgba(14, 26, 20, .72);
  --focus: var(--ledger);                     /* 11.25:1 on Paper */
  --focus-soft: rgba(13, 59, 46, .18);
  --link: var(--ledger);
  --link-hover: var(--ink);                   /* hover thickens the underline; Fern on Paper-2 is only 4.27:1 */
  --field-bg: var(--white);
  --field-fg: var(--ink);
  --field-placeholder: rgba(14, 26, 20, .6);  /* 4.68:1 on white */
  --field-disabled-bg: rgba(14, 26, 20, .04);
  --selected: var(--ledger);
  --selected-bg: rgba(13, 59, 46, .045);
  --tint: rgba(13, 59, 46, .05);
  --outline-fg: var(--ledger);
  --outline-line: rgba(13, 59, 46, .6);       /* 3.62:1 on Paper */
  --outline-hover-bg: rgba(13, 59, 46, .06);
  --outline-hover-line: var(--ledger);
  --muted-btn-bg: rgba(14, 26, 20, .07);      /* disabled fill */
  /* Primary button fill follows the surface: Ledger on light, Lime on dark.
     Lime on Paper is 1.15:1, so a lime button there loses its edge (and vanishes in
     greyscale); on light pages the lime highlight then stays the only lime in view.
     To make primaries lime everywhere, point these four at the lime tokens. */
  --primary-bg: var(--ledger);                /* Paper label on it: 11.25:1 */
  --primary-fg: var(--paper);
  --primary-hover: var(--ledger-2);           /* 9.64:1 */
  --primary-press: #0A3125;
  --error: var(--red);
  --error-tint: var(--red-tint);
  --warning: var(--amber);
  --warning-tint: var(--amber-tint);
  --success: var(--green);
  --success-tint: var(--green-tint);
  --info: var(--ledger);
  --info-tint: #E9EFE9;
  --choice-bg: var(--white);                  /* option rows */
  --choice-bg-on: var(--white);
  --line-choice: rgba(14, 26, 20, .16);
  --check-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7' fill='none' stroke='%23F6F3EA' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");   /* Paper tick on the Ledger fill */
  --ph-bg: repeating-linear-gradient(135deg, rgba(138, 83, 0, .09) 0 6px, rgba(138, 83, 0, .03) 6px 12px);   /* placeholder hatch */
  --tag-bg: var(--paper-2);                   /* the squared Example tag on Paper grounds */
}
/* White grounds: the squared tag sits on Paper instead */
[data-surface="white"], .ts-surface-white, .ts-card, .ts-glass, .ts-file, .ts-errors { --bg: var(--white); --tag-bg: var(--paper); }

[data-surface="ledger"],
.ts-dark,
.ts-surface-ledger, .ts-header, .ts-menu, .ts-flowbar, .ts-footer, .ts-sticky, .ts-toast {   /* always dark */
  --bg: var(--ledger);
  --fg: var(--paper);
  --fg-heading: var(--paper);
  --fg-muted: var(--paper-85);
  --fg-subtle: var(--paper-72);
  --fg-disabled: rgba(246, 243, 234, .5);
  --line: rgba(246, 243, 234, .12);
  --line-strong: rgba(246, 243, 234, .2);
  --line-control: rgba(246, 243, 234, .55);
  --line-control-hover: rgba(246, 243, 234, .8);
  --focus: var(--lime);                       /* 9.75:1 on Ledger; the one place lime is a state colour */
  --focus-soft: rgba(197, 243, 106, .22);
  --link: var(--paper);
  --link-hover: var(--white);
  --field-bg: rgba(246, 243, 234, .06);
  --field-fg: var(--paper);
  --field-placeholder: rgba(246, 243, 234, .66);
  --field-disabled-bg: rgba(246, 243, 234, .04);
  --selected: var(--paper);
  --selected-bg: rgba(246, 243, 234, .08);
  --tint: rgba(246, 243, 234, .06);
  --outline-fg: var(--paper);
  --outline-line: rgba(246, 243, 234, .55);   /* hero .btn-alt */
  --outline-hover-bg: rgba(246, 243, 234, .08);
  --outline-hover-line: var(--paper);
  --muted-btn-bg: rgba(246, 243, 234, .1);
  --primary-bg: var(--lime);                  /* Ledger label on it: 9.75:1 */
  --primary-fg: var(--ledger);
  --primary-hover: var(--lime-hover);
  --primary-press: var(--lime-press);
  --error: var(--red-on-dark);
  --error-tint: rgba(255, 164, 148, .12);
  --warning: var(--amber-on-dark);
  --warning-tint: rgba(243, 199, 122, .12);
  --success: var(--green-on-dark);
  --success-tint: rgba(166, 220, 189, .12);
  --info: var(--paper);
  --info-tint: rgba(246, 243, 234, .08);
  --choice-bg: rgba(246, 243, 234, .05);
  --choice-bg-on: rgba(246, 243, 234, .1);
  --line-choice: rgba(246, 243, 234, .24);
  --check-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 10.5 3.2 3.2L15 7' fill='none' stroke='%230D3B2E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");   /* Ledger tick on the Paper fill */
  --ph-bg: repeating-linear-gradient(135deg, rgba(243, 199, 122, .16) 0 6px, rgba(243, 199, 122, .05) 6px 12px);
  --tag-bg: rgba(246, 243, 234, .1);
}
