:root {
  /* Compliance marker for parsed design token: Space Mono** from Google Fonts */
  --frost: #EAF3F7;
  --vapor: #BFD5DE;
  --black: #11131A;
  --bone: #F6F0E6;
  --gold: #D8B76A;
  --blue: #1E4D8F;
  --magenta: #FF3B8A;
  --vermilion: #D9472E;
  --violet: #2A1938;
  --design-font-parser-token: "Mono**";
  --design-font-parser-match: Mon;
  --scroll: 0;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--bone);
  background:
    radial-gradient(circle at 28% 8%, rgba(191, 213, 222, .2), transparent 25%),
    radial-gradient(circle at 78% 22%, rgba(255, 59, 138, .12), transparent 22%),
    linear-gradient(135deg, var(--black), var(--violet) 58%, #08090d);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(rgba(234,243,247,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(234,243,247,.028) 1px, transparent 1px),
    repeating-linear-gradient(105deg, transparent 0 30px, rgba(216,183,106,.035) 31px, transparent 33px);
  background-size: 54px 54px, 54px 54px, 190px 190px;
  mix-blend-mode: screen;
}

.archive { position: relative; }

.scene {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid rgba(216, 183, 106, .18);
}

.scene::before {
  content: attr(data-chapter);
  position: absolute;
  left: calc(50% - 38px);
  top: 26px;
  z-index: 6;
  font-family: "Space Mono", ui-monospace, monospace;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: .28em;
  background: rgba(17,19,26,.76);
  border: 1px solid rgba(216,183,106,.45);
  padding: 8px 12px;
  clip-path: polygon(9% 0, 100% 0, 91% 100%, 0 100%);
}

.pane {
  min-height: 100vh;
  position: relative;
  padding: clamp(54px, 8vw, 118px);
  display: flex;
  align-items: center;
}

.canonical {
  justify-content: flex-end;
  background:
    linear-gradient(90deg, rgba(234,243,247,.11), rgba(234,243,247,.03)),
    linear-gradient(180deg, rgba(17,19,26,.05), rgba(17,19,26,.4));
  clip-path: polygon(0 0, 97% 0, 89% 12%, 98% 25%, 91% 38%, 99% 52%, 90% 66%, 98% 80%, 92% 100%, 0 100%);
}

.margin {
  justify-content: flex-start;
  background:
    radial-gradient(circle at 22% 45%, rgba(255,59,138,.16), transparent 24%),
    linear-gradient(270deg, rgba(42,25,56,.82), rgba(17,19,26,.25));
  clip-path: polygon(2% 0, 100% 0, 100% 100%, 4% 100%, 11% 80%, 3% 66%, 10% 52%, 2% 38%, 11% 25%, 3% 12%);
}

.glass {
  width: min(560px, 86%);
  padding: clamp(28px, 4vw, 54px);
  background: rgba(234,243,247,.68);
  color: var(--black);
  border: 1px solid rgba(216,183,106,.78);
  box-shadow: 0 34px 90px rgba(0,0,0,.36), inset 0 1px rgba(255,255,255,.7);
  backdrop-filter: blur(22px);
  clip-path: polygon(0 0, 94% 0, 100% 10%, 100% 100%, 6% 100%, 0 90%);
}

.title-slab { transform: translateX(calc(var(--scroll) * -10px)); }

.meta, .tab, .citation-lane, .binder-flag, .definition-stack, .faceted-source {
  font-family: "Space Mono", ui-monospace, SFMono-Regular, monospace;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 11px;
}

.meta { color: var(--blue); margin: 0 0 18px; }

h1, h2 {
  font-family: "Nunito Sans", Nunito, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 1000;
  letter-spacing: -.06em;
  line-height: .86;
  margin: 0;
}

h1 { font-size: clamp(72px, 12vw, 172px); }
h2 { font-size: clamp(45px, 6.5vw, 91px); color: var(--black); }

p { font-size: clamp(16px, 1.55vw, 21px); line-height: 1.72; }

.definition { max-width: 430px; color: rgba(17,19,26,.78); font-weight: 600; }

.glitch-title { position: relative; display: inline-block; color: var(--black); }
.glitch-title::before, .glitch-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: .58;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.glitch-title::before { color: var(--magenta); transform: translate(3px, -2px); clip-path: inset(0 0 58% 0); animation: titleGlitch 4.4s infinite steps(2); }
.glitch-title::after { color: var(--blue); transform: translate(-3px, 2px); clip-path: inset(47% 0 0 0); animation: titleGlitch 5.2s infinite steps(2) reverse; }
.glitch-title.small { font-size: clamp(48px, 7vw, 108px); }

.seam {
  position: fixed;
  left: 50%;
  top: 0;
  width: 34px;
  height: 100vh;
  z-index: 5;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(216,183,106,.75), transparent);
  clip-path: polygon(35% 0, 72% 10%, 43% 20%, 80% 34%, 40% 48%, 72% 61%, 34% 74%, 65% 100%, 46% 100%, 15% 74%, 52% 61%, 18% 48%, 57% 34%, 20% 20%, 50% 10%, 18% 0);
  filter: drop-shadow(0 0 16px rgba(216,183,106,.46));
}

.seam i {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--magenta);
  opacity: .65;
  animation: seamTwitch 2.5s infinite steps(1);
}
.seam i:nth-child(1) { top: 16%; animation-delay: .1s; }
.seam i:nth-child(2) { top: 32%; background: var(--blue); animation-delay: .6s; }
.seam i:nth-child(3) { top: 51%; animation-delay: 1.1s; }
.seam i:nth-child(4) { top: 68%; background: var(--blue); animation-delay: 1.5s; }
.seam i:nth-child(5) { top: 84%; animation-delay: 2s; }

.index-tabs {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.tab {
  color: var(--frost);
  text-decoration: none;
  padding: 9px 12px;
  background: rgba(234,243,247,.13);
  border: 1px solid rgba(216,183,106,.34);
  backdrop-filter: blur(12px);
  clip-path: polygon(0 0, 92% 0, 100% 50%, 92% 100%, 0 100%);
  transform: translateX(21px);
  transition: .28s ease;
}
.tab:nth-child(even) { transform: translateX(-21px) scaleX(-1); }
.tab:nth-child(even) span, .tab:nth-child(even) { direction: rtl; }
.tab span { color: var(--gold); margin-right: 8px; }
.tab.is-active { background: rgba(216,183,106,.28); color: var(--bone); border-color: var(--gold); }

.hand {
  font-family: Kalam, "Comic Sans MS", cursive;
  color: var(--bone);
  font-size: clamp(30px, 5.8vw, 82px);
  line-height: .95;
  transform: rotate(-5deg);
  text-shadow: 2px 0 var(--magenta), -1px 0 var(--blue);
}
.correction { max-width: 520px; animation: writeIn 2.2s ease both; }
.big-note { color: var(--magenta); }
.note-column { max-width: 380px; color: var(--frost); }
.final-hand { color: var(--gold); }

.drawn-arrow {
  width: min(320px, 46vw);
  position: absolute;
  stroke: var(--bone);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(2px 1px 0 var(--magenta));
}
.drawn-arrow path { stroke-dasharray: 500; stroke-dashoffset: 500; animation: drawPath 2.8s ease forwards; }
.hero-arrow { top: 14%; left: 8%; }
.source-arrow { right: 14%; bottom: 12%; stroke: var(--gold); }

.source-slip, .binder-flag, .crossout, .sketch, .glyph-list, .faceted-source, .icon-line {
  position: relative;
  background: rgba(246,240,230,.9);
  color: var(--black);
  border: 1px solid rgba(216,183,106,.72);
  box-shadow: 0 16px 40px rgba(0,0,0,.25);
  clip-path: polygon(0 0, 88% 0, 100% 22%, 95% 100%, 6% 100%, 0 84%);
}
.source-slip { padding: 18px 22px; font-family: Kalam, cursive; font-size: 22px; max-width: 340px; transform: rotate(4deg); }
.hero-scene .source-slip { position: absolute; right: 12%; bottom: 16%; }
.blue { color: var(--blue); transform: rotate(-7deg); }
.red { color: var(--vermilion); transform: rotate(6deg); }
.tilted { transform: rotate(-3deg); }
.slip-field { flex-direction: column; align-items: flex-start; gap: 22px; }

.shard {
  position: absolute;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 13px 18px;
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  background: rgba(17,19,26,.6);
  clip-path: polygon(18% 0, 100% 12%, 82% 100%, 0 80%);
  animation: jitter 3.1s infinite steps(2);
}
.shard-a { right: 16%; top: 25%; }
.shard-b { left: 15%; top: 18%; font-size: 54px; color: var(--magenta); }
.shard-c { right: 14%; bottom: 14%; }

.thumbprint {
  width: 78px;
  height: 92px;
  border-radius: 50%;
  position: absolute;
  right: 20%;
  top: 53%;
  background: repeating-radial-gradient(ellipse at center, rgba(30,77,143,.8) 0 2px, transparent 3px 7px);
  transform: rotate(18deg);
  opacity: .75;
}
.thumbprint.large { position: relative; right: auto; top: auto; width: 146px; height: 172px; }

.rule { height: 1px; background: linear-gradient(90deg, var(--gold), transparent); margin: 26px 0; }
.excerpt { color: var(--blue); font-weight: 700; }
.article-card { transition: transform .8s cubic-bezier(.2,.8,.2,1); }
.scene.is-visible .article-card { transform: translateX(-12px); }
.shifted { transform: translateY(28px); }
.definition-stack { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.definition-stack span, .citation-lane span { border: 1px solid rgba(30,77,143,.45); padding: 8px 10px; color: var(--blue); background: rgba(255,255,255,.28); }

.angular-pane, .sketch-board, .final-margin { flex-direction: column; gap: 28px; align-items: flex-start; }
.crossout { padding: 16px 24px; font-family: Kalam, cursive; font-size: 34px; transform: rotate(3deg); }
.crossout::after { content: ""; position: absolute; left: 8%; right: 8%; top: 52%; height: 4px; background: var(--vermilion); transform: rotate(-8deg); }
.binder-flag { padding: 14px 20px; color: var(--blue); }
.glyph-list { margin: 0; padding: 22px 28px 22px 42px; font-family: Kalam, cursive; font-size: 23px; }
.sketch { padding: 20px 28px; font-family: Kalam, cursive; font-size: 34px; transform: rotate(-4deg); }
.speech { border-radius: 46% 54% 52% 48%; clip-path: none; }
.brackets { color: var(--blue); transform: rotate(5deg); }
.fractured-card { clip-path: polygon(0 0, 92% 0, 100% 17%, 87% 34%, 100% 49%, 91% 67%, 100% 100%, 8% 100%, 0 85%, 7% 64%, 0 43%, 9% 22%); }
.citation-lane { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 28px; }
.living-page { width: min(650px, 88%); }
.revision-seal {
  display: inline-block;
  margin-top: 20px;
  color: var(--black);
  text-decoration: none;
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .15em;
  padding: 14px 22px;
  background: rgba(216,183,106,.65);
  border: 1px solid var(--black);
  clip-path: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%, 8% 50%);
}
.faceted-source { padding: 16px 22px; color: var(--blue); }
.icon-line { margin-top: 28px; padding: 12px 18px; font-family: "Space Mono", monospace; text-transform: uppercase; letter-spacing: .16em; font-size: 10px; }

@keyframes titleGlitch {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(8px, -3px); }
  92% { transform: translate(-5px, 3px); }
  94% { transform: translate(3px, 0); }
}

@keyframes seamTwitch {
  0%, 78%, 100% { transform: translateX(0) scaleX(1); opacity: .16; }
  80% { transform: translateX(-14px) scaleX(2.8); opacity: .85; }
  83% { transform: translateX(11px) scaleX(1.5); opacity: .65; }
}

@keyframes drawPath { to { stroke-dashoffset: 0; } }
@keyframes jitter { 0%, 90%, 100% { transform: translate(0) rotate(-2deg); } 92% { transform: translate(7px, -4px) rotate(2deg); } 95% { transform: translate(-5px, 3px) rotate(-5deg); } }
@keyframes writeIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

@media (max-width: 860px) {
  .scene { grid-template-columns: 1fr; }
  .pane { min-height: 58vh; padding: 76px 24px; }
  .canonical, .margin { clip-path: none; justify-content: center; }
  .seam, .index-tabs { left: auto; right: 12px; transform: translateY(-50%); }
  .index-tabs { align-items: flex-end; }
  .tab, .tab:nth-child(even) { transform: none; direction: ltr; }
  .scene::before { left: 18px; }
  h1 { font-size: clamp(58px, 19vw, 108px); }
  .glass { width: 100%; }
}
