:root {
  /* Layout:** Layout* Layout its */
  --obsidian: #1A110A;
  --charred: #2B1D0E;
  --oxide: #8B5E3C;
  --terracotta: #C2704F;
  --kiln: #D4843E;
  --sand: #A89279;
  --ivory: #F5E6D3;
  --parchment: #F5E6D3;
  --parchment-2: #EDD9C4;
  --parchment-3: #E8D0B8;
  --fold: #5C4033;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  background: var(--obsidian);
  color: var(--ivory);
  font-family: "DM Sans", sans-serif;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
}

body::-webkit-scrollbar { height: 0; }

.top-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: rgba(92, 64, 51, 0.28);
  z-index: 50;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: var(--terracotta);
  transform-origin: left center;
  transition: width 120ms linear, opacity 300ms ease;
}

#progressFill.complete { animation: completePulse 2s infinite; }

.rail { display: flex; height: 100vh; min-width: 500vw; }

.bay {
  position: relative;
  width: 100vw;
  min-width: 100vw;
  height: 100vh;
  padding: 0 6vw;
  display: grid;
  grid-template-rows: 12vh 1fr 8vh;
  grid-template-columns: 1fr;
  scroll-snap-align: start;
  overflow: hidden;
  border-right: 1px solid rgba(92, 64, 51, 0.3);
  isolation: isolate;
}

.bay::before {
  content: "";
  position: absolute;
  inset: 12vh 6vw 8vh 6vw;
  border-top: 1px solid rgba(139, 94, 60, 0.28);
  pointer-events: none;
}

.bay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 22%, rgba(194,112,79,0.09), transparent 28%), radial-gradient(circle at 78% 68%, rgba(168,146,121,0.08), transparent 30%);
  z-index: -1;
}

.bay-dark { background-color: var(--obsidian); color: var(--ivory); }
.bay-light { background-color: var(--parchment); color: var(--charred); }

.bay-observe { background-image: radial-gradient(circle at 16% 18%, #231810 0, transparent 34%), radial-gradient(circle at 78% 28%, #2B1D0E 0, transparent 32%), radial-gradient(circle at 48% 84%, rgba(92,64,51,0.36) 0, transparent 38%), linear-gradient(120deg, #1A110A, #231810 52%, #1A110A); }
.bay-sketch { background-image: radial-gradient(circle at 18% 22%, #EDD9C4 0, transparent 34%), radial-gradient(circle at 80% 70%, #E8D0B8 0, transparent 35%), linear-gradient(120deg, #F5E6D3, #EDD9C4); }
.bay-model { background-image: radial-gradient(circle at 58% 42%, rgba(194,112,79,0.13), transparent 34%), radial-gradient(circle at 20% 78%, #2B1D0E 0, transparent 38%), radial-gradient(circle at 82% 16%, #231810 0, transparent 30%), linear-gradient(125deg, #1A110A, #231810); }
.bay-test { background-image: radial-gradient(circle at 72% 22%, #E8D0B8 0, transparent 38%), radial-gradient(circle at 26% 82%, #EDD9C4 0, transparent 30%), linear-gradient(130deg, #F5E6D3, #EDD9C4); }
.bay-iterate { background-image: radial-gradient(circle at 30% 28%, rgba(212,132,62,0.12), transparent 32%), radial-gradient(circle at 74% 66%, #2B1D0E 0, transparent 39%), linear-gradient(115deg, #1A110A, #231810 58%, #1A110A); }

.status-row {
  grid-row: 1;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2vw;
  font-family: "IBM Plex Mono", monospace;
  color: rgba(168, 146, 121, 0.68);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bay-light .status-row { color: rgba(43, 29, 14, 0.58); }

.status-scale { height: 100%; display: grid; grid-template-columns: repeat(9, 1fr); align-items: end; border-bottom: 1px solid rgba(139, 94, 60, 0.34); }
.status-scale i { display: block; height: 9px; border-left: 1px solid rgba(139, 94, 60, 0.42); }
.status-scale i.hot { border-left-color: var(--terracotta); height: 18px; box-shadow: 0 0 14px rgba(194,112,79,0.55); }

.bay-core { grid-row: 2; position: relative; display: grid; align-items: center; }
.centered-core { place-items: center; text-align: center; }

.type-title, .phase-copy h2, .iterate-core h2, .outline-title {
  margin: 0;
  font-family: "Space Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.type-title { min-height: 1.1em; font-size: clamp(4rem, 8vw, 7rem); color: var(--ivory); }
.type-title span { opacity: 0; transform: translateY(18px); display: inline-block; animation: letterIn 420ms ease forwards; }

.observe-line {
  margin: 1.7rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  color: var(--oxide);
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 600ms ease, transform 600ms ease;
}
.observe-line.visible { opacity: 1; transform: translateY(0); }

.hud-frame { position: absolute; inset: 4vw; pointer-events: none; z-index: 2; }
.corner { position: absolute; width: 44px; height: 44px; border-color: rgba(139, 94, 60, 0.4); opacity: 0; transition: transform 400ms ease-out, opacity 400ms ease-out; }
.corner-tl { left: 0; top: 0; border-left: 2px solid; border-top: 2px solid; transform: translate(-20px, -20px); }
.corner-tr { right: 0; top: 0; border-right: 2px solid; border-top: 2px solid; transform: translate(20px, -20px); }
.corner-bl { left: 0; bottom: 0; border-left: 2px solid; border-bottom: 2px solid; transform: translate(-20px, 20px); }
.corner-br { right: 0; bottom: 0; border-right: 2px solid; border-bottom: 2px solid; transform: translate(20px, 20px); }
.bay.in-view .corner, .bay-observe.active .corner { opacity: 1; transform: translate(0, 0); }
.light-hud .corner { border-color: rgba(43, 29, 14, 0.28); }

.breadcrumb { grid-row: 3; display: flex; align-items: center; justify-content: center; gap: 12px; }
.breadcrumb span { width: 9px; height: 9px; border: 1px solid var(--oxide); }
.bay-light .breadcrumb span { border-color: rgba(43, 29, 14, 0.58); }
.breadcrumb .filled { background: var(--terracotta); border-color: var(--terracotta); box-shadow: 0 0 18px rgba(194, 112, 79, 0.38); }

.split-core { grid-template-columns: 0.9fr 1.1fr; gap: 6vw; }
.phase-copy h2 { font-size: clamp(2.5rem, 6vw, 5.5rem); color: var(--charred); }
.diagram-panel { align-self: center; }
.wire-diagram, .circuit-diagram { width: min(46vw, 620px); overflow: visible; }
.wire-diagram path, .wire-diagram circle, .circuit-diagram path {
  stroke: var(--charred); stroke-width: 1.25; fill: none; vector-effect: non-scaling-stroke;
}
.wire-diagram .dash, .circuit-diagram .dash { stroke-dasharray: 7 9; opacity: 0.62; }
.draw-diagram path, .draw-diagram circle { stroke-dasharray: 900; stroke-dashoffset: 900; transition: stroke-dashoffset 2s ease; }
.bay.in-view .draw-diagram path, .bay.in-view .draw-diagram circle { stroke-dashoffset: 0; }
.annotation { font-size: clamp(0.875rem, 1.2vw, 1.1rem); line-height: 1.75; letter-spacing: 0.02em; color: var(--charred); margin: 2rem 0 0; }

.tally { position: absolute; left: 4vw; top: 40vh; width: 52px; height: 92px; opacity: 0.35; }
.tally b { position: absolute; top: 0; width: 1px; height: 76px; background: var(--oxide); }
.tally b:nth-child(1) { left: 0; } .tally b:nth-child(2) { left: 10px; } .tally b:nth-child(3) { left: 20px; } .tally b:nth-child(4) { left: 30px; } .tally b:nth-child(5) { left: 40px; }
.tally em { position: absolute; left: -6px; top: 35px; width: 58px; height: 1px; background: var(--oxide); transform: rotate(-35deg); }

.model-core { align-content: center; gap: 4rem; }
.cell-word { display: grid; grid-template-columns: repeat(6, minmax(60px, 1fr)); border-top: 1px solid rgba(139,94,60,0.75); border-left: 1px solid rgba(139,94,60,0.75); }
.cell-word span { min-height: 20vh; display: grid; place-items: center; border-right: 1px solid rgba(139,94,60,0.75); border-bottom: 1px solid rgba(139,94,60,0.75); font-family: "Space Mono", monospace; font-size: clamp(2.5rem, 6vw, 5.5rem); color: var(--ivory); }
.cell-word span:last-child { color: rgba(194,112,79,0.5); }
.model-text { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 3vw; color: var(--sand); font-size: clamp(0.875rem, 1.2vw, 1.1rem); line-height: 1.75; letter-spacing: 0.02em; }
.model-text::before { content: ""; grid-column: 2; grid-row: 1; width: 1px; background: rgba(92,64,51,0.3); }
.model-text p:first-child { grid-column: 1; }
.model-text p:last-child { grid-column: 3; }

.test-core { justify-items: center; align-content: center; gap: 2.4rem; }
.outline-title {
  font-size: clamp(5rem, 12vw, 10rem);
  color: transparent;
  -webkit-text-stroke: 2px var(--charred);
  background: linear-gradient(90deg, transparent 40%, rgba(194,112,79,0.13) 50%, transparent 60%);
  background-size: 230% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: scanText 3s linear infinite;
}
.circuit-diagram .node { fill: var(--parchment); stroke: var(--charred); stroke-width: 1.5; animation: nodePulse 2.4s infinite; }
.node.n2 { animation-delay: 0.25s; } .node.n3 { animation-delay: 0.5s; } .node.n4 { animation-delay: 0.75s; } .node.n5 { animation-delay: 1s; } .node.n6 { animation-delay: 1.25s; }

.iterate-core { grid-template-columns: 1.1fr 0.9fr; grid-template-rows: auto auto; column-gap: 6vw; align-content: center; }
.iterate-core h2 { grid-row: 1 / span 2; font-size: clamp(4rem, 8vw, 7rem); color: var(--terracotta); }
.sequence-list { align-self: end; font-family: "IBM Plex Mono", monospace; color: var(--sand); letter-spacing: 0.08em; }
.sequence-list p { display: grid; grid-template-columns: 34px 80px 1fr; align-items: center; gap: 14px; margin: 0 0 1rem; }
.sequence-list span { color: var(--oxide); }
.sequence-list i { height: 1px; background: rgba(139,94,60,0.65); }
.final-line { grid-column: 2; align-self: start; color: var(--sand); font-size: clamp(0.875rem, 1.2vw, 1.1rem); line-height: 1.75; letter-spacing: 0.02em; }

@keyframes letterIn { to { opacity: 1; transform: translateY(0); } }
@keyframes scanText { from { background-position: 140% 0; } to { background-position: -90% 0; } }
@keyframes nodePulse { 0%, 70%, 100% { fill: var(--parchment); filter: none; } 18% { fill: var(--kiln); filter: drop-shadow(0 0 12px rgba(212,132,62,0.9)); } }
@keyframes completePulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

@media (max-width: 820px) {
  .split-core, .iterate-core { grid-template-columns: 1fr; gap: 2rem; }
  .wire-diagram, .circuit-diagram { width: 78vw; }
  .model-text { grid-template-columns: 1fr; }
  .model-text::before { display: none; }
  .model-text p:first-child, .model-text p:last-child, .final-line { grid-column: 1; }
  .cell-word { grid-template-columns: repeat(3, 1fr); }
  .cell-word span { min-height: 11vh; }
}
