/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  LIQUID GLASS — CONTROL PANEL                                          ║
   ║  Edit these to tune the glass EVERYWHERE (buttons, pills, navs).        ║
   ║  One source of truth — change a value here and every glass surface      ║
   ║  updates together.                                                      ║
   ║                                                                        ║
   ║  v2 · 2026-07-28 — the fill now SURVIVES A LIGHT GROUND.               ║
   ║  See "What changed in v2" at the bottom of this file.                  ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
:root {
  /* ── TINT — the colour wash ─────────────────────────────────────────
     A MID-TONE, not white. This is the single most important value in the
     kit and the one most likely to be "corrected" back by mistake.

     v1 was rgba(255,255,255,0.05) — a dark-ground recipe. It reads as a pane
     only because it is lighter than what is behind it. Measured on a light
     canvas (#F4F2EE) it composited to rgb(244.5,242.6,238.8) against a ground
     of rgb(244,242,238): LIGHTER than the surface it sits on. The pane was not
     faint there, it was INVERTED — glass is meant to sit ON a surface, and
     that one receded behind it. Raising the alpha only deepens the failure.

     A mid-tone lightens a dark ground and darkens a light one, so ONE value
     behaves correctly on both:
       on #0a0a0a  → rgb(27,27,26)     +17 lighter
       on #F4F2EE  → rgb(233,231,226)  −11 darker
       on #FFFFFF  → rgb(243,243,241)  −12 darker
     Correct direction on every ground.

     The hue is a warm neutral rather than pure grey, which gives the material
     a faint warmth instead of reading as generic frosted plastic. Re-tint it
     to your own brand's neutral — keep the LIGHTNESS mid-range. */
  --lg-fill:        rgba(154, 151, 138, 0.12);

  /* Brand-tinted variant. 0.28 rather than v1's 0.22 for the same reason: at
     22% over a light canvas it composited to a pale peach that read as a
     tinted rectangle rather than coloured glass. */
  --lg-fill-orange:       rgba(255, 163, 63, 0.28);
  --lg-fill-orange-hover: rgba(255, 163, 63, 0.38);

  /* WIDE bars (full-width navs) keep their own DARK tint and are deliberately
     not mid-toned: a dark pane already survives a light ground, and a wide bar
     sits over arbitrary content where a warm cast would soften legibility. */
  --lg-fill-nav:    rgba(20, 22, 30, 0.52);

  /* ── FROST — the blur (atoms, so each is tunable; --lg-frost composes them) */
  --lg-blur: 8px;    /* frost blur radius */
  --lg-sat:  1.5;    /* frost saturation */
  --lg-frost: blur(var(--lg-blur)) saturate(var(--lg-sat));

  /* ── EDGE — hairline rim */
  --lg-rim: 0.51px solid rgba(255, 255, 255, 0.14);

  /* ── INK — the label colour ON the glass ────────────────────────────
     v2 addition. The class used to set a material but never a text colour, so
     a bare `<button class="liquid-glass">` inherited the UA default
     `buttontext` (pure black) and measured ~1.13:1 on a dark canvas. It was
     invisible as a bug because every real-world glass surface happened to set
     its own colour — the defect only appears when the primitive is used ALONE,
     which is exactly what a reusable primitive invites. Inheriting is not
     enough either: form controls do not inherit colour.

     Point this at your own text token. The ink must follow THE GROUND, not the
     material — the glass is the same in a dark room and a bright one, but the
     label on it is not. */
  --lg-ink: rgba(255, 255, 255, 0.95);          /* on a dark ground */
  --lg-ink-on-light: rgba(26, 20, 14, 0.94);    /* on a bright ground */

  /* ── SHEEN — broad glossy top-light (0 = off; raise for more gloss) */
  --lg-sheen: 0;

  /* ── SHINE — 10-layer specular box-shadow: 8 inset gloss/contour layers +
     2 outer depth drops. This stack IS the visible glossy bevel. */
  --lg-shine:
    inset 0 0 0 0.64px rgba(255, 255, 255, 0.063),
    inset 1.15px 1.92px 0 -1.28px rgba(255, 255, 255, 0.567),
    inset -1.28px -1.28px 0 -1.28px rgba(255, 255, 255, 0.504),
    inset -1.92px -5.12px 0.64px -3.84px rgba(255, 255, 255, 0.378),
    inset -0.19px -0.64px 2.56px 0 rgba(0, 0, 0, 0.076),
    inset -0.96px 1.6px 0 -1.28px rgba(0, 0, 0, 0.126),
    inset 0 1.92px 2.56px -1.28px rgba(0, 0, 0, 0.126),
    inset 1.28px -4.16px 0.64px -2.56px rgba(0, 0, 0, 0.063),
    /* The two OUTER drops. On a dark ground these barely register — the eight
       inset layers carry the whole bevel there. On a LIGHT ground the inverse
       is true: every white inset vanishes and these two are the only thing
       separating the pane from the paper. Raised in v2 (0.10→0.13, 0.08→0.11)
       alongside the fill tint, because a tinted face with no edge still reads
       as a flat patch rather than a pane above a surface. */
    0 1px 5px 0 rgba(0, 0, 0, 0.13),
    0 6px 16px 0 rgba(0, 0, 0, 0.11);
}

/* ── Light ground: swap the ink ────────────────────────────────────────
   The FILL does not change — one material, every ground. Only the label ink
   follows the surface. Wire this to however your project signals light mode. */
[data-theme="light"] {
  --lg-ink: var(--lg-ink-on-light);
}

/* ╔══════════════════════════════════════════════════════════════════════╗
   ║  WHAT CHANGED IN v2 (2026-07-28)                                       ║
   ║                                                                        ║
   ║  1. --lg-fill  white-5% → warm mid-neutral 12%.                        ║
   ║     v1 only ever had to survive a dark demo page. On any light surface  ║
   ║     it composited LIGHTER than its own ground and disappeared.          ║
   ║  2. --lg-fill-orange 0.22 → 0.28 (hover 0.32 → 0.38), same reason.     ║
   ║  3. Outer drops 0.10/0.08 → 0.13/0.11 — the edge on light grounds.     ║
   ║  4. NEW --lg-ink / --lg-ink-on-light — the primitive now sets a label   ║
   ║     colour instead of inheriting the UA default.                        ║
   ║                                                                        ║
   ║  Unchanged: blur, saturation, rim, sheen, and all eight inset shine     ║
   ║  layers. The refraction engine is untouched.                            ║
   ║                                                                        ║
   ║  THE RULE v2 MAKES EXPLICIT: glass needs something behind it. Over a    ║
   ║  flat, empty surface there is nothing to frost and nothing to refract,  ║
   ║  so it will always be quiet no matter how you tune it. Put glass over   ║
   ║  content — imagery, a tinted band, a gradient, a scrolling list. If a   ║
   ║  glass control has nothing behind it, it should not be glass.           ║
   ╚══════════════════════════════════════════════════════════════════════╝ */
