/* DECODE — home */

/* ---------- Hero: the wireframe stage ---------- */
.hero-stage {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}

.hero-stage__inner {
  width: 100%;
  align-items: center;
  padding-block: var(--space-8) var(--space-9);
}

.hero-stage__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.hero-stage__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

.hero-stage__mesh {
  position: relative;
  height: min(72vh, 680px);
  min-height: 380px;
}

.hero-stage__mesh canvas {
  opacity: 0;
  transition: opacity var(--dur-orchestrated) var(--ease-out);
}

.hero-stage__mesh.is-live canvas {
  opacity: 1;
}

/* The still wireframe the page carries for no script and no WebGL */
.hero-stage__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--mesh);
  stroke-width: 1.2;
  opacity: 0.8;
  transition: opacity var(--dur-orchestrated) var(--ease-out);
}

.hero-stage__fallback circle[r="2"] {
  fill: var(--mesh);
  stroke: none;
}

.hero-stage__mesh.is-live .hero-stage__fallback {
  opacity: 0;
}

.hero-stage__cue {
  position: absolute;
  left: var(--margin);
  bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-3);
}

.hero-stage__cue::before {
  content: "";
  width: 40px;
  height: 1px;
  background: var(--hairline-strong);
}

/* ---------- The instrument: the door with its selects ---------- */
.instrument {
  padding-block: var(--space-8) var(--space-8);
  align-items: start;
}

.instrument__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.instrument__title {
  font-size: var(--step-4);
  font-weight: 500;
  letter-spacing: var(--tracking-tight);
  max-width: 18ch;
}

.instrument__lede {
  font-size: var(--step-1);
  color: var(--ink-2);
  max-width: 40ch;
}

.hero__title {
  font-size: var(--step-6);
  font-weight: 600;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
  max-width: 12ch;
}

.hero__lede {
  font-size: var(--step-2);
  line-height: 1.4;
  color: var(--ink-2);
  max-width: 40ch;
}

.instrument__controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  padding-top: var(--space-2);
}

.instrument__readouts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 200px;
}

.door__reason {
  font-size: var(--step-0);
  color: var(--ink-2);
  max-width: 48ch;
}

.door__numbers {
  padding-top: var(--space-2);
}

.door__link {
  padding-top: var(--space-2);
}

/* ---------- The door diagram ---------- */
.door {
  position: relative;
  aspect-ratio: 1200 / 440;
  width: 100%;
}

.door__svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.door__room {
  fill: none;
  stroke: var(--hairline-strong);
  stroke-width: 1.5;
}

.door__wall {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: butt;
}

.door__block--weights { fill: var(--weights); }
.door__block--cache { fill: var(--cache); }
.door__block--overhead { fill: var(--overhead); }
.door__block--overflow { fill: var(--fail); }

.door__block + .door__block {
  stroke: var(--panel-0);
  stroke-width: 1;
}

.door__label {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  fill: var(--ink-2);
}

.door__label--in {
  fill: var(--panel-0);
  font-weight: 500;
}

.door__label--free {
  fill: var(--ink-2);
}

.door__dots circle {
  fill: var(--ink);
}

.door__flow {
  position: absolute;
  top: 0;
  height: 100%;
  left: 63%;
  width: 37%;
  pointer-events: none;
}

.door__legend {
  margin-top: var(--space-4);
}

/* ---------- The idea ---------- */
.idea-block {
  padding-block: var(--space-9);
  border-top: 1px solid var(--hairline);
}

.idea-block .idea {
  font-size: var(--step-5);
  max-width: 24ch;
}

.vocab {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-6) var(--gutter);
  margin-top: var(--space-8);
  list-style: none;
  padding: 0;
}

.vocab__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--hairline);
}

.vocab__glyph {
  width: 56px;
  height: 40px;
  stroke: var(--ink-2);
  stroke-width: 1.5;
  fill: none;
}

.vocab__title {
  font-size: var(--step-2);
  font-weight: 500;
}

.vocab__text {
  font-size: var(--step-0);
  color: var(--ink-2);
}

/* ---------- Calculator teaser ---------- */
.teaser {
  padding-block: var(--space-8);
  border-top: 1px solid var(--hairline);
}

.teaser__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.teaser__title {
  font-size: var(--step-4);
}

.teaser__lede {
  color: var(--ink-2);
  max-width: 52ch;
}

.teaser table {
  font-size: var(--step-0);
}

.teaser td, .teaser th {
  padding-block: var(--space-3);
}

.teaser__machine {
  color: var(--ink);
}

.teaser__verdict {
  font-family: var(--font-mono);
  font-weight: 500;
  white-space: nowrap;
}

.teaser__verdict--fits { color: var(--room); }
.teaser__verdict--tight { color: var(--warn); }
.teaser__verdict--wont-fit { color: var(--fail); }

.teaser__foot {
  margin-top: var(--space-5);
  display: flex;
  gap: var(--space-4);
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Guide index ---------- */
.guide-index {
  padding-block: var(--space-8) var(--space-6);
  border-top: 1px solid var(--hairline);
}

.guide-index__head {
  margin-bottom: var(--space-6);
}

.guide-index__title {
  font-size: var(--step-4);
}

.guide-index__lede {
  color: var(--ink-2);
  max-width: 52ch;
  margin-top: var(--space-3);
}

.chapters {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--gutter);
}

.chapter {
  display: grid;
  grid-template-columns: 3ch 1fr;
  gap: var(--space-4);
  padding-block: var(--space-4);
  border-top: 1px solid var(--hairline);
}

.chapter__n {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  padding-top: 0.2em;
}

.chapter__title {
  font-size: var(--step-1);
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}

.chapter__title:hover {
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
}

.chapter__line {
  font-size: var(--step-0);
  color: var(--ink-2);
  margin-top: var(--space-1);
}

.chapter__status {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-3);
  margin-left: var(--space-2);
}

/* ---------- Reveal: start states set in JS; these only hold layout ---------- */
.reveal-ready [data-reveal] {
  will-change: transform, opacity;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-stage {
    min-height: 0;
  }

  .hero-stage__inner {
    padding-block: var(--space-7) var(--space-8);
  }

  .hero-stage__mesh {
    height: 46vh;
    min-height: 300px;
  }

  .hero-stage__cue {
    display: none;
  }

  .instrument {
    padding-block: var(--space-6);
  }

  .hero__title {
    font-size: var(--step-5);
  }

  .hero__lede {
    font-size: var(--step-1);
  }

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

  .chapters {
    grid-template-columns: 1fr;
  }

  .idea-block .idea {
    font-size: var(--step-4);
  }
}

@media (max-width: 600px) {
  .vocab {
    grid-template-columns: 1fr;
  }

  .door__label {
    font-size: 22px;
  }
}
