@font-face {
  font-family: Cinzel;
  src: url("assets/fonts/Cinzel.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: Cormorant;
  src: url("assets/fonts/CormorantGaramond.ttf") format("truetype");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: Runic;
  src: url("assets/fonts/NotoSansRunic-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0b0b0a;
  --surface: #151514;
  --ink: #e8e0cf;
  --soft: #b9b3a8;
  --muted: #989185;
  --edge: #464038;
  --gold: #c9a673;
  --red: #ad5547;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .13; background: repeating-linear-gradient(0deg, transparent 0 3px, #c7aa7610 4px); }
a { color: inherit; }
a:focus-visible, button:focus-visible, video:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Cinzel, Georgia, serif; font-weight: 600; }
h2, h3 { font-family: Cormorant, Georgia, serif; font-weight: 600; }
h2 { font-size: clamp(2.4rem, 4.7vw, 4.6rem); line-height: 1.05; letter-spacing: -.025em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-footer { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.eyebrow { font-size: .69rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 700; }
.eyebrow { color: var(--gold); }
.craft a { font-size: .79rem; text-decoration: none; border-bottom: 1px solid transparent; }
.craft a:hover { border-bottom-color: var(--gold); color: var(--gold); }
.chain-page { position: relative; max-width: 1280px; margin: 0 auto; padding-block: 22px 48px; isolation: isolate; }
.chain-page > .chain-section { position: relative; z-index: 1; width: min(920px, calc(100% - 170px)); margin: 0 auto clamp(100px, 10vw, 150px); padding: clamp(24px, 3.6vw, 44px); border: 1px solid #504438; background: #10100f; }
.chain-page > .intro-section { width: min(1100px, calc(100% - 150px)); }
.chain-page > .chain-section:last-child { margin-bottom: 0; }
.chain-page > .craft { margin-bottom: clamp(170px, 15vw, 205px); }
.chain-page > .next { border: 0; background: transparent; }
.chain-page > .statement { padding-block: 10px; }
.chain-page > .model-section { padding: 0; border: 0; background: transparent; }
.chain-page .statement-row:first-child { border-top: 0; }
.chain-page .statement-row:last-child { border-bottom: 0; }
.chain-art { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.chain-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chain-underlay { fill: none; stroke: none; }
.chain-glyph { fill: #44474f; stroke: #0b0b0a; stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; font: 700 12px ui-monospace, Consolas, monospace; }
.chain-glyph.rune { font: 400 20px Runic, serif; }
.chain-glyph.epilogue { fill: #6e717c; }
.opening { padding-block: clamp(48px, 6vw, 80px) clamp(32px, 4vw, 54px); text-align: center; }
.opening h1 { position: relative; display: inline-block; margin-bottom: 10px; font-size: clamp(4.3rem, 11vw, 10rem); line-height: 1.1; font-weight: 600; letter-spacing: -.055em; text-shadow: 0 8px 45px #c9a6731b; }
.opening h1::before, .opening h1::after { content: ""; position: absolute; top: 50%; width: clamp(15px, 6vw, 75px); height: 1px; background: var(--red); }
.opening h1::before { right: calc(100% + 18px); }
.opening h1::after { left: calc(100% + 18px); }
.opening-subtitle { margin: 0; color: var(--soft); font-family: Georgia, serif; font-size: clamp(1.08rem, 2vw, 1.4rem); font-style: italic; }
.film-section { max-width: 1020px; }
.film-frame { border: 1px solid #746451; background: #060706; box-shadow: 0 22px 70px #0009; }
video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #050505; }
.encounter-player { display: block; width: 100%; aspect-ratio: 16 / 9; background: #050505; --media-primary-color: #f0eade; --media-secondary-color: #131411d9; --media-control-hover-background: #574028; }
.encounter-player > video { width: 100%; height: 100%; object-fit: contain; }
.encounter-player .hero-play { border: 1px solid var(--gold); border-radius: 50%; box-shadow: 0 0 28px #000b; --media-control-background: #11110fd9; --media-control-hover-background: #5e442f; --media-control-height: 68px; --media-control-padding: 16px; }
.encounter-player:not([mediapaused]) .hero-play { --media-control-display: none; }
.encounter-player media-control-bar { padding: 6px; background: linear-gradient(0deg, #060606f0, #10100fc9); --media-control-background: transparent; --media-control-hover-background: #574028; }
.encounter-player media-time-range { flex: 1; min-width: 40px; }
.encounter-player .desktop-only { --media-control-display: none; }
.encounter-player[breakpointmd] .desktop-only { --media-control-display: unset; }
.encounter-player media-volume-range[mediavolumeunavailable], .encounter-player media-pip-button[mediapipunavailable] { --media-control-display: none; }
.encounter-player:fullscreen { width: 100vw; height: 100vh; aspect-ratio: auto; }
.film-caption { margin: 0; padding-top: 16px; color: var(--gold); font: italic 1.05rem/1.5 Georgia, serif; text-align: center; }
.statement { padding-block: clamp(95px, 11vw, 155px); }
.statement-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; padding-block: 48px; border-top: 1px solid var(--edge); }
.statement-row:last-child { border-bottom: 1px solid var(--edge); }
.statement-row .eyebrow { margin-top: 13px; }
.statement-row h2 { max-width: 700px; margin: 0 0 18px; }
.statement-row p:not(.eyebrow) { max-width: 650px; color: var(--soft); line-height: 1.85; }
.statement-row em { color: var(--ink); }
.model-section { padding-block: 36px clamp(40px, 5vw, 70px); }
.section-intro { max-width: 680px; margin: 0 auto 45px; text-align: center; }
.section-intro .eyebrow { margin-bottom: 19px; }
.section-intro h2 { margin-bottom: 16px; }
.section-intro > p:last-child { color: var(--soft); }
.comparison { border: 1px solid var(--edge); background: #11110f; }
.tree-intro { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(250px, 1fr); align-items: center; gap: 32px; padding: 24px 28px; border-bottom: 1px solid var(--edge); }
.tree-intro h2 { margin-bottom: 4px; font-size: clamp(2rem, 3vw, 3rem); }
.tree-intro p { margin: 0; color: var(--soft); font-size: .84rem; }
.tree-source { display: grid; gap: 2px; padding-left: 20px; border-left: 1px solid var(--edge); }
.tree-source span { color: var(--muted); font-size: .63rem; letter-spacing: .1em; text-transform: uppercase; }
.tree-source code { margin-bottom: 8px; color: var(--gold); font: .69rem/1.4 ui-monospace, "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
.tree-source code:last-child { margin-bottom: 0; }
.compare-controls { padding: 16px 28px; border-bottom: 1px solid var(--edge); }
.control-heading, .level-choice label { color: var(--gold); font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.signal-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.signal-choice .control-heading { margin-right: 8px; }
.signal-choice button { min-height: 38px; padding: 7px 13px; border: 1px solid var(--edge); background: #1e1d19; color: var(--ink); font: inherit; font-size: .81rem; cursor: pointer; }
.signal-choice button[hidden] { display: none; }
.signal-choice button[data-example="true"] { border-color: var(--gold); background: #473721; box-shadow: inset 0 -2px var(--gold); }
.signal-choice button:active { background: #57453055; color: #f0d7a8; }
.signal-choice button:hover { border-color: var(--gold); }
.level-choice { width: min(100%, 320px); }
.level-choice label { display: flex; justify-content: space-between; }
.level-choice output { color: var(--ink); font-size: .9rem; letter-spacing: 0; }
.level-choice input { width: 100%; margin: 10px 0 3px; accent-color: var(--gold); }
.level-ends { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .61rem; }
.diagrams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.diagram-card { min-width: 0; margin: 0; padding: clamp(16px, 2.6vw, 32px); }
.diagram-card.baseline { border-right: 1px solid var(--edge); background: radial-gradient(ellipse at 45% 55%, #746f6211, transparent 68%); }
.diagram-card.enhanced { background: radial-gradient(ellipse at 55% 52%, #a5844a1c, transparent 68%); }
.diagram-card figcaption { color: var(--gold); font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.tree-mount svg { display: block; width: 100%; height: auto; margin-top: 12px; }
.score-edge { fill: none; stroke: #69645b; stroke-width: 2; transition: stroke .35s ease, stroke-width .35s ease; }
.score-edge.leading { stroke: var(--gold); stroke-width: 3; }
.baseline .score-edge.leading { stroke: #8a7960; }
.score-node circle { fill: #1e1d1a; stroke: #70685c; stroke-width: 2; transition: fill .35s ease, stroke .35s ease; }
.score-node.leading circle { fill: #443523; stroke: var(--gold); stroke-width: 2.5; }
.baseline .score-node.leading circle { fill: #34302a; stroke: #a48d6a; }
.score-node text { fill: var(--ink); font: 700 17px system-ui, sans-serif; }
.memory-area { display: grid; grid-template-columns: minmax(0, 1fr) minmax(175px, .75fr); gap: 24px; align-items: center; margin-top: 2px; padding-top: 18px; border-top: 1px solid var(--edge); }
.memory-journal { min-width: 0; }
.memory-heading { display: flex; align-items: center; justify-content: space-between; }
.memory-heading span { color: var(--gold); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.memory-heading button { padding: 3px 0 3px 9px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .7rem; cursor: pointer; }
.memory-heading button:hover { color: var(--gold); }
#memory-events { display: block; margin: 8px 0 0; padding: 0; border: 1px solid #705e46; background: #161512; list-style: none; }
#memory-events li { display: grid; grid-template-columns: 44px minmax(0, 1fr); min-height: 33px; border-bottom: 1px solid var(--edge); color: #f0d7a8; font: 600 .7rem/1.25 ui-monospace, "SFMono-Regular", Consolas, monospace; }
#memory-events li:last-child { border-bottom: 0; }
.memory-index { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--edge); background: #30261a; color: var(--gold); }
.memory-value { display: flex; align-items: center; min-width: 0; padding: 5px 8px; overflow-wrap: anywhere; }
#memory-events li.vacant .memory-index { background: #201f1b; color: var(--muted); }
#memory-events li.vacant .memory-value { color: var(--muted); }
.model-disclaimer { max-width: 790px; margin: 20px auto 0; color: var(--muted); font-size: .73rem; text-align: center; }
.craft, .next { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; padding-block: clamp(65px, 9vw, 120px); border-top: 1px solid var(--edge); }
.craft-copy p { color: var(--soft); line-height: 1.85; }
.craft a { display: inline-block; padding-bottom: 5px; border-bottom: 1px solid var(--gold); color: var(--gold); }
.craft a.tangled-link { display: inline-flex; align-items: center; gap: 8px; }
.tangled-link img { flex: 0 0 auto; }
.next p { max-width: 470px; margin: 0; color: var(--soft); line-height: 1.85; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-block: 32px; border-top: 1px solid var(--edge); }
.site-footer p { margin: 0; }
.site-footer .credit { color: var(--muted); font: 400 .79rem/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.site-footer .credit a { color: var(--soft); text-decoration-color: var(--edge); text-underline-offset: 3px; }
.site-footer .credit a:hover { color: var(--gold); }
.site-footer .legal { max-width: 520px; color: var(--muted); font-size: .7rem; text-align: right; }

@media (max-width: 960px) {
  .chain-page > .chain-section { width: calc(100% - 150px); margin-bottom: 100px; padding: 24px; }
  .chain-page > .model-section { padding: 0; }
  .chain-page > .craft { margin-bottom: 150px; }
  .tree-intro { grid-template-columns: 1fr; gap: 18px; }
  .statement-row { grid-template-columns: 1fr; gap: 8px; }
  .statement-row .eyebrow { margin: 0; }
  .diagrams { grid-template-columns: 1fr; }
  .diagram-card.baseline { border-right: 0; border-bottom: 1px solid var(--edge); }
  .memory-area { grid-template-columns: 1fr; gap: 15px; }
  .craft, .next { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 580px) {
  .chain-page > .chain-section { width: calc(100% - 104px); margin-bottom: 78px; padding: 16px; }
  .chain-page > .model-section { padding: 0; }
  .chain-page > .craft { margin-bottom: 125px; }
  .intro-section .film-section { margin-inline: -16px; }
  .film-frame { border-inline: 0; }
  .film-caption { padding-inline: 8px; }
  .encounter-player .hero-play { --media-control-height: 40px; --media-control-padding: 8px; }
  .encounter-player media-control-bar { padding: 2px; }
  .opening h1::before, .opening h1::after { display: none; }
  .opening h1 { font-size: clamp(3.5rem, 15vw, 4.3rem); }
  .statement-row { padding-block: 34px; }
  .diagram-card { padding: 12px; }
  .score-node text { font-size: 24px; }
  .tree-intro, .compare-controls { padding: 18px; }
  .site-footer { align-items: start; flex-direction: column; }
  .site-footer .legal { text-align: left; }
}
@media (max-width: 360px) {
  .chain-art { display: none; }
  .chain-page > .chain-section { width: calc(100% - 28px); }
}
@media (prefers-reduced-motion: reduce) {
  .score-edge, .score-node circle { transition: none; }
}
