:root {
  color-scheme: dark;
  --ink: #f6f9f8;
  --muted: rgba(236, 244, 241, .68);
  --faint: rgba(236, 244, 241, .46);
  --line: rgba(224, 255, 247, .15);
  --glass: rgba(2, 9, 17, .34);
  --accent: #8fffc8;
  --page: #030813;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; background: var(--page); }
body {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

/* Home: intentionally one viewport, no page scroll. */
body.home { height: 100svh; overflow: hidden; }
.hero-shell { position: relative; width: 100%; height: 100svh; min-height: 540px; overflow: hidden; isolation: isolate; background: #020711; }
.hero-art {
  position: absolute;
  inset: 0;
  z-index: -3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #020711;
}
.hero-art::before {
  content: "";
  position: absolute;
  inset: -7%;
  background: url("assets/hero-desktop.webp") center / cover no-repeat;
  filter: blur(34px) brightness(.26) saturate(.72);
  transform: scale(1.05);
  opacity: .96;
}
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(1,5,11,.24) 72%, rgba(1,4,9,.72) 100%),
    linear-gradient(to bottom, rgba(1,5,11,.18), transparent 20%, transparent 78%, rgba(1,4,10,.34));
  pointer-events: none;
}
.hero-art img {
  position: relative;
  z-index: 1;
  width: 93%;
  height: 93%;
  display: block;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 18px 70px rgba(0,0,0,.24));
}
.hero-shell::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 44% 38% at 14% 87%, rgba(0, 5, 11, .72) 0%, rgba(0, 5, 11, .34) 54%, transparent 100%),
    linear-gradient(to bottom, rgba(0, 5, 12, .22) 0%, transparent 17%, transparent 72%, rgba(0, 4, 10, .10) 100%);
}
.hero-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0, 0, 0, .16);
}

.topbar {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  min-height: 78px;
  padding: max(20px, env(safe-area-inset-top)) clamp(22px, 4vw, 64px) 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
}
.brand { display: inline-flex; align-items: center; gap: 10px; width: max-content; font-size: 15px; font-weight: 650; letter-spacing: -.015em; text-shadow: 0 1px 18px rgba(0,0,0,.35); }
.brand img { display: block; filter: drop-shadow(0 0 14px rgba(122,255,198,.14)); }
.nav-links {
  align-self: start;
  display: flex;
  align-items: center;
  gap: clamp(22px, 2.4vw, 38px);
  padding: 11px 18px;
  border: 1px solid rgba(225, 255, 247, .11);
  border-radius: 999px;
  background: rgba(3, 10, 18, .24);
  backdrop-filter: blur(12px) saturate(120%);
  box-shadow: 0 12px 44px rgba(0,0,0,.08);
  font-size: 13px;
  color: rgba(244, 250, 248, .72);
}
.nav-links a, .github-link { transition: color .18s ease, opacity .18s ease; }
.nav-links a:hover, .github-link:hover { color: #fff; }
.github-link { justify-self: end; padding-top: 11px; font-size: 13px; color: rgba(244, 250, 248, .76); }
.menu-toggle, .mobile-menu { display: none; }

.hero-copy {
  position: absolute;
  z-index: 8;
  left: clamp(28px, 5vw, 82px);
  bottom: clamp(24px, 4vh, 40px);
  width: min(385px, 33vw);
  text-shadow: 0 2px 24px rgba(0, 0, 0, .38);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  color: rgba(234, 246, 241, .64);
  font-size: 10px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 13px rgba(143,255,200,.85); }
.hero-copy h1 {
  margin: 0;
  max-width: 385px;
  font-size: clamp(40px, 3.7vw, 58px);
  line-height: .97;
  font-weight: 520;
  letter-spacing: -.055em;
}
.lede {
  max-width: 390px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(13px, 1vw, 15px);
  line-height: 1.52;
  letter-spacing: -.012em;
}
.actions { display: flex; align-items: center; gap: 9px; margin-top: 18px; }
.button {
  min-height: 43px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.008em;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: rgba(239, 250, 246, .96); color: #04100c; box-shadow: 0 8px 30px rgba(0,0,0,.16); }
.button.primary:hover { background: #fff; }
.button.ghost { border-color: rgba(229,255,248,.18); background: rgba(1,9,15,.28); backdrop-filter: blur(12px); color: rgba(246,251,249,.86); }
.button.ghost:hover { border-color: rgba(229,255,248,.34); background: rgba(1,9,15,.42); }


/* Supporting pages keep the home visual language but allow normal scrolling. */
body:not(.home) { min-height: 100vh; background: radial-gradient(circle at 80% -10%, rgba(44,126,116,.13), transparent 34%), #040913; }
.inner-header { position: sticky; top: 0; z-index: 20; min-height: 72px; padding: 18px clamp(22px,4vw,64px); display: flex; align-items: center; justify-content: space-between; background: rgba(4,9,19,.76); backdrop-filter: blur(18px); border-bottom: 1px solid var(--line); }
.inner-nav { display: flex; gap: 24px; color: var(--muted); font-size: 13px; }
.page-wrap { width: min(940px, calc(100% - 44px)); margin: 0 auto; padding: 96px 0 120px; }
.page-kicker { color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .15em; }
.page-wrap h1 { max-width: 800px; margin: 18px 0 26px; font-size: clamp(46px,7vw,78px); line-height: .98; letter-spacing: -.055em; font-weight: 520; }
.page-intro { max-width: 720px; color: var(--muted); font-size: 19px; line-height: 1.6; }
.page-grid { margin-top: 64px; display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.page-card { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); }
.page-card h2 { margin: 0 0 12px; font-size: 21px; font-weight: 600; }
.page-card p { margin: 0; color: var(--muted); line-height: 1.58; }
.page-card a { display: inline-block; margin-top: 20px; color: #c9fff0; font-size: 13px; }

@media (max-width: 900px) {
  .nav-links { gap: 18px; padding-inline: 14px; }
  .hero-copy { width: min(410px, 45vw); }
}

@media (max-width: 720px) {
  .hero-shell { min-height: 520px; }
  .hero-art::before { background-image: url("assets/hero-mobile.webp"); filter: blur(30px) brightness(.24) saturate(.72); }
  .hero-art img { width: 94%; height: 94%; object-position: center center; }
  .hero-shell::before {
    background:
      radial-gradient(ellipse 92% 34% at 25% 92%, rgba(0,5,11,.80) 0%, rgba(0,5,11,.38) 56%, transparent 100%),
      linear-gradient(to bottom, rgba(0,5,12,.20), transparent 16%, transparent 68%, rgba(0,4,10,.09));
  }
  .topbar { min-height: 68px; grid-template-columns: 1fr auto; padding: max(16px, env(safe-area-inset-top)) 18px 0; }
  .brand { font-size: 14px; }
  .brand img { width: 28px; height: 28px; }
  .nav-links, .github-link { display: none; }
  .menu-toggle {
    display: flex;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(229,255,248,.13);
    border-radius: 50%;
    background: rgba(1,8,15,.25);
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
  }
  .menu-toggle span { width: 15px; height: 1px; background: rgba(255,255,255,.82); transition: transform .18s ease; }
  .menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }
  .mobile-menu {
    position: absolute;
    z-index: 18;
    display: flex;
    top: 66px;
    right: 18px;
    width: min(220px, calc(100vw - 36px));
    padding: 10px;
    border: 1px solid rgba(229,255,248,.13);
    border-radius: 16px;
    background: rgba(2,9,17,.86);
    backdrop-filter: blur(22px) saturate(120%);
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-7px) scale(.98);
    transform-origin: top right;
    transition: .18s ease;
  }
  .mobile-menu.open { opacity: 1; visibility: visible; transform: none; }
  .mobile-menu a { padding: 11px 12px; border-radius: 10px; color: rgba(244,250,248,.78); font-size: 14px; }
  .mobile-menu a:hover { background: rgba(255,255,255,.05); color: #fff; }

  .hero-copy {
    left: 20px;
    right: 20px;
    bottom: max(20px, env(safe-area-inset-bottom));
    width: auto;
    max-width: 480px;
  }
  .eyebrow { margin-bottom: 12px; font-size: 9px; }
  .hero-copy h1 { max-width: 360px; font-size: clamp(36px, 10.4vw, 49px); line-height: .98; }
  .lede { max-width: 350px; margin-top: 12px; font-size: 12.5px; line-height: 1.48; }
  .actions { margin-top: 16px; gap: 8px; }
  .button { min-height: 40px; padding-inline: 15px; font-size: 12px; }

  .inner-header { padding: 16px 20px; }
  .inner-nav { display: none; }
  .page-wrap { width: calc(100% - 40px); padding-top: 68px; }
  .page-grid { grid-template-columns: 1fr; margin-top: 46px; }
  .page-intro { font-size: 17px; }
}

@media (max-height: 680px) and (min-width: 721px) {
  .hero-copy { bottom: 24px; }
  .eyebrow { margin-bottom: 10px; }
  .hero-copy h1 { font-size: clamp(36px, 3.7vw, 50px); }
  .lede { margin-top: 12px; font-size: 13px; }
  .actions { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; }
}

/* Short mobile viewports (including browser chrome) keep the artwork completely clear. */
@media (max-width: 720px) and (max-height: 700px) {
  .hero-copy {
    left: 18px;
    right: 18px;
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: 340px;
  }
  .hero-copy h1 {
    max-width: 335px;
    font-size: 27px;
    line-height: 1;
    letter-spacing: -.045em;
  }
  .lede { display: none; }
  .actions { margin-top: 11px; }
  .button { min-height: 36px; padding-inline: 14px; font-size: 11px; }
  .button.ghost { display: none; }
}

@media (max-width: 420px) and (min-height: 701px) {
  .hero-copy {
    left: 18px;
    right: 18px;
    bottom: max(18px, env(safe-area-inset-bottom));
  }
  .hero-copy h1 { font-size: 33px; max-width: 350px; }
  .lede { max-width: 330px; font-size: 11.5px; }
  .actions { margin-top: 14px; }
  .button { min-height: 38px; font-size: 11.5px; }
}

/* Soft local contrast only behind the hero copy; the artwork remains visually dominant. */
.hero-copy::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -24px -48px -26px -26px;
  pointer-events: none;
  border-radius: 32px;
  background: radial-gradient(ellipse at 20% 54%, rgba(0, 5, 12, .68) 0%, rgba(0, 5, 12, .46) 46%, rgba(0, 5, 12, .14) 72%, transparent 100%);
  filter: blur(2px);
}
.github-link {
  min-height: 39px;
  padding: 0 14px;
  border: 1px solid rgba(229,255,248,.13);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(3,10,18,.24);
  backdrop-filter: blur(12px) saturate(120%);
}
.github-link img { display: block; filter: brightness(0) invert(1); opacity: .96; }

.content-stack { margin-top: 66px; border-top: 1px solid var(--line); }
.content-card { display: grid; grid-template-columns: minmax(190px,.75fr) minmax(0,1.4fr); gap: 54px; padding: 32px 0; border-bottom: 1px solid var(--line); }
.content-card h2 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 620; letter-spacing: -.02em; }
.content-card p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.68; }
.related { margin-top: 70px; padding: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 26px; }
.related > span { color: var(--faint); text-transform: uppercase; letter-spacing: .13em; font-size: 10px; padding-top: 4px; }
.related > div { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.related a { color: #d1fff2; font-size: 14px; }
.site-footer { width: min(940px, calc(100% - 44px)); margin: 0 auto; padding: 30px 0 44px; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: 36px; align-items: start; color: var(--faint); font-size: 11px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 9px 18px; }
.site-footer nav a { color: rgba(236,244,241,.58); }
.site-footer nav a:hover { color: #fff; }
.site-footer p { margin: 4px 0 0; white-space: nowrap; }
@media (max-width:720px) {
  .content-stack { margin-top: 46px; }
  .content-card { grid-template-columns: 1fr; gap: 10px; padding: 24px 0; }
  .content-card p { font-size: 14px; }
  .related { grid-template-columns: 1fr; gap: 16px; margin-top: 52px; }
  .site-footer { width: calc(100% - 40px); grid-template-columns: 1fr; gap: 22px; }
  .site-footer p { margin: 0; }
}

/* Final mobile composition: keep the full diagram above the copy. */
@media (max-width: 720px) {
  .topbar > .github-link { display: none !important; }
  .menu-toggle { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; }
  .hero-art img {
    width: 88%;
    height: 62%;
    align-self: start;
    margin-top: 9svh;
    object-fit: contain;
  }
  .hero-art::after {
    background:
      radial-gradient(ellipse at 50% 40%, transparent 34%, rgba(1,5,11,.17) 68%, rgba(1,4,9,.76) 100%),
      linear-gradient(to bottom, rgba(1,5,11,.10), transparent 48%, rgba(1,4,10,.48) 76%, rgba(1,4,10,.84) 100%);
  }
  .hero-copy {
    bottom: max(18px, env(safe-area-inset-bottom));
    max-width: 355px;
  }
  .hero-copy::before {
    inset: -18px -24px -20px -20px;
    background: radial-gradient(ellipse at 18% 58%, rgba(0,5,12,.72) 0%, rgba(0,5,12,.48) 49%, rgba(0,5,12,.12) 76%, transparent 100%);
  }
  .hero-copy h1 { max-width: 350px; font-size: clamp(31px, 8.7vw, 38px); line-height: .98; }
  .lede { max-width: 345px; font-size: 11.5px; line-height: 1.48; }
  .actions { margin-top: 14px; }
  .button { min-height: 38px; padding-inline: 14px; font-size: 11.5px; }
}

@media (max-width: 720px) and (max-height: 700px) {
  .hero-art img { height: 58%; margin-top: 8svh; }
  .hero-copy h1 { font-size: 28px; }
  .lede { display: none; }
  .button.ghost { display: none; }
}

/* Hero safe zones: statement and actions are deliberately separated from the diagram. */
.hero-statement {
  position: absolute;
  z-index: 8;
  top: clamp(118px, 15.5vh, 158px);
  left: clamp(28px, 5vw, 82px);
  width: min(455px, 36vw);
  text-shadow: 0 2px 28px rgba(0,0,0,.46);
}
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 15px;
  color: rgba(226,245,238,.58);
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero-kicker span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(143,255,200,.76);
}
.hero-statement h1 {
  margin: 0;
  max-width: 455px;
  font-size: clamp(40px, 3.55vw, 56px);
  line-height: .97;
  font-weight: 535;
  letter-spacing: -.052em;
}
.hero-statement::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -28px -50px -34px -30px;
  border-radius: 40px;
  background: radial-gradient(ellipse at 20% 42%, rgba(0,5,12,.56), rgba(0,5,12,.30) 48%, rgba(0,5,12,.08) 72%, transparent 100%);
  pointer-events: none;
}
.hero-cta {
  position: absolute;
  z-index: 8;
  left: clamp(28px, 5vw, 82px);
  bottom: clamp(26px, 4.2vh, 42px);
  width: min(405px, 34vw);
  text-shadow: 0 2px 22px rgba(0,0,0,.42);
}
.hero-cta::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -24px -44px -26px -28px;
  border-radius: 34px;
  background: radial-gradient(ellipse at 18% 58%, rgba(0,5,12,.72), rgba(0,5,12,.43) 48%, rgba(0,5,12,.10) 74%, transparent 100%);
  pointer-events: none;
}
.hero-cta > p {
  max-width: 405px;
  margin: 0;
  color: rgba(236,244,241,.68);
  font-size: clamp(12px, .95vw, 14px);
  line-height: 1.56;
  letter-spacing: -.008em;
}
.hero-cta .actions { margin-top: 17px; }

@media (max-width: 900px) and (min-width: 721px) {
  .hero-statement { width: min(390px, 42vw); }
  .hero-statement h1 { font-size: clamp(38px, 4.5vw, 48px); }
  .hero-cta { width: min(360px, 40vw); }
}

@media (max-width: 720px) {
  .hero-statement {
    top: max(90px, 10.5svh);
    left: 20px;
    right: 20px;
    width: auto;
    max-width: 340px;
  }
  .hero-kicker { margin-bottom: 11px; font-size: 8px; }
  .hero-statement h1 {
    max-width: 330px;
    font-size: clamp(31px, 8.8vw, 38px);
    line-height: .98;
  }
  .hero-statement::before { inset: -18px -26px -22px -20px; }
  .hero-art img {
    width: 84%;
    height: 48%;
    align-self: start;
    margin-top: 25svh;
  }
  .hero-cta {
    left: 20px;
    right: 20px;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: auto;
    max-width: 355px;
  }
  .hero-cta::before { inset: -18px -24px -20px -20px; }
  .hero-cta > p { max-width: 345px; font-size: 11.5px; line-height: 1.48; }
  .hero-cta .actions { margin-top: 13px; }
}

@media (max-width: 720px) and (max-height: 700px) {
  .hero-statement { top: max(78px, 9svh); }
  .hero-statement h1 { font-size: 29px; }
  .hero-art img { width: 80%; height: 43%; margin-top: 24svh; }
  .hero-cta > p { display: none; }
  .hero-cta .actions { margin-top: 0; }
  .hero-cta .button.ghost { display: none; }
}

/* Final desktop statement spacing after visual review. */
@media (min-width: 901px) {
  .hero-statement { top: clamp(104px, 13.2vh, 128px); }
  .hero-statement h1 { font-size: clamp(39px, 3.2vw, 52px); max-width: 440px; }
}

@media (max-width: 720px) {
  .hero-art img {
    -webkit-mask-image: radial-gradient(ellipse 70% 66% at 50% 50%, #000 0%, #000 64%, rgba(0,0,0,.88) 76%, transparent 100%);
    mask-image: radial-gradient(ellipse 70% 66% at 50% 50%, #000 0%, #000 64%, rgba(0,0,0,.88) 76%, transparent 100%);
  }
}

/* Hero scale tuning after desktop/mobile visual review. */
@media (min-width: 721px) {
  .hero-art img {
    width: 89%;
    height: 89%;
  }
}

@media (max-width: 720px) {
  .hero-art img {
    width: 94%;
    height: 54%;
    align-self: start;
    margin-top: 27svh;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .hero-art img {
    width: 92%;
    height: 48%;
    margin-top: 26svh;
  }
}

/* Final hero scale: larger mobile diagram inside its safe middle band, calmer desktop framing. */
@media (min-width: 721px) {
  .hero-art img {
    width: 86%;
    height: 86%;
  }
}

@media (max-width: 720px) {
  .hero-art img {
    width: 98%;
    height: 59%;
    margin-top: 24svh;
  }
}

@media (max-width: 720px) and (max-height: 700px) {
  .hero-art img {
    width: 96%;
    height: 51%;
    margin-top: 25svh;
  }
}

/* Desktop artwork sits slightly lower so the composition breathes under the header. */
@media (min-width: 721px) {
  .hero-art img { transform: translateY(2.4vh); }
}
