/* =============================================================
   César Antonio Pérez Quintana — portfolio
   Design system: "instrument panel" — dark, technical, physical.
   ============================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg:          #05070e;
  --bg-panel:    #090d17;
  --bg-raise:    #0d1220;
  --bg-sunken:   #03050a;

  /* Rules & strokes */
  --line:        rgba(150, 180, 220, 0.11);
  --line-mid:    rgba(150, 180, 220, 0.18);
  --line-strong: rgba(150, 180, 220, 0.30);

  /* Type */
  --text:        #e7edf6;
  --text-dim:    #9dabc1;
  --text-faint:  #64728a;

  /* Accents — ocean / spectral */
  --accent:      #3ddbc7;
  --accent-deep: #14b8a6;
  --accent-2:    #7da2ff;
  --warm:        #f6a94a;
  --hot:         #ff6f6f;
  --violet:      #b08cff;

  --glow:        rgba(61, 219, 199, 0.22);
  --glow-2:      rgba(125, 162, 255, 0.18);

  /* Fonts */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Metrics */
  --wrap:     1180px;
  --wrap-narrow: 780px;
  --gutter:   clamp(1rem, 4vw, 2.75rem);
  --radius:   14px;
  --radius-sm: 8px;

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

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint field gradient behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 12% -8%,  rgba(61, 219, 199, 0.09), transparent 62%),
    radial-gradient(900px 560px at 92% 4%,    rgba(125, 162, 255, 0.08), transparent 60%),
    radial-gradient(1000px 700px at 50% 108%, rgba(176, 140, 255, 0.06), transparent 65%);
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #6ff0de; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; }
p { margin: 0; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: rgba(61, 219, 199, 0.28); color: #fff; }

.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: #03110f;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 0; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

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

.section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; }
.section + .section { padding-top: 0; }
.section--ruled { border-top: 1px solid var(--line); }

/* Eyebrow: "01 / SECTION NAME" */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.15rem;
}
.eyebrow::before {
  content: "";
  width: 1.9rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  flex: none;
}
.eyebrow b { color: var(--accent); font-weight: 500; }

.section-head { max-width: 62ch; margin-bottom: clamp(2rem, 4vw, 3.25rem); }
.section-head h2 {
  font-size: clamp(1.85rem, 4.1vw, 2.9rem);
  margin-bottom: 1rem;
  text-wrap: balance;
}
.lede {
  color: var(--text-dim);
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  line-height: 1.72;
  text-wrap: pretty;
}
.lede strong { color: var(--text); font-weight: 600; }

.prose p + p { margin-top: 1.05rem; }
.prose { color: var(--text-dim); line-height: 1.75; }
.prose strong { color: var(--text); font-weight: 600; }
.prose em { color: var(--accent); font-style: normal; }

/* ---------- 4. Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.brand { display: flex; align-items: center; gap: 0.7rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand__mark { width: 28px; height: 28px; flex: none; }
.brand__mark circle, .brand__mark path { transform-origin: center; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; letter-spacing: -0.01em; }
.brand__role {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.nav { display: flex; align-items: center; gap: 0.3rem; }
.nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav a:hover { color: var(--text); background: rgba(150, 180, 220, 0.07); }
.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0.85rem; right: 0.85rem; bottom: 0.15rem;
  height: 1px;
  background: var(--accent);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-mid);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    padding: 0.7rem var(--gutter) 1.1rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 0.8rem 0.6rem; font-size: 0.82rem; }
  .nav a[aria-current="page"]::after { left: 0.6rem; right: auto; width: 1.4rem; }
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.78rem 1.3rem;
  border: 1px solid var(--line-mid);
  border-radius: 999px;
  background: rgba(150, 180, 220, 0.04);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease), color 0.2s var(--ease);
}
.btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(150, 180, 220, 0.09);
  transform: translateY(-1px);
}
.btn svg { width: 14px; height: 14px; flex: none; }
.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #03120f;
  font-weight: 600;
  box-shadow: 0 10px 30px -12px var(--glow);
}
.btn--primary:hover { color: #03120f; background: linear-gradient(135deg, #58ecd8, var(--accent)); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- 6. Panels, figures, chips ---------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.figure {
  position: relative;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.figure__body { padding: clamp(0.9rem, 2vw, 1.4rem); }
.figure__body--flush { padding: 0; }
.figure figcaption {
  border-top: 1px solid var(--line);
  padding: 0.85rem clamp(0.9rem, 2vw, 1.4rem);
  font-family: var(--font-mono);
  font-size: 0.71rem;
  line-height: 1.65;
  color: var(--text-faint);
  letter-spacing: 0.01em;
  background: rgba(3, 5, 10, 0.5);
}
.figure figcaption b { color: var(--accent); font-weight: 500; letter-spacing: 0.1em; }
.figure figcaption a { color: var(--text-dim); text-decoration: underline; text-decoration-color: var(--line-strong); }
.figure figcaption a:hover { color: var(--accent); }

/* Corner ticks — measurement motif */
.ticked::before, .ticked::after {
  content: "";
  position: absolute;
  width: 9px; height: 9px;
  border: 1px solid var(--accent);
  opacity: 0.5;
  pointer-events: none;
}
.ticked::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: var(--radius-sm) 0 0 0; }
.ticked::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 var(--radius-sm) 0; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(150, 180, 220, 0.045);
  font-family: var(--font-mono);
  font-size: 0.685rem;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  white-space: nowrap;
}
.chip--accent { border-color: rgba(61, 219, 199, 0.35); color: var(--accent); background: rgba(61, 219, 199, 0.07); }
.chip--warm   { border-color: rgba(246, 169, 74, 0.32);  color: var(--warm);   background: rgba(246, 169, 74, 0.07); }
.chip--violet { border-color: rgba(176, 140, 255, 0.32); color: var(--violet); background: rgba(176, 140, 255, 0.07); }
.chip--blue   { border-color: rgba(125, 162, 255, 0.32); color: var(--accent-2); background: rgba(125, 162, 255, 0.07); }

/* Small mono label above a value */
.label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- 7. Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }
.reveal[data-delay="5"] { transition-delay: 0.40s; }

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

/* ---------- 8. Hero ---------- */
.hero {
  position: relative;
  min-height: min(92vh, 900px);
  display: flex;
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
/* Vignette so type stays readable over the field */
.hero__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(100deg, rgba(5, 7, 14, 0.97) 0%, rgba(5, 7, 14, 0.9) 28%, rgba(5, 7, 14, 0.5) 52%, rgba(5, 7, 14, 0.14) 74%, rgba(5, 7, 14, 0.3) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 26%);
}
.hero__inner { position: relative; z-index: 2; width: 100%; }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero__loc {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 1.6rem;
}
.hero__loc {
  flex-wrap: wrap;
  align-items: flex-start;
}
.hero__loc .dot {
  flex: none;
  margin-top: 0.42em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--glow);
  animation: pulse 2.6s var(--ease) infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 219, 199, 0.5); }
  70%  { box-shadow: 0 0 0 9px rgba(61, 219, 199, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 219, 199, 0); }
}

.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.9rem);
  line-height: 1.04;
  letter-spacing: -0.032em;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}
.hero h1 .accent {
  background: linear-gradient(105deg, var(--accent) 10%, var(--accent-2) 55%, var(--violet) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero__role {
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 1.55vw, 0.92rem);
  letter-spacing: 0.07em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-transform: uppercase;
}
.hero__role span { color: var(--text-faint); }
.hero__role b { color: var(--text); font-weight: 500; }
.hero__lede {
  max-width: 52ch;
  color: var(--text-dim);
  font-size: clamp(1rem, 1.75vw, 1.15rem);
  line-height: 1.72;
  margin-bottom: 2.1rem;
  text-wrap: pretty;
}
.hero__lede strong { color: var(--text); font-weight: 600; }

/* Instrument panel */
.instr {
  background: color-mix(in srgb, var(--bg-panel) 85%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-mid);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 70px -28px rgba(0, 0, 0, 0.9);
}
.instr__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 5, 10, 0.6);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.instr__led { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent); }
.instr__led i {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 7px var(--accent);
  animation: blink 1.6s steps(1, end) infinite;
}
@keyframes blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0.25; } }

.instr__readouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.readout {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
}
.readout:nth-child(odd) { border-right: 1px solid var(--line); }
.readout dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.3rem;
}
.readout dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.readout dd small { color: var(--text-faint); font-size: 0.68rem; letter-spacing: 0.05em; }

.instr__controls { padding: 0.85rem 0.9rem 1rem; }
.seg {
  display: grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(3, 5, 10, 0.6);
  margin-top: 0.45rem;
}
.seg button {
  padding: 0.44rem 0.3rem;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] {
  background: rgba(61, 219, 199, 0.14);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(61, 219, 199, 0.3);
}
.instr__hint {
  margin-top: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  line-height: 1.6;
  color: var(--text-faint);
}
.instr__sliders {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.ctrl__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.15rem;
}
.ctrl__reset {
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.ctrl__reset:hover {
  color: var(--accent);
}

.hero__scroll {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.hero__scroll i {
  width: 1px; height: 34px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: drop 2.2s var(--ease) infinite;
}
@keyframes drop { 0% { transform: scaleY(0.2); transform-origin: top; opacity: 0; } 40% { opacity: 1; } 100% { transform: scaleY(1); transform-origin: top; opacity: 0; } }

@media (max-width: 960px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__veil { background: linear-gradient(180deg, rgba(5,7,14,0.9) 0%, rgba(5,7,14,0.72) 45%, rgba(5,7,14,0.92) 100%); }
  .hero__scroll { display: none; }
}

/* ---------- 9. The bridge (two-domain diagram) ---------- */
.bridge {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
.bridge__viz { padding: clamp(1rem, 3vw, 2rem); }
.bridge__viz svg { width: 100%; height: auto; }
.bridge__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
}
.tenet {
  padding: 1.35rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.tenet:hover { border-color: var(--line-mid); transform: translateY(-2px); }
.tenet__n {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.tenet h3 { font-size: 1.02rem; margin-bottom: 0.5rem; }
.tenet p { color: var(--text-dim); font-size: 0.9rem; line-height: 1.68; }

/* ---------- 10. Metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.metric {
  padding: 1.5rem 1.35rem 1.4rem;
  background: var(--bg-panel);
  position: relative;
  transition: background 0.25s var(--ease);
}
.metric:hover { background: var(--bg-raise); }
.metric__val {
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 3.6vw, 2.4rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 0.1rem;
}
.metric__val .unit { font-size: 0.5em; color: var(--text-dim); letter-spacing: 0; }
.metric__key {
  margin-top: 0.7rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.metric__ctx {
  margin-top: 0.3rem;
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text-faint);
}
.metric--blue   .metric__val { color: var(--accent-2); }
.metric--warm   .metric__val { color: var(--warm); }
.metric--violet .metric__val { color: var(--violet); }

/* ---------- 11. Case studies ---------- */
.case {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
  overflow: hidden;
  scroll-margin-top: 6rem;
}
.case + .case { margin-top: clamp(1.75rem, 4vw, 3rem); }

.case__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.75rem;
  padding: clamp(1.3rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(3, 5, 10, 0.4);
}
.case__id {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.7rem;
}
.case__head > div:first-child { flex: 1 1 24rem; min-width: 0; }
.case__head h2, .case__head h3 {
  font-size: clamp(1.35rem, 2.9vw, 1.95rem);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.case__org {
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.case__org span { color: var(--text-faint); }
.case__stamp { text-align: right; flex: 0 0 auto; }
.case__stamp .v {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3.6vw, 2.3rem);
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.case__stamp .k {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.case__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
}
.case__narrative { padding: clamp(1.3rem, 3vw, 2rem); border-right: 1px solid var(--line); }
.case__viz {
  padding: clamp(1.1rem, 2.5vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: rgba(3, 5, 10, 0.35);
  min-width: 0;
}
.case__viz svg, .case__viz canvas { width: 100%; height: auto; }
.case__viz .cap {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.6;
  color: var(--text-faint);
}
.case__viz .cap b { color: var(--accent); font-weight: 500; letter-spacing: 0.1em; }

.beat + .beat { margin-top: 1.3rem; }
.beat__k {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.beat__k::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.beat p { color: var(--text-dim); font-size: 0.935rem; line-height: 1.72; }
.beat p + p { margin-top: 0.7rem; }
.beat strong { color: var(--text); font-weight: 600; }
.beat--result .beat__k { color: var(--accent); }
.beat--result .beat__k::after { background: linear-gradient(90deg, rgba(61,219,199,0.35), var(--line)); }

.bullets { margin-top: 0.15rem; }
.bullets li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--text-dim);
  font-size: 0.925rem;
  line-height: 1.7;
}
.bullets li + li { margin-top: 0.55rem; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.68em;
  width: 5px; height: 5px;
  border: 1px solid var(--accent);
  border-radius: 1px;
  transform: rotate(45deg);
}
.bullets strong { color: var(--text); font-weight: 600; }

.case__foot {
  padding: 1rem clamp(1.3rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
  background: rgba(3, 5, 10, 0.45);
}

@media (max-width: 880px) {
  .case__body { grid-template-columns: 1fr; }
  .case__narrative { border-right: 0; border-bottom: 1px solid var(--line); }
  .case__stamp { text-align: left; }
}

/* ---------- 12. Teaser cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(265px, 1fr));
  gap: 1.1rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.5rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
  color: var(--text);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
a.card:hover {
  color: var(--text);
  border-color: rgba(61, 219, 199, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.95);
}
.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.card__top .arrow { color: var(--accent); transition: transform 0.25s var(--ease); }
a.card:hover .card__top .arrow { transform: translate(3px, -3px); }
.card h3 { font-size: 1.12rem; line-height: 1.25; text-wrap: balance; }
.card p { color: var(--text-dim); font-size: 0.9rem; line-height: 1.68; flex: 1; }
.card__glyph { height: 84px; margin: -0.2rem 0 0.1rem; }
.card__glyph svg { width: 100%; height: 100%; }

/* ---------- 13. Interactive demo shell ---------- */
.demo { scroll-margin-top: 6rem; }
.demo__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
}
.demo__stage {
  position: relative;
  min-height: clamp(340px, 46vh, 480px);
  background: var(--bg-sunken);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.demo__stage canvas, .demo__stage svg {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  /* The stage stretches to the side column; the plot itself should not. */
  height: min(100%, 560px);
  display: block;
}
.demo__side { padding: clamp(1.1rem, 2.5vw, 1.6rem); display: flex; flex-direction: column; gap: 1.05rem; }
.demo__side h3 { font-size: 1.05rem; }
.demo__side p { color: var(--text-dim); font-size: 0.885rem; line-height: 1.68; }
.demo__math {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: rgba(3, 5, 10, 0.55);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.85;
  color: var(--text-dim);
  overflow-x: auto;
}
.demo__math b { color: var(--accent); font-weight: 500; }
.demo__math .cmt { color: var(--text-faint); }

.ctrl { display: flex; flex-direction: column; gap: 0.35rem; }
.ctrl__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.ctrl__row .v { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-deep), rgba(150, 180, 220, 0.16));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 10px var(--glow);
}
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: rgba(150, 180, 220, 0.16); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--accent-deep); }
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}

.legend { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; }
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}
.legend__item i { width: 11px; height: 11px; border-radius: 3px; flex: none; }

@media (max-width: 900px) {
  .demo__grid { grid-template-columns: 1fr; }
  .demo__stage { border-right: 0; border-bottom: 1px solid var(--line); min-height: 360px; }
}

/* ---------- 14. Capability map ---------- */
.caps { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.1rem; }
.cap {
  padding: 1.35rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
}
.cap__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}
.cap__head svg { width: 20px; height: 20px; flex: none; color: var(--accent); }
.cap__head h3 { font-size: 0.98rem; }
.cap__proof {
  margin-top: 0.95rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  font-family: var(--font-mono);
  font-size: 0.665rem;
  line-height: 1.7;
  color: var(--text-faint);
}
.cap__proof a { color: var(--text-dim); text-decoration: underline; text-decoration-color: var(--line-strong); }
.cap__proof a:hover { color: var(--accent); }
.cap__proof b { color: var(--accent); font-weight: 500; letter-spacing: 0.1em; }

/* ---------- 15. Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(1.6rem, 4vw, 2.75rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(700px 320px at 88% 15%, rgba(61, 219, 199, 0.09), transparent 66%),
    linear-gradient(180deg, var(--bg-panel), var(--bg-sunken));
}
.contact h2 { font-size: clamp(1.6rem, 3.6vw, 2.35rem); margin-bottom: 0.9rem; text-wrap: balance; }
.links { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.links a, .links div {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  background: var(--bg-panel);
  color: var(--text);
  transition: background 0.2s var(--ease);
}
.links a:hover { background: var(--bg-raise); color: var(--text); }
.links svg { width: 17px; height: 17px; flex: none; color: var(--accent); }
.links .k {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: block;
  margin-bottom: 0.1rem;
}
.links .v { font-size: 0.88rem; word-break: break-word; }
@media (max-width: 820px) { .contact { grid-template-columns: 1fr; } }

/* ---------- 16. Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3rem;
  margin-top: clamp(3rem, 7vw, 5rem);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.1rem; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--accent); }

/* ---------- 17. Page header (interior pages) ---------- */
.page-head {
  position: relative;
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.page-head__bg { position: absolute; inset: 0; z-index: 0; opacity: 0.5; }
.page-head__inner { position: relative; z-index: 1; }
.page-head h1 {
  font-size: clamp(2.1rem, 5.6vw, 3.5rem);
  letter-spacing: -0.03em;
  margin-bottom: 1.1rem;
  text-wrap: balance;
}
.page-head .lede { max-width: 60ch; }
.page-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.page-head__meta b { color: var(--accent); font-weight: 500; }

/* Jump bar */
.jump {
  position: sticky;
  top: 4.25rem;
  z-index: 60;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.jump__inner {
  display: flex;
  gap: 0.2rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 0.5rem;
}
.jump__inner::-webkit-scrollbar { display: none; }
.jump a {
  flex: none;
  padding: 0.42rem 0.62rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.jump a:hover { color: var(--text); background: rgba(150, 180, 220, 0.07); }
.jump a.is-active { color: var(--accent); background: rgba(61, 219, 199, 0.1); }

/* ---------- 18. Utilities ---------- */
.stack-sm > * + * { margin-top: 0.75rem; }
.stack    > * + * { margin-top: 1.25rem; }
.stack-lg > * + * { margin-top: 2rem; }
.mono { font-family: var(--font-mono); }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.1rem; }
.note {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-2);
  border-radius: var(--radius-sm);
  background: rgba(125, 162, 255, 0.05);
  font-size: 0.885rem;
  line-height: 1.68;
  color: var(--text-dim);
}

/* ---------- 19. Print ---------- */
@media print {
  :root { --bg: #fff; --text: #000; --text-dim: #333; --text-faint: #555; --line: #ccc; --accent: #066; }
  body { background: #fff; color: #000; }
  body::before, .hero__canvas, .hero__veil, .page-head__bg, .hero__scroll, .instr, .demo__stage, .jump, .nav-toggle { display: none !important; }
  .site-header { position: static; }
  .section { padding-block: 1rem; }
  .case, .panel, .figure, .card, .cap, .contact { border-color: #ccc; background: #fff; break-inside: avoid; }
  a { color: #000; text-decoration: underline; }
  .metric__val, .case__stamp .v { color: #066; }
}

/* ---------- 20. Comparison bars (case-study visuals) ---------- */
.bars { display: grid; gap: 1.05rem; }
.bar__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.38rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.bar__row .v { color: var(--text); font-variant-numeric: tabular-nums; }
.bar__track {
  height: 9px;
  border-radius: 3px;
  background: rgba(150, 180, 220, 0.07);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar__fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width 1.1s var(--ease);
}
.bar--muted .bar__fill { background: linear-gradient(90deg, #2c3a55, #465b7d); }
.bar--blue  .bar__fill { background: linear-gradient(90deg, #3a5ba8, var(--accent-2)); }
.bar--warm  .bar__fill { background: linear-gradient(90deg, #b9741f, var(--warm)); }
.reveal.is-in .bar__fill, .is-in .bar__fill { width: var(--pct, 0%); }
@media (prefers-reduced-motion: reduce) { .bar__fill { transition: none; width: var(--pct, 0%); } }

.bar__note {
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--text-faint);
}

/* ---------- 21. Stat lines ---------- */
.statline { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.statline > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.62rem 0.8rem;
  background: var(--bg-panel);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.statline .k { color: var(--text-faint); letter-spacing: 0.06em; }
.statline .v { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 22. Scenario grid canvas ---------- */
.scengrid { position: relative; }
.scengrid canvas { width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-sunken); }
.scengrid__hud {
  position: absolute;
  top: 0.55rem; right: 0.65rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(3, 5, 10, 0.82);
  border: 1px solid var(--line-mid);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* ---------- 23. Diagram SVG defaults ---------- */
.diagram { width: 100%; height: auto; }
.diagram text { font-family: var(--font-mono); }
@media (max-width: 620px) {
  .bridge__viz { display: none; }
}
