/* ============================================================================
   base.css — reset, typography, background system, spine, reveals, print.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-mid);
  background: var(--bg-base);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
:where(ul, ol) { list-style: none; padding: 0; }

::selection { background: rgba(var(--glow-cyan), 0.28); color: var(--text-hi); }

/* ── Focus ─────────────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--cyan-500);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Type roles ────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text-hi); font-weight: 420;
  font-optical-sizing: auto; line-height: 1.08; letter-spacing: -0.005em; }

.display-xl {
  font-family: var(--font-display); font-weight: 400; font-optical-sizing: auto;
  font-size: clamp(3.4rem, 8vw, 8rem); line-height: 0.9; letter-spacing: -0.015em;
  color: var(--text-hi);
}
.display-l {
  font-family: var(--font-display); font-weight: 440; font-optical-sizing: auto;
  font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.02; letter-spacing: -0.01em;
  color: var(--text-hi);
}
h3, .h3 { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.005em; line-height: 1.15; }

.body-l { font-size: 1.125rem; line-height: 1.6; }
.small  { font-size: 0.875rem; font-weight: 500; line-height: 1.5; }

.eyebrow {
  font-family: var(--font-mono); font-weight: 500; font-size: 0.75rem;
  letter-spacing: 0.18em; text-transform: uppercase; line-height: 1;
  color: var(--text-lo);
}
.eyebrow .num { color: var(--cyan-500); }

.kpi {
  font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(2.25rem, 4vw, 3.25rem); letter-spacing: -0.01em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--text-hi);
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.grad-word {
  background: var(--duotone);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(var(--glow-cyan), 0.25);
  /* padding avoids clipping the italic/edge glyphs of the gradient word */
  padding-right: 0.04em;
}

.measure { max-width: 68ch; }
.text-hi { color: var(--text-hi); }
.text-lo { color: var(--text-lo); }

/* ============================================================================
   Background system — four stacked fixed layers (behind all content).
   ========================================================================== */

/* Layer 1 — base wash (warm graphite; no blue) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: var(--z-bg-wash); pointer-events: none;
  background: radial-gradient(125% 95% at 50% -12%, #17181C 0%, var(--bg-base) 46%, var(--bg-void) 100%);
}
/* Layer 4 — monochrome grain (material tooth, not glow; data-URI, no network) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: var(--z-bg-grain); pointer-events: none;
  opacity: 0.06; mix-blend-mode: soft-light;
  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.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Layer 3 — technical grid (the only structural texture; aurora blobs removed) */
.bg-field { position: fixed; inset: 0; pointer-events: none; }
.bg-grid { /* technical dot-matrix, alpha-masked toward edges */
  z-index: var(--z-bg-grid);
  background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 30%, #000 40%, transparent 92%);
  mask-image: radial-gradient(120% 100% at 50% 30%, #000 40%, transparent 92%);
}

/* ============================================================================
   Layout primitives
   ========================================================================== */
.shell { width: 100%; max-width: var(--shell-max); margin-inline: auto; padding-inline: var(--page-x); }
.container { width: 100%; max-width: var(--content-max); margin-inline: auto; }

.section {
  position: relative; z-index: var(--z-content);
  padding-block: clamp(80px, 12vh, 160px);
  scroll-margin-top: calc(var(--nav-h) + 12px);
}
.section-head { margin-bottom: var(--s-7); display: flex; flex-direction: column; gap: var(--s-3); }
.section-head .eyebrow { display: inline-flex; gap: 0.7em; align-items: center; }
.section-kicker { color: var(--text-lo); font-size: 1rem; max-width: 60ch; }

.grid { display: grid; gap: var(--s-5); }
.split-7-5 { display: grid; grid-template-columns: 7fr 5fr; gap: clamp(24px, 5vw, 72px); align-items: center; }

/* ============================================================================
   The Pipeline Spine — signature element
   ========================================================================== */
/* The Axis — a milled chart-axis rail (ticks, no glow) replacing the glowing spine */
.spine {
  position: fixed; top: 0; bottom: 0; left: var(--spine-x); width: 1px;
  z-index: var(--z-spine); pointer-events: none;
  background: var(--hairline-soft);
}
.spine::before { /* tick marks down the axis */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 5px;
  background: repeating-linear-gradient(180deg, var(--hairline-soft) 0 1px, transparent 1px 20px);
}

/* section nodes rail (anchored dots with labels; positioned by JS along document height) */
.spine-rail {
  position: absolute; left: var(--spine-x); top: 0; width: 1px; height: 100%;
  z-index: calc(var(--z-spine) + 1); pointer-events: none;
}
.spine-node {
  position: absolute; left: 0; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 10px; pointer-events: auto;
}
.spine-node > a { display: flex; align-items: center; gap: 10px; }
.spine-node .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--bg-raised); border: 1px solid var(--hairline-accent);
  box-shadow: 0 0 0 3px rgba(var(--glow-cyan), 0.08);
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1) var(--ease-out);
}
.spine-node .dot::after {
  content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--cyan-500); opacity: 0.35;
}
.spine-node .label {
  font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim); white-space: nowrap; transition: color var(--dur-1) var(--ease-out);
}
.spine-node.is-active .dot {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(var(--glow-cyan), 0.12), 0 0 14px 2px rgba(var(--glow-cyan), 0.6);
}
.spine-node.is-active .dot::after { opacity: 1; }
.spine-node.is-active .label { color: var(--cyan-400); }

/* ============================================================================
   Reveal-on-scroll (progressive enhancement; visible by default if no JS)
   ========================================================================== */
.reveal { opacity: 1; }
.js .reveal { opacity: 0; transform: translateY(14px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}

/* ── Skip link ─────────────────────────────────────────────────────────── */
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: var(--z-skiplink);
  background: var(--bg-raised); color: var(--text-hi);
  padding: 10px 16px; border-radius: var(--r-btn); border: 1px solid var(--hairline-accent);
  transform: translateY(-160%); transition: transform var(--dur-1) var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ============================================================================
   Accessibility / capability fallbacks
   ========================================================================== */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-strong { background: rgba(12,16,32,0.9) !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-strong {
    background: rgba(12,16,32,0.9);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .bg-aurora span, .spine .pulse { animation: none !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================================================
   Print — this is an online résumé/CV. Ctrl+P → clean light 1–2 page résumé.
   ========================================================================== */
@media print {
  :root { --text-hi:#111; --text-mid:#222; --text-lo:#555; }
  html, body { background: #fff !important; color: #111 !important; }
  body::before, body::after,
  .bg-field, .spine, .spine-nodes, .spine-node, .site-nav, .to-top,
  .cursor-glow, .hero-status, .filter-bar, #work, .skip-link,
  .report-card, .drawer, dialog { display: none !important; }
  .section { padding-block: 12px !important; page-break-inside: avoid; }
  .glass, .glass-strong {
    background: #fff !important; box-shadow: none !important;
    border: 1px solid #ccc !important; backdrop-filter: none !important;
  }
  .glass::before { display: none !important; }
  h1, h2, h3, .display-xl, .display-l { color: #000 !important; }
  .grad-word { -webkit-text-fill-color: #0a5; color: #0a5 !important; }
  a { color: #06c !important; }
  .print-url::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #555; }
  .experience-item, .edu-item, .card { break-inside: avoid; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
