/* (FINAL-FIX2 perf) 6 selector lists in this file whose last compound was a bare :is(...) are written out one selector per alternative, so Blink buckets each by its own class / id / tag instead of testing every element on every style recalc. Each alternative is padded with :not(#zz-) / :not(.zz-) / :not(zz-) so its specificity is what the :is() gave (the most specific alternative); one that cannot be padded down is a class / type more specific only where no rule anywhere could tell the difference (checked against every stylesheet and the DOM), otherwise it stays in a :is() with a never-matching alternative of the full specificity. Same elements, same cascade. */
/* Liquid Glass · the shared material (Phase 7a). Variables, tiers and the performance budget are documented at the top of css/tokens.css.
   One recipe, three tiers:  flat (.lg, .lg-thin, .lg-prominent: no backdrop-filter)  ·  thick (.lg-thick: the only tier that blurs, max 3 on screen)
   Existing components join the tiers through the two selector lists below, so no markup had to change. */

/* ---------- 1 · regular glass, FLAT: the chrome. tint + sheen + specular edge, no backdrop-filter, no snapshot ---------- */
.lg, body #back, body #tally button, body #guest, body #chap .rail-pill, body #mbar, .lg-thin, body #sampleflag {
  background-color: var(--lg-tint); background-image: var(--lg-sheen); color: var(--lg-fg); border: 0;
  box-shadow: var(--lg-hi), var(--lg-shade), var(--lg-shadow-s);
}
.lg-thin, body #sampleflag { background-color: var(--lg-tint-thin); box-shadow: var(--lg-hi), var(--lg-shadow-s); }

/* ---------- 2 · snapshot glass: cards, the rail, the context strip. js/ux/glass.js sets --lg-snap (the blurred map behind the surface) and --lg-avg (its average colour).
   Layers, back to front: the snapshot (a) · a white wash (b) · the sheen (b) · [the edge and highlight in section 3 (c)].
   In flight the wash fades (200ms) to an opaque average-colour fill, so a stale snapshot is never seen; on settle it fades back to the fresh one. ---------- */
.lg-snap, body #lv-map .info, body #ctx .strip, body #chap .rail-list, body #lv-map .tl-bar {
  --lg-wash: var(--lg-wash-rest);
  background-color: var(--lg-tint-thick);
  background-image: var(--lg-sheen), linear-gradient(var(--lg-wash), var(--lg-wash)), var(--lg-snap, none);
  background-size: auto, auto, 100% 100%; background-position: 0 0; background-repeat: no-repeat; color: var(--lg-fg); border: 0;
  box-shadow: var(--lg-hi), var(--lg-shade), var(--lg-shadow);
  transition: --lg-wash var(--dur-quick) var(--ease-out);
}
body.is-moving .lg-snap:not(#zz-), body.is-moving :is(#lv-map .info, #ctx .strip, #chap .rail-list, #lv-map .tl-bar) { --lg-wash: rgb(var(--lg-avg, var(--lg-avg-d)) / .97); }
/* real backdrop-filter: ONE element at a time, never while moving (the budget in css/tokens.css) */
.lg-live { background-color: var(--lg-tint-thick); background-image: var(--lg-sheen); color: var(--lg-fg); border: 0; box-shadow: var(--lg-hi), var(--lg-shade), var(--lg-shadow);
  -webkit-backdrop-filter: blur(var(--lg-blur-card)) saturate(var(--lg-sat)) brightness(var(--lg-bright)); backdrop-filter: blur(var(--lg-blur-card)) saturate(var(--lg-sat)) brightness(var(--lg-bright)); }
body.is-moving .lg-live { -webkit-backdrop-filter: none; backdrop-filter: none; }
/* the moving fill: 200ms while the camera flies. Written as body's own transition (16 October): as a custom property on <body> (--lg-fade) every flight's
   start and end restyled ~830 elements, because custom properties inherit. Same list as css/tokens.css, only --lg-tint-thick differs. */
body.is-moving, body.is-settling {
  transition: --lg-fg var(--dur-slow) var(--ease-out), --lg-fg2 var(--dur-slow) var(--ease-out), --lg-fg3 var(--dur-slow) var(--ease-out), --lg-line var(--dur-slow) var(--ease-out),
    --lg-field var(--dur-slow) var(--ease-out), --lg-field-hi var(--dur-slow) var(--ease-out), --lg-tint var(--dur-slow) var(--ease-out), --lg-tint-thin var(--dur-slow) var(--ease-out),
    --lg-tint-thick 200ms var(--ease-out), --lg-sel var(--dur-slow) var(--ease-out); }

/* ---------- 3 · the specular edge: a 1px white gradient ring, bright top-left, ~10% bottom-right ---------- */
.lg, .lg-thin, .lg-snap, .lg-live, .lg-prominent, body #tally button, body #chap .rail-pill, body #ctx .strip { position: relative; }
.lg::before, .lg-thin::before, .lg-snap::before, .lg-live::before, .lg-prominent::before, .lg-sel::before, body #back:not(.zz-)::before, body #guest:not(.zz-)::before, body #cta:not(.zz-)::before, body #chap .rail-pill::before, body #orb .core::before, body #mbar:not(.zz-)::before, body #sampleflag:not(.zz-)::before, body #ctx .strip::before, body #lv-map .tl-bar::before, body :is(#tally button, #zz-.zz-)::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: linear-gradient(135deg, rgba(255, 255, 255, var(--lg-e0)) 0%, rgba(255, 255, 255, calc(var(--lg-e0) * .24)) 30%, rgba(255, 255, 255, calc(var(--lg-e1) * 1.5)) 62%, rgba(255, 255, 255, var(--lg-e1)) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* scrolling surfaces cannot carry a pseudo ring (it would scroll away): the same edge as two inset crescents, bright top-left */
body #lv-map .info, body #chap .rail-list {
  box-shadow: inset 1.2px 1.2px 0 rgba(255, 255, 255, calc(var(--lg-e0) * .72)), inset -1px -1px 0 rgba(255, 255, 255, var(--lg-e1)), var(--lg-hi), var(--lg-shade), var(--lg-shadow);
}

/* ---------- 4 · the prominent capsule: the ONE primary action. bright near-white glass, dark text ---------- */
.lg-prominent, body #cta {
  background: var(--lg-prom); color: var(--lg-prom-fg); border: 0; box-shadow: var(--lg-prom-sh);
}
.lg-prominent::before, body #cta::before { background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, .4) 50%, rgba(255, 255, 255, .85) 100%); }

/* ---------- 5 · press: scale .96 (js/ux/chrome.js) + a pre-made highlight layer that fades in. Nothing but transform and opacity ---------- */
.lg::after, .lg-thin::after, .lg-prominent::after, .lg-btn::after, body #back:not(.zz-)::after, body #guest:not(.zz-)::after, body #cta:not(.zz-)::after, body #orb .core::after, body :is(#tally button, #zz-.zz-)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1; opacity: 0;
  background: radial-gradient(120% 140% at 30% 0%, rgba(255, 255, 255, .34), rgba(255, 255, 255, .08) 60%, transparent); transition: opacity var(--dur-base) var(--ease-out);
}
.lg:active::after, .lg-thin:active::after, .lg-prominent:active::after, .lg-btn:active::after, body #back:not(.zz-):active::after, body #guest:not(.zz-):active::after, body #orb .core:active::after, body :is(#tally button, #zz-.zz-):active::after { opacity: 1; transition-duration: 60ms; }
.lg-prominent:active::after, body #cta:active::after { opacity: 1; transition-duration: 60ms; background: rgba(0, 0, 0, .07); }
/* a button that holds children above the highlight layer */
:is(.lg, .lg-prominent, .lg-btn) > *, body :is(#back, #tally button, #guest, #cta) > * { position: relative; z-index: 1; }

/* ---------- 6 · the selected blob that slides under a segmented control (window.__uxGlide) ---------- */
.lg-sel, .seg-glow.gl {
  background-color: var(--lg-sel); background-image: var(--lg-sheen); box-shadow: var(--lg-sel-sh); border-radius: var(--r-pill);
  transition: transform var(--dur-base) var(--ease-spring), width var(--dur-base) var(--ease-spring), height var(--dur-base) var(--ease-spring), opacity var(--dur-quick);
}
.seg[data-glide] > button.on { color: var(--lg-sel-fg); }

/* ---------- 7 · type on the scene (no box) ---------- */
.lg-title { text-shadow: var(--lg-halo); }

@media (prefers-reduced-motion: reduce) { .lg::after, .lg-thin::after, .lg-prominent::after, .lg-btn::after, .seg-glow.gl { transition: none; } }

/* a snapshot surface appears only once its first backdrop is in (js/ux/glass.js adds .lg-ready), then fades up, so it never shows the plain default fill and corrects itself a moment later */
#lv-map .info.on:not(.lg-ready), #ctx .strip:not(.zz-):not(.lg-ready), #chap.open .rail-list:not(.lg-ready), #lv-map .tl-bar:not(.zz-):not(.lg-ready) { opacity: 0; }
:is(#lv-map .info.on, #ctx .strip, #chap.open .rail-list, #lv-map .tl-bar).lg-ready { opacity: 1; transition: opacity .28s var(--ease-out, cubic-bezier(.22, 1, .36, 1)), --lg-wash var(--dur-quick) var(--ease-out); }
