@import url('https://fonts.googleapis.com/css2?family=Saira:wght@300;400;500;600;700;800&family=Sora:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* =====================================================================
   wavestripe.app — design tokens · "Diagnostic Instrument"
   Single source of truth for color, type, spacing, and shared primitives.
   Loaded by every public page (marketing, auth, account, legal) AND the
   /app SPA, which themes entirely off these variables.

   Aesthetic: a precision automotive-HMI for a deep-ocean EV. Carbon
   surfaces over a faint blueprint grid; a luminous aqua-teal charge-signal
   accent; technical type (Saira display / Sora body / JetBrains Mono data).
   Variable NAMES are stable — only values evolve — so the SPA never breaks.
   ===================================================================== */

:root {
  /* ---- surfaces : carbon with a deep-ocean undertone ---- */
  --bg-0: #05080b;                       /* page base */
  --bg-1: #080d13;                       /* app main */
  --bg-2: rgba(13, 20, 28, 0.30);
  --surf-1: #0c131c;                     /* card */
  --surf-2: #111a25;                     /* raised */
  --surf-3: #182433;                     /* hover / raised-2 */
  --border: #1e2b39;
  --border-soft: #16212d;
  --border-bright: #2a3d50;              /* NEW — instrument hairline */

  /* ---- text ---- */
  --fg: #eaf2f7;
  --fg-soft: #abbccc;
  --fg-mute: #6e8093;
  --fg-dim: #455567;

  /* ---- brand : signal aqua-teal (battery / charge energy) ---- */
  --accent: #2fe3c6;
  --accent-2: #11b39c;
  --accent-3: #5cf0d8;
  --accent-soft: rgba(47, 227, 198, 0.12);
  --accent-glow: rgba(47, 227, 198, 0.42);
  --accent-ink: #02201a;                 /* NEW — text/icon on accent fill */

  /* ---- status ---- */
  --ok: #34e0a0;
  --ok-soft: rgba(52, 224, 160, 0.12);
  --warn: #f5b13d;
  --warn-soft: rgba(245, 177, 61, 0.12);
  --bad: #ff6b6b;
  --bad-soft: rgba(255, 107, 107, 0.12);
  --info: #7aa2ff;
  --info-soft: rgba(122, 162, 255, 0.12);

  /* ---- shapes ---- */
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* ---- type ---- */
  --ff: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ff-display: "Saira", "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* , *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  /* Interface text size — driven by the A− / A+ buttons that every surface
     mounts: the /app top bar (public/app/text-scale.js) and the marketing,
     pricing, auth, account and legal headers (public/text-size.js). Both
     write --text-scale on <html> off the same localStorage key, so the
     reader sets it once and the whole site remembers. Every type size in
     tokens.css, app.css, marketing.css, auth.css, account.css and
     legal.css is `rem`, so this one multiplier resizes the site's words
     while padding, radii and icon boxes stay put. Basing it on 100% rather
     than a fixed 16px keeps the reader's own browser font-size setting in
     play — ours multiplies theirs. */
  font-size: calc(100% * var(--text-scale, 1));
}
/* ── Interface text size (A− / A+) ──────────────────────────────────────
   The one control on the whole site whose own type is deliberately px, not
   rem: it must stay the same size at 85% and at 140% so the reader can always
   find it and walk back out. Everything it *changes* is rem — see
   the `html { font-size: calc(100% * var(--text-scale, 1)) }` rule above.
   Lives in tokens.css — not app.css — because every surface mounts it: the
   /app top bar, and the marketing / pricing / auth / account / legal
   headers via public/text-size.js.
   The % readout is hidden at the default 100%, so at rest this reads as
   exactly two quiet buttons; off-default it shows where you are and
   clicking it snaps back. */
.text-size {
  display: inline-flex; align-items: stretch; flex-shrink: 0;
  border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--surf-1); overflow: hidden;
}
.text-size .ts-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  min-width: 34px; padding: 0 10px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--fg-soft); font-family: var(--ff-display); font-weight: 700;
  font-size: 12px; line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.text-size .ts-btn.ts-big { font-size: 16px; }
.text-size .ts-btn .ts-op { font-size: 10px; font-weight: 600; opacity: 0.85; }
.text-size .ts-btn:hover:not(:disabled) { color: var(--accent); background: var(--surf-2); }
.text-size .ts-btn:disabled { color: var(--fg-dim); cursor: default; }
.text-size .ts-level {
  align-self: center; padding: 0 6px; border: 0; background: transparent;
  color: var(--fg-mute); cursor: pointer;
  font-family: var(--ff-mono); font-size: 10px; font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft);
}
.text-size .ts-level:hover { color: var(--accent); }
.text-size .ts-btn:focus-visible,
.text-size .ts-level:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Phone widths: keep the pair reachable — that is exactly where oversized
   type earns its keep — but give back the width the bar around it needs.
   The % readout goes; the drawer's "Reset to 100%" and a tap on the top
   bar's own readout at wider sizes are still the way back. */
@media (max-width: 480px) {
  .text-size .ts-btn { min-width: 28px; padding: 0 5px; }
  .text-size .ts-level { display: none; }
}

/* Language switch — public/i18n.js mounts one right after every text-size
   control, so it inherits the same spot on every page and in the SPA bar. */
.lang-switch {
  display: inline-flex; align-items: stretch; flex-shrink: 0; margin-left: 6px;
  border: 1px solid var(--border-soft); border-radius: 10px;
  background: var(--surf-1); overflow: hidden;
}
.lang-switch .ls-btn {
  min-width: 34px; min-height: 30px; padding: 0 8px; border: 0; cursor: pointer;
  background: transparent; color: var(--fg-soft);
  font-family: var(--ff-display); font-weight: 700; font-size: 0.75rem; line-height: 1;
}
.lang-switch .ls-btn + .ls-btn { border-left: 1px solid var(--border-soft); }
.lang-switch .ls-btn[aria-pressed="true"] { background: var(--accent); color: var(--bg-0); }
.lang-switch .ls-btn:hover:not([aria-pressed="true"]) { color: var(--accent); background: var(--surf-2); }
.lang-switch .ls-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 480px) { .lang-switch .ls-btn { min-width: 28px; padding: 0 5px; } }
.i18n-note {
  margin: 0 0 1rem; padding: 0.5rem 0.75rem; border-left: 3px solid var(--accent);
  background: var(--surf-1); color: var(--fg-soft); font-size: 0.8125rem;
}

body {
  font-family: var(--ff);
  background: var(--bg-0);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(1020px 760px at 86% -10%, rgba(47, 227, 198, 0.08), transparent 60%),
    radial-gradient(840px 640px at -10% 26%, rgba(17, 179, 156, 0.055), transparent 60%);
  background-attachment: fixed;
}

/* faint engineering blueprint grid — fades toward the page edges so it
   reads as atmosphere, not a spreadsheet. Fixed + behind everything. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 168, 190, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 168, 190, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 110% 80% at 50% 12%, #000 0%, transparent 78%);
          mask-image: radial-gradient(ellipse 110% 80% at 50% 12%, #000 0%, transparent 78%);
}
/* film grain — micro-texture for depth on the flat carbon surfaces */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------------
   Shared button — refined instrument control
   --------------------------------------------------------------------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-family: var(--ff-display);
  font-weight: 600; font-size: 0.875rem; letter-spacing: 0.01em;
  padding: 11px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .14s var(--ease), box-shadow .18s var(--ease),
              background .16s, border-color .16s, color .16s;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-3), var(--accent));
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 10px 28px -12px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.btn-primary:hover {
  box-shadow: 0 14px 34px -10px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.34);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.012);
  color: var(--fg);
  border-color: var(--border-bright);
}
.btn-ghost:hover {
  background: var(--surf-2);
  border-color: var(--accent);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.btn-soft {
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(47, 227, 198, 0.22);
}
.btn-soft:hover { background: rgba(47, 227, 198, 0.18); border-color: var(--accent); }

.btn-big { padding: 14px 26px; font-size: 0.9375rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------------------------------------------------------------------
   Shared pill — telemetry tag
   --------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff-mono);
  font-size: 0.65625rem; font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-info { background: var(--accent-soft); color: var(--accent); }
.pill-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 7px currentColor;
}

/* ---------------------------------------------------------------------
   Shared brand mark
   --------------------------------------------------------------------- */
.brand-logo {
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent-3) 0%, var(--accent-2) 100%);
  box-shadow: 0 8px 24px -8px var(--accent-glow),
              inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}
.brand-logo svg { width: 60%; height: 60%; }

/* ---------------------------------------------------------------------
   Shared input
   --------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-family: var(--ff-mono);
  font-size: 0.65625rem; color: var(--fg-mute); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.field .input {
  display: flex; align-items: center; gap: 10px;
  height: 47px; padding: 0 14px;
  background: var(--surf-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field .input:focus-within {
  border-color: var(--accent);
  background: var(--surf-2);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .input svg { width: 16px; height: 16px; color: var(--fg-mute); flex-shrink: 0; }
.field .input input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--fg); font: inherit; font-size: 0.875rem;
}
.field .input input::placeholder { color: var(--fg-dim); }

/* ---------------------------------------------------------------------
   Shared card
   --------------------------------------------------------------------- */
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 120px),
    var(--surf-1);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: 22px;
}
.card.glow {
  background:
    linear-gradient(180deg, rgba(47, 227, 198, 0.07) 0%, rgba(47, 227, 198, 0) 60%),
    var(--surf-1);
  border-color: rgba(47, 227, 198, 0.24);
}

/* ---------------------------------------------------------------------
   Eyebrow chip — system-status tag
   --------------------------------------------------------------------- */
.eye {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ff-mono);
  font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 12px 5px 11px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(47, 227, 198, 0.26);
  border-radius: var(--r-pill);
}
.eye::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: eyePulse 2.4s var(--ease) infinite;
}
@keyframes eyePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent); }
  50% { opacity: 0.45; box-shadow: 0 0 3px var(--accent); }
}

/* ---------------------------------------------------------------------
   Utilities
   --------------------------------------------------------------------- */
.text-mono { font-family: var(--ff-mono); }
.muted { color: var(--fg-mute); }
.soft { color: var(--fg-soft); }
.grad {
  background: linear-gradient(120deg, var(--accent-3) 0%, var(--accent) 55%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* focus ring (keyboard nav) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* shared shell (used by marketing + account) */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
@media (max-width: 540px) {
  .shell { padding: 0 16px; }
}

/* global reduced-motion guard for token-level animations */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eye::before { animation: none; }
  .btn { transition: background .16s, border-color .16s, color .16s; }
}
