/* ============================================================
   NEXUM — Base: reset, typography, primitives
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--banner-h) + 12px);
}

body {
  background: var(--bg);
  color: var(--fg-1);
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}

img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:root[data-theme] :focus-visible { outline-color: var(--accent); }

.skip-link {
  position: absolute; top: 0; left: 50%;
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.7rem 1.2rem; border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: 600; font-size: var(--t-small);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

/* ---------- Type primitives ---------- */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.99;
  text-wrap: balance;
}
h1 { font-size: var(--t-h1); }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h4 { font-size: var(--t-body); font-weight: 600; line-height: 1.35; }

.lead {
  font-size: var(--t-lead);
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 46ch;
  text-wrap: pretty;
}
.body-copy { color: var(--fg-2); max-width: 62ch; text-wrap: pretty; }
.muted { color: var(--fg-3); }
.small { font-size: var(--t-small); line-height: 1.6; }
.gold { color: var(--accent); }

/* The utility face carries measurement cadence, section index and data labels */
.mono {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-feature-settings: "tnum" 1;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex; align-items: center; gap: 0.7em;
}
.eyebrow::before {
  content: ""; width: 1.8em; height: 1px;
  background: var(--accent-line); flex-shrink: 0;
}
.eyebrow--plain::before { display: none; }

/* ---------- Layout primitives ---------- */
.wrap      { width: 100%; max-width: var(--w);      margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { width: 100%; max-width: var(--w-wide); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-mid  { width: 100%; max-width: var(--w-mid);  margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { width: 100%; max-width: var(--w-narrow); margin-inline: auto; padding-inline: var(--gutter); }

.chapter {
  position: relative;
  padding-block: var(--chapter-y);
  background: var(--bg);
  color: var(--fg-1);
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease);
}
.chapter--tight { padding-block: clamp(3.5rem, 2rem + 5vw, 6.5rem); }
.chapter-head { max-width: 46ch; }
.chapter-head .eyebrow { margin-bottom: 1.4rem; }
.chapter-head h2 { margin-bottom: 1.3rem; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 48px;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: var(--t-small);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease),
              color 0.25s var(--ease), transform 0.25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 84%, #fff); }
.btn--ghost { border-color: var(--line-med); color: var(--fg-1); }
.btn--ghost:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.btn--quiet { padding-inline: 0; min-height: 32px; color: var(--accent); font-weight: 600; }
.btn--quiet .arrow { transition: transform 0.25s var(--ease); }
.btn--quiet:hover .arrow { transform: translateX(3px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }

/* ---------- Status — colour is never the only signal ---------- */
.status {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--font-mono); font-size: var(--t-mono);
  font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.35em 0.75em 0.35em 0.6em;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.status svg { width: 0.95em; height: 0.95em; flex-shrink: 0; }
.status--pos  { color: var(--pos); }
.status--warn { color: var(--warn); }
.status--risk { color: var(--risk); }
.status--info { color: var(--info); }

/* ---------- Surfaces ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

/* ---------- Demo-data marker ---------- */
.demo-note {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-4);
  display: inline-flex; align-items: center; gap: 0.6em;
}
.demo-note::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  border: 1px solid currentColor;
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity 0.75s var(--ease), transform 0.75s var(--ease);
  transition-delay: var(--delay, 0s);
}

/* ---------- Drawn signal paths ---------- */
.signal-path {
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: var(--len, 1200);
  stroke-dashoffset: var(--len, 1200);
}
.is-in .signal-path,
.signal-path.is-drawn {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.9s var(--ease);
  transition-delay: var(--delay, 0s);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .signal-path { stroke-dashoffset: 0; }
  .btn:hover { transform: none; }
}
