/* ============================================================
   SURFACE — Tier 2, the contract
   ============================================================

   TWO INDEPENDENT AXES
   --------------------
   THEME    global, one per page.   <html data-theme="light|dark">
            Owns the background veil and the DEFAULT surface polarity.

   SURFACE  local, nestable to any depth.  data-surface="light|dark"
            THE NEAREST ANCESTOR WINS.

   HOW THE NESTING WORKS
   ---------------------
   There is no JavaScript and no depth counter, because CSS already
   does exactly this. Custom properties inherit; re-declaring them on
   a descendant overrides them for that subtree and nothing else.
   That IS "the closest parent decides", for free, at any depth.

       <body data-theme="dark">              → dark tokens
         <aside data-surface="light">         → light tokens
           <div data-surface="dark">          → dark tokens
             <span data-surface="light">      → light tokens   ...

   Specificity is irrelevant here: the root's declaration applies to
   the root element, and a nested element's own declaration wins for
   itself and its descendants. Inheritance is not a cascade fight.

   THE ONE RULE
   ------------
   Both blocks below MUST define the identical set of variable names.
   If a name exists in one and not the other, a component will inherit
   a stale value from an ancestor surface and break silently on
   nesting. Keep them in lockstep.

   Components read ONLY the names in this file. They never know which
   theme is active, and they never reference a palette primitive.

   This is not theoretical: the dark app screen (Figma 47:4038) has a
   LIGHT sidebar, and the dark mobile screen (24:3725) has a LIGHT tab
   bar. Both are the light variant placed on a dark page — not dark
   variants of those components.
   ============================================================ */


/* ------------------------------------------------------------
   LIGHT SURFACE
   ------------------------------------------------------------ */
[data-surface="light"],
:root[data-theme="light"] {

  --surface-is-dark: 0;

  /* Foreground — THE EMPHASIS SCALE, Figma 89:19649.
     One ramp of four rungs. Text takes the first three, icons the
     last three — an icon never carries the ink, which is why the
     two scales are shifted by one:

                     text              icon
       high          ice-blue-900      ice-blue-700
       medium        ice-blue-700      ice-blue-700 @ 80%
       low           ice-blue-700@80%  ice-blue-700 @ 60%

     Emphasis is its own axis: it says nothing about size, weight or
     link state, and they say nothing about it. */
  --fg-high:   var(--ice-blue-900);
  --fg-medium: var(--ice-blue-700);
  --fg-low:    color-mix(in srgb, var(--fg-medium) 80%, transparent);

  --fg-icon-high:   var(--fg-medium);
  --fg-icon-medium: color-mix(in srgb, var(--fg-medium) 80%, transparent);
  --fg-icon-low:    color-mix(in srgb, var(--fg-medium) 60%, transparent);
  --fg-disabled:  var(--ice-grey-300);
  --fg-accent:    var(--ice-blue-600);
  --fg-link:       var(--vivid-blue-600);
  --fg-link-hover: var(--gold-500);       /* warm gold */
  /* The dashed rule under a link. Quiet at rest — it firms up to
     currentColor on hover. */
  --link-underline: rgb(39 104 206 / .45);   /* vivid-blue-600 */
  --fg-on-accent: var(--white);
  --fg-success:   #2B548D;   /* field hints — "extrait avec succès" */

  /* The tint behind a highlighted field group (onboarding step 1).
     vivid-blue-200 → gold-50, both at 60%. */

  /* Accent / interaction */
  --accent:        var(--ice-blue-400);  /* selected border, focus   */
  --accent-strong: var(--ice-blue-600);
  --accent-soft:   var(--ice-blue-300);
  --accent-subtle: var(--ice-blue-200);

  /* Solid fills, for the rare non-glass element */
  --bg-solid:  var(--white);
  --bg-subtle: var(--ice-blue-50);
  --bg-sunken: var(--ice-blue-100);

  /* Hairlines */
  --border-hairline: rgb(255 255 255 / .30);
  --border-quiet:    rgb(255 255 255 / .15);
  --border-strong:   rgb(62 87 122 / .20);
  --border-divider:  rgb(62 87 122 / .15);

  /* Shadow hue — blue, never black. This is what makes the material
     read as ice rather than as generic glassmorphism.              */
  /* ice-blue-900. Drawn as #132D4B on 58:6515 — d=7 from the token,
     so the palette value is used. */

  /* ---- Shadow scale ----  Figma 66:1938
     A shadow and its background blur are one effect style in Figma,
     so they travel together here: --shadow-x and --shadow-x-blur.
     The blur is the Figma radius halved, which is what CSS wants.
     `strong` repeats the inner geometry at 40% instead of 8%, for a
     well cut into a solid fill rather than into glass.              */
  --shadow-ink: var(--ice-blue-900);
  --shadow-none:        none;
  --shadow-none-blur:   6px;
  --shadow-xs:          0  2px  6px  -2px color-mix(in srgb, var(--shadow-ink) 16%, transparent);
  --shadow-xs-blur:     3px;
  --shadow-s:           0  4px 12px  -4px color-mix(in srgb, var(--shadow-ink) 18%, transparent);
  --shadow-s-blur:      4.5px;
  --shadow-m:           0  6px 18px  -6px color-mix(in srgb, var(--shadow-ink) 20%, transparent);
  --shadow-m-blur:      6px;
  --shadow-l:           0  8px 24px  -8px color-mix(in srgb, var(--shadow-ink) 22%, transparent);
  --shadow-l-blur:      7.5px;
  --shadow-xl:          0 12px 36px -12px color-mix(in srgb, var(--shadow-ink) 24%, transparent);
  --shadow-xl-blur:     7.5px;
  /* Drawn #00FAFC 20% and #2768CE 50%. Neither is a palette
     variable, so both are written out. Figma Shadows/Highlight. */
  --shadow-highlight:   0  4px 12px  -4px rgb(0 250 252 / .20),
                        0 12px 36px -12px rgb(39 104 206 / .50);
  --shadow-highlight-blur: 7.5px;
  /* The inner shadows carry the lit lip under them — one effect. */
  --shadow-inner-s:     inset 0 1px 3px 0 color-mix(in srgb, var(--ice-grey-900) 8%, transparent),
                        0 1px 1px 0 rgb(255 255 255 / .25);
  --shadow-inner-s-blur: 3px;
  --shadow-inner-m:     inset 0 2px 6px 0 color-mix(in srgb, var(--shadow-ink) 8%, transparent),
                        0 1px 1px 0 rgb(255 255 255 / .25);
  --shadow-inner-m-blur: 3px;
  --shadow-inner-l:     inset 0 3px 9px 0 color-mix(in srgb, var(--shadow-ink) 8%, transparent),
                        0 2px 1px 0 rgb(255 255 255 / .25);
  --shadow-inner-l-blur: 3px;
  --shadow-inner-s-strong: inset 0 1px 3px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 1px 1px 0 rgb(255 255 255 / .25);
  --shadow-inner-m-strong: inset 0 2px 6px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 1px 1px 0 rgb(255 255 255 / .25);
  --shadow-inner-l-strong: inset 0 3px 9px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 2px 1px 0 rgb(255 255 255 / .25);

  /* ---- Elevations ----  Figma 66:1938
     Each one names a fill, a stroke pair and a shadow. The shadow
     brings its own background blur, so an elevation is one line to
     apply and never assembled by hand.

     PRIMARY    white glass, lifts off the page
       1 · 2 · 3 · 4        .30→.15   .60→.20   .80→.50   .95→.80
       highlight           the fill of 4 plus a cyan/blue glow
     SECONDARY  blue-tinted, sits in the page, inner shadow
       0 · 1 · 2
     INK        the two solid pills
       dark-high · dark-medium · dark-low
     TINTED     glass plus a duotone glow
       success · warning
     ------------------------------------------------------- */
  --elev-primary-1-image:  linear-gradient(var(--glass-dir),
                             rgb(255 255 255 / .30), rgb(255 255 255 / .15));
  --elev-primary-1-border:     rgb(255 255 255 / .15);
  --elev-primary-1-border-lit: rgb(255 255 255 / .35);
  --elev-primary-1-border-w: var(--border-w);
  --elev-primary-1-shadow: var(--shadow-xs);
  --elev-primary-1-blur:   var(--shadow-xs-blur);

  --elev-primary-2-image:  linear-gradient(var(--glass-dir),
                             rgb(255 255 255 / .60), rgb(255 255 255 / .20));
  --elev-primary-2-border:     rgb(255 255 255 / .40);
  --elev-primary-2-border-lit: rgb(255 255 255 / .70);
  --elev-primary-2-border-w: var(--border-w);
  --elev-primary-2-shadow: var(--shadow-s);
  --elev-primary-2-blur:   var(--shadow-s-blur);

  --elev-primary-3-image:  linear-gradient(var(--glass-dir),
                             rgb(255 255 255 / .80), rgb(255 255 255 / .50));
  --elev-primary-3-border:     rgb(255 255 255 / .30);
  --elev-primary-3-border-lit: rgb(255 255 255 / .70);
  --elev-primary-3-border-w: var(--border-w);
  --elev-primary-3-shadow: var(--shadow-m);
  --elev-primary-3-blur:   var(--shadow-m-blur);

  --elev-primary-3-image-inv: linear-gradient(var(--glass-dir-inv),
                             rgb(255 255 255 / .80), rgb(255 255 255 / .50));

  --elev-primary-4-image:  linear-gradient(var(--glass-dir),
                             rgb(255 255 255 / .95), rgb(255 255 255 / .80));
  --elev-primary-4-border:     rgb(255 255 255 / .30);
  --elev-primary-4-border-lit: rgb(255 255 255 / .70);
  --elev-primary-4-border-w: var(--border-w);
  --elev-primary-4-shadow: var(--shadow-xl);
  --elev-primary-4-blur:   var(--shadow-xl-blur);

  --elev-highlight-image:  var(--elev-primary-4-image);
  --elev-highlight-border:     rgb(255 255 255 / .30);
  --elev-highlight-border-lit: rgb(255 255 255 / .70);
  --elev-highlight-border-w: var(--border-w);
  --elev-highlight-shadow: var(--shadow-highlight);
  --elev-highlight-blur:   var(--shadow-highlight-blur);

  /* The hover twin of the ink pills. Same radial geometry as
     dark-high, cyan at the lit corner, whole fill at 95%.
     Figma 76:11825 / 76:11920. The two middle stops are straight
     interpolations between the two ends, as on dark-high. */
  --elev-highlight-ink-image: radial-gradient(140% 200% at 100% 0%,
      color-mix(in srgb, var(--vivid-turquoise-200) 95%, transparent)  0%,
      color-mix(in srgb, #15A6E5 95%, transparent)  50%,
      color-mix(in srgb, #0B88DD 95%, transparent)  75%,
      color-mix(in srgb, var(--vivid-blue-600) 95%, transparent) 100%);
  /* One linear stroke at 30%: vivid-blue-400 at the shaded corner,
     vivid-turquoise-50 at the lit one. */
  --elev-highlight-ink-border:     color-mix(in srgb, var(--vivid-blue-400) 30%, transparent);
  --elev-highlight-ink-border-lit: color-mix(in srgb, var(--vivid-turquoise-50) 30%, transparent);
  --elev-highlight-ink-border-w:   var(--border-w);
  --elev-highlight-ink-shadow: var(--shadow-highlight);
  --elev-highlight-ink-blur:   var(--shadow-highlight-blur);
  --elev-highlight-ink-fg:     var(--white);

  --elev-secondary-0-image:  linear-gradient(var(--glass-dir),
                               rgb(131 162 215 / .20), rgb(168 192 227 / .20));
  --elev-secondary-0-border:     transparent;
  --elev-secondary-0-border-lit: transparent;
  --elev-secondary-0-border-w: 0;
  --elev-secondary-0-shadow: var(--shadow-none);
  --elev-secondary-0-blur:   0px;

  --elev-secondary-1-image:  linear-gradient(210deg,
                               rgb(219 230 250 / .20), rgb(123 160 223 / .30));
  --elev-secondary-1-border:     transparent;
  --elev-secondary-1-border-lit: transparent;
  --elev-secondary-1-border-w: 0;
  --elev-secondary-1-shadow: var(--shadow-inner-s);
  --elev-secondary-1-blur:   var(--shadow-inner-s-blur);

  --elev-secondary-2-image:  linear-gradient(30deg,
                               rgb(88 115 157 / .40), rgb(168 192 227 / .20));
  --elev-secondary-2-border:     transparent;
  --elev-secondary-2-border-lit: transparent;
  --elev-secondary-2-border-w: 0;
  --elev-secondary-2-shadow: var(--shadow-inner-m);
  --elev-secondary-2-blur:   var(--shadow-inner-m-blur);

  /* ---- Ink ----  three solid pills, Figma 66:1938.
     Same construction each time: a radial from the upper right,
     a stroke two rungs deeper than the fill, shadow M, and an inner
     highlight along the top-right edge. */
  /* The fill is drawn at 95%. The two middle stops are straight
     interpolations between the ends. Figma 76:11675. */
  --elev-dark-high-image:  radial-gradient(140% 200% at 100% 0%,
                             color-mix(in srgb, var(--vivid-blue-600) 95%, transparent)  0%,
                             color-mix(in srgb, #004B99 95%, transparent) 50%,
                             color-mix(in srgb, #003C7A 95%, transparent) 75%,
                             color-mix(in srgb, var(--vivid-blue-900) 95%, transparent) 100%);
  /* Drawn as one linear stroke at 30%: vivid-blue-700 at the shaded
     corner, vivid-blue-300 at the lit one. CSS splits it in two. */
  --elev-dark-high-border:     color-mix(in srgb, var(--vivid-blue-700) 30%, transparent);
  --elev-dark-high-border-lit: color-mix(in srgb, var(--vivid-blue-300) 30%, transparent);
  --elev-dark-high-border-w: var(--border-w);
  --elev-dark-high-shadow: var(--shadow-m),
                           inset -1px 1px 4px 0 color-mix(in srgb, var(--vivid-blue-200) 30%, transparent);
  --elev-dark-high-blur:   var(--shadow-m-blur);
  --elev-dark-high-fg:     var(--white);

  /* Whole fill at 95%. Figma 74:6497. */
  --elev-dark-medium-image:  radial-gradient(140% 200% at 100% 0%,
                               color-mix(in srgb, var(--ice-blue-500) 95%, transparent)  0%,
                               color-mix(in srgb, #476993 95%, transparent) 50%,
                               color-mix(in srgb, var(--ice-blue-800) 95%, transparent) 100%);
  /* Drawn as one linear stroke at 30%: ice-blue-700 at the shaded
     corner, ice-blue-300 at the lit one. CSS splits it in two. */
  --elev-dark-medium-border:     color-mix(in srgb, var(--ice-blue-700) 30%, transparent);
  --elev-dark-medium-border-lit: color-mix(in srgb, var(--ice-blue-300) 30%, transparent);
  --elev-dark-medium-border-w: var(--border-w);
  --elev-dark-medium-shadow: var(--shadow-m),
                             inset -1px 1px 4px 0 color-mix(in srgb, var(--ice-blue-200) 30%, transparent);
  --elev-dark-medium-blur:   var(--shadow-m-blur);
  --elev-dark-medium-fg:     var(--white);

  /* Whole fill at 95%, like the other two ink levels. Figma
     74:6525, which names the style — the button sheet 76:11774
     draws the same level from the colour BOARD values instead. */
  --elev-dark-low-image:  radial-gradient(140% 200% at 100% 0%,
                            color-mix(in srgb, var(--ice-blue-300) 95%, transparent)  0%,
                            color-mix(in srgb, #7B9BC4 95%, transparent) 50%,
                            color-mix(in srgb, var(--ice-blue-600) 95%, transparent) 100%);
  /* Drawn as one linear stroke: ice-blue-600 at 30% on the shaded
     corner, white at 20% on the lit one. */
  --elev-dark-low-border:     color-mix(in srgb, var(--ice-blue-600) 30%, transparent);
  --elev-dark-low-border-lit: color-mix(in srgb, var(--white) 20%, transparent);
  --elev-dark-low-border-w: var(--border-w);
  --elev-dark-low-shadow: var(--shadow-m),
                          inset -1px 1px 4px 0 rgb(214 229 255 / .20);
  --elev-dark-low-blur:   var(--shadow-m-blur);
  --elev-dark-low-fg:     var(--white);

  /* Success and warning — one recipe, two hue pairs. The glow climbs
     from the bottom-left and falls from the top-right. */
  --elev-success-glow-a:   var(--ice-turquoise-300);
  --elev-success-glow-b:   var(--vivid-green-50);
  --elev-success-glow-a-opacity: 20%;
  --elev-success-glow-b-opacity: 20%;
  /* The two glows as ONE value, so the three places that quote this
     elevation cannot each rebuild them differently. Layer order is
     glows first, fill last — the fill is what they sit on. */
  --elev-success-glows:
    radial-gradient(120% 200% at 0% 100%,
      color-mix(in srgb, var(--elev-success-glow-a) var(--elev-success-glow-a-opacity), transparent) 0%, transparent 100%),
    radial-gradient(120% 200% at 100% 0%,
      color-mix(in srgb, var(--elev-success-glow-b) var(--elev-success-glow-b-opacity), transparent) 0%, transparent 100%);
  --elev-success-image:  linear-gradient(210deg,
                           rgb(255 255 255 / .70), rgb(255 255 255 / .30));
  --elev-success-border:     rgb(255 255 255 / .30);
  --elev-success-border-lit: rgb(255 255 255 / .70);
  --elev-success-border-w: var(--border-w);
  --elev-success-shadow: var(--shadow-m);
  --elev-success-blur:   var(--shadow-m-blur);

  --elev-warning-glow-a:   var(--ice-red-400);
  --elev-warning-glow-b:   var(--ice-peach-100);
  --elev-warning-glow-a-opacity: 20%;
  --elev-warning-glow-b-opacity: 50%;
  /* The two glows as ONE value, so the three places that quote this
     elevation cannot each rebuild them differently. Layer order is
     glows first, fill last — the fill is what they sit on. */
  --elev-warning-glows:
    radial-gradient(120% 200% at 0% 100%,
      color-mix(in srgb, var(--elev-warning-glow-a) var(--elev-warning-glow-a-opacity), transparent) 0%, transparent 100%),
    radial-gradient(120% 200% at 100% 0%,
      color-mix(in srgb, var(--elev-warning-glow-b) var(--elev-warning-glow-b-opacity), transparent) 0%, transparent 100%);
  --elev-warning-image:  linear-gradient(var(--glass-dir),
                           rgb(255 255 255 / .80), rgb(255 255 255 / .50));
  --elev-warning-border:     rgb(255 255 255 / .30);
  --elev-warning-border-lit: rgb(255 255 255 / .70);
  --elev-warning-border-w: var(--border-w);
  --elev-warning-shadow: var(--shadow-m);
  --elev-warning-blur:   var(--shadow-m-blur);

  /* Choice indicator */
  --choice-on-image:  linear-gradient(var(--glass-dir-inv),
                        var(--ice-blue-400) 0%, var(--ice-blue-600) 100%);
  --choice-on-fg:     var(--white);
  --choice-on-shadow: inset 0 2px 6px 0 rgb(24 45 70 / .4),
                      0 1px .5px 0 rgb(255 255 255 / .5);
  --choice-on-border: transparent;
  --choice-off-image: linear-gradient(var(--glass-dir-inv),
                        var(--well-from), var(--well-to));
  --choice-off-shadow: var(--well-inset), 0 1px 1px 0 rgb(255 255 255 / .1);

  /* No text shadow needed: light text sits on light glass. */
  /* ---- Field ----  Figma 67:3350. Four states, each one an
     elevation plus its own stroke. */
  /* One flat colour per state, NOT the two-tone pair the elevations
     use. A lit/shaded split reads as light catching an edge only
     when the stroke is faint over a gradient; at this weight it just
     looks like two different borders. Judi's call. */
  --field-border:        color-mix(in srgb, var(--ice-grey-400) 30%, transparent);
  --field-border-filled: color-mix(in srgb, var(--ice-grey-500) 50%, transparent);
  --field-border-focus:  var(--vivid-blue-500);
  --field-placeholder:         var(--ice-grey-700);
  /* The leading icon, Figma 68:4577. Focus does not change it. */
  --field-icon:        var(--ice-grey-700);
  --field-icon-filled: var(--ice-blue-800);

  /* ---- Chip hues ----  Figma 68:4730. Five hues, two styles.
     Each is a pair for the fill plus two glow colours; the stroke
     and the label shadow are the pair's dark end. */
  --chip-fg:          var(--ice-blue-700);
  --chip-fill-from:   rgb(255 255 255 / .80);
  --chip-fill-to:     rgb(255 255 255 / .50);
  /* Outlined is now OPAQUE — that is what lets its stroke be a
     gradient: the ring is painted on the element and the fill is
     clipped over it. Figma: white 100% → white 95%. */
  --chip-outline-from: rgb(255 255 255 / 1);
  --chip-outline-to:   rgb(255 255 255 / .95);
  --chip-border:      rgb(255 255 255 / .30);
  --chip-border-lit:  rgb(255 255 255 / .70);






  /* ---- Badge hues ----  three, always filled. */

  /* ---- Component tokens ---- */
  --well-from: rgb(168 192 227 / .50);
  --well-to:   rgb(210 219 240 / .50);
  --well-inset: var(--shadow-inner-s);

  --tooltip-bg: var(--ice-blue-900);
  --tooltip-fg: var(--white);

  --scrollbar-thumb:        linear-gradient(to bottom,
                              rgb(131 162 215 / .35), rgb(88 115 157 / .45));
  --scrollbar-thumb-active: linear-gradient(to bottom,
                              rgb(131 162 215 / .75), rgb(88 115 157 / .85));
  --scrollbar-thin:         rgb(88 115 157 / .45);

  --select-ring-width: 3px;
  --select-ring-color: var(--accent);
  --select-ring-hover: var(--vivid-blue-400);

  --hover-veil:  rgb(255 255 255 / .30);
  --glass-inset: inset 0 1px 0 0 rgb(255 255 255 / .45);
  --focus-ring:  0 0 0 3px rgb(131 162 215 / .55);

  --text-shadow-legible: none;
}


/* ------------------------------------------------------------
   DARK SURFACE
   ------------------------------------------------------------
   NOTE: these are grounded in the mobile dark screen (24:3725) and
   the dark app screen. They get a dedicated tuning pass in Phase 7
   once the dark onboarding context is read — expect refinement, not
   restructuring. The NAMES are final; only values may move.
   ------------------------------------------------------------ */
[data-surface="dark"],
:root[data-theme="dark"] {

  --surface-is-dark: 1;

  /* Foreground — the same emphasis scale, measured from 39:1141 /
     24:3725. The rungs are derived the same way, so the shape of
     the ramp survives the polarity. */
  --fg-high:   var(--white);
  --fg-medium: rgb(234 242 255 / .80);   /* ice-blue-50 @ 80% */
  --fg-low:    color-mix(in srgb, var(--fg-medium) 80%, transparent);

  --fg-icon-high:   var(--fg-medium);
  --fg-icon-medium: color-mix(in srgb, var(--fg-medium) 80%, transparent);
  --fg-icon-low:    color-mix(in srgb, var(--fg-medium) 60%, transparent);
  --fg-disabled:  rgb(234 242 255 / .30);
  --fg-accent:    var(--ice-blue-300);
  --fg-link:       var(--link-sand);       /* warm sand — see §BREAK 3 */
  --fg-link-hover: var(--gold-300);       /* warm gold, lifted for a dark ground */
  --link-underline: rgb(233 214 199 / .45);
  --fg-on-accent: var(--ice-blue-900);
  --fg-success:   var(--ice-blue-200);

  /* Same tint, dropped in opacity so it reads on a dark ground. */

  /* Accent / interaction */
  --accent:        var(--ice-blue-400);
  --accent-strong: var(--ice-blue-300);
  --accent-soft:   var(--ice-blue-600);
  --accent-subtle: var(--ice-blue-700);

  /* Solid fills */
  --bg-solid:  var(--ice-blue-900);
  --bg-subtle: var(--ice-grey-900);
  --bg-sunken: #0C1728;

  /* Hairlines */
  --border-hairline: rgb(242 233 224 / .30);
  --border-quiet:    rgb(242 233 224 / .15);
  --border-strong:   rgb(255 255 255 / .35);
  --border-divider:  rgb(255 255 255 / .12);

  /* Shadow hue — deep and cold on dark. */

  /* ---- Shadow scale ----  same names, same geometry.
     Never drawn on dark: the ink goes near-black and the opacities
     roughly triple.                                                 */
  --shadow-ink: #061020;
  --shadow-none:        none;
  --shadow-none-blur:   6px;
  --shadow-xs:          0  2px  6px  -2px color-mix(in srgb, var(--shadow-ink) 50%, transparent);
  --shadow-xs-blur:     3px;
  --shadow-s:           0  4px 12px  -4px color-mix(in srgb, var(--shadow-ink) 55%, transparent);
  --shadow-s-blur:      4.5px;
  --shadow-m:           0  6px 18px  -6px color-mix(in srgb, var(--shadow-ink) 60%, transparent);
  --shadow-m-blur:      6px;
  --shadow-l:           0  8px 24px  -8px color-mix(in srgb, var(--shadow-ink) 65%, transparent);
  --shadow-l-blur:      7.5px;
  --shadow-xl:          0 12px 36px -12px color-mix(in srgb, var(--shadow-ink) 70%, transparent);
  --shadow-xl-blur:     7.5px;
  --shadow-highlight:   0  4px 12px  -4px rgb(0 250 252 / .25),
                        0 12px 36px -12px color-mix(in srgb, var(--vivid-blue-600) 60%, transparent);
  --shadow-highlight-blur: 7.5px;
  /* The inner shadows carry the lit lip under them — one effect. */
  --shadow-inner-s:     inset 0 1px 3px 0 color-mix(in srgb, var(--shadow-ink) 22%, transparent),
                        0 1px 1px 0 rgb(234 242 255 / .15);
  --shadow-inner-s-blur: 3px;
  --shadow-inner-m:     inset 0 2px 6px 0 color-mix(in srgb, var(--shadow-ink) 22%, transparent),
                        0 1px 1px 0 rgb(234 242 255 / .15);
  --shadow-inner-m-blur: 3px;
  --shadow-inner-l:     inset 0 3px 9px 0 color-mix(in srgb, var(--shadow-ink) 22%, transparent),
                        0 2px 1px 0 rgb(234 242 255 / .15);
  --shadow-inner-l-blur: 3px;
  --shadow-inner-s-strong: inset 0 1px 3px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 1px 1px 0 rgb(234 242 255 / .15);
  --shadow-inner-m-strong: inset 0 2px 6px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 1px 1px 0 rgb(234 242 255 / .15);
  --shadow-inner-l-strong: inset 0 3px 9px 0 color-mix(in srgb, var(--shadow-ink) 40%, transparent),
                        0 2px 1px 0 rgb(234 242 255 / .15);

  /* ---- Elevations ----  same names.
     Never drawn on a dark surface: the white glass goes to ink and
     `dark` inverts to a light pebble, as the screens do. Everything
     else is carried over.

     PRIMARY    white glass, lifts off the page
       1 · 2 · 3 · 4        .30→.15   .60→.20   .80→.50   .95→.80
       highlight           the fill of 4 plus a cyan/blue glow
     SECONDARY  blue-tinted, sits in the page, inner shadow
       0 · 1 · 2
     INK        the two solid pills
       dark-high · dark-medium · dark-low
     TINTED     glass plus a duotone glow
       success · warning
     ------------------------------------------------------- */
  --elev-primary-1-image:  linear-gradient(var(--glass-dir),
                             rgb(24 45 70 / .45), rgb(24 45 70 / .28));
  --elev-primary-1-border:     rgb(255 255 255 / .15);
  --elev-primary-1-border-lit: rgb(255 255 255 / .35);
  --elev-primary-1-border-w: var(--border-w);
  --elev-primary-1-shadow: var(--shadow-xs);
  --elev-primary-1-blur:   var(--shadow-xs-blur);

  --elev-primary-2-image:  linear-gradient(var(--glass-dir),
                             rgb(24 45 70 / .68), rgb(24 45 70 / .45));
  --elev-primary-2-border:     rgb(255 255 255 / .40);
  --elev-primary-2-border-lit: rgb(255 255 255 / .70);
  --elev-primary-2-border-w: var(--border-w);
  --elev-primary-2-shadow: var(--shadow-s);
  --elev-primary-2-blur:   var(--shadow-s-blur);

  --elev-primary-3-image:  linear-gradient(var(--glass-dir),
                             rgb(24 45 70 / .86), rgb(24 45 70 / .62));
  --elev-primary-3-border:     rgb(255 255 255 / .30);
  --elev-primary-3-border-lit: rgb(255 255 255 / .70);
  --elev-primary-3-border-w: var(--border-w);
  --elev-primary-3-shadow: var(--shadow-m);
  --elev-primary-3-blur:   var(--shadow-m-blur);

  --elev-primary-3-image-inv: linear-gradient(var(--glass-dir-inv),
                             rgb(24 45 70 / .86), rgb(24 45 70 / .62));

  --elev-primary-4-image:  linear-gradient(var(--glass-dir),
                             rgb(24 45 70 / .95), rgb(24 45 70 / .80));
  --elev-primary-4-border:     rgb(255 255 255 / .30);
  --elev-primary-4-border-lit: rgb(255 255 255 / .70);
  --elev-primary-4-border-w: var(--border-w);
  --elev-primary-4-shadow: var(--shadow-xl);
  --elev-primary-4-blur:   var(--shadow-xl-blur);

  --elev-highlight-image:  var(--elev-primary-4-image);
  --elev-highlight-border:     rgb(255 255 255 / .30);
  --elev-highlight-border-lit: rgb(255 255 255 / .70);
  --elev-highlight-border-w: var(--border-w);
  --elev-highlight-shadow: var(--shadow-highlight);
  --elev-highlight-blur:   var(--shadow-highlight-blur);

  /* The hover twin of the ink pills. Same radial geometry as
     dark-high, cyan at the lit corner, whole fill at 95%.
     Figma 76:11825 / 76:11920. The two middle stops are straight
     interpolations between the two ends, as on dark-high. */
  --elev-highlight-ink-image: radial-gradient(140% 200% at 100% 0%,
      color-mix(in srgb, var(--vivid-turquoise-200) 95%, transparent)  0%,
      color-mix(in srgb, #15A6E5 95%, transparent)  50%,
      color-mix(in srgb, #0B88DD 95%, transparent)  75%,
      color-mix(in srgb, var(--vivid-blue-600) 95%, transparent) 100%);
  /* One linear stroke at 30%: vivid-blue-400 at the shaded corner,
     vivid-turquoise-50 at the lit one. */
  --elev-highlight-ink-border:     color-mix(in srgb, var(--vivid-blue-400) 30%, transparent);
  --elev-highlight-ink-border-lit: color-mix(in srgb, var(--vivid-turquoise-50) 30%, transparent);
  --elev-highlight-ink-border-w:   var(--border-w);
  --elev-highlight-ink-shadow: var(--shadow-highlight);
  --elev-highlight-ink-blur:   var(--shadow-highlight-blur);
  --elev-highlight-ink-fg:     var(--white);

  --elev-secondary-0-image:  linear-gradient(var(--glass-dir),
                               rgb(131 162 215 / .20), rgb(168 192 227 / .20));
  --elev-secondary-0-border:     transparent;
  --elev-secondary-0-border-lit: transparent;
  --elev-secondary-0-border-w: 0;
  --elev-secondary-0-shadow: var(--shadow-none);
  --elev-secondary-0-blur:   0px;

  --elev-secondary-1-image:  linear-gradient(210deg,
                               rgb(219 230 250 / .20), rgb(123 160 223 / .30));
  --elev-secondary-1-border:     transparent;
  --elev-secondary-1-border-lit: transparent;
  --elev-secondary-1-border-w: 0;
  --elev-secondary-1-shadow: var(--shadow-inner-s);
  --elev-secondary-1-blur:   var(--shadow-inner-s-blur);

  --elev-secondary-2-image:  linear-gradient(30deg,
                               rgb(88 115 157 / .40), rgb(168 192 227 / .20));
  --elev-secondary-2-border:     transparent;
  --elev-secondary-2-border-lit: transparent;
  --elev-secondary-2-border-w: 0;
  --elev-secondary-2-shadow: var(--shadow-inner-m);
  --elev-secondary-2-blur:   var(--shadow-inner-m-blur);

  /* ---- Ink ----  inverted: on a dark surface these become light
     pebbles with ink text, as the screens do. Never drawn. */
  --elev-dark-high-image:  linear-gradient(198deg,
                             rgb(255 255 255 / .95) 0%, rgb(255 255 255 / .70) 100%);
  --elev-dark-high-border:     rgb(255 255 255 / .50);
  --elev-dark-high-border-lit: rgb(255 255 255 / .85);
  --elev-dark-high-border-w: var(--border-w);
  --elev-dark-high-shadow: var(--shadow-m);
  --elev-dark-high-blur:   var(--shadow-m-blur);
  --elev-dark-high-fg:     var(--ice-blue-900);

  --elev-dark-medium-image:  linear-gradient(198deg,
                               rgb(234 242 255 / .80) 0%, rgb(234 242 255 / .55) 100%);
  --elev-dark-medium-border:     rgb(255 255 255 / .40);
  --elev-dark-medium-border-lit: rgb(255 255 255 / .70);
  --elev-dark-medium-border-w: var(--border-w);
  --elev-dark-medium-shadow: var(--shadow-m);
  --elev-dark-medium-blur:   var(--shadow-m-blur);
  --elev-dark-medium-fg:     var(--ice-blue-900);

  --elev-dark-low-image:  linear-gradient(198deg,
                            rgb(234 242 255 / .55) 0%, rgb(234 242 255 / .30) 100%);
  --elev-dark-low-border:     rgb(255 255 255 / .30);
  --elev-dark-low-border-lit: rgb(255 255 255 / .55);
  --elev-dark-low-border-w: var(--border-w);
  --elev-dark-low-shadow: var(--shadow-m);
  --elev-dark-low-blur:   var(--shadow-m-blur);
  --elev-dark-low-fg:     var(--white);

  /* Success and warning — one recipe, two hue pairs. The glow climbs
     from the bottom-left and falls from the top-right. */
  --elev-success-glow-a:   var(--ice-turquoise-300);
  --elev-success-glow-b:   var(--vivid-green-50);
  --elev-success-glow-a-opacity: 20%;
  --elev-success-glow-b-opacity: 20%;
  /* The two glows as ONE value, so the three places that quote this
     elevation cannot each rebuild them differently. Layer order is
     glows first, fill last — the fill is what they sit on. */
  --elev-success-glows:
    radial-gradient(120% 200% at 0% 100%,
      color-mix(in srgb, var(--elev-success-glow-a) var(--elev-success-glow-a-opacity), transparent) 0%, transparent 100%),
    radial-gradient(120% 200% at 100% 0%,
      color-mix(in srgb, var(--elev-success-glow-b) var(--elev-success-glow-b-opacity), transparent) 0%, transparent 100%);
  --elev-success-image:  linear-gradient(210deg,
                           rgb(255 255 255 / .70), rgb(255 255 255 / .30));
  --elev-success-border:     rgb(255 255 255 / .30);
  --elev-success-border-lit: rgb(255 255 255 / .70);
  --elev-success-border-w: var(--border-w);
  --elev-success-shadow: var(--shadow-m);
  --elev-success-blur:   var(--shadow-m-blur);

  --elev-warning-glow-a:   var(--ice-red-400);
  --elev-warning-glow-b:   var(--ice-peach-100);
  --elev-warning-glow-a-opacity: 20%;
  --elev-warning-glow-b-opacity: 50%;
  /* The two glows as ONE value, so the three places that quote this
     elevation cannot each rebuild them differently. Layer order is
     glows first, fill last — the fill is what they sit on. */
  --elev-warning-glows:
    radial-gradient(120% 200% at 0% 100%,
      color-mix(in srgb, var(--elev-warning-glow-a) var(--elev-warning-glow-a-opacity), transparent) 0%, transparent 100%),
    radial-gradient(120% 200% at 100% 0%,
      color-mix(in srgb, var(--elev-warning-glow-b) var(--elev-warning-glow-b-opacity), transparent) 0%, transparent 100%);
  --elev-warning-image:  linear-gradient(var(--glass-dir),
                           rgb(24 45 70 / .86), rgb(24 45 70 / .62));
  --elev-warning-border:     rgb(255 255 255 / .30);
  --elev-warning-border-lit: rgb(255 255 255 / .70);
  --elev-warning-border-w: var(--border-w);
  --elev-warning-shadow: var(--shadow-m);
  --elev-warning-blur:   var(--shadow-m-blur);

  /* Choice indicator — also inverted. */
  --choice-on-image:  linear-gradient(var(--glass-dir-inv),
                        rgb(255 255 255 / .85) 0%, rgb(234 242 255 / .60) 100%);
  --choice-on-fg:     var(--ice-blue-900);
  --choice-on-shadow: 0 8px 22px -4px rgb(24 45 70 / .5);
  --choice-on-border: rgb(255 255 255 / .3);
  --choice-off-image: linear-gradient(var(--glass-dir-inv),
                        rgb(24 45 70 / .20), rgb(24 45 70 / .35));
  --choice-off-shadow: var(--shadow-inner-s),
                       0 1px 1px 0 rgb(234 242 255 / .15);

  /* ---- Field ----  carried over, never drawn on dark. */
  /* Not measured on a dark surface yet. */
  --field-border:        rgb(255 255 255 / .30);
  --field-border-filled: rgb(255 255 255 / .50);
  --field-border-focus:  var(--vivid-blue-300);
  --field-placeholder:         var(--ice-grey-300);
  /* Not measured on a dark surface yet. */
  --field-icon:        var(--ice-grey-300);
  --field-icon-filled: var(--white);

  /* ---- Chip hues ----  same names. Only the neutral glass moves. */
  --chip-fg:          var(--ice-blue-50);
  --chip-fill-from:   rgb(24 45 70 / .80);
  --chip-fill-to:     rgb(24 45 70 / .50);
  --chip-outline-from: rgb(24 45 70 / 1);
  --chip-outline-to:   rgb(24 45 70 / .95);
  --chip-border:      rgb(255 255 255 / .30);
  --chip-border-lit:  rgb(255 255 255 / .70);






  /* ---- Badge hues ----  three, always filled. */

  /* ---- Component tokens ----  carried over, never drawn. */
  --well-from: rgb(24 45 70 / .35);
  --well-to:   rgb(24 45 70 / .20);
  --well-inset: var(--shadow-inner-s);

  --tooltip-bg: var(--white);
  --tooltip-fg: var(--ice-blue-900);

  --scrollbar-thumb:        linear-gradient(to bottom,
                              rgb(234 242 255 / .25), rgb(234 242 255 / .35));
  --scrollbar-thumb-active: linear-gradient(to bottom,
                              rgb(234 242 255 / .55), rgb(234 242 255 / .70));
  --scrollbar-thin:         rgb(234 242 255 / .35);

  --select-ring-width: 4px;
  --select-ring-color: rgb(24 45 70 / .50);
  --select-ring-hover: var(--vivid-blue-400);

  --hover-veil:  rgb(255 255 255 / .10);
  --glass-inset: inset 0 1px 0 0 rgb(255 255 255 / .20);
  --focus-ring:  0 0 0 3px rgb(234 242 255 / .45);

  /* Dark surfaces sit over photography — titles need lifting. */
  --text-shadow-legible: 0 1px 3px rgb(27 44 70 / .40);
}


/* ============================================================
   GLASS — the only surface material
   ------------------------------------------------------------
       <div class="ice-glass" data-elevation="2">…</div>

   Twelve elevations. Each brings its fill, its two-tone stroke,
   its shadow AND the background blur that goes with it — in Figma
   these are one effect style, so they travel together here.

     PRIMARY    1 · 2 · 3 · 4 · highlight     white, lifts off
     SECONDARY  secondary-0 · 1 · 2           blue, sits in
     INK        dark-high · -medium · -low    three solid pills
     TINTED     success · warning             glass + duotone glow

   Figma 66:1938.
   ============================================================ */
.ice-glass {
  --_image:      var(--elev-primary-2-image);
  --_border:     var(--elev-primary-2-border);
  --_border-lit: var(--elev-primary-2-border-lit);
  --_shadow:     var(--elev-primary-2-shadow);
  --_blur:       var(--elev-primary-2-blur);

  /* Width comes from the elevation too, because a transparent border
     is NOT the same as no border: an inset shadow starts at the
     padding edge, so a 1px transparent ring stays unshadowed and
     reads as a pale hairline. The levels drawn without a stroke —
     the three secondary ones — set their -border-w to 0. */
  --_border-w:   var(--elev-primary-2-border-w);

  background-image: var(--_image);
  border: var(--_border-w) solid;
  border-color: var(--_border-lit) var(--_border-lit)
                var(--_border)     var(--_border);
  box-shadow: var(--_shadow);
  backdrop-filter: blur(var(--_blur));
  -webkit-backdrop-filter: blur(var(--_blur));
}

.ice-glass[data-elevation="1"] {
  --_image:      var(--elev-primary-1-image);
  --_border:     var(--elev-primary-1-border);
  --_border-lit: var(--elev-primary-1-border-lit);
  --_shadow:     var(--elev-primary-1-shadow);
  --_border-w:   var(--elev-primary-1-border-w);
  --_blur:       var(--elev-primary-1-blur);
}
.ice-glass[data-elevation="2"] {
  --_image:      var(--elev-primary-2-image);
  --_border:     var(--elev-primary-2-border);
  --_border-lit: var(--elev-primary-2-border-lit);
  --_shadow:     var(--elev-primary-2-shadow);
  --_border-w:   var(--elev-primary-2-border-w);
  --_blur:       var(--elev-primary-2-blur);
}
.ice-glass[data-elevation="3"] {
  --_image:      var(--elev-primary-3-image);
  --_border:     var(--elev-primary-3-border);
  --_border-lit: var(--elev-primary-3-border-lit);
  --_shadow:     var(--elev-primary-3-shadow);
  --_border-w:   var(--elev-primary-3-border-w);
  --_blur:       var(--elev-primary-3-blur);
}
.ice-glass[data-elevation="4"] {
  --_image:      var(--elev-primary-4-image);
  --_border:     var(--elev-primary-4-border);
  --_border-lit: var(--elev-primary-4-border-lit);
  --_shadow:     var(--elev-primary-4-shadow);
  --_border-w:   var(--elev-primary-4-border-w);
  --_blur:       var(--elev-primary-4-blur);
}
.ice-glass[data-elevation="highlight"] {
  --_image:      var(--elev-highlight-image);
  --_border:     var(--elev-highlight-border);
  --_border-lit: var(--elev-highlight-border-lit);
  --_shadow:     var(--elev-highlight-shadow);
  --_border-w:   var(--elev-highlight-border-w);
  --_blur:       var(--elev-highlight-blur);
}
.ice-glass[data-elevation="secondary-0"] {
  --_image:      var(--elev-secondary-0-image);
  --_border:     var(--elev-secondary-0-border);
  --_border-lit: var(--elev-secondary-0-border-lit);
  --_shadow:     var(--elev-secondary-0-shadow);
  --_border-w:   var(--elev-secondary-0-border-w);
  --_blur:       var(--elev-secondary-0-blur);
}
.ice-glass[data-elevation="secondary-1"] {
  --_image:      var(--elev-secondary-1-image);
  --_border:     var(--elev-secondary-1-border);
  --_border-lit: var(--elev-secondary-1-border-lit);
  --_shadow:     var(--elev-secondary-1-shadow);
  --_border-w:   var(--elev-secondary-1-border-w);
  --_blur:       var(--elev-secondary-1-blur);
}
.ice-glass[data-elevation="secondary-2"] {
  --_image:      var(--elev-secondary-2-image);
  --_border:     var(--elev-secondary-2-border);
  --_border-lit: var(--elev-secondary-2-border-lit);
  --_shadow:     var(--elev-secondary-2-shadow);
  --_border-w:   var(--elev-secondary-2-border-w);
  --_blur:       var(--elev-secondary-2-blur);
}
.ice-glass[data-elevation="highlight-ink"] {
  --_image:      var(--elev-highlight-ink-image);
  --_border:     var(--elev-highlight-ink-border);
  --_border-lit: var(--elev-highlight-ink-border-lit);
  --_border-w:   var(--elev-highlight-ink-border-w);
  --_shadow:     var(--elev-highlight-ink-shadow);
  --_blur:       var(--elev-highlight-ink-blur);
  color: var(--elev-highlight-ink-fg);
}
.ice-glass[data-elevation="dark-high"] {
  --_image:      var(--elev-dark-high-image);
  --_border:     var(--elev-dark-high-border);
  --_border-lit: var(--elev-dark-high-border-lit);
  --_shadow:     var(--elev-dark-high-shadow);
  --_border-w:   var(--elev-dark-high-border-w);
  --_blur:       var(--elev-dark-high-blur);
  color: var(--elev-dark-high-fg);
}
.ice-glass[data-elevation="dark-medium"] {
  --_image:      var(--elev-dark-medium-image);
  --_border:     var(--elev-dark-medium-border);
  --_border-lit: var(--elev-dark-medium-border-lit);
  --_shadow:     var(--elev-dark-medium-shadow);
  --_border-w:   var(--elev-dark-medium-border-w);
  --_blur:       var(--elev-dark-medium-blur);
  color: var(--elev-dark-medium-fg);
}
.ice-glass[data-elevation="dark-low"] {
  --_image:      var(--elev-dark-low-image);
  --_border:     var(--elev-dark-low-border);
  --_border-lit: var(--elev-dark-low-border-lit);
  --_shadow:     var(--elev-dark-low-shadow);
  --_border-w:   var(--elev-dark-low-border-w);
  --_blur:       var(--elev-dark-low-blur);
  color: var(--elev-dark-low-fg);
}

/* Over ink, a label needs a shadow of its own to hold. */
.ice-glass[data-elevation^="dark-"] { text-shadow: 0 1px 3px rgb(79 113 136 / .25); }

.ice-glass[data-elevation="success"],
.ice-glass[data-elevation="warning"] {
  background-image:
    radial-gradient(120% 200% at 0% 100%,
      color-mix(in srgb, var(--_glow-a) var(--_glow-a-opacity), transparent) 0%, transparent 100%),
    radial-gradient(120% 200% at 100% 0%,
      color-mix(in srgb, var(--_glow-b) var(--_glow-b-opacity), transparent) 0%, transparent 100%),
    var(--_image);
}
.ice-glass[data-elevation="success"] {
  --_glow-a: var(--elev-success-glow-a); --_glow-a-opacity: var(--elev-success-glow-a-opacity);
  --_glow-b: var(--elev-success-glow-b); --_glow-b-opacity: var(--elev-success-glow-b-opacity);
}
.ice-glass[data-elevation="warning"] {
  --_glow-a: var(--elev-warning-glow-a); --_glow-a-opacity: var(--elev-warning-glow-a-opacity);
  --_glow-b: var(--elev-warning-glow-b); --_glow-b-opacity: var(--elev-warning-glow-b-opacity);
}

/* Opt in to the edge highlight where the design shows one. */
.ice-glass[data-inset] {
  box-shadow: var(--_shadow), var(--glass-inset);
}

/* Browsers without backdrop-filter get a denser fill so text stays
   legible over the photographic background. */
@supports not (backdrop-filter: blur(1px)) {
  .ice-glass {
    --_from: color-mix(in srgb, var(--bg-solid) 82%, transparent);
    --_to:   color-mix(in srgb, var(--bg-solid) 70%, transparent);
  }
}


/* ============================================================
   SURFACE ROOT
   ------------------------------------------------------------
   Any element carrying data-surface adopts that polarity's base
   text colour, so nested surfaces are legible without extra markup.
   ============================================================ */
[data-surface] {
  color: var(--fg-medium);
}
