/* ════════════════════════════════════════════════════════════════════
   VYAN — Base & Primitives
   A calm instrument: dark, precise, fast, quiet.
   Information rises by meaning, not decoration. The page is still;
   confidence does not animate itself into view.
   ════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; color-scheme: dark; }

body {
  background: var(--obsidian);
  color: var(--platinum);
  font-family: var(--body);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

::selection { background: rgba(201,162,63,.25); color: var(--platinum); }

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.028em; line-height: 1.05; text-wrap: balance; }
h1 { font-size: clamp(38px, 6vw, 78px); font-weight: 750; }
h2 { font-size: clamp(28px, 3.8vw, 50px); }
h3 { font-size: clamp(18px, 2vw, 22px); letter-spacing: -.015em; }
h4 { font-size: 15px; letter-spacing: -.01em; }

.disp {
  font-family: var(--disp);
  font-weight: 400;
  letter-spacing: .16em;
  text-transform: uppercase;
}

em.ink-ember, em.ink-plat, .no-italic { font-style: normal; } /* no italics in UI — brand law */
.ink-ember {
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.ink-plat {
  background: var(--grad-plat);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* mono annotation — used for indices, captions, data. Sparingly. */
.lbl {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--plat-faint);
  font-weight: 500;
}
.lbl.ember { color: var(--ember); }

.sub { color: var(--plat-dim); font-size: clamp(16px, 1.5vw, 18px); line-height: 1.65; max-width: var(--max-w-text); text-wrap: pretty; }
.dim { color: var(--plat-dim); }
.faint { color: var(--plat-faint); }
.small { font-size: 13px; }

/* money is typographically sacred */
.money, .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.money { font-weight: 700; letter-spacing: -.01em; }
.money.gold {
  background: var(--grad-ember);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

/* ── Buttons · exactly ONE .btn-gold per surface — brand law ────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 13.5px; font-weight: 600; letter-spacing: .01em;
  padding: 12px 22px;
  border-radius: var(--r-control);
  border: 1px solid var(--line-hi);
  background: transparent;
  color: var(--platinum);
  transition: border-color var(--m-fast) var(--ease), background var(--m-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--plat-faint); background: rgba(232,232,236,.03); }

/* the golden CTA — apex-notched corner, cut at the mark's angle */
.btn-gold {
  background: var(--grad-ember);
  color: var(--ember-ink);
  border: none;
  border-radius: 2px;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
  padding: 14px 26px;
  font-weight: 700;
}
.btn-gold:hover { background: linear-gradient(90deg, #F0DA9A, var(--ember)); }

.btn-ghost { border-color: transparent; color: var(--plat-dim); }
.btn-ghost:hover { color: var(--platinum); background: rgba(232,232,236,.04); border-color: transparent; }

.btn-lg { padding: 15px 30px; font-size: 14.5px; }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* understated editorial link — often better than a second button */
.tlink {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--platinum);
  border-bottom: 1px solid var(--line-hi);
  padding-bottom: 3px;
  transition: border-color var(--m-fast) var(--ease);
}
.tlink:hover { border-color: var(--ember); }
.tlink .arr { color: var(--ember); font-weight: 400; }

/* ── Surfaces ───────────────────────────────────────────────────── */
.card {
  background: var(--graphite-2);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 26px;
}
.card.hover { transition: border-color var(--m-base) var(--ease); }
.card.hover:hover { border-color: var(--line-hi); }

.inset {
  background: var(--obsidian);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  padding: 14px 16px;
}

/* ── Chips & status · precise rectangles, not bubbles ───────────── */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--plat-dim);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  padding: 4px 9px;
}
.tag.ember { color: var(--ember); border-color: rgba(201,162,63,.35); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: currentColor; }
.status.ok    { color: var(--green); }
.status.warn  { color: var(--amber); }
.status.bad   { color: var(--red); }

.badge-verified {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; color: var(--trust);
}

/* ── The ember pulse — the system's single flourish ─────────────── */
@keyframes emberPulse {
  0%   { box-shadow: 0 0 0 rgba(201,162,63,0); }
  45%  { box-shadow: var(--glow-ember); }
  100% { box-shadow: 0 0 0 rgba(201,162,63,0); }
}
.ember-pulse { animation: emberPulse calc(var(--m-pulse) * 3) var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .ember-pulse { animation: none; }
}

/* ── Forms ──────────────────────────────────────────────────────── */
.field label {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--plat-faint); margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--obsidian);
  border: 1px solid var(--line-hi);
  border-radius: var(--r-control);
  color: var(--platinum);
  padding: 11px 13px;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--ember);
}

/* ── Tables ─────────────────────────────────────────────────────── */
table.vt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.vt th {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--plat-faint); text-align: left; font-weight: 500;
  padding: 10px 14px; border-bottom: 1px solid var(--line-hi);
}
table.vt td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.vt tr:last-child td { border-bottom: none; }
table.vt td.r, table.vt th.r { text-align: right; }

/* ── Layout helpers ─────────────────────────────────────────────── */
.wrap { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-text { max-width: var(--max-w-text); margin: 0 auto; padding: 0 var(--gutter); }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .g4 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .g4, .g3, .g2 { grid-template-columns: 1fr; } }

/* asymmetric splits — the default composition. Centered symmetry is the exception. */
.split { display: grid; gap: 56px; align-items: start; }
.split-57 { grid-template-columns: 5fr 7fr; }
.split-75 { grid-template-columns: 7fr 5fr; }
.split-48 { grid-template-columns: 4fr 8fr; }
.split-84 { grid-template-columns: 8fr 4fr; }
@media (max-width: 920px) { .split-57, .split-75, .split-48, .split-84 { grid-template-columns: 1fr; gap: 36px; } }

.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.apex-rule {
  height: 1px; border: none; background: var(--line);
}

/* legacy alias kept inert — motion-on-scroll is retired */
.reveal { opacity: 1; transform: none; }

/* ── Mobile-first hardening ─────────────────────────────────────── */
/* Touch targets: 48px is the doctrine floor for critical actions (§5.1) */
@media (pointer: coarse) {
  .btn, .btn-gold { min-height: 46px; }
  .btn-sm { min-height: 40px; }
  .tlink { padding-top: 8px; padding-bottom: 8px; }
  .field input, .field select, .field textarea { min-height: 46px; font-size: 16px; } /* 16px stops iOS zoom-on-focus */
}

/* horizontal-scroll shell for wide tables on small screens */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.scroll-x > table.vt { min-width: 560px; }

/* iOS / Android safe areas — apply to sticky bottom bars */
.safe-bottom { padding-bottom: max(14px, env(safe-area-inset-bottom)); }

@media (max-width: 640px) {
  :root { --gutter: 20px; }
  body { font-size: 15px; }
  h1 { font-size: clamp(34px, 10.5vw, 44px); }
  h2 { font-size: clamp(25px, 7.5vw, 34px); }
}

/* a11y */
.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-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--graphite); color: var(--platinum);
  padding: 10px 16px; font-size: 13px;
}
.skip-link:focus { left: 0; }
