/* ═══════════════════════════════════════════════════════════════════════════
   AETERIA — the design system. LAW. Every surface obeys.

   THE ONE-LINE LAW:
   Gray-dark ground. Amber light. Thin glass. Sharp particles as smoke.
   No blue. No clutter. 60fps. Senior-architect Apple grade.

   QUALITY GATES (checked by tests/visual QA):
   zero blue backgrounds · zero invisible text · every button answers ·
   1px glass edges · sharp particles · 60fps · no console errors ·
   every form accepts input · 4.5:1 contrast
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ground + elevation */
  --ground: #161618;
  --elevated: #1C1C1F;
  --elevated-2: #222226;

  /* the light */
  --amber: #E8641A;
  --amber-bright: #FFB347;
  --amber-soft: rgba(232, 100, 26, 0.14);
  --gold: #C4780A;

  /* smoke */
  --steel: #4A6FA5;      /* cool steel — accent only, NEVER a background */
  --neutral: #8A8A8E;

  /* light mode supports (reliquary export, print) */
  --paper: #F5F2EE;
  --paper-amber: #C4780A;

  /* ink */
  --ink: #EDEDEE;        /* 13.9:1 on ground */
  --muted: #A7A7AC;      /* 6.9:1 on ground */
  --faint: #8A8A8E;      /* 4.6:1 on ground — floor for body text */

  /* glass */
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --glass: rgba(28, 28, 31, 0.55);
  --glass-2: rgba(28, 28, 31, 0.72);
  --glass-3: rgba(34, 34, 38, 0.5);

  /* radius */
  --r-lg: 20px;
  --r-md: 14px;
  --r-pill: 999px;

  /* motion — water-weighted, never snappy */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --dur-1: 0.18s;
  --dur-2: 0.45s;
  --dur-3: 0.9s;

  /* type — SF Pro / system-ui · six sizes */
  --t-11: 11px;
  --t-13: 13px;
  --t-15: 15px;
  --t-20: 20px;
  --t-28: 28px;
  --t-44: 44px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ── theme switch: light / auto tokens ───────────────────────────────── */
:root[data-theme="light"], [data-theme="light"] {
  --bg: #F5F2EE;
  --bg-elevated: #FFFFFF;
  --bg-sunken: #EAE7E2;
  --ground: #F5F2EE;
  --elevated: #FFFFFF;
  --elevated-2: #EAE7E2;
  --text-primary: #1A1815;
  --text-secondary: #5A5550;
  --text-tertiary: #9A948E;
  --ink: #1A1815;
  --muted: #5A5550;
  --faint: #7A7570;
  --accent: #C4780A;
  --accent-bright: #C4780A;
  --amber: #C4780A;
  --amber-bright: #C4780A;
  --amber-soft: rgba(196, 120, 10, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 0, 0, 0.08);
  --btn-bg: rgba(0, 0, 0, 0.05);
  --btn-text: #1A1815;
  --btn-border: rgba(0, 0, 0, 0.10);
  --particle-ink: #1A1815;
  --bar-bg: #EAE7E2;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.15);
  --glass: rgba(255, 255, 255, 0.65);
  --glass-2: rgba(255, 255, 255, 0.85);
  --glass-3: rgba(245, 242, 238, 0.7);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    --bg: #F5F2EE;
    --bg-elevated: #FFFFFF;
    --bg-sunken: #EAE7E2;
    --ground: #F5F2EE;
    --elevated: #FFFFFF;
    --elevated-2: #EAE7E2;
    --text-primary: #1A1815;
    --text-secondary: #5A5550;
    --text-tertiary: #9A948E;
    --ink: #1A1815;
    --muted: #5A5550;
    --faint: #7A7570;
    --accent: #C4780A;
    --accent-bright: #C4780A;
    --amber: #C4780A;
    --amber-bright: #C4780A;
    --amber-soft: rgba(196, 120, 10, 0.12);
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(0, 0, 0, 0.08);
    --btn-bg: rgba(0, 0, 0, 0.05);
    --btn-text: #1A1815;
    --btn-border: rgba(0, 0, 0, 0.10);
    --particle-ink: #1A1815;
    --bar-bg: #EAE7E2;
    --hairline: rgba(0, 0, 0, 0.08);
    --hairline-strong: rgba(0, 0, 0, 0.15);
    --glass: rgba(255, 255, 255, 0.65);
    --glass-2: rgba(255, 255, 255, 0.85);
    --glass-3: rgba(245, 242, 238, 0.7);
  }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline-strong);
  background: var(--glass);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 0 12px -2px var(--amber-soft);
  transition: all var(--dur-1) var(--ease);
}
.theme-toggle:hover {
  border-color: var(--amber-bright);
  box-shadow: 0 0 16px var(--amber-soft);
  transform: translateY(-1px);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* the ⌘K command palette trigger — token-driven, inverts with the theme */
.cmd-palette-btn {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line, var(--hairline, rgba(255, 255, 255, 0.12)));
  color: var(--text-secondary, rgba(255, 255, 255, 0.6));
  background: var(--glass-bg, rgba(255, 255, 255, 0.04));
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.cmd-palette-btn:hover {
  border-color: var(--amber-bright);
  color: var(--ink);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  max-width: 100vw;
  /* S4/S5 · the G1 lesson at the document level: `hidden` here forced
     overflow-y to compute `auto` (CSS spec), making the BODY a scroll
     container — which kills every position:sticky on every page (the
     alpha's command bar proved it). `clip` guards the horizontal
     without owning the vertical. One scroll context: the viewport. */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-15);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: 100vw;
  overflow-x: clip;
}

img, svg, video, canvas {
  max-width: 100%;
}

.gen-img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

::selection { background: rgba(232, 100, 26, 0.35); color: var(--ink); }

a { color: var(--amber-bright); text-decoration: none; transition: color var(--dur-1) var(--ease); }
a:hover { color: var(--amber); }

/* the smoke canvas — ambient floating embers behind the glass cards */
#smoke {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  z-index: 0;
  pointer-events: none;
}

/* ── layout ────────────────────────────────────────────────────────────── */

/* BUG 1 · one scroll context per page: the body scrolls. `overflow-x: hidden`
   here used to force overflow-y to compute `auto` (CSS spec), giving every
   page a second nested scrollbar; `clip` guards the horizontal without
   touching the vertical. */
.page { min-height: 100vh; display: flex; flex-direction: column; max-width: 100vw; overflow-x: clip; }
.container { width: min(1120px, calc(100% - 48px)); max-width: 100%; margin: 0 auto; box-sizing: border-box; }
.section { padding: 96px 0; position: relative; max-width: 100vw; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 16px; align-items: center; min-width: 0; }
.wrap, .row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--hairline); border: 0; margin: 24px 0; }

main { flex: 1; min-width: 0; }

/* ── type ──────────────────────────────────────────────────────────────── */

.t-11 { font-size: var(--t-11); letter-spacing: 0.08em; }
.t-13 { font-size: var(--t-13); }
.t-15 { font-size: var(--t-15); }
.t-20 { font-size: var(--t-20); }
.t-28 { font-size: var(--t-28); }
.t-44 { font-size: var(--t-44); }

.wordmark {
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.amber { color: var(--amber-bright); }
.steel { color: #8FA8CC; }
.center { text-align: center; }

.label {
  font-size: var(--t-11);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--faint);
}

h1, h2, h3 { font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: var(--t-28); }
h3 { font-size: var(--t-20); font-weight: 500; }
p { margin: 0; }

/* ── S5 · THE SENIOR GUARANTEES — focus, motion mercy, skeletons ─────────── */

/* 5.6 · every interactive element carries a visible focus ring — the amber
   outline is the product's law, not a per-component favor */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--amber, #E8641A);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 5.5 · REDUCED MOTION, GUARANTEED — the global mercy: any animation or
   transition anywhere collapses to a 0.01ms step, scrolling goes instant.
   (Pages can layer finer behavior on top; none can escape this floor.) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 5.6 · THE SKELETON — the shimmer every data fetch deserves while it waits */
.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
  border-radius: var(--r-sm, 8px);
  min-height: 14px;
}
:root[data-theme="light"] .skeleton { background: rgba(0, 0, 0, 0.06); }
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: skeletonShimmer 1.6s var(--ease, cubic-bezier(0.25, 0.1, 0.25, 1)) infinite;
}
:root[data-theme="light"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
}
@keyframes skeletonShimmer {
  100% { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}

/* ── glass ─────────────────────────────────────────────────────────────── */

.glass {
  position: relative;
  background: radial-gradient(120% 120% at 50% 0%, var(--panel-sheen) 0%, var(--panel-shade) 100%),
              linear-gradient(155deg, var(--panel-grad-1) 0%, var(--panel-grad-2) 100%);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid var(--panel-border);       /* 1px edges ONLY */
  border-radius: var(--r-lg);
  box-shadow: var(--panel-shadow),
              var(--panel-inset-top),
              var(--panel-inset-deep);
}

.glass--raised {
  background: radial-gradient(120% 120% at 50% 0%, var(--panel-sheen) 0%, var(--panel-shade) 100%),
              linear-gradient(155deg, var(--panel-grad-1) 0%, var(--panel-grad-2) 100%);
  border-color: var(--hairline-strong);
  box-shadow: var(--panel-shadow),
              var(--panel-inset-top),
              var(--panel-inset-deep);
}

.glass--flat {
  background: radial-gradient(120% 120% at 50% 0%, var(--panel-sheen) 0%, var(--panel-shade) 100%),
              linear-gradient(155deg, var(--panel-grad-1) 0%, var(--panel-grad-2) 100%);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18),
              var(--panel-inset-top);
}

/* specular follows the mouse (glass.js sets --mx/--my) */
.specular::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.06),
    transparent 60%
  );
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}

.hairline { border: 1px solid var(--hairline); border-radius: var(--r-md); }

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.scrim.on { opacity: 1; pointer-events: auto; }

/* ── buttons: the droplet ──────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-size: var(--t-15);
  color: var(--ink);
  cursor: pointer;
  border: 0;
  padding: 14px 28px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform var(--dur-1) var(--ease),
    box-shadow var(--dur-2) var(--ease),
    background var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* asymmetric radius — the droplet */
.btn-droplet { border-radius: 24px 30px 22px 28px; }

/* refraction shimmer — a slow band of light crossing the droplet */
.btn-droplet::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    115deg,
    transparent 32%,
    rgba(255, 255, 255, 0.07) 45%,
    rgba(255, 214, 170, 0.14) 50%,
    rgba(255, 255, 255, 0.07) 55%,
    transparent 68%
  );
  background-size: 260% 100%;
  background-position: 120% 0;
  animation: shimmer 6.5s var(--ease) infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes shimmer {
  0% { background-position: 130% 0; }
  55%, 100% { background-position: -130% 0; }
}

.btn-droplet--amber {
  background: linear-gradient(160deg, var(--accent-hover), var(--accent) 82%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 8px 28px var(--accent-soft);
  color: var(--accent-on);
}
.btn-droplet--amber:hover {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 10px 34px var(--accent-soft);
}

.btn-droplet--ghost {
  background: var(--glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hairline-strong);
}
.btn-droplet--ghost:hover { border-color: rgba(255, 179, 71, 0.4); }

.btn-droplet--sm { padding: 9px 18px; font-size: var(--t-13); border-radius: 18px 22px 16px 20px; }

.btn:active { transform: scale(0.97); }   /* press */
.btn:focus-visible {
  outline: 2px solid var(--amber-bright);
  outline-offset: 2px;
}
.btn[disabled] { opacity: 0.45; cursor: wait; }

/* ripple — glass.js appends span.ripple at the press point */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 226, 190, 0.35), transparent 70%);
  transform: scale(0);
  animation: ripple 0.6s var(--ease) forwards;
  pointer-events: none;
  z-index: -1;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--hairline-strong); }
.icon-btn:active { transform: scale(0.94); }

/* ── chips ─────────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline);
  background: var(--glass-3);
  font-size: var(--t-13);
  color: var(--muted);
  white-space: nowrap;
}
.chip--amber { border-color: rgba(232, 100, 26, 0.4); color: var(--amber-bright); }
.chip--steel { border-color: rgba(74, 111, 165, 0.45); color: var(--steel-bright, #8FA8CC); }
.chip .dot { width: 6px; height: 6px; background: currentColor; border-radius: 1px; }

/* ── light & auto-light inversions (tokens carry most of the weight) ──── */

:root[data-theme="light"] .btn-droplet--ghost:hover,
:root[data-theme="light"] .btn-droplet--amber {
  color: var(--accent-on);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] .btn-droplet--ghost:hover,
  :root[data-theme="auto"] .btn-droplet--amber {
    color: var(--accent-on);
  }
}

/* ghost buttons invert through --glass / --ink tokens;
   icon-btns through --btn-bg / --line tokens; the nav through --nav-bg */

/* ── fields — every form accepts input ─────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: var(--t-11); text-transform: uppercase; letter-spacing: 0.18em; color: var(--muted); }

.field__input,
.field__select,
.field__textarea {
  font-family: var(--font);
  font-size: var(--t-15);
  color: var(--ink);
  background: var(--input-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 13px 16px;
  outline: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
  width: 100%;
}
.field__textarea { resize: vertical; min-height: 96px; }
.field__select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; }
.field__select option { background: var(--elevated); color: var(--ink); }

.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  border-color: rgba(232, 100, 26, 0.55);
  box-shadow: 0 0 0 3px rgba(232, 100, 26, 0.14);
}

.field__input::placeholder,
.field__textarea::placeholder { color: var(--placeholder, #71717A); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--hairline-strong);
  border-radius: 1px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--amber-bright);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 3px;
  background: var(--amber-bright); cursor: pointer; border: none;
}

/* ── nav ───────────────────────────────────────────────────────────────── */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
}
.nav__links { display: flex; gap: 22px; align-items: center; }
.nav__links a { font-size: var(--t-13); color: var(--muted); letter-spacing: 0.04em; }
.nav__links a:hover, .nav__links a.active { color: var(--ink); }
.nav__links a.active { color: var(--amber-bright); }
.nav__session { margin-left: auto; display: flex; gap: 12px; align-items: center; position: relative; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid rgba(232, 100, 26, 0.35);
  font-size: var(--t-13);
  color: var(--amber-bright);
  background: var(--amber-soft);
  cursor: pointer;
}

/* ── v7 3.1 · the account menu — the way back to everything a household owns */
.nav-account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: var(--r-md, 12px);
  border: 1px solid var(--hairline, rgba(255,255,255,0.08));
  background: var(--glass-2, rgba(22,22,24,0.92));
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 220;
}
.nav-account-menu__head {
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--hairline, rgba(255,255,255,0.06));
  margin-bottom: 4px;
  letter-spacing: 0.06em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}
.nav-account-menu a,
.nav-account-menu button {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: var(--t-13);
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav-account-menu a:hover,
.nav-account-menu button:hover {
  background: rgba(232,100,26,0.10);
  color: var(--ink, #F5F2EE);
}
.nav-account-menu button:last-child { color: var(--faint); }
.nav-account-menu button:last-child:hover { color: var(--ink, #F5F2EE); }

/* ── scroll reveal ─────────────────────────────────────────────────────── */

.rise {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.rise.in { opacity: 1; transform: none; }

/* ── misc motion ───────────────────────────────────────────────────────── */

.pulse { animation: breathe 4.8s var(--ease) infinite; }
@keyframes breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

.drift { animation: drift 14s var(--ease) infinite alternate; }
@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}

.typing-dots { display: inline-flex; gap: 5px; align-items: center; }
.typing-dots i {
  width: 4px; height: 4px; border-radius: 1px;
  background: var(--amber-bright);
  opacity: 0.4;
  animation: dotpulse 1.2s var(--ease) infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.18s; }
.typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotpulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ── toasts ────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
  width: min(420px, calc(100vw - 40px));
}
.toast {
  padding: 13px 18px;
  font-size: var(--t-13);
  border-radius: var(--r-md);
  background: var(--glass-2);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.4s var(--ease);
}
.toast--ok { border-color: rgba(232, 100, 26, 0.5); }
.toast--warn { border-color: rgba(217, 84, 43, 0.55); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* ── sheets & modals ───────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--glass-2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--hairline-strong);
  border-radius: 24px 24px 0 0;
  padding: 32px 0 44px;
  transform: translateY(105%);
  transition: transform var(--dur-3) var(--ease);
  max-height: 86vh;
  overflow-y: auto;
}
.sheet.on { transform: translateY(0); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.modal.on { opacity: 1; pointer-events: auto; }
.modal__card {
  width: min(520px, 100%);
  padding: 32px;
  background: var(--glass-2);
  backdrop-filter: blur(16px);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform var(--dur-2) var(--ease);
}
.modal.on .modal__card { transform: none; }

/* ── footer ────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--hairline);
  padding: 44px 0 120px;
  margin-top: 40px;
}
.footer__word { font-size: var(--t-20); }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--amber-bright); }

/* ── reduced motion: static ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* ── responsive ────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root { --t-44: 34px; --t-28: 23px; }
  .section { padding: 64px 0; }
  .container { width: calc(100% - 40px); }
  .nav__links a.hide-sm { display: none; }
  .row.wrap { flex-wrap: wrap; }
}

/* ═══ S7 · MOBILE (375–768px) — water in a smaller vessel ═══ */

/* the burger — a water droplet, sharp at one corner (the drop's tail) */
.nav__burger {
  display: none;
  width: 48px; height: 48px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(45deg);
  background: var(--glass-bg, rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  cursor: pointer;
  position: relative;
  flex: none;
}
.nav__burger i {
  position: absolute; inset: 0; margin: auto;
  width: 16px; height: 2px; background: var(--text-primary, #F5F2EE);
  box-shadow: 0 -5px 0 var(--text-primary, #F5F2EE), 0 5px 0 var(--text-primary, #F5F2EE);
  transform: rotate(-45deg);
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.nav__burger:focus-visible { outline: 2px solid var(--amber-bright, #FFB347); outline-offset: 2px; }

/* the fullscreen glass nav the droplet opens */
.mobile-nav {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px calc(100% - 88vw) 24px 10vw;
  background: var(--scrim, rgba(8, 8, 10, 0.78));
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  opacity: 0; pointer-events: none;
  transition: opacity 240ms ease;
}
.mobile-nav.on { opacity: 1; pointer-events: auto; }
.mobile-nav__close {
  position: absolute; top: 18px; right: 18px;
  width: 48px; height: 48px; font-size: 20px;
}
.mobile-nav a.mobile-nav__link {
  display: flex; align-items: center; gap: 14px;
  min-height: 56px; padding: 0 18px;
  font-size: 19px; letter-spacing: 0.02em;
  color: var(--text-primary, #F5F2EE);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  margin-bottom: 10px;
  transform: translateX(-14px); opacity: 0;
  transition: transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 320ms ease, background 160ms ease;
}
.mobile-nav.on a.mobile-nav__link { transform: translateX(0); opacity: 1; }
.mobile-nav a.mobile-nav__link.active { border-color: var(--amber, #E8641A); color: var(--amber-bright, #FFB347); }
.mobile-nav a.mobile-nav__link:focus-visible { outline: 2px solid var(--amber-bright, #FFB347); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .mobile-nav, .mobile-nav a.mobile-nav__link { transition: none; }
}

/* the pull-to-refresh droplet */
.ptr-droplet {
  position: fixed; top: -34px; left: 50%;
  width: 28px; height: 28px; margin-left: -14px;
  border-radius: 50% 50% 50% 6px;
  transform: rotate(45deg) scale(0.6);
  background: var(--amber, #E8641A);
  opacity: 0;
  transition: transform 140ms ease, opacity 140ms ease;
  pointer-events: none; z-index: 150;
}
.ptr-droplet.pull { opacity: 0.7; }
.ptr-droplet.ready { opacity: 1; box-shadow: 0 0 18px rgba(232, 100, 26, 0.5); }

@media (max-width: 768px) {
  /* S7 · the burger appears, the cramped link row steps aside */
  .nav__burger { display: block; }
  .nav__links { display: none; }
  .nav .cmd-palette-btn { display: none; }

  /* S7 · every touch target ≥ 48px */
  .icon-btn, .btn, button.chip, .chip--btn {
    min-height: 48px; min-width: 48px;
  }
  .btn-droplet--sm, .tool-btn { min-height: 48px; padding: 10px 16px; }
  .field__input, .field__select, .field__textarea { min-height: 48px; }
  .mode-chip { min-height: 48px; padding: 10px 14px; }
  a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; }

  /* panels stack; tables scroll honestly */
  .panels { display: block !important; }
  .panel { margin-bottom: 18px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* the wordmark breathes */
  .nav__inner { gap: 10px; }
  .breadcrumbs-container { display: none; }
}

@media (min-width: 768px) and (max-width: 1024px) {
  /* S8 · tablet — panels hold two columns where the grid allows */
  .panels { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ── scrollbars (subtle, on-system) ────────────────────────────────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, #2E2E33); border-radius: 5px; border: 2px solid var(--ground); }
::-webkit-scrollbar-track { background: transparent; }

/* ── water ripple ─────────────────────────────────────────────────────── */
.water-ripple {
  position: absolute !important;
  border-radius: 50% !important;
  pointer-events: none !important;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: water-ripple-bloom 600ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  z-index: 10;
}

@keyframes water-ripple-bloom {
  0% { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(1); opacity: 0; }
}

/* ── loading skeletons (the shimmer) ──────────────────────────────────── */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: var(--glass-bg);
  color: transparent !important;
  min-height: 1em;
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    transparent 20%,
    var(--hover-tint) 50%,
    transparent 80%
  );
  transform: translateX(-100%);
  animation: skeleton-shimmer 1.6s var(--ease) infinite;
}
@keyframes skeleton-shimmer {
  to { transform: translateX(100%); }
}
.skeleton--line { height: 14px; margin: 8px 0; }
.skeleton--card { min-height: 120px; border: 1px solid var(--hairline); }

/* ── empty states — never blank, always a way forward ────────────────── */

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 44px 20px;
  text-align: center;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--r-lg);
  background: var(--glass-bg);
}
.empty-state .glyph {
  font-size: 26px;
  color: var(--amber-bright);
  opacity: 0.75;
  animation: breathe 4.8s var(--ease) infinite;
}
.empty-state .hint { max-width: 380px; }

/* ── error states — soft ripple, a readable message, a recovery path ───── */

.error-state {
  padding: 28px 22px;
  text-align: center;
  border: 1px solid rgba(217, 84, 43, 0.35);
  border-radius: var(--r-lg);
  background: rgba(217, 84, 43, 0.06);
}
.error-state .glyph { font-size: 22px; display: block; margin-bottom: 8px; }
.error-state .retry { margin-top: 14px; }

/* ── #26 · THE QUIET HOURS GUARDIAN — 23:00–07:00, the whole house dims ──── */
/* S6 #20 · THE DEEP BREATH — every ~95s the whole house settles at once */
html.deep-breath *,
html.deep-breath *::before,
html.deep-breath *::after {
  animation-play-state: paused !important;
}
html.deep-breath #water-ground {
  opacity: 0.9;
  transition: opacity 2.2s ease-in-out;
}
#water-ground { transition: opacity 2.2s ease-in-out; }
@media (prefers-reduced-motion: reduce) {
  html.deep-breath *, html.deep-breath *::before, html.deep-breath *::after { animation-play-state: running !important; }
}

:root.quiet-hours body,
html.quiet-hours body {
  filter: brightness(0.86) saturate(0.9);
  transition: filter 2400ms ease;
}
:root.quiet-hours body::after,
html.quiet-hours body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(255, 179, 71, 0.035);
  pointer-events: none;
  z-index: 4;
  transition: opacity 2400ms ease;
}
:root[data-theme="light"].quiet-hours body::after,
html[data-theme="light"].quiet-hours body::after {
  background: rgba(196, 120, 10, 0.03);
}

/* ── #27 · THE GRACEFUL OFFLINE — "the water stilled" ───────────────────── */
.water-offline-banner {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  z-index: 90;
  padding: 9px 20px;
  border-radius: 999px;
  background: var(--tooltip-bg, #1C1C1F);
  border: 1px solid rgba(255, 179, 71, 0.4);
  color: var(--text-primary, #EDEDEE);
  font-size: 12.5px;
  letter-spacing: 0.05em;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: offline-rise 700ms cubic-bezier(0.2, 1, 0.3, 1) both;
}
@keyframes offline-rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ════════════════════════════════════════════════════════════════════════
   SECTION 1 · THE LANDING CEREMONY (master upgrade order)
   ════════════════════════════════════════════════════════════════════════ */

/* ── 1 · THE DAWN LOADING — the page loads as a sunrise ─────────────────── */
#dawn-veil {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: #0B0B0D;
  display: grid; place-items: center;
  transition: opacity 700ms var(--ease);
}
#dawn-veil.dawn-done { opacity: 0; }
#dawn-veil .dawn-warm {
  position: absolute; inset: -20%;
  background: radial-gradient(ellipse 120% 90% at 50% 115%, rgba(232,100,26,0) 40%, rgba(232,100,26,0) 40%);
  transform: scale(1);
  transition: none;
}
#dawn-veil.dawn-run .dawn-warm {
  animation: dawn-warmth 1100ms var(--ease) forwards;
}
@keyframes dawn-warmth {
  0%   { background: radial-gradient(ellipse 120% 90% at 50% 115%, rgba(232,100,26,0) 40%, rgba(232,100,26,0) 40%); }
  55%  { background: radial-gradient(ellipse 120% 90% at 50% 115%, rgba(232,100,26,.30) 40%, rgba(196,120,10,.10) 70%); }
  100% { background: radial-gradient(ellipse 120% 90% at 50% 115%, rgba(255,179,71,.34) 40%, rgba(232,100,26,.12) 72%); }
}
#dawn-veil .dawn-word {
  position: relative; font-size: var(--t-20, 18px); letter-spacing: .34em; text-indent: .34em;
  color: #FFCA7A; opacity: 0; transform: translateY(10px);
}
#dawn-veil.dawn-run .dawn-word { animation: dawn-word 700ms var(--ease) 420ms forwards; }
@keyframes dawn-word { to { opacity: 1; transform: none; } }
[data-theme="light"] #dawn-veil { background: #EFEBE4; }
[data-theme="light"] #dawn-veil .dawn-word { color: #8A5408; }

/* ── 3 · THE LIVING WORDMARK ───────────────────────────────────────────── */
.wordmark-canvas { display: block; margin: 0 auto; max-width: 100%; }
.wordmark-source { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── 2 · PARALLAX DEPTH — the text drifts fastest ───────────────────────── */
.hero-stage .hero-line, .hero-stage .hero-cta, .hero-stage .hero-foot, .hero-stage .live-counter {
  transform: translateY(var(--text-drift, 0));
  transition: transform 60ms linear;
}

/* ── 4 · SECTION-SPECIFIC WATER — the bloom carries the content's hue ──── */
.section { position: relative; }
.section::before {
  content: ""; position: absolute; inset: -2% -4%; pointer-events: none; z-index: 0;
  background: radial-gradient(58% 46% at var(--bloom-x, 50%) 46%, rgba(var(--bloom-hue, 232,100,26), 0) 46%, rgba(var(--bloom-hue, 232,100,26), .11) 100%);
  opacity: 0; transition: opacity 1.4s var(--ease);
}
.section.sec-in::before { opacity: 1; }
.section > .container { position: relative; z-index: 1; }

/* ── 17 · SCROLL-TRIGGERED BLOOMS — the 600ms water-ease ────────────────── */
.rise {
  opacity: 0; transform: translateY(22px) scale(0.985);
  transition: opacity 600ms cubic-bezier(0.22,1,0.36,1), transform 600ms cubic-bezier(0.22,1,0.36,1);
}
.rise.in { opacity: 1; transform: none; }

/* ── 18 · THE WAVE DIVIDER — the scroll leaves a wake ──────────────────── */
.wave-divider { position: absolute; left: 0; right: 0; bottom: -13px; height: 26px; z-index: 2; pointer-events: none; }
.wave-divider svg { width: 100%; height: 100%; display: block; }
.wave-divider path {
  fill: none; stroke: rgba(var(--bloom-hue, 232,100,26), .5); stroke-width: 1.4;
  stroke-dasharray: 6 10; stroke-dashoffset: 0;
}
.wave-divider.passed path { animation: wake-ripple 2.4s var(--ease) 1; }
@keyframes wake-ripple {
  0%   { stroke-dashoffset: 0; stroke-width: 1.4; }
  40%  { stroke-dashoffset: -64; stroke-width: 2.2; }
  100% { stroke-dashoffset: -128; stroke-width: 1.4; }
}

/* ── 19 · THE PULSE CTA — breathing at the resting rate (4s) ────────────── */
.hero-cta .btn-droplet--amber { position: relative; }
.hero-cta .btn-droplet--amber::after {
  content: ""; position: absolute; inset: -5px; border-radius: inherit;
  border: 1px solid rgba(255,179,71,.55);
  animation: cta-breath 4s var(--ease) infinite;
  pointer-events: none;
}
@keyframes cta-breath {
  0%, 100% { opacity: .25; inset: -5px; }
  50%      { opacity: .8;  inset: -8px; }
}

/* ── 6 · THE LIVE BEING ────────────────────────────────────────────────── */
#live-being {
  position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none;
  width: 76px; height: 76px;
  filter: drop-shadow(0 4px 18px rgba(0,0,0,.35));
}

/* ── 10 · THE PHASE EXPLORER ────────────────────────────────────────────── */
.orb { cursor: pointer; outline: none; }
.orb.exploring { border-color: rgba(255,179,71,.65); box-shadow: 0 0 54px rgba(232,100,26,.2) inset, 0 0 22px rgba(232,100,26,.18); }
.orb:focus-visible { border-color: rgba(255,179,71,.65); }
.phase-detail { margin-top: 20px; padding: 18px 22px; border-radius: var(--r-md); border: 1px solid var(--hairline);
  opacity: 0; transform: translateY(8px); transition: all 600ms cubic-bezier(0.22,1,0.36,1); max-width: 100%; }
.phase-detail.on { opacity: 1; transform: none; }
.phase-detail #phaseDetailText { margin: 0; }

/* ── 11 · PRICE BREAKDOWN ───────────────────────────────────────────────── */
.price-card {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translateX(-50%) translateY(6px);
  min-width: 240px; padding: 16px 18px; z-index: 40;
  background: var(--glass-2, rgba(28,28,31,.9)); backdrop-filter: blur(14px);
  border: 1px solid rgba(232,100,26,.35); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: all 320ms var(--ease);
}
.price-card.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.price-card strong { display: block; color: var(--amber-bright, #FFB347); font-size: 18px; margin-bottom: 8px; }
.price-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; color: var(--muted, #B9B9BE); }
.price-card li { padding-left: 14px; position: relative; }
.price-card li::before { content: "·"; position: absolute; left: 0; color: var(--amber-bright, #FFB347); }

/* ── 9 · INTERACTIVE TRY ────────────────────────────────────────────────── */
.try-btn { display: block; margin: 18px auto 0; }
#heroTry {
  margin-top: 20px; display: flex; flex-direction: column; gap: 8px;
  padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: rgba(255,255,255,.03); max-height: 320px; overflow-y: auto; text-align: left;
}
#heroTry .try-msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; font-size: var(--t-13); line-height: 1.5; }
#heroTry .try-msg--you { align-self: flex-end; background: rgba(255,255,255,.06); border: 1px solid var(--hairline); border-radius: 12px 3px 12px 12px; }
#heroTry .try-msg--them { align-self: flex-start; background: rgba(232,100,26,.09); border: 1px solid rgba(232,100,26,.25); border-radius: 3px 12px 12px 12px; }
#heroTry form { display: flex; gap: 8px; margin-top: 4px; }
#heroTry input { flex: 1; min-width: 0; background: rgba(22,22,24,.6); border: 1px solid var(--hairline); color: var(--ink); border-radius: 10px; padding: 9px 12px; font-size: var(--t-13); font-family: var(--font); outline: none; }
#heroTry input:focus { border-color: rgba(232,100,26,.5); }
#heroTry .try-note { font-size: var(--t-11); color: var(--faint, #8A8A8E); }

/* ── 20 · THE EXIT TRAIL ────────────────────────────────────────────────── */
.exit-spark { position: fixed; z-index: 190; width: 5px; height: 5px; border-radius: 50%; pointer-events: none; mix-blend-mode: screen; }
[data-theme="light"] .exit-spark { mix-blend-mode: multiply; }

/* ── 12 · SDK WAITLIST COUNTER ──────────────────────────────────────────── */
.sdk-wait { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--glass-3, rgba(255,255,255,.04)); font-size: var(--t-13); color: var(--muted); }
.sdk-wait .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber-bright, #FFB347); animation: counterpulse 2.4s var(--ease) infinite; }
.sdk-wait strong { color: var(--amber-bright, #FFB347); }

/* ── touch-hold parity for hover states (S8.7) ──────────────────────────── */
@media (hover: none) {
  .price-card { left: 0; transform: translateY(6px); }
  .price-card.on { transform: translateY(0); }
}
