/* Liquid Glass v8: shared tokens, components and interaction layer.
   Spec: Resources/design/liquid-glass-v8.md. Copy into each repo and load it
   after the repo's own CSS. Override --lg-accent and --lg-accent-2 per product.
   Transform and opacity animation only. No third-party requests. */

:root {
  --lg-bg: #060d0f;
  --lg-accent: #34e0d6;
  --lg-accent-2: #0b7a75;
  --lg-orange: #ff7a45;
  --lg-cool: #5b7cfa;
  --lg-tint: rgb(12 24 38 / .55);
  --lg-tint-solid: #112135;
  --lg-fill: linear-gradient(180deg, rgb(255 255 255 / .13), rgb(255 255 255 / .05));
  --lg-edge: rgb(255 255 255 / .16);
  --lg-hi: inset 0 1px 0 rgb(255 255 255 / .22), inset 0 -1px 0 rgb(0 0 0 / .25);
  --lg-shadow-shell: 0 40px 80px -24px rgb(0 0 0 / .55);
  --lg-shadow-card: 0 24px 48px -16px rgb(0 0 0 / .5);
  --lg-r-shell: 30px;
  --lg-r-card: 22px;
  --lg-r-tile: 18px;
  --lg-r-field: 14px;
  --lg-ink: #fff;
  --lg-ink-2: rgb(255 255 255 / .72);
  --lg-ink-3: rgb(255 255 255 / .5);
  --lg-good: #4ade80;
  --lg-bad: #f87171;
  --lg-warn: #34e0d6;
  --lg-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;
  --lg-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --lg-ease: cubic-bezier(.2, .8, .2, 1);
  --lg-t-state: 160ms;
  --lg-t-swap: 320ms;
  --lg-t-enter: 480ms;
}

/* The lit room behind the glass */
.lg-room {
  background-color: var(--lg-bg);
  background-image:
    radial-gradient(55vw 45vw at 12% 8%, color-mix(in srgb, var(--lg-accent) 22%, transparent), transparent 70%),
    radial-gradient(50vw 40vw at 88% 18%, color-mix(in srgb, var(--lg-orange) 14%, transparent), transparent 70%),
    radial-gradient(60vw 50vw at 60% 110%, color-mix(in srgb, var(--lg-cool) 10%, transparent), transparent 70%);
  background-attachment: fixed;
  color: var(--lg-ink);
  font-family: var(--lg-sans);
}

/* Glass surfaces */
.lg-glass, .lg-shell, .lg-card, .lg-tile, .lg-widget {
  background: var(--lg-fill), var(--lg-tint-solid);
  border: 1px solid var(--lg-edge);
  box-shadow: var(--lg-hi), var(--lg-shadow-card);
  color: var(--lg-ink);
}
.lg-shell { border-radius: var(--lg-r-shell); box-shadow: var(--lg-hi), var(--lg-shadow-shell); }
.lg-card, .lg-widget { border-radius: var(--lg-r-card); }
.lg-tile { border-radius: var(--lg-r-tile); padding: 14px 16px; }
.lg-widget--hero {
  background: linear-gradient(160deg, var(--lg-accent), var(--lg-accent-2));
  border-color: rgb(255 255 255 / .28);
}

@media (min-width: 900px) and (hover: hover) {
  .lg-shell, .lg-widget {
    background: var(--lg-fill), var(--lg-tint);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
  }
  .lg-widget--hero { background: linear-gradient(160deg, var(--lg-accent), var(--lg-accent-2)); }
}

/* Type */
.lg-title { font-family: var(--lg-serif); font-weight: 400; font-size: 28px; line-height: 1.15; letter-spacing: -.01em; }
.lg-sub { font-size: 13.5px; color: var(--lg-ink-3); }
.lg-num { font-family: var(--lg-serif); font-size: 40px; line-height: 1; font-variant-numeric: tabular-nums; }
.lg-label { font-size: 12px; color: var(--lg-ink-2); }
.lg-delta { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; padding: 2px 8px; border-radius: 9999px; background: rgb(255 255 255 / .08); }
.lg-delta--up { color: var(--lg-good); }
.lg-delta--down { color: var(--lg-bad); }

/* Rail (sidebar) */
.lg-rail { display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; }
.lg-rail a, .lg-rail button {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border-radius: 12px; color: var(--lg-ink-2); text-decoration: none; background: transparent; border: 0;
  font: 500 13.5px/1 var(--lg-sans);
}
.lg-rail [aria-current], .lg-rail [aria-selected="true"] { background: rgb(255 255 255 / .12); color: var(--lg-ink); box-shadow: inset 0 1px 0 rgb(255 255 255 / .14); }

/* Pills and segmented control */
.lg-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 16px; border-radius: 9999px; border: 1px solid var(--lg-edge);
  background: rgb(255 255 255 / .08); color: var(--lg-ink); font: 500 13px/1 var(--lg-sans); cursor: pointer;
}
.lg-pill--primary { background: var(--lg-accent); border-color: transparent; color: #04080b; box-shadow: 0 8px 24px -8px var(--lg-accent); }
.lg-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9999px; background: rgb(255 255 255 / .06); }
.lg-seg > * { min-height: 30px; padding: 0 14px; border-radius: 9999px; border: 0; background: transparent; color: var(--lg-ink-2); font: 500 12.5px/1 var(--lg-sans); }
.lg-seg > [aria-selected="true"], .lg-seg > [aria-pressed="true"], .lg-seg > label:has(input:checked) { background: rgb(255 255 255 / .14); color: var(--lg-ink); }

/* Fields */
.lg-field { min-height: 40px; padding: 0 14px; border-radius: var(--lg-r-field); border: 1px solid var(--lg-edge); background: rgb(255 255 255 / .06); color: var(--lg-ink); font: 14px var(--lg-sans); }
.lg-field::placeholder { color: var(--lg-ink-3); }

/* Rows */
.lg-row { display: grid; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 14px; }
.lg-row + .lg-row { border-top: 1px solid rgb(255 255 255 / .06); }
.lg-bar { height: 4px; border-radius: 9999px; background: rgb(255 255 255 / .1); overflow: hidden; }
.lg-bar > i { display: block; height: 100%; background: var(--lg-accent); transform-origin: left; }

/* ===== Interaction layer ===== */
.lg-card, .lg-tile, .lg-widget, .lg-row, .lg-pill, .lg-rail a, .lg-rail button {
  transition: transform var(--lg-t-state) var(--lg-ease), opacity var(--lg-t-state) var(--lg-ease);
}
.lg-card, .lg-tile, .lg-widget { position: relative; }
.lg-card::after, .lg-tile::after, .lg-widget::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(120deg, rgb(255 255 255 / .10), transparent 45%);
  opacity: 0; transition: opacity var(--lg-t-state) var(--lg-ease);
}
@media (hover: hover) and (pointer: fine) {
  .lg-card:hover, .lg-tile:hover, .lg-widget:hover { transform: translateY(-3px); }
  .lg-card:hover::after, .lg-tile:hover::after, .lg-widget:hover::after { opacity: 1; }
  .lg-row:hover { background: rgb(255 255 255 / .05); }
}
.lg-pill:active, .lg-seg > *:active, .lg-rail a:active, .lg-rail button:active, .lg-card:active { transform: scale(.98); }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 3px; }

/* Content swap */
@keyframes lg-enter { from { opacity: 0; transform: translateY(8px) scale(.995); } to { opacity: 1; transform: none; } }
.lg-enter { animation: lg-enter var(--lg-t-swap) var(--lg-ease) both; }
.lg-stagger > * { animation: lg-enter var(--lg-t-enter) var(--lg-ease) both; }
.lg-stagger > :nth-child(2) { animation-delay: 40ms; }
.lg-stagger > :nth-child(3) { animation-delay: 80ms; }
.lg-stagger > :nth-child(4) { animation-delay: 120ms; }
::view-transition-old(lg-main) { animation: 200ms var(--lg-ease) both lg-leave; }
::view-transition-new(lg-main) { animation: var(--lg-t-swap) var(--lg-ease) both lg-enter; }
@keyframes lg-leave { to { opacity: 0; transform: scale(.985); } }

/* Scrolling */
.lg-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.lg-strip > * { scroll-snap-align: start; flex: 0 0 auto; }

/* Phones */
@media (max-width: 899px) {
  .lg-rail--tabbar { position: fixed; left: 12px; right: 12px; bottom: 12px; flex-direction: row; justify-content: space-around; padding: 6px; border-radius: 22px; z-index: 50; }
  .lg-rail--tabbar a, .lg-rail--tabbar button { flex-direction: column; gap: 3px; min-height: 48px; min-width: 48px; padding: 4px 8px; font-size: 11px; }
  .lg-pill, .lg-seg > * { min-height: 44px; }
}

/* Accessibility fallbacks */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .lg-card:hover, .lg-tile:hover, .lg-widget:hover { transform: none; }
  ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .lg-shell, .lg-widget, .lg-card, .lg-tile, .lg-glass { background: var(--lg-tint-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --lg-edge: rgb(255 255 255 / .45); --lg-ink-2: rgb(255 255 255 / .9); --lg-ink-3: rgb(255 255 255 / .75); }
}
