/* ==========================================================================
   HospEx — Hospital Exchange
   Design system: light-first, editorial, market-infrastructure aesthetic.
   Mobile-first. PT-BR / EN.
   ========================================================================== */

:root {
  /* palette — warm paper + ink + market accents */
  --paper: #F6F4EF;
  --paper-rgb: 246, 244, 239;   /* for translucent bands without color-mix() */
  --paper-2: #FDFCFA;
  --ink: #101418;
  --ink-70: rgba(16, 20, 24, 0.74);
  --ink-50: rgba(16, 20, 24, 0.63); /* ≥4.5:1 on --paper — used for meaningful muted text */
  --ink-35: rgba(16, 20, 24, 0.38); /* decorative / aria-hidden only */
  --line: rgba(16, 20, 24, 0.12);
  --line-soft: rgba(16, 20, 24, 0.07);

  --capacity: #2B44FF;   /* cobalt      — Capacity  */
  --supply: #0A7057;  /* deep green  — Supply    */
  --urgent: #A84A0C;   /* dark amber  — Urgency   */
  --capacity-soft: rgba(43, 68, 255, 0.08);
  --supply-soft: rgba(10, 112, 87, 0.09);
  --urgent-soft: rgba(168, 74, 12, 0.09);

  --font-sans: "Inter Tight", "Inter", -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;

  --radius: 16px;
  --radius-sm: 10px;
  --container: 1280px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --header-h: 72px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img, svg, canvas { display: block; max-width: 100%; }
::selection { background: rgba(43, 68, 255, 0.16); }

body.menu-open { overflow: hidden; }

/* ---------- webgl stage ---------- */
#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
}
body.scene-ready #stage { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  #stage { transition: none; }
}
/* graceful fallback when WebGL is unavailable */
#stage-fallback {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(1px 1px at 12% 30%, var(--ink-35) 40%, transparent 41%),
    radial-gradient(1.5px 1.5px at 38% 62%, var(--ink-35) 40%, transparent 41%),
    radial-gradient(1px 1px at 64% 22%, var(--ink-35) 40%, transparent 41%),
    radial-gradient(2px 2px at 78% 58%, rgba(43,68,255,.5) 40%, transparent 41%),
    radial-gradient(1px 1px at 88% 34%, var(--ink-35) 40%, transparent 41%),
    radial-gradient(1.5px 1.5px at 24% 80%, var(--ink-35) 40%, transparent 41%),
    radial-gradient(1px 1px at 52% 86%, rgba(11,126,98,.5) 40%, transparent 41%);
}
body.no-webgl #stage-fallback { opacity: 0.9; }
body.no-webgl #stage { display: none; }
/* soft vignette: the world fades into the page edges and under the header */
.stage-vignette {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(var(--paper-rgb), 0.80) 0%, transparent 16%),
    radial-gradient(130% 100% at 50% 46%, transparent 74%, rgba(var(--paper-rgb), 0.42) 100%);
}
body.no-webgl .stage-vignette { display: none; }

main, .site-header, .site-footer, .mobile-menu, .progress-rail { position: relative; z-index: 1; }

/* ---------- typography helpers ---------- */
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: 0; }
.mono { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em; }

.kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-50);
}
.kicker-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-70);
}

.h2 {
  font-size: clamp(2rem, 5.4vw, 3.9rem);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.032em;
  text-wrap: balance;
}
.h3 {
  font-size: clamp(1.55rem, 3.4vw, 2.4rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.lead {
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.6;
  color: var(--ink-70);
  max-width: 46rem;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(5.5rem, 12vw, 10rem); }
section[id] { scroll-margin-top: calc(var(--header-h) + 4px); }
.section-head { display: grid; gap: 1.4rem; max-width: 54rem; margin-bottom: clamp(2.75rem, 6vw, 5rem); }

/* ---------- reveal on scroll ----------
   Content is visible by default; the hidden entry state only applies once
   the inline bootstrap has stamped html.js, so a JS/module failure can
   never blank the page. */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  transition-delay: var(--d, 0s);
  will-change: opacity, transform;
}
.js .reveal.in { opacity: 1; transform: none; }

/* no-JS: linearize the sticky scrollytelling and drop the JS-only shells */
html:not(.js) .tx { height: auto; }
html:not(.js) .tx-sticky { position: static; height: auto; overflow: visible; }
html:not(.js) .tx-steps { display: grid; gap: 1rem; min-height: 0; }
html:not(.js) .tx-step { position: static; opacity: 1; transform: none; pointer-events: auto; }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease-out), background 0.25s ease, color 0.25s ease,
    border-color 0.25s ease, box-shadow 0.35s var(--ease-out);
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper-2);
  box-shadow: 0 1px 0 rgba(16, 20, 24, 0.2), 0 12px 28px -14px rgba(16, 20, 24, 0.45);
}
.btn-primary:hover { background: #1d232b; box-shadow: 0 1px 0 rgba(16,20,24,.2), 0 18px 36px -14px rgba(16,20,24,.5); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-50); background: rgba(255, 255, 255, 0.55); }
.btn-lg { padding: 1.05rem 2rem; font-size: 1.02rem; }
.btn:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--capacity);
  outline-offset: 3px;
  border-radius: 6px;
}
.btn:focus-visible { border-radius: 999px; }

/* ---------- progress rail ---------- */
.progress-rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 60;
  background: transparent;
}
#progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink);
  transform-origin: left center;
  transform: scaleX(0);
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--line-soft);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: var(--gutter);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 44px;
}
.brand-logo {
  width: clamp(6.5rem, 13vw, 8.15rem);
  height: auto;
}

.main-nav { display: none; }
.header-actions { display: flex; align-items: center; gap: 0.9rem; }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}
.lang-switch button {
  padding: 0.3rem 0.15rem;
  color: var(--ink-50);
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.lang-switch button:hover { color: var(--ink-70); }
.lang-switch button.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.lang-divider { width: 1px; height: 0.9rem; background: var(--line); }

.btn-header { display: none; padding: 0.6rem 1.15rem; font-size: 0.86rem; }

.menu-toggle {
  width: 42px; height: 42px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.menu-toggle span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--ink);
  transition: transform 0.35s var(--ease-inout), opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- mobile menu ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, white);
  padding: calc(var(--header-h) + 2rem) var(--gutter) 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  visibility: hidden;
  /* visibility flips instantly on open (so links are focusable at once)
     and only after the fade on close */
  transition: opacity 0.4s var(--ease-out), visibility 0s 0.4s;
}
.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.4s var(--ease-out), visibility 0s 0s;
}
.mobile-menu nav { display: grid; gap: 0.4rem; }
.mobile-menu nav a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 0;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--line-soft);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}
.mobile-menu.is-open nav a { opacity: 1; transform: none; }
.mobile-menu.is-open nav a:nth-child(1) { transition-delay: 0.05s; }
.mobile-menu.is-open nav a:nth-child(2) { transition-delay: 0.1s; }
.mobile-menu.is-open nav a:nth-child(3) { transition-delay: 0.15s; }
.mobile-menu.is-open nav a:nth-child(4) { transition-delay: 0.2s; }
.mobile-menu.is-open nav a:nth-child(5) { transition-delay: 0.25s; }
.mm-idx { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-50); }
.mm-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-top: calc(var(--header-h) + 38svh);   /* phones: the campus shows above the copy */
}
@media (min-width: 1024px) { .hero { padding-top: calc(var(--header-h) + 2rem); } }
/* short viewports: keep the whole hero above the fold */
@media (max-height: 860px) and (min-width: 1024px) {
  .hero-title { font-size: clamp(2.2rem, 5.2vw, 3.9rem); }
  .hero-copy { gap: 1.15rem; }
}
.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: end;
  padding-bottom: clamp(2rem, 5vh, 4rem);
  flex: 1;
  align-content: center;
}
.hero-copy { display: grid; gap: 1.6rem; max-width: 52rem; }
.hero-title {
  font-size: clamp(2.35rem, 5.6vw, 4.3rem);
  line-height: 1.01;
  font-weight: 600;
  letter-spacing: -0.038em;
  text-wrap: balance;
}
.hero-title .serif { font-size: 1.02em; }
.hero-sub { font-size: clamp(1rem, 1.7vw, 1.2rem); line-height: 1.6; color: var(--ink-70); max-width: 40rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 0.4rem; }

.hero-scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-35);
  margin-top: 1rem;
}
.hint-line {
  width: 2.6rem; height: 1px;
  background: var(--ink-35);
  position: relative;
  overflow: hidden;
}
.hint-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateX(-100%);
  animation: hintSlide 2.4s var(--ease-inout) infinite;
}
@keyframes hintSlide { 50% { transform: translateX(0); } 100% { transform: translateX(100%); } }

/* ---------- vitals trace (abstract monitor line) ---------- */
.vitals { display: block; height: 22px; width: 120px; color: var(--supply); overflow: visible; }
.vitals path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.vitals .vitals-line { opacity: 0.3; }
.vitals .vitals-dot {
  stroke-width: 2.2;
  stroke-dasharray: 4 400;
  animation: vitalsSweep 3.2s linear infinite;
}
@keyframes vitalsSweep {
  from { stroke-dashoffset: 404; }
  to { stroke-dashoffset: 4; }
}
.vitals-tx { width: 88px; height: 20px; align-self: center; }

/* ---------- hero match cards ---------- */
.hero-match {
  display: grid;
  gap: 0.9rem;
  align-content: center;
}
.match-card {
  position: relative;
  display: grid;
  gap: 0.55rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--mk, var(--ink));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-2) 96%, transparent);
  box-shadow: 0 24px 48px -34px rgba(16, 20, 24, 0.4);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.match-card:hover { transform: translateY(-3px); box-shadow: 0 30px 54px -34px rgba(16, 20, 24, 0.5); }
.match-card[data-kind="capacity"] { --mk: var(--capacity); --mk-soft: var(--capacity-soft); }
.match-card[data-kind="supply"] { --mk: var(--supply); --mk-soft: var(--supply-soft); }
.match-top { display: flex; align-items: center; justify-content: space-between; }
.match-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mk);
  padding: 0.26rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--mk) 32%, transparent);
  background: var(--mk-soft);
  border-radius: 999px;
}
.match-icon { color: var(--mk); display: inline-flex; }
.match-icon svg { width: 22px; height: 22px; }
.match-row { display: grid; gap: 0.12rem; }
.match-h { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-50); }
.match-text { font-size: 0.95rem; font-weight: 500; letter-spacing: -0.012em; line-height: 1.4; }
.match-trace { padding-block: 0.1rem; }
.match-trace .vitals { width: 100%; height: 16px; color: var(--mk); }
.match-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-self: start;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--supply);
}
.match-check {
  position: relative;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--supply);
  flex: none;
}
.match-check::after {
  content: "";
  position: absolute;
  left: 4.2px; top: 3.4px;
  width: 5px; height: 7px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(42deg);
}
.hero-match-note {
  justify-self: end;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-50);
}

/* ---------- paper bands — copy sits on paper, the world stays in view beside it ----------
   Each scene section paints a soft band behind its content instead of boxing
   every paragraph in frosted glass. Desktop bands run left→right (copy column
   on paper, world on the right); phones stack, so the bands run top→bottom. */
.hero, .section, .tx-sticky { position: relative; }
.hero::before, .section::before, .tx-sticky::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(var(--paper-rgb), 0.93) 0%, rgba(var(--paper-rgb), 0.90) 100%);
}
.hero::before {
  background: linear-gradient(180deg,
    transparent 0,
    transparent calc(var(--header-h) + 29svh),
    rgba(var(--paper-rgb), 0.88) calc(var(--header-h) + 37svh),
    rgba(var(--paper-rgb), 0.95) 100%);
}
.tx-sticky::before {
  background: linear-gradient(180deg,
    rgba(var(--paper-rgb), 0.94) 0%,
    rgba(var(--paper-rgb), 0.90) 26%,
    rgba(var(--paper-rgb), 0.22) 36%,
    rgba(var(--paper-rgb), 0.22) 56%,
    rgba(var(--paper-rgb), 0.90) 72%,
    rgba(var(--paper-rgb), 0.94) 100%);
}
/* editorial sections between scene moments rest on near-solid paper */
.section.result::before, .section.elective::before, .section.credits::before {
  background: linear-gradient(180deg, rgba(var(--paper-rgb), 0.97) 0%, rgba(var(--paper-rgb), 0.95) 100%);
}
@media (min-width: 1024px) {
  .hero::before {
    background: linear-gradient(90deg,
      rgba(var(--paper-rgb), 0.96) 0%,
      rgba(var(--paper-rgb), 0.94) 38%,
      rgba(var(--paper-rgb), 0.50) 52%,
      transparent 66%);
  }
  .section::before {
    background: linear-gradient(90deg,
      rgba(var(--paper-rgb), 0.96) 0%,
      rgba(var(--paper-rgb), 0.94) 46%,
      rgba(var(--paper-rgb), 0.62) 66%,
      rgba(var(--paper-rgb), 0.22) 84%,
      transparent 100%);
  }
  .tx-sticky::before {
    background: linear-gradient(90deg,
      rgba(var(--paper-rgb), 0.96) 0%,
      rgba(var(--paper-rgb), 0.93) 36%,
      rgba(var(--paper-rgb), 0.40) 50%,
      transparent 62%);
  }
  .network::before {
    background: linear-gradient(90deg,
      rgba(var(--paper-rgb), 0.94) 0%,
      rgba(var(--paper-rgb), 0.86) 40%,
      rgba(var(--paper-rgb), 0.30) 64%,
      transparent 82%);
  }
}
.network-lines { justify-self: start; padding-right: 1rem; }

/* ---------- tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink-50);
  background: rgba(255, 255, 255, 0.5);
}
.tag-capacity { color: var(--capacity); border-color: rgba(43, 68, 255, 0.35); background: var(--capacity-soft); }
.tag-supply { color: var(--supply); border-color: rgba(11, 126, 98, 0.35); background: var(--supply-soft); }
.tag-urgent { color: var(--urgent); border-color: rgba(199, 89, 15, 0.35); background: var(--urgent-soft); }
.tag-settled { color: var(--paper-2); border-color: var(--ink); background: var(--ink); }

/* ---------- 01 asymmetry ---------- */
.asymmetry .section-head { max-width: 58rem; }
.asym-board {
  position: relative;
  display: grid;
  gap: 1rem;
}
.asym-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.asym-links path {
  fill: none;
  stroke: var(--ink-35);
  stroke-width: 1.2;
  stroke-dasharray: 6 7;
  stroke-dashoffset: 897; /* multiple of the 13px dash cycle, > any path length */
  transition: stroke-dashoffset 1.8s var(--ease-inout) 0.3s, stroke 0.5s ease;
}
.asym-board.is-linked .asym-links path { stroke-dashoffset: 0; }
.asym-board.is-linked .asym-links #asym-link-ab { stroke: var(--capacity); }
.asym-board.is-linked .asym-links #asym-link-cd { stroke: var(--supply); }

.asym-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.8rem;
  padding: 1.4rem 1.5rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.02rem;
  font-weight: 500;
  letter-spacing: -0.012em;
  line-height: 1.45;
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), border-color 0.35s ease;
}
.asym-card:hover {
  transform: translateY(-3px);
  border-color: var(--ink-35);
  box-shadow: 0 24px 44px -30px rgba(16, 20, 24, 0.35);
}
.asym-card[data-side="demand"] { background: color-mix(in srgb, var(--paper-2) 55%, var(--paper)); }
/* clinical accent stripe per institution */
.asym-card { border-left-width: 3px; }
.asym-card:nth-of-type(1), .asym-card:nth-of-type(2) { border-left-color: var(--capacity); }
.asym-card:nth-of-type(3), .asym-card:nth-of-type(4) { border-left-color: var(--supply); }
.asym-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.asym-hospital {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-70);
}

.asym-match {
  position: relative;
  z-index: 1;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-70);
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.6s var(--ease-out) 0.85s, transform 0.6s var(--ease-out) 0.85s;
}
.asym-board.is-linked .asym-match { opacity: 1; transform: none; }
.match-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.asym-match[data-match="1"] .match-pulse { background: var(--capacity); }
.asym-match[data-match="2"] .match-pulse { background: var(--supply); }
.match-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: 0;
  animation: matchRing 2.2s ease-out infinite;
}
.asym-match[data-match="1"] .match-pulse::after { color: var(--capacity); }
.asym-match[data-match="2"] .match-pulse::after { color: var(--supply); }
@keyframes matchRing { 0% { transform: scale(0.5); opacity: 0.9; } 70% { transform: scale(1.6); opacity: 0; } 100% { opacity: 0; } }

.asym-note {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.25rem, 2.6vw, 1.8rem);
  color: var(--ink-70);
  max-width: 34em;
}

/* ---------- 02 markets ---------- */
.market-grid { display: grid; gap: 1.1rem; }
.market-card {
  position: relative;
  display: grid;
  gap: 0.9rem;
  align-content: start;
  padding: 1.7rem 1.6rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  transition: transform 0.55s var(--ease-out), box-shadow 0.55s var(--ease-out), border-color 0.4s ease;
}
.market-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--mk, var(--ink));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.7s var(--ease-inout);
}
.market-card:hover::before, .market-card.in::before { transform: scaleX(1); }
.market-card:hover {
  transform: translateY(-4px);
  border-color: var(--ink-35);
  box-shadow: 0 32px 56px -36px rgba(16, 20, 24, 0.4);
}
.market-card[data-market="capacity"] { --mk: var(--capacity); --mk-soft: var(--capacity-soft); }
.market-card[data-market="supply"] { --mk: var(--supply); --mk-soft: var(--supply-soft); }

/* soft clinical wash so the section reads warmer than bare paper */
.markets {
  background: linear-gradient(180deg,
    rgba(10, 112, 87, 0) 0%, rgba(10, 112, 87, 0.035) 14%,
    rgba(10, 112, 87, 0.035) 86%, rgba(10, 112, 87, 0) 100%);
}
.market-top { display: flex; align-items: center; justify-content: space-between; }
.market-icon { color: var(--mk); display: inline-flex; }
.market-icon svg { width: 26px; height: 26px; }
.market-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  color: var(--mk);
  padding: 0.3rem 0.6rem;
  border: 1px solid color-mix(in srgb, var(--mk) 32%, transparent);
  background: var(--mk-soft);
  border-radius: 6px;
}
.market-name { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 600; letter-spacing: -0.028em; line-height: 1.05; }
.market-tagline { font-weight: 500; letter-spacing: -0.012em; color: var(--ink); }
.market-body { font-size: 0.94rem; color: var(--ink-70); line-height: 1.6; }
.market-list { display: grid; gap: 0.45rem; margin-top: 0.2rem; }
.market-list li {
  position: relative;
  padding-left: 1.15rem;
  font-size: 0.88rem;
  color: var(--ink-70);
}
.market-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.52em;
  width: 6px; height: 6px;
  border-radius: 2px;
  background: var(--mk);
  opacity: 0.85;
}
.market-sample {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-50);
  background: color-mix(in srgb, var(--paper) 55%, transparent);
}
.sample-state {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.6rem;
  color: var(--ink-50);
}
.sample-state.is-matched { color: var(--supply); }

/* ---------- 03 transaction (sticky scrollytelling) ---------- */
.tx { position: relative; height: 580svh; }
.tx-sticky {
  position: sticky;
  top: 0;
  height: 100lvh;            /* covers the strip that appears when mobile browser chrome collapses */
  display: flex;
  align-items: flex-start;
  overflow: hidden;
}
.tx-layout {
  display: grid;
  gap: 1.4rem;
  align-content: space-between;   /* head at the top, card in the middle, kicker at the bottom of the small viewport */
  min-height: 100svh;
  padding-top: calc(var(--header-h) + 0.6rem);
  padding-bottom: 1.4rem;
}
.tx-head { display: grid; gap: 1.2rem; max-width: 40rem; }
.tx-clock {
  display: inline-flex;
  align-items: baseline;
  gap: 0.8rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tx-clock-label {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-50);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: var(--paper-2);
}

.tx-steps { position: relative; min-height: 14rem; }
.tx-step {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: grid;
  gap: 0.7rem;
  align-content: start;
  max-width: 34rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-2) 97%, transparent);
  box-shadow: 0 28px 52px -38px rgba(16, 20, 24, 0.4);
  opacity: 0;
  transform: translateY(30px) scale(0.985);
  pointer-events: none;
  transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}
.tx-step.is-active { opacity: 1; transform: none; pointer-events: auto; }
.tx-step.is-past { opacity: 0; transform: translateY(-24px) scale(0.985); }
.tx-step-time { color: var(--ink-50); font-size: 0.72rem; letter-spacing: 0.1em; }
.tx-step h3 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); font-weight: 600; letter-spacing: -0.025em; }
.tx-step p { color: var(--ink-70); font-size: 1rem; line-height: 1.55; }
.tx-step-tag { justify-self: start; margin-top: 0.2rem; }

.tx-kicker { display: grid; gap: 1.1rem; max-width: 40rem; }
.tx-human {
  font-size: clamp(1.02rem, 1.9vw, 1.25rem);
  color: var(--ink-70);
  margin-top: -0.3rem;
}
/* landscape phones: too short for the sticky stage — read the steps as a list */
@media (max-width: 899px) and (max-height: 520px) {
  .tx { height: auto; }
  .tx .tx-sticky { position: static; height: auto; overflow: visible; align-items: stretch; }
  .tx .tx-layout { min-height: 0; padding-bottom: 3rem; }
  .tx .tx-steps { display: grid; gap: 1rem; min-height: 0; }
  .tx .tx-step { position: static; opacity: 1 !important; transform: none !important; pointer-events: auto; }
}
/* short phones (Safari with toolbars ≈ 664px): trim so the stack still fits */
@media (max-width: 899px) and (max-height: 720px) {
  .tx-layout { gap: 1rem; }
  .tx-head .h2 { font-size: 1.7rem; }
  .tx-human { display: none; }
  .tx .tx-steps { min-height: 12.5rem; }
}

.tx-summary {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.tx-progress {
  height: 2px;
  background: var(--line-soft);
  border-radius: 2px;
  overflow: hidden;
}
#tx-progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--ink);
  transform-origin: left;
  transform: scaleX(0);
}

/* ---------- 03a result board ---------- */
.win-grid { display: grid; gap: 1.1rem; }
.win-card {
  position: relative;
  display: grid;
  gap: 0.65rem;
  align-content: start;
  padding: 1.5rem 1.5rem 1.4rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--wc, var(--ink));
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: 0 24px 48px -34px rgba(16, 20, 24, 0.35);
  transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out);
}
.win-card:hover { transform: translateY(-3px); box-shadow: 0 30px 54px -34px rgba(16, 20, 24, 0.45); }
.win-card[data-win="a"] { --wc: var(--urgent); }
.win-card[data-win="b"] { --wc: var(--capacity); }
.win-card[data-win="c"] { --wc: var(--supply); }
.win-top { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.win-hospital { font-size: 0.7rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink-50); }
.win-title { font-size: clamp(1.3rem, 2.4vw, 1.65rem); font-weight: 600; letter-spacing: -0.024em; }
.win-title::after { content: ""; display: block; width: 2.2rem; height: 2px; margin-top: 0.55rem; background: var(--wc); }
.win-text { font-size: 0.94rem; color: var(--ink-70); line-height: 1.55; }
.win-chip {
  justify-self: start;
  margin-top: 0.3rem;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  padding: 0.34rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 60%, transparent);
  font-variant-numeric: tabular-nums;
}
.win-chip.is-credit { color: var(--supply); border-color: color-mix(in srgb, var(--supply) 35%, transparent); background: var(--supply-soft); }
.win-chip.is-debit { color: var(--ink-70); }
.win-foot {
  margin-top: clamp(2.2rem, 4.5vw, 3.2rem);
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  font-weight: 500;
  letter-spacing: -0.018em;
}
@media (min-width: 900px) { .win-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 04b credit regime ---------- */
.credits {
  background: linear-gradient(180deg,
    rgba(10, 112, 87, 0) 0%, rgba(10, 112, 87, 0.04) 14%,
    rgba(10, 112, 87, 0.04) 86%, rgba(10, 112, 87, 0) 100%);
}
.credit-grid { display: grid; gap: 1.1rem; margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
.credit-card {
  display: grid;
  gap: 0.55rem;
  align-content: start;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.credit-card h3 { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.018em; }
.credit-card h3::after { content: ""; display: block; width: 2rem; height: 2px; margin-top: 0.5rem; background: var(--supply); }
.credit-card p { font-size: 0.92rem; color: var(--ink-70); line-height: 1.55; }
@media (min-width: 900px) { .credit-grid { grid-template-columns: repeat(3, 1fr); } }

.ledger {
  max-width: 40rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  font-family: var(--font-mono);
  box-shadow: 0 24px 48px -34px rgba(16, 20, 24, 0.3);
}
.ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1.15rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-70);
}
.ledger-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: 0.72rem 1.15rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.8rem;
}
.ledger-row:last-child { border-bottom: 0; }
.lg-who { font-weight: 500; letter-spacing: 0.08em; color: var(--ink); }
.lg-what { color: var(--ink-50); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-val { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; color: var(--ink-70); }
.lg-val.is-credit { color: var(--supply); }
.lg-val.is-debit { color: var(--urgent); }
.ledger-row.is-total {
  border-top: 2px solid var(--line);
  background: color-mix(in srgb, var(--supply) 5%, transparent);
}
.ledger-row.is-total .lg-who { letter-spacing: 0.12em; }
.ledger-row.is-total .lg-what { color: var(--supply); }
.ledger-row.is-total .lg-val { font-weight: 500; color: var(--supply); }
.credit-note { margin-top: 1.4rem; color: var(--ink-50); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; max-width: 46rem; }

/* ---------- 03b elective ---------- */
.elective { padding-block: clamp(4rem, 9vw, 7rem); }
.elective-inner {
  display: grid;
  gap: 1.8rem;
  padding: clamp(1.8rem, 4.5vw, 3.2rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  background: var(--paper-2);
}
.elective-flow { display: grid; gap: 0; counter-reset: ef; }
.elective-flow li {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.1rem;
  align-items: start;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.elective-flow li:last-child { border-bottom: 0; }
.ef-idx {
  color: var(--ink-50);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  padding-top: 0.2rem;
}
.elective-flow p { font-size: clamp(1rem, 1.9vw, 1.18rem); font-weight: 500; letter-spacing: -0.014em; }

/* ---------- 04 infrastructure ---------- */
.infra {
  background: linear-gradient(180deg,
    rgba(43, 68, 255, 0) 0%, rgba(43, 68, 255, 0.028) 14%,
    rgba(43, 68, 255, 0.028) 86%, rgba(43, 68, 255, 0) 100%);
}
.infra .section-head { max-width: 60rem; }
.rail {
  position: relative;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 1.1rem;
}
.rail-beam {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--capacity-soft) 18%, rgba(43, 68, 255, 0.22) 50%, var(--capacity-soft) 82%, transparent 100%);
  width: 40%;
  animation: railBeam 5s var(--ease-inout) infinite;
}
@keyframes railBeam {
  0% { transform: translateX(-110%); }
  60%, 100% { transform: translateX(280%); }
}
.rail-label {
  position: relative;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-50);
}

.infra-grid {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line-soft);
  gap: 1px;
}
.infra-cell {
  background: var(--paper-2);
  padding: 1.25rem 1.3rem;
  display: grid;
  gap: 0.35rem;
  transition: background 0.35s ease;
}
.infra-cell:hover { background: color-mix(in srgb, var(--paper-2) 60%, var(--paper)); }
.infra-cell h3 { font-size: 0.98rem; font-weight: 600; letter-spacing: -0.015em; }
.infra-cell p { font-size: 0.82rem; color: var(--ink-50); line-height: 1.5; }
.infra-note { margin-top: 1.6rem; color: var(--ink-50); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.66rem; }

/* ---------- 05 network ---------- */
.network {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: clamp(6rem, 14vw, 11rem);
}
.network .container { display: grid; gap: clamp(2.2rem, 5vw, 3.6rem); }
.network-lines { display: grid; gap: 0.4rem; }
.network-line {
  font-size: clamp(1.5rem, 4.4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
  transition: color 0.7s ease;
}
.js .network-line:not(.in) { color: var(--ink-35); }
.network-line:nth-child(1).in { transition-delay: 0.05s; }
.network-line:nth-child(2).in { transition-delay: 0.25s; }
.network-line:nth-child(3).in { transition-delay: 0.45s; }

.network-stats {
  display: grid;
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 56rem;
}
.stat { background: color-mix(in srgb, var(--paper-2) 96%, transparent); padding: 1.4rem 1.5rem; display: grid; gap: 0.3rem; }
.stat-value { font-size: 2rem; font-weight: 500; letter-spacing: -0.02em; }
.stat-label { font-size: 0.82rem; color: var(--ink-50); }

.final-cta { display: grid; gap: 1.6rem; max-width: 48rem; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 72%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  padding-top: clamp(2.6rem, 6vw, 4rem);
}
.footer-grid { display: grid; gap: 2.2rem; padding-bottom: 2.6rem; }
.footer-brand { display: grid; gap: 0.7rem; max-width: 20rem; }
.footer-brand p { font-size: 0.9rem; color: var(--ink-50); }
.footer-col { display: grid; gap: 0.55rem; align-content: start; }
.footer-col h3 {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-50);
  margin-bottom: 0.3rem;
}
.footer-col a { font-size: 0.9rem; color: var(--ink-70); transition: color 0.2s ease; }
.footer-col a:hover { color: var(--ink); }
.footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  justify-content: space-between;
  padding-block: 1.4rem;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-50);
}
.footer-base .mono { font-size: 0.68rem; }

/* ==========================================================================
   Breakpoints
   ========================================================================== */

@media (min-width: 640px) {
  .asym-board {
    grid-template-columns: 1fr 1fr;
    gap: 2.6rem 4.5rem;
  }
  /* chips are pinned by JS to the apex of each dashed link */
  .asym-match { position: absolute; z-index: 2; transform: translate(-50%, -50%) scale(0.92); }
  .asym-board.is-linked .asym-match { transform: translate(-50%, -50%) scale(1); }
  .network-stats { grid-template-columns: repeat(3, 1fr); }
  .infra-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .infra-grid { grid-template-columns: repeat(3, 1fr); }
  .market-grid { grid-template-columns: repeat(2, 1fr); max-width: 66rem; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .tx-sticky { height: 100svh; align-items: center; }
  .tx-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-rows: auto auto;
    align-items: start;
    align-content: center;
    min-height: 0;
    gap: 2rem 4rem;
    padding-top: var(--header-h);
    padding-bottom: 0;
  }
  .tx-head { grid-column: 1; grid-row: 1; }
  .tx-steps { grid-column: 2; grid-row: 1 / span 2; align-self: end; justify-self: end; width: min(100%, 30rem); min-height: 15.5rem; }
  .tx-kicker { grid-column: 1; grid-row: 2; align-self: end; }
}

@media (min-width: 1024px) {
  .main-nav {
    display: flex;
    gap: 1.9rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--ink-70);
  }
  .main-nav a { position: relative; padding: 0.3rem 0; transition: color 0.25s ease; }
  .main-nav a::after {
    content: "";
    position: absolute;
    left: 0; right: 100%;
    bottom: 0;
    height: 1px;
    background: var(--ink);
    transition: right 0.35s var(--ease-out);
  }
  .main-nav a:hover { color: var(--ink); }
  .main-nav a:hover::after, .main-nav a.is-current::after { right: 0; }
  .main-nav a.is-current { color: var(--ink); }
  .btn-header { display: inline-flex; }
  .menu-toggle { display: none; }
  .mobile-menu { display: none; }

  .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.7fr); gap: clamp(3rem, 7vw, 8rem); }
  .hero-copy { max-width: 44rem; }
  .infra-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1440px) {
  .infra-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- small phones ---------- */
@media (max-width: 400px) {
  .hero-ctas .btn { width: 100%; }
}

/* ==========================================================================
   Motion preferences & fallbacks
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .js .reveal { opacity: 1; transform: none; transition: none; }
  .hint-line::after, .rail-beam, .match-pulse::after { animation: none; }
  .vitals .vitals-dot { animation: none; stroke-dasharray: none; opacity: 0.5; }
  .asym-links path { stroke-dashoffset: 0; transition: none; }
  .asym-match { opacity: 1; transform: none; transition: none; }
  .tx-step, .btn, .market-card, .asym-card { transition-duration: 0.01s; }
}
