/* SOUVENNA design tokens (24 Oct 2026): the one source for colour, type, space, shape, depth and motion.
   Why: the app had 1,207 distinct hex colours, 348 font sizes and 341 shadows across 119 sheets, and that
   inconsistency is most of why it felt cheap. Every value here is the most-used existing value for its job
   (measured on owner-release 54c95392), so adopting a token changes almost nothing visually; it removes the
   near-duplicates (#fffdf9 / #fffdf8 / #fdfbf7, 12.5px / 13px / 13.5px ...).
   Rules for every screen:
   - colours, sizes, radii, shadows and timings come from var(--sv-...) only; no new raw values
     (scripts/design-tokens-ratchet.test.mjs fails if raw counts outside this file go up);
   - fonts come only from souvenna-type.css (var(--sv-serif), var(--sv-sans)), linked just before this file;
   - names that already existed in sv-shell.css (--sv-ink, --sv-line, --sv-forest, --sv-canvas, --sv-soft)
     keep their meaning and value, so the shell and these tokens never disagree. */

:root {
  /* Existing component values centralized without changing their appearance.
     Fallback tokens retain the exact old branch when legacy variables are absent. */
  --sv-business-document-focus: #1a584a;
  --sv-onboarding-ink-fallback: #202b26;
  --sv-handover-ink: #253c34;
  --sv-onboarding-soft-fallback: #59665e;
  --sv-handover-focus: #8c633f;
  --sv-private-guest-line-fallback: #bbb8af;
  --sv-business-document-line-fallback: #d9d8cf;
  --sv-handover-card-line: #d9ded5;
  --sv-handover-line-fallback: #deded5;
  --sv-handover-photo-surface: #f3f2ec;
  --sv-handover-gradient-start: #f4f2e9;
  --sv-onboarding-canvas-fallback: #faf8f3;
  --sv-handover-card-surface: #fffefb;
  --sv-handover-heading-size: clamp(1.4rem,2.5vw,2rem);

  /* ---------- colour: 12 core ---------- */
  --sv-canvas: #fdfbf7;        /* the ivory page behind everything (most used ivory) */
  --sv-paper: #ffffff;         /* cards, fields, dialogs */
  --sv-linen: #f6f1e8;         /* quiet bands, table heads, hover on paper */
  --sv-line: #ebe4d8;          /* hairlines, card borders */
  --sv-line-strong: #ddd3c3;   /* field borders, dividers that must be seen */
  --sv-ink: #1d2623;           /* headings and body text: 15:1 on canvas */
  --sv-ink-soft: #3d4441;      /* secondary text: 9.7:1 */
  --sv-soft: #5f6662;          /* muted text, captions: 5.7:1, the lightest grey allowed for words */
  --sv-forest: #174d40;        /* brand primary, primary buttons (white words 9.7:1) */
  --sv-forest-deep: #0f3a30;   /* menu rail, pressed primary */
  --sv-bronze: #93673f;        /* accent and links (4.8:1 on canvas, 4.9:1 on paper, white words 4.9:1; not for words on linen, 4.4:1); #a9794d is decoration only */
  --sv-blush: #f3e6dc;         /* warm highlight, selected chips */

  /* decoration-only tones: never for text */
  --sv-bronze-light: #a9794d;
  --sv-gold: #c9a96a;
  --sv-sage: #e8eee9;

  /* semantic: words / background pairs, every word colour 4.5:1 or better on its own background */
  --sv-ok: #2f6b46;      --sv-ok-bg: #e6f1e8;
  --sv-warn: #8a5a14;    --sv-warn-bg: #fbf1dc;
  --sv-bad: #9c3533;     --sv-bad-bg: #f9e5e2;
  --sv-info: #24557a;    --sv-info-bg: #e7f0f7;
  --sv-focus: #174d40;   /* focus ring: 2px forest + 2px offset, visible on canvas and paper */
  --sv-scrim: rgba(29, 38, 35, .45);  /* behind dialogs and drawers */

  /* state tones: used by sv-components.css so no component carries a raw colour */
  --sv-forest-lift: #2a6a59;   /* primary hover: lighter, never darker (sv-states.css rule) */
  --sv-bad-deep: #82292a;      /* danger hover */
  --sv-line-hover: #c9bda9;    /* field border on hover */
  --sv-placeholder: #9aa09c;   /* placeholder text only, never real content */
  --sv-bad-tint: #fffafa;      /* field background when invalid */
  --sv-row-hover: #fbf8f2;     /* table row hover */
  --sv-shimmer-a: #f1ebe0;     /* skeleton base */
  --sv-shimmer-b: #f8f4ec;     /* skeleton highlight */
  --sv-ring-forest: 0 0 0 3px rgba(23, 77, 64, .14);
  --sv-ring-bad: 0 0 0 3px rgba(156, 53, 51, .14);
  --sv-ring-line: 0 0 0 1px var(--sv-line-strong);      /* hairline round a swatch or avatar */
  --sv-ring-selected: 0 0 0 2px var(--sv-forest);       /* the chosen swatch */
  --sv-ring-halo: 0 0 0 4px var(--sv-sage);             /* the current step in a progress line */
  --sv-ring-gold: 0 0 0 1px rgb(201 169 110 / .6);      /* fine gold edge round a portrait */
  --sv-inset-forest: inset 0 0 0 1px var(--sv-forest);  /* a selected chip or button drawn from the inside */

  /* Approved onboarding scene: retained exact surface/chart/room colours, not a new palette. */
  --sv-onboarding-linen: #f3efe5;
  --sv-onboarding-divider: #dedfd5;
  --sv-onboarding-control: #879089;
  --sv-chart-sage: #648575;
  --sv-chart-taupe: #b5a18b;
  --sv-chart-sand: #ded4c5;
  --sv-control-focus-paper: #fcfefb;
  --sv-onboarding-primary-hover: #24614f;
  --sv-onboarding-quiet-hover: #edf2eb;
  --sv-onboarding-inset-line: #e7e4d7;
  --sv-onboarding-preview-divider: #d2d4c8;
  --sv-room-boundary: #a8b0a2;
  --sv-room-table-edge: #8d9d8b;
  --sv-room-table-paper: #eef1e7;
  --sv-room-table-selected: #dbe6d7;
  --sv-room-chair-edge: #879580;

  /* Onboarding display geometry and dense sample-seat labels retain their approved sizes. */
  --sv-room-seat-caption: 8px;
  --sv-onboarding-room-title-mobile: 33px;
  --sv-onboarding-profile-title-mobile: 35px;
  --sv-onboarding-heading-mid: 39px;
  --sv-onboarding-wedding-title-mobile: 43px;
  --sv-onboarding-wedding-title-mid: 49px;
  --sv-onboarding-handoff-title: clamp(32px, 4vw, 48px);

  --sv-guest-title-size: clamp(1.85rem,5vw,2.5rem); /* Existing private invitation title, exact geometry. */

  /* ---------- type: 7 steps (13px is the app's own default, so the scale is built round it) ---------- */
  --sv-fs-1: 12px;   /* labels, captions, table meta */
  --sv-fs-2: 13px;   /* controls, menus, dense UI (the most used size today) */
  --sv-fs-3: 14px;   /* body text */
  --sv-fs-4: 16px;   /* lead text, phone body */
  --sv-fs-5: 20px;   /* card and section titles (serif) */
  --sv-fs-6: 28px;   /* page titles (serif) */
  --sv-fs-7: clamp(34px, 4.2vw, 48px);  /* hero titles (serif); never above 64px by standing rule */
  --sv-lh-tight: 1.12;  /* serif titles */
  --sv-lh-ui: 1.35;     /* controls, one-line text */
  --sv-lh-body: 1.55;   /* paragraphs */
  --sv-tracking-caps: .08em;  /* small capitals labels */

  /* ---------- space: 8px grid, with 4px for hairline nudges ---------- */
  --sv-space-1: 4px;
  --sv-space-2: 8px;
  --sv-space-3: 12px;
  --sv-space-4: 16px;
  --sv-space-5: 24px;
  --sv-space-6: 32px;
  --sv-space-7: 48px;
  --sv-space-8: 64px;

  /* ---------- shape: 4 radii (today's top four, merged from 9 near-identical values) ---------- */
  --sv-radius-sm: 8px;     /* chips, small buttons, inputs inside dense tables */
  --sv-radius-md: 12px;    /* buttons, fields, cards inside cards */
  --sv-radius-lg: 16px;    /* cards, dialogs, panels */
  --sv-radius-pill: 999px; /* pills, avatars, toggles */

  /* ---------- depth: 4 elevations ----------
     Layered ramps taken from Open Props shadows 1-4 (MIT, open-props.style; values copied, package not installed),
     re-tinted warm (hsl 33 43% 16%) so shadows read as paper on ivory, never grey smudge. */
  --sv-shadow-tone: 33 43% 16%;
  --sv-elev-1: 0 1px 2px -1px hsl(var(--sv-shadow-tone) / 10%);                                                       /* resting cards */
  --sv-elev-2: 0 3px 5px -2px hsl(var(--sv-shadow-tone) / 4%), 0 7px 14px -5px hsl(var(--sv-shadow-tone) / 6%);        /* raised cards, hover */
  --sv-elev-3: 0 -1px 3px 0 hsl(var(--sv-shadow-tone) / 3%), 0 1px 2px -5px hsl(var(--sv-shadow-tone) / 3%),
    0 2px 5px -5px hsl(var(--sv-shadow-tone) / 5%), 0 4px 12px -5px hsl(var(--sv-shadow-tone) / 6%), 0 12px 15px -5px hsl(var(--sv-shadow-tone) / 8%); /* menus, popovers, toasts */
  --sv-elev-4: 0 -2px 5px 0 hsl(var(--sv-shadow-tone) / 3%), 0 1px 1px -2px hsl(var(--sv-shadow-tone) / 4%), 0 2px 2px -2px hsl(var(--sv-shadow-tone) / 4%),
    0 5px 5px -2px hsl(var(--sv-shadow-tone) / 5%), 0 9px 9px -2px hsl(var(--sv-shadow-tone) / 6%), 0 16px 16px -2px hsl(var(--sv-shadow-tone) / 7%),
    0 28px 60px -12px hsl(var(--sv-shadow-tone) / 18%);                                                                 /* dialogs, drawers: Open Props 4 plus one deep layer so a dialog lifts off a busy page */

  /* ---------- motion: 3 durations + 4 easings ---------- */
  --sv-dur-fast: 120ms;   /* press, hover, toggle: feedback inside the 100ms-feels-instant window */
  --sv-dur-base: 200ms;   /* state changes, field focus, tabs */
  --sv-dur-slow: 360ms;   /* entrances, dialogs, drawers */
  --sv-ease: cubic-bezier(.2, 0, 0, 1);        /* standard: quick start, soft landing (already the shell's curve) */
  --sv-ease-out: cubic-bezier(.23, 1, .32, 1); /* entrances: settles without bounce */
  --sv-ease-in-out: cubic-bezier(.5, 0, .5, 1); /* things that move across the screen and stop (Open Props ease-in-out-3) */
  --sv-ease-pop: cubic-bezier(.5, .75, .75, 1.25); /* a small overshoot for a toggle or a tick landing, never for layout (Open Props ease-elastic-out-1) */

  /* ---------- layout ---------- */
  --sv-tap: 44px;          /* smallest touch target */
  --sv-content-max: 1200px;
  --sv-gutter: clamp(16px, 4vw, 32px);
}

/* Less motion when the person asks for it (system setting or SOUVENNA's own Animations: Reduce). Durations collapse
   rather than disappear, so code waiting for transitionend still runs. */
@media (prefers-reduced-motion: reduce) {
  :root { --sv-dur-fast: 1ms; --sv-dur-base: 1ms; --sv-dur-slow: 1ms; }
}
:root[data-motion='reduced'] { --sv-dur-fast: 1ms; --sv-dur-base: 1ms; --sv-dur-slow: 1ms; }

/* ---------- Luminous Glass preview (12 Nov 2026): on only under <html data-look="glass">, see luminous-glass.css ---------- */
html[data-look='glass'] {
  --lg-white: #ffffff;
  --lg-pearl: #f5f3f0;
  --lg-stone: #e7e1db;
  --lg-champagne: #b69a79;      /* decoration only: 2.7:1 on white, never for words */
  --lg-champagne-ink: #7d6444;  /* champagne for words: 5.5:1 on white */
  --lg-ink: #24272d;
  --lg-soft: #565b64;
  --lg-slate: #4b5432;
  --lg-slate-lift: #616b44;

  --lg-radius: 28px;
  --lg-radius-sm: 18px;
  --lg-speed: 200ms;
  --lg-ease: cubic-bezier(.2, .8, .2, 1);
  --lg-line: rgb(60 64 40 / .12);
  --lg-line-strong: rgb(60 64 40 / .24);
  --lg-border: rgb(255 255 255 / .82);
  /* Depth (12 Nov 2026): three shadows per pane (contact, body, far) so it reads as a sheet lifted off the page,
     and an edge with a bright top lip and a soft shaded foot so the pane has thickness. */
  --lg-shadow: 0 1px 2px rgb(60 62 40 / .10), 0 12px 24px rgb(60 62 40 / .12), 0 34px 64px rgb(60 62 40 / .14);
  --lg-shadow-lift: 0 2px 4px rgb(60 62 40 / .12), 0 18px 34px rgb(60 62 40 / .16), 0 46px 84px rgb(60 62 40 / .18);
  --lg-edge: inset 0 1.5px 0 rgb(255 255 255 / .95), inset 0 -2px 4px rgb(60 62 40 / .10), inset 0 0 0 1px rgb(255 255 255 / .22);

  --lg-nav-surface: rgb(255 255 255 / .44);
  --lg-nav-filter: blur(28px) saturate(165%);
  --lg-card-surface: rgb(255 255 255 / .34);
  --lg-card-filter: blur(24px) saturate(165%);
  --lg-overlay-surface: rgb(255 255 255 / .52);
  --lg-overlay-filter: blur(30px) saturate(165%);
  --lg-emerald: #4b5432;        /* "you are here": active menu link, chosen toggle, today (white words 9.6:1) */
  --lg-emerald-lift: #616b44;
  --lg-navy: #4b5432;           /* main buttons (white words 15:1) */
  --lg-navy-lift: #616b44;
  --lg-sand: #f3efe2;           /* the warm page behind the glass */
  --lg-sand-deep: #e3dec9;
  --lg-emerald-fill: linear-gradient(180deg, var(--lg-emerald-lift), var(--lg-emerald));
  --lg-navy-fill: linear-gradient(180deg, var(--lg-navy-lift), var(--lg-navy));
  --lg-shadow-pill: inset 0 1px 0 rgb(255 255 255 / .30), 0 6px 16px rgb(50 56 30 / .28);
  --lg-shadow-soft: inset 0 1px 0 rgb(255 255 255 / .9), 0 3px 10px rgb(70 52 30 / .08);
  --lg-fill-quiet: rgb(255 255 255 / .46);
  --lg-olive-soft: rgb(110 118 72 / .46);   /* current sub-link: soft olive, dark words */
  --lg-sheen: linear-gradient(160deg, rgb(255 255 255 / .34), rgb(255 255 255 / 0) 46%);
  --lg-leaves: url('/img/glass-leaves.svg');

  --lg-slate-soft: #565c47;
  --lg-slate-deep: #3a4127;
  --lg-ink-soft: #3b4049;
  --lg-mist: #eef0e6;
  --lg-warm: #f3ede5;
  --lg-shadow-top: 0 1px 0 var(--lg-line), 0 8px 24px rgb(35 42 55 / .05);
  --lg-shadow-rail: 1px 0 0 var(--lg-line), 8px 0 28px rgb(35 42 55 / .05);
  --lg-shadow-active: 0 4px 14px rgb(35 42 55 / .08);
  --lg-shadow-press: 0 6px 18px rgb(60 64 40 / .22);
  --lg-edge-dark: inset 0 1px 0 rgb(255 255 255 / .18);

  /* Refinement (13 Nov 2026): a deeper-frosted couple menu, one lead card with quieter neighbours, the main button and the send button. */
  --lg-rail-surface: linear-gradient(160deg, rgb(255 255 255 / .62), rgb(255 255 255 / .30));
  --lg-rail-filter: blur(36px) saturate(170%);
  --lg-card-lead: linear-gradient(135deg, rgb(255 255 255 / .86), rgb(255 255 255 / .56));
  --lg-card-quiet: rgb(255 255 255 / .24);
  --lg-border-quiet: rgb(255 255 255 / .4);
  --lg-main-fill: linear-gradient(180deg, var(--lg-navy-lift) 0%, var(--lg-navy) 55%, var(--lg-slate-deep) 100%);   /* white words 5.9:1 at its lightest */
  --lg-main-shadow: inset 0 1px 0 rgb(255 255 255 / .38), inset 0 -2px 0 rgb(0 0 0 / .18), 0 14px 28px -12px rgb(59 65 38 / .75), 0 0 0 4px rgb(109 117 68 / .14);
  --lg-main-shadow-press: inset 0 2px 6px rgb(0 0 0 / .3), 0 6px 14px -10px rgb(59 65 38 / .7);
  --lg-main-sheen: linear-gradient(90deg, transparent, rgb(255 255 255 / .36), transparent);
  --lg-main-dot: rgb(255 255 255 / .18);
  --lg-runway: repeating-linear-gradient(90deg, rgb(255 255 255 / .55) 0 7px, transparent 7px 13px);
}
/* Phones: lighter blur is cheaper to draw; the menu is more solid so its words keep their contrast over the page. */
@media (max-width: 640px) {
  html[data-look='glass'] { --lg-rail-filter: blur(12px) saturate(140%); --lg-rail-surface: rgb(255 255 255 / .78); --lg-nav-filter: blur(12px) saturate(140%); --lg-card-filter: blur(8px) saturate(140%); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-look='glass'] { --lg-nav-surface: #f6f3e9; --lg-card-surface: #faf8f1; --lg-overlay-surface: #f6f3e9; --lg-rail-surface: #f6f3e9; --lg-card-lead: #ffffff; --lg-card-quiet: #faf8f1; }
}
@media (prefers-reduced-transparency: reduce) {
  html[data-look='glass'] { --lg-nav-surface: #f6f3e9; --lg-card-surface: #faf8f1; --lg-overlay-surface: #f6f3e9; --lg-nav-filter: none; --lg-card-filter: none; --lg-overlay-filter: none;
    --lg-rail-surface: #f6f3e9; --lg-rail-filter: none; --lg-card-lead: #ffffff; --lg-card-quiet: #faf8f1; }
}
@media (prefers-contrast: more) {
  html[data-look='glass'] { --lg-nav-surface: #ffffff; --lg-card-surface: #ffffff; --lg-overlay-surface: #ffffff; --lg-line: rgb(60 64 40 / .4); --lg-border: rgb(60 64 40 / .4);
    --lg-rail-surface: #ffffff; --lg-card-lead: #ffffff; --lg-card-quiet: #ffffff; --lg-border-quiet: rgb(60 64 40 / .4); }
}
