/*
 * OrbitAIO "Liquid Glass" — design tokens + utilities for the vanilla
 * static pages (dashboard.html, chooser.html; index.html follows in WP3).
 *
 * Ported from frontend/src/theme/orbit-glass.css:37-247 — the Tailwind
 * @theme block there becomes a plain :root block here (same property names,
 * same values), since these pages have no Tailwind pipeline. That file's own
 * comment at :199-206 already anticipated this: "Kept as plain classes
 * rather than @utility so they also work in the non-Tailwind static pages
 * (api/static) later in Phase 2."
 *
 * Each page keeps its OWN pre-existing --neon-blue/--dark-bg/--card-bg/...
 * variables (same hex values, different names) for its existing rules —
 * this file adds the NEW --color-, --radius- and --glass- prefixed names
 * alongside them rather than renaming anything, so it is purely additive.
 *
 * ⚠️ ROOT-PAINTING RULE (read before touching the ambient layer or adding a
 * full-bleed background anywhere): backdrop-filter has nothing to blur over
 * a flat fill, so the ambient gradient below is not decoration — without it
 * every .glass-card renders as a plain dark rectangle. And only `html` (the
 * true root element) may hold the page's opaque background. Per CSS2.1
 * Appendix E, a negative-z-index child of `body` (the ambient layer) paints
 * in step 2 of body's stacking context, but body's OWN background paints in
 * step 3 — so if `body` (or any full-bleed wrapper) has an opaque
 * background, it paints OVER the ambient layer and hides it. This is not
 * theoretical: it is exactly what happened in the Electron app the first
 * time this pattern was introduced (tokens correct, ambient invisible,
 * because body AND #root both painted over body::before) — see
 * CLAUDE-orbitaio-todo.md §2. Fixed there by moving the opaque background to
 * `html` and leaving body transparent; do the same for every future
 * full-bleed element in these pages.
 */

:root {
  /* ---- surfaces ------------------------------------------------------ */
  --color-bg: #01030a;
  --color-surface: #04070f;
  --color-surface-2: #030920;

  --color-glass-1: rgba(255, 255, 255, 0.05);
  --color-glass-2: rgba(255, 255, 255, 0.09);
  --color-glass-3: rgba(255, 255, 255, 0.14);
  --color-glass-subtle: rgba(255, 255, 255, 0.03);

  /* ---- borders --------------------------------------------------------- */
  --color-border: rgba(255, 255, 255, 0.1);
  --color-border-soft: rgba(255, 255, 255, 0.09);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-border-accent: rgba(143, 208, 255, 0.5);

  /* ---- foreground ------------------------------------------------------- */
  --color-fg: #eaf2ff;
  --color-fg-body: #93a6c6;
  --color-fg-muted: #7f93b5;
  --color-fg-subtle: #64789c;
  --color-fg-bright: #f2f7ff;

  /* ---- accent ------------------------------------------------------------*/
  --color-accent: #8fd0ff;
  --color-accent-hover: #d8ecff;
  --color-accent-soft: rgba(143, 208, 255, 0.14);
  --color-accent-faint: rgba(143, 208, 255, 0.06);
  --color-accent-deep: #1e50c8;

  /* ---- status ------------------------------------------------------------*/
  --color-success: #4ade9b;
  --color-danger: #ff6b8a;
  --color-warning: #ffc75a;
  --color-warning-alt: #ffb877;

  /* ---- radii ----------------------------------------------------------
   * Pills dominate the source design by a wide margin — this design rounds
   * hard. */
  --radius-pill: 999px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-2xl: 24px;

  /* ---- glass effect -----------------------------------------------------
   * The blur is the load-bearing part of the look. */
  --glass-blur: blur(26px);
  --glass-blur-strong: blur(40px) saturate(160%);

  /* Canonical card shadow — an outer drop plus an inset top highlight. The
   * inset line is what reads as a lit glass edge; dropping it flattens the
   * whole look. */
  --shadow-card: 0 14px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --shadow-raised: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  --shadow-modal: 0 50px 120px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(143, 208, 255, 0.06),
    0 0 90px rgba(37, 99, 235, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  --shadow-glow-accent: 0 0 18px rgba(56, 189, 248, 0.5);

  /* ---- typography -------------------------------------------------------
   * Same families the app already ships (self-hosted via shared/tokens.css),
   * no font-loading changes. Caps labels (Geist Mono, wide tracking,
   * uppercase) are this design's signature label style. */
  --font-sans: 'Geist', 'Inter', system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;

  --text-2xs: 9.5px;
  --text-xs: 10.5px;
  --text-sm: 11px;
  --text-base: 12.5px;
  --text-md: 13px;
  --text-lg: 15px;
  --text-xl: 20px;
  --text-2xl: 23px;
  --text-display: 40px;

  --tracking-caps: 0.16em;
  --tracking-caps-wide: 0.2em;
  --tracking-heading: -0.02em;

  /* ---- spacing ---------------------------------------------------------- */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 10px;
  --space-5: 12px;
  --space-6: 14px;
  --space-7: 20px;
  --space-8: 24px;
}

/* ---- root background -----------------------------------------------
 * See the file-level comment above: only `html` may paint the opaque page
 * background. Pages that include this file must NOT also set an opaque
 * `background` on `body` or any full-bleed wrapper. */
html {
  background: var(--color-bg);
}

/* ---- ambient background ---------------------------------------------
 * Ported verbatim (geometry + blur radii unchanged) from
 * orbit-glass.css:186-197. Three blurred colour fields, fixed to the
 * viewport so they don't scroll with content. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle 297px at calc(100% - 530px) 450px, rgba(255, 159, 90, 0.1), transparent 66%),
    radial-gradient(circle 524px at calc(100% - 330px) calc(100% - 90px), rgba(14, 165, 233, 0.22), transparent 64%),
    radial-gradient(circle 475px at 480px 130px, rgba(37, 99, 235, 0.4), transparent 62%);
  filter: blur(60px);
}

/* ---- glass utilities ---------------------------------------------------
 * Applied at card boundaries. Plain classes (not @utility) so they work
 * without a build step. */

.glass-card {
  background: var(--color-glass-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
}

/* A recessed surface for wells inside a card (table bodies, key displays).
 * Deliberately has NO blur: stacking backdrop-filter inside an already
 * blurred parent costs a second full-surface composite per frame for an
 * effect that is invisible against it. */
.glass-well {
  background: var(--color-glass-subtle);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
}

/* Small controls — segmented pills, icon buttons, inline chips. Shares the
 * card's surface and hairline but deliberately drops backdrop-filter and
 * the drop shadow: a small chip does not read as floating glass, and every
 * backdrop-filter is a real per-frame cost. */
.glass-chip {
  background: var(--color-glass-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
}

/* Geist Mono, wide tracking, uppercase — the design's signature label
 * style ("EXPIRES", "STORE", "PRODUCT"). */
.caps-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-fg-subtle);
}
