:root {
  color-scheme: light;
  --ink: #182126;
  --muted: #596466;
  --soft: #eef3ef;
  --paper: #f8faf7;
  --surface: #ffffff;
  --line: #dce5de;
  --orange: #bf5700;
  --orange-soft: #f5ddca;
  --teal: #087f83;
  --teal-soft: #d8eeec;
  --green: #5f8d3e;
  --green-soft: #e4efd9;
  --gold: #d89a2b;
  --gray: #8a8175;
  --shadow: 0 20px 60px rgba(24, 33, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(248, 250, 247, 0.94), rgba(255, 255, 255, 0.96)),
    radial-gradient(circle at 12% 18%, rgba(191, 87, 0, 0.06), transparent 28%),
    radial-gradient(circle at 86% 28%, rgba(8, 127, 131, 0.06), transparent 30%);
  line-height: 1.55;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.65rem 0.85rem;
  background: var(--ink);
  color: white;
  border-radius: 6px;
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: rgba(248, 250, 247, 0.88);
  border-bottom: 1px solid rgba(220, 229, 222, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 16rem;
  text-decoration: none;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--orange), var(--gold) 45%, var(--teal)), var(--orange);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.95rem;
  line-height: 1.1;
}

.brand small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.top-nav a {
  padding: 0.48rem 0.72rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--ink);
  background: var(--soft);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(20rem, 1.14fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  min-height: calc(100vh - 4.5rem);
  padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 5vw, 4.5rem) 2rem;
  overflow: hidden;
  min-width: 0;
}

.hero::before {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 9rem;
  background: linear-gradient(180deg, transparent, rgba(248, 250, 247, 0.94));
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 48rem;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1rem;
  font-size: clamp(2.35rem, 5.2vw, 5.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.75rem, 3vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.hero-lede {
  max-width: 43rem;
  color: #344246;
  font-size: clamp(1.02rem, 1.45vw, 1.25rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.65rem;
  padding: 0.72rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(24, 33, 38, 0.06);
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(8, 127, 131, 0.45);
}

.button.primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.release-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.hero-visual {
  position: relative;
  margin: 0;
  z-index: 1;
  min-width: 0;
}

.hero-visual img {
  width: 100%;
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: heroDrift 8s ease-in-out infinite;
}

figcaption {
  color: var(--muted);
  font-size: 0.84rem;
}

.hero-visual figcaption,
.wide-figure figcaption,
.prototype-figure figcaption {
  margin-top: 0.65rem;
}

.metric-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0 clamp(1rem, 5vw, 4.5rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  box-shadow: 0 16px 40px rgba(24, 33, 38, 0.08);
}

.metric {
  min-height: 8.2rem;
  padding: 1.1rem;
  background: rgba(255, 255, 255, 0.9);
}

.metric strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--teal);
  font-size: clamp(1.6rem, 3vw, 2.55rem);
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-weight: 650;
}

.section {
  padding: clamp(3.5rem, 8vw, 7rem) clamp(1rem, 5vw, 4.5rem);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(22rem, 1.1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.two-column p,
.section-heading p {
  color: #405052;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.fact-grid article,
.story-steps article,
.link-grid a,
.posterior-card,
.control-panel,
.citation-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(24, 33, 38, 0.06);
}

.fact-grid article {
  min-height: 11rem;
  padding: 1rem;
}

.fact-grid span,
.posterior-summary span,
.link-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fact-grid strong {
  display: block;
  margin: 0.45rem 0;
  color: var(--orange);
  font-size: 1.65rem;
  line-height: 1;
}

.fact-grid p,
.story-steps p,
.link-grid p,
.gallery-card p {
  margin-bottom: 0;
  color: #4d5b5e;
}

.section-heading {
  max-width: 62rem;
  margin-bottom: 1.6rem;
}

.section-heading.compact {
  max-width: 54rem;
}

.visual-story {
  background: linear-gradient(180deg, rgba(238, 243, 239, 0.58), rgba(255, 255, 255, 0.86));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.wide-figure {
  margin: 0;
}

.wide-figure img,
.prototype-figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.story-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.story-steps article {
  padding: 1rem;
}

.story-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.8rem;
  border-radius: 6px;
  background: var(--orange-soft);
  color: var(--orange);
  font-weight: 850;
}

.atlas-section {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(238, 243, 239, 0.62)), var(--paper);
}

.atlas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(20rem, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.atlas-figure {
  margin: 0;
}

.atlas-figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.atlas-figure figcaption {
  margin-top: 0.65rem;
}

.atlas-copy {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 30px rgba(24, 33, 38, 0.06);
}

.atlas-copy p {
  margin: 1rem 0 0;
  color: #405052;
}

.atlas-copy h3 + .chip-cloud {
  margin-bottom: 1.2rem;
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip-cloud span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.36rem 0.55rem;
  border: 1px solid rgba(191, 87, 0, 0.25);
  border-radius: 6px;
  background: rgba(245, 221, 202, 0.58);
  color: #5c3420;
  font-size: 0.84rem;
  font-weight: 760;
}

.chip-cloud.body span {
  border-color: rgba(95, 141, 62, 0.25);
  background: rgba(228, 239, 217, 0.7);
  color: #314a22;
}

.chip-cloud.brain span {
  border-color: rgba(8, 127, 131, 0.24);
  background: rgba(216, 238, 236, 0.72);
  color: #17484a;
}

.config-section {
  background: linear-gradient(180deg, rgba(24, 33, 38, 0.96), rgba(32, 45, 48, 0.96)), #182126;
  color: white;
}

.config-section .eyebrow {
  color: #f4ba79;
}

.config-section .section-heading p,
.microcopy {
  color: rgba(255, 255, 255, 0.72);
}

.config-theater {
  display: grid;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(0, 1.28fr);
  gap: 1rem;
  align-items: stretch;
}

.config-controls,
.config-stage {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.config-controls {
  padding: 1rem;
}

.control-stack {
  display: grid;
  gap: 1rem;
}

.control-stack label {
  display: grid;
  gap: 0.36rem;
}

.control-stack label > span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.82rem;
  font-weight: 820;
  text-transform: uppercase;
}

.control-stack output {
  justify-self: start;
  min-width: 4.8rem;
  padding: 0.18rem 0.48rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-weight: 800;
}

.control-stack select {
  min-height: 2.45rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: #243135;
  color: white;
  font: inherit;
}

.config-controls .preset {
  background: rgba(255, 255, 255, 0.09);
  color: white;
  border-color: rgba(255, 255, 255, 0.16);
}

.config-controls .preset.is-active,
.config-controls .preset:hover,
.config-controls .preset:focus-visible {
  background: rgba(191, 87, 0, 0.36);
  border-color: rgba(244, 186, 121, 0.62);
}

.microcopy {
  margin: 0.9rem 0 0;
  font-size: 0.88rem;
}

.config-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 1rem;
  padding: 1rem;
}

#configCanvas {
  width: 100%;
  height: 28rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)), #10191d;
}

.config-readout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  overflow: hidden;
  align-self: start;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
}

.config-readout div {
  padding: 0.78rem;
  background: rgba(255, 255, 255, 0.07);
}

.config-readout span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.config-readout strong {
  display: block;
  margin-top: 0.18rem;
  color: white;
  font-size: 1.04rem;
}

.component-strip {
  grid-column: 1 / -1;
  display: grid;
  gap: 0.48rem;
}

.component-row {
  display: grid;
  grid-template-columns: 5.8rem minmax(0, 1fr) 4rem;
  gap: 0.65rem;
  align-items: center;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.88rem;
}

.component-track {
  height: 0.68rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.component-fill {
  height: 100%;
  border-radius: inherit;
}

.explorer-layout {
  display: grid;
  grid-template-columns: minmax(18rem, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
  align-items: stretch;
  margin-top: 1.5rem;
}

.control-panel,
.posterior-card {
  padding: 1rem;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.preset,
.dialog-close {
  min-height: 2.35rem;
  padding: 0.55rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}

.preset.is-active,
.preset:hover,
.preset:focus-visible {
  border-color: rgba(191, 87, 0, 0.35);
  background: var(--orange-soft);
}

.slider-list {
  display: grid;
  gap: 1rem;
}

.slider-list label {
  display: grid;
  gap: 0.38rem;
  font-weight: 760;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--teal);
}

.posterior-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.posterior-summary div {
  padding: 0.85rem;
  background: #fbfcfa;
}

.posterior-summary strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

.posterior-visual {
  display: grid;
  grid-template-columns: minmax(12rem, 0.82fr) minmax(15rem, 1fr);
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

#posteriorCanvas {
  width: 100%;
  height: 18rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 243, 239, 0.72)), var(--paper);
}

.bar-stack {
  display: grid;
  gap: 0.6rem;
}

.prob-row {
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr) 3.5rem;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.prob-track {
  height: 0.72rem;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
  transition: width 180ms ease;
}

.prototype-figure {
  margin: 1.1rem 0 0;
}

.results-section {
  background: #fbfcfa;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.gallery-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 36px rgba(24, 33, 38, 0.08);
}

.gallery-card.large {
  grid-column: span 2;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  padding: 0.7rem;
  background: #f4f7f4;
  cursor: zoom-in;
}

.gallery-card.large img {
  aspect-ratio: 16 / 7;
}

.gallery-card figcaption {
  padding: 0.85rem;
}

.gallery-card figcaption strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--ink);
}

.network-section {
  background:
    linear-gradient(180deg, rgba(8, 127, 131, 0.08), rgba(248, 250, 247, 0.7)), var(--paper);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.link-grid a {
  display: block;
  min-height: 13rem;
  padding: 1rem;
  text-decoration: none;
}

.link-grid a:hover,
.link-grid a:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(8, 127, 131, 0.36);
}

.link-grid strong {
  display: block;
  margin: 0.45rem 0;
  font-size: 1.18rem;
  line-height: 1.15;
}

.citation-section {
  padding-top: 3rem;
}

.citation-box {
  display: grid;
  grid-template-columns: minmax(16rem, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem;
}

pre {
  margin: 0;
  overflow-x: auto;
  padding: 1rem;
  border-radius: 8px;
  background: #172126;
  color: #f6fbf7;
  font-size: 0.95rem;
  line-height: 1.55;
}

.site-footer {
  display: grid;
  gap: 0.45rem;
  padding: 2rem clamp(1rem, 5vw, 4.5rem);
  border-top: 1px solid var(--line);
  background: #182126;
  color: rgba(255, 255, 255, 0.78);
}

.site-footer p {
  margin: 0;
  max-width: 70rem;
}

dialog {
  width: min(92vw, 72rem);
  max-height: 90vh;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(24, 33, 38, 0.68);
}

dialog img {
  max-height: 72vh;
  margin: 0 auto;
  object-fit: contain;
}

.dialog-close {
  float: right;
  margin-bottom: 0.7rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 540ms ease,
    transform 540ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@keyframes heroDrift {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@media (max-width: 1180px) {
  .gallery,
  .link-grid,
  .story-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .site-header,
  .hero,
  .two-column,
  .atlas-grid,
  .config-theater,
  .config-stage,
  .explorer-layout,
  .posterior-visual,
  .citation-box {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .hero {
    min-height: auto;
  }

  .hero-visual {
    order: -1;
  }

  .posterior-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand {
    min-width: 0;
    width: 100%;
  }

  .hero,
  .hero-copy,
  .hero-visual,
  .hero-visual img {
    width: calc(100vw - 2rem);
    max-width: 100%;
  }

  h1 {
    width: calc(100vw - 2rem);
    max-width: 100%;
    font-size: clamp(1.9rem, 8.5vw, 2.6rem);
  }

  .hero-lede {
    width: calc(100vw - 2rem);
    max-width: 100%;
  }

  .top-nav a {
    padding: 0.44rem 0.52rem;
  }

  .metric-band,
  .fact-grid,
  .gallery,
  .link-grid,
  .story-steps {
    grid-template-columns: 1fr;
  }

  .gallery-card.large {
    grid-column: span 1;
  }

  .prob-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .component-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  #posteriorCanvas {
    height: 15rem;
  }

  #configCanvas {
    height: 22rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
