:root {
  --spruce: #15201d;
  --dusk: #263430;
  --lantern: #f3c46d;
  --parchment: #e8dfc5;
  --moss: #6e8b5d;
  --ember: #d86b45;
  --iron: #59615b;
  --night: #0b110f;
  --coal: #101815;
  --edge-light: #839080;
  --edge-dark: #080d0b;
  --display: "Arial Black", Impact, Haettenschweiler, system-ui, sans-serif;
  --body: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --utility: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --section-pad: clamp(24px, 5vw, 80px);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 300px;
  min-height: 100%;
  color-scheme: dark;
  background: var(--spruce);
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--parchment);
  background: var(--spruce);
  font-family: var(--body);
}

body.explore-mode {
  overflow: hidden;
}

body.explore-mode #main-content {
  pointer-events: none;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button {
  color: inherit;
}

code,
pre,
kbd {
  font-family: var(--utility);
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--night);
  background: var(--lantern);
  border: 2px solid var(--night);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.scene-stage {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: var(--spruce);
}

#shelf-canvas,
.fallback-world,
.scene-wash,
.scene-vignette {
  position: absolute;
  inset: 0;
}

#shelf-canvas {
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  outline: none;
  touch-action: none;
  pointer-events: none;
  transition: opacity 500ms ease-out;
}

.scene-ready #shelf-canvas {
  opacity: 1;
}

.explore-mode #shelf-canvas {
  pointer-events: auto;
  cursor: grab;
}

.explore-mode #shelf-canvas:active {
  cursor: grabbing;
}

.fallback-world {
  z-index: 1;
  overflow: hidden;
  background: var(--dusk);
  transition: opacity 500ms ease-out;
}

.scene-ready .fallback-world {
  opacity: 0;
}

.fallback-horizon {
  position: absolute;
  inset: 0 0 44%;
  background: linear-gradient(#263430 0%, #1c2925 72%, #15201d 100%);
  box-shadow: inset 0 -80px 100px #15201d;
}

.fallback-grid {
  position: absolute;
  top: 54%;
  right: -20%;
  bottom: -38%;
  left: -20%;
  border-top: 2px solid var(--iron);
  background-color: #101815;
  background-image:
    linear-gradient(#59615b80 1px, transparent 1px),
    linear-gradient(90deg, #59615b80 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(620px) rotateX(58deg);
  transform-origin: top center;
}

.fallback-shelf {
  position: absolute;
  top: 22%;
  left: 50%;
  width: min(64vw, 760px);
  height: min(58vh, 560px);
  border: 12px solid #101815;
  box-shadow: 24px 26px 0 #0b110f80;
  transform: translateX(-50%) skewY(-1deg);
  opacity: 0.55;
}

.fallback-shelf::before,
.fallback-shelf::after,
.fallback-shelf i {
  position: absolute;
  right: -12px;
  left: -12px;
  height: 12px;
  content: "";
  background: #101815;
}

.fallback-shelf::before { top: 17%; }
.fallback-shelf i:nth-child(1) { top: 37%; }
.fallback-shelf i:nth-child(2) { top: 57%; }
.fallback-shelf i:nth-child(3) { top: 77%; }
.fallback-shelf::after { bottom: 5%; }

.scene-wash {
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(90deg, #0b110fb0 0%, #15201d42 34%, transparent 64%),
    linear-gradient(180deg, #0b110f8f 0%, transparent 23%, #0b110fbd 100%);
  transition: opacity 300ms ease;
}

.scene-vignette {
  z-index: 4;
  pointer-events: none;
  box-shadow: inset 0 0 15vw 4vw #080d0bc4;
}

.explore-mode .scene-wash {
  opacity: 0.22;
}

.site-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 50%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(1240px, calc(100% - 36px));
  min-height: 88px;
  gap: 18px;
  transform: translateX(-50%);
}

.wordmark {
  color: var(--parchment);
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.9;
  letter-spacing: -0.065em;
  text-decoration: none;
  text-shadow: 3px 3px 0 var(--edge-dark), 5px 5px 0 #59615b80;
}

.wordmark.small {
  font-size: 1.8rem;
}

.site-header > p,
.source-link,
.eyebrow,
.path-token,
.hud-label,
.scene-readout,
.hero-footnote,
.site-footer {
  font-family: var(--utility);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header > p {
  margin: 0;
  color: var(--lantern);
  font-size: 0.68rem;
}

.source-link {
  min-height: 44px;
  padding: 13px 14px;
  color: #c5d0c8;
  font-size: 0.68rem;
  text-decoration: none;
  border-bottom: 2px solid var(--iron);
}

.source-link:hover {
  color: var(--lantern);
  border-color: var(--lantern);
}

main,
.site-footer {
  position: relative;
  z-index: 10;
}

.hero {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 110px 18px 58px;
  transition: opacity 240ms ease;
}

.compiler-plate {
  position: relative;
  width: min(720px, calc(100vw - 36px));
  padding: clamp(24px, 5vw, 54px);
  background: #1a2622ed;
  border: 3px solid var(--edge-dark);
  border-top-color: var(--edge-light);
  border-left-color: var(--edge-light);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 2px #101815,
    inset 0 -1px 0 #080d0b,
    12px 14px 0 #080d0b9c,
    0 28px 70px #0007;
}

.plate-rail {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  gap: 7px;
}

.plate-rail span {
  width: 7px;
  height: 7px;
  background: var(--iron);
  border: 1px solid var(--night);
  box-shadow: inset 1px 1px #9aa59b80;
}

.plate-rail span:first-child {
  background: var(--moss);
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--lantern);
  font-size: 0.66rem;
}

.status-lamp {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  vertical-align: 0;
  background: var(--moss);
  border: 1px solid var(--night);
  box-shadow: 0 0 10px #6e8b5dc4;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
}

h1,
h2 {
  font-family: var(--display);
  letter-spacing: -0.04em;
}

h1 {
  max-width: 610px;
  font-size: clamp(3.1rem, 9vw, 7.2rem);
  line-height: 0.78;
  text-shadow: 4px 4px 0 var(--night);
}

h1 span {
  display: block;
  color: var(--lantern);
}

h2 {
  font-size: clamp(2.15rem, 6vw, 4.8rem);
  line-height: 0.95;
}

h3 {
  font-size: 1.12rem;
}

.hero-thesis {
  max-width: 610px;
  margin: 26px 0 22px;
  color: #d5ddd6;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.62;
}

.witness-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 0 22px;
  color: #aebbb1;
  background: #0d1512;
  border: 2px solid var(--night);
  border-right-color: var(--iron);
  border-bottom-color: var(--iron);
  font-family: var(--utility);
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.witness-strip span {
  padding: 11px 12px;
  border-right: 1px solid #59615b70;
}

.witness-strip span:last-child {
  border-right: 0;
}

.witness-strip b {
  color: var(--parchment);
  font-size: 0.84rem;
}

.primary-routes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.material-action,
.hud-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 10px 15px;
  color: var(--parchment);
  background: var(--iron);
  border: 3px solid var(--edge-dark);
  border-top-color: var(--edge-light);
  border-left-color: var(--edge-light);
  border-radius: 1px;
  box-shadow: inset 0 0 0 1px #2c3530;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.material-action:hover,
.hud-exit:hover {
  color: #fff7df;
  background: #657068;
}

.material-action.is-primary {
  color: var(--night);
  background: var(--lantern);
  border-top-color: #fff0b9;
  border-left-color: #fff0b9;
  box-shadow: inset 0 0 0 1px #9e7838;
}

.material-action:active,
.hud-exit:active {
  border-color: var(--edge-light);
  border-top-color: var(--edge-dark);
  border-left-color: var(--edge-dark);
  transform: translateY(2px);
}

.material-action:focus-visible,
.hud-exit:focus-visible,
.source-link:focus-visible,
.wordmark:focus-visible,
#shelf-canvas:focus-visible {
  outline: 3px solid var(--lantern);
  outline-offset: 4px;
}

.scene-readout {
  min-height: 1.4em;
  margin: 17px 0 0;
  color: #aebbb1;
  font-size: 0.61rem;
  line-height: 1.45;
}

.scene-error .status-lamp,
.no-webgl-preview .status-lamp {
  background: var(--ember);
  box-shadow: 0 0 10px #d86b45a6;
}

.hero-footnote {
  align-self: end;
  width: min(720px, calc(100vw - 36px));
  margin: 26px 0 0;
  color: #9daba0;
  font-size: 0.59rem;
  line-height: 1.55;
  text-align: center;
}

.content-section {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(70px, 11vw, 150px) var(--section-pad);
  background: #15201df5;
  border-top: 2px solid #59615b80;
}

.content-section + .content-section {
  border-top: 1px solid var(--iron);
}

.system-section {
  min-height: 100svh;
  border: 3px solid var(--night);
  border-top-color: var(--edge-light);
  border-left-color: var(--edge-light);
  box-shadow: 12px 14px 0 #080d0b9c;
}

.section-heading {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: end;
  gap: clamp(28px, 6vw, 90px);
}

.section-heading .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: -16px;
}

.section-heading > p:last-child,
.witness-copy > p:last-child,
.run-section > div:first-child > p:last-child {
  margin: 0;
  color: #bdc8c0;
  font-size: 1rem;
  line-height: 1.72;
}

.compile-path {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: clamp(54px, 8vw, 96px) 0 0;
  padding: 0;
  list-style: none;
  border: 2px solid var(--night);
  border-right-color: var(--edge-light);
  border-bottom-color: var(--edge-light);
}

.compile-path li {
  position: relative;
  min-height: 300px;
  padding: 25px 22px 28px;
  background: var(--dusk);
  border-right: 1px solid var(--iron);
}

.compile-path li:last-child {
  border-right: 0;
}

.compile-path li:not(:last-child)::after {
  position: absolute;
  z-index: 2;
  top: 37px;
  right: -8px;
  width: 14px;
  height: 14px;
  content: "";
  background: var(--lantern);
  border: 2px solid var(--night);
  transform: rotate(45deg);
}

.path-token {
  display: inline-block;
  margin-bottom: 42px;
  color: var(--lantern);
  font-size: 0.62rem;
}

.compile-path h3 {
  font-family: var(--display);
  line-height: 1.1;
}

.compile-path p {
  margin: 14px 0 0;
  color: #bac5bc;
  font-size: 0.88rem;
  line-height: 1.62;
}

.compile-path code {
  color: var(--parchment);
  font-size: 0.78rem;
}

.witness-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(40px, 7vw, 100px);
  background: #101815f5;
}

.witness-copy {
  align-self: start;
  position: sticky;
  top: 40px;
}

.witness-copy h2 {
  margin-bottom: 28px;
}

.witness-ledger {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-self: start;
  border: 2px solid var(--night);
  border-right-color: var(--edge-light);
  border-bottom-color: var(--edge-light);
}

.witness-ledger article {
  min-width: 0;
  padding: 22px;
  background: var(--dusk);
  border-right: 1px solid var(--iron);
}

.witness-ledger article:nth-child(3) {
  border-right: 0;
}

.witness-ledger .ledger-wide {
  display: grid;
  grid-template-columns: 46px 150px 1fr;
  grid-column: 1 / -1;
  align-items: start;
  gap: 14px;
  border-top: 1px solid var(--iron);
  border-right: 0;
}

.ledger-index {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 40px;
  color: var(--night);
  background: var(--lantern);
  border: 2px solid var(--night);
  font-family: var(--display);
}

.ledger-wide .ledger-index {
  margin: 0;
}

.witness-ledger h3 {
  font-family: var(--display);
}

.witness-ledger p {
  margin: 13px 0 0;
  color: #bac5bc;
  font-size: 0.88rem;
  line-height: 1.6;
}

.ledger-wide p {
  margin: 0;
}

.prototype-gate {
  grid-column: 1 / -1;
  margin: 0;
  padding: 16px 18px;
  color: #d3d9d3;
  background: #2d2419;
  border: 2px solid #9e7838;
  font-size: 0.86rem;
  line-height: 1.58;
}

.prototype-gate strong {
  color: var(--lantern);
}

.run-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: clamp(40px, 8vw, 110px);
  min-height: 90svh;
  background: #15201dfa;
}

.run-section h2 {
  margin-bottom: 28px;
}

.terminal-card {
  min-width: 0;
  overflow: hidden;
  background: #080d0b;
  border: 3px solid var(--night);
  border-top-color: var(--edge-light);
  border-left-color: var(--edge-light);
  box-shadow: 12px 14px 0 #080d0b9c;
}

.terminal-title {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  gap: 7px;
  color: #9daba0;
  background: var(--dusk);
  border-bottom: 2px solid var(--night);
  font-family: var(--utility);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.terminal-title span {
  width: 8px;
  height: 8px;
  background: var(--iron);
  border: 1px solid var(--night);
}

.terminal-title span:first-child {
  background: var(--moss);
}

.terminal-title b {
  margin-left: auto;
  font-weight: 500;
}

.terminal-card pre {
  margin: 0;
  padding: clamp(18px, 4vw, 34px);
  overflow-x: auto;
  color: #d9e2db;
  font-size: clamp(0.68rem, 1.4vw, 0.86rem);
  line-height: 1.85;
  scrollbar-color: var(--iron) var(--night);
}

.source-action {
  margin: 0 18px 18px;
}

.order-gate {
  grid-column: 1 / -1;
  margin: 0;
  color: #9daba0;
  font-family: var(--utility);
  font-size: 0.67rem;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.explore-hud {
  position: fixed;
  z-index: 40;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 20px;
  visibility: hidden;
  background: #101815e8;
  border: 2px solid var(--night);
  border-top-color: var(--edge-light);
  border-left-color: var(--edge-light);
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms;
  pointer-events: none;
}

.explore-mode .explore-hud {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.explore-mode .hero,
.explore-mode .site-header,
.explore-mode main > :not(.hero),
.explore-mode .site-footer {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.explore-hud > div {
  display: grid;
  gap: 4px;
}

.hud-label {
  color: var(--lantern);
  font-size: 0.6rem;
}

.explore-hud strong {
  color: #c5d0c8;
  font-size: 0.8rem;
  font-weight: 600;
}

.hud-exit {
  flex: 0 0 auto;
  min-height: 44px;
  font-size: 0.78rem;
}

kbd {
  margin-left: 6px;
  padding: 2px 5px;
  color: #bdc8c0;
  background: var(--night);
  border: 1px solid var(--edge-light);
  font-size: 0.65rem;
}

.site-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  width: min(1240px, calc(100% - 36px));
  min-height: 100px;
  margin: 0 auto;
  padding: 22px var(--section-pad);
  gap: 22px;
  color: #89988d;
  background: #080d0bf5;
  border-top: 2px solid var(--iron);
  font-size: 0.58rem;
}

.site-footer p {
  margin: 0;
}

.site-footer p:last-child {
  text-align: right;
}

.noscript-note {
  position: fixed;
  z-index: 80;
  right: 12px;
  bottom: 12px;
  left: 12px;
  margin: 0;
  padding: 12px 14px;
  color: var(--night);
  background: var(--lantern);
  border: 2px solid var(--night);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 900px) {
  .primary-routes,
  .section-heading,
  .witness-section,
  .run-section {
    grid-template-columns: 1fr;
  }

  .section-heading .eyebrow {
    margin-bottom: -4px;
  }

  .compile-path {
    grid-template-columns: repeat(2, 1fr);
  }

  .compile-path li:nth-child(2) {
    border-right: 0;
  }

  .compile-path li:nth-child(2)::after {
    display: none;
  }

  .compile-path li:nth-child(n + 3) {
    border-top: 1px solid var(--iron);
  }

  .witness-copy {
    position: static;
  }
}

@media (max-width: 620px) {
  .site-header {
    grid-template-columns: auto 1fr;
    min-height: 76px;
  }

  .site-header > p {
    display: none;
  }

  .source-link {
    justify-self: end;
  }

  .hero {
    align-content: center;
    min-height: 100svh;
    padding: 90px 12px 32px;
  }

  .compiler-plate,
  .hero-footnote,
  .content-section,
  .site-footer {
    width: min(100% - 24px, 100%);
  }

  .compiler-plate {
    padding: 26px 18px 22px;
    box-shadow: inset 0 0 0 2px #101815, 7px 8px 0 #080d0b9c;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.5rem);
  }

  .hero-thesis {
    margin: 20px 0 18px;
    font-size: 0.92rem;
  }

  .witness-strip {
    grid-template-columns: 1fr;
  }

  .witness-strip span {
    padding: 8px 10px;
    border-right: 0;
    border-bottom: 1px solid #59615b70;
  }

  .witness-strip span:last-child {
    border-bottom: 0;
  }

  .primary-routes {
    gap: 8px;
  }

  .material-action {
    min-height: 48px;
  }

  .hero-footnote {
    display: none;
  }

  .content-section {
    padding: 72px 20px;
  }

  .compile-path,
  .witness-ledger {
    grid-template-columns: 1fr;
  }

  .compile-path li,
  .compile-path li:nth-child(2) {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--iron);
  }

  .compile-path li:last-child {
    border-bottom: 0;
  }

  .compile-path li:not(:last-child)::after {
    top: auto;
    right: 28px;
    bottom: -8px;
    display: block;
  }

  .path-token,
  .ledger-index {
    margin-bottom: 22px;
  }

  .witness-ledger article,
  .witness-ledger article:nth-child(3) {
    border-right: 0;
    border-bottom: 1px solid var(--iron);
  }

  .witness-ledger .ledger-wide {
    display: block;
    grid-column: auto;
    border-top: 0;
    border-bottom: 0;
  }

  .ledger-wide .ledger-index {
    margin-bottom: 22px;
  }

  .ledger-wide p {
    margin-top: 13px;
  }

  .terminal-card pre {
    padding: 18px;
    font-size: 0.62rem;
  }

  .explore-hud {
    right: 10px;
    bottom: 10px;
    left: 10px;
    display: grid;
    gap: 12px;
  }

  .hud-exit {
    width: 100%;
  }

  .site-footer {
    grid-template-columns: 1fr auto;
    min-height: 88px;
    padding: 18px;
  }

  .site-footer p:nth-child(2) {
    display: none;
  }
}

@media (max-height: 760px) and (min-width: 621px) {
  .hero {
    align-content: center;
    padding-top: 96px;
  }

  .compiler-plate {
    padding-block: 28px 22px;
  }

  h1 {
    font-size: clamp(3rem, 9vh, 5.3rem);
  }

  .hero-thesis {
    margin-block: 18px 16px;
  }

  .hero-footnote {
    display: none;
  }
}

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

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

@media (forced-colors: active) {
  .compiler-plate,
  .content-section,
  .material-action,
  .hud-exit {
    border: 2px solid CanvasText;
  }

  .status-lamp,
  .plate-rail,
  .scene-stage {
    display: none;
  }
}
