:root {
  /* compliance tokens from DESIGN.md parser: Mon* Mono** Google Fonts */
  --navy: #102033;
  --cream: #FFF4D8;
  --teal: #38E8C6;
  --mint: #B8F7D4;
  --violet: #8B5CF6;
  --ochre: #D9A441;
  --coral: #FF6B6B;
  --display: "Nunito Sans", "Avenir Next Rounded Std", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Rubik", "Trebuchet MS", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--body);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(16, 32, 51, 0.06) 0 1px, transparent 1.6px),
    linear-gradient(90deg, rgba(16, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 28px 28px, 12.5vw 100%;
  z-index: 0;
}

.aurora {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  filter: blur(3px);
  opacity: 0.42;
  mix-blend-mode: multiply;
}

.aurora-one {
  width: 78vw;
  height: 34vh;
  right: -18vw;
  top: 5vh;
  background: linear-gradient(135deg, #38E8C6 0%, #8B5CF6 52%, #FF6B6B 100%);
  border-radius: 55% 45% 60% 40%;
  transform: rotate(-12deg);
  animation: driftOne 18s ease-in-out infinite alternate;
}

.aurora-two {
  width: 58vw;
  height: 24vh;
  left: -18vw;
  bottom: 6vh;
  background: linear-gradient(135deg, #38E8C6 0%, #8B5CF6 52%, #FF6B6B 100%);
  border-radius: 42% 58% 44% 56%;
  opacity: 0.25;
  transform: rotate(13deg);
  animation: driftTwo 22s ease-in-out infinite alternate;
}

@keyframes driftOne { to { transform: translate3d(-4vw, 2vh, 0) rotate(-9deg) scale(1.05); } }
@keyframes driftTwo { to { transform: translate3d(5vw, -3vh, 0) rotate(10deg) scale(1.08); } }

.lesson-ruler {
  position: fixed;
  left: clamp(18px, 2.2vw, 34px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px 9px;
  border: 3px solid var(--navy);
  border-radius: 999px;
  background: rgba(255, 244, 216, 0.74);
  box-shadow: 8px 8px 0 rgba(16, 32, 51, 0.12);
}

.ruler-title {
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--ochre);
}

.chapter-dot {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--navy);
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  font-family: var(--mono);
  font-size: 9px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.chapter-dot.active, .chapter-dot:hover {
  background: var(--teal);
  transform: scale(1.22);
  box-shadow: 0 0 0 7px rgba(56, 232, 198, 0.22);
}

.lesson-plate {
  position: relative;
  min-height: 100vh;
  scroll-snap-align: start;
  overflow: hidden;
  padding: clamp(48px, 7vw, 100px) clamp(48px, 9vw, 140px);
  background:
    radial-gradient(circle at 72% 22%, rgba(56, 232, 198, 0.20), transparent 30%),
    radial-gradient(circle at 84% 65%, rgba(139, 92, 246, 0.12), transparent 34%),
    var(--cream);
}

.lesson-plate::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 2px dashed rgba(16, 32, 51, 0.13);
  border-radius: 34px;
  pointer-events: none;
}

.intro .film-edge {
  position: absolute;
  right: 0;
  top: 0;
  width: 38px;
  height: 100%;
  background: repeating-linear-gradient(to bottom, var(--navy) 0 16px, transparent 16px 32px);
  opacity: 0.13;
}

.wordmark-block {
  position: absolute;
  left: clamp(80px, 10vw, 150px);
  bottom: clamp(70px, 11vh, 130px);
  z-index: 3;
  width: min(720px, 70vw);
}

.manual-kicker, .stamp, .diagram-label, .index-tab, .notebook-link {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.manual-kicker {
  display: inline-block;
  padding: 8px 12px;
  margin-bottom: 18px;
  background: var(--ochre);
  border: 2px solid var(--navy);
  border-radius: 12px 12px 12px 3px;
  box-shadow: 5px 5px 0 rgba(16, 32, 51, 0.14);
  font-size: 12px;
}

h1, h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

h1 {
  font-size: clamp(70px, 14vw, 184px);
}

h2 {
  font-size: clamp(46px, 7.6vw, 112px);
  max-width: 920px;
}

p {
  margin: 22px 0 0;
  max-width: 560px;
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.5;
}

.annotation-line {
  position: absolute;
  inset: 6vh 6vw;
  width: 88vw;
  height: 72vh;
  z-index: 2;
  pointer-events: none;
}

.annotation-line path {
  fill: none;
  stroke: var(--coral);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 3 18;
  stroke-dashoffset: 600;
  animation: drawDots 1600ms ease forwards 300ms;
}

@keyframes drawDots { to { stroke-dashoffset: 0; } }

.stamp {
  display: inline-block;
  padding: 10px 14px;
  border: 2px solid var(--navy);
  border-radius: 14px;
  background: var(--cream);
  color: var(--navy);
  box-shadow: 5px 5px 0 rgba(255, 107, 107, 0.45);
  font-size: 12px;
}

.intro-stamp {
  position: absolute;
  left: clamp(160px, 21vw, 360px);
  bottom: clamp(48px, 7vh, 78px);
  opacity: 0;
  transform: rotate(-1deg) translateY(10px);
  animation: stampIn 520ms ease forwards 1750ms;
  z-index: 4;
}

@keyframes stampIn { to { opacity: 1; transform: rotate(-1deg) translateY(0); } }

.tilted { transform: rotate(-1.5deg); margin-bottom: 22px; }
.reverse { transform: rotate(1.5deg); }

.chapter-copy {
  position: relative;
  z-index: 4;
  margin-left: clamp(46px, 8vw, 110px);
  margin-top: clamp(28px, 7vh, 90px);
}

.right-copy {
  margin-left: auto;
  margin-right: clamp(20px, 8vw, 120px);
  width: min(760px, 58vw);
  padding-top: 18vh;
}

.archive-copy {
  margin-left: auto;
  margin-right: clamp(20px, 9vw, 140px);
  padding-top: 18vh;
  width: min(740px, 58vw);
}

.iso-object {
  position: absolute;
  z-index: 5;
  transform-style: preserve-3d;
  transition: transform 220ms ease, filter 220ms ease;
}

.hover-pop:hover, .hover-pop.is-near {
  transform: translateY(-10px) scale(1.08) rotate(-1deg);
  filter: drop-shadow(14px 18px 0 rgba(16, 32, 51, 0.13));
}

.lesson-kit { right: 10vw; top: 12vh; width: 250px; height: 220px; }
.iso-stack, .tiny-terminal, .paper-note, .cassette-face, .manual-cover, .box-front, .box-lid, .floppy {
  border: 4px solid var(--navy);
  box-shadow: 12px 12px 0 rgba(16, 32, 51, 0.12);
}

.iso-stack {
  position: absolute;
  width: 170px;
  height: 70px;
  border-radius: 22px;
  transform: skewY(-14deg) rotate(2deg);
}
.iso-stack.top { right: 20px; top: 6px; background: var(--mint); }
.iso-stack.middle { right: 44px; top: 62px; background: var(--teal); }
.iso-stack.base { right: 70px; top: 118px; background: var(--violet); }

.tiny-terminal {
  position: absolute;
  right: 90px;
  top: 38px;
  width: 102px;
  height: 72px;
  border-radius: 14px;
  background: var(--navy);
  padding: 17px 13px;
}
.tiny-terminal span { display: block; height: 6px; margin: 5px 0; border-radius: 4px; background: var(--teal); }
.tab { position: absolute; right: 10px; top: 112px; padding: 8px 13px; border: 3px solid var(--navy); border-radius: 12px 12px 2px 12px; background: var(--coral); font-family: var(--mono); font-size: 11px; transform: rotate(7deg); }

.magnifier { right: 14vw; bottom: 14vh; width: 330px; height: 280px; }
.lens { position: absolute; width: 150px; height: 150px; border: 18px solid var(--teal); border-radius: 50%; background: rgba(255, 244, 216, 0.5); box-shadow: inset 0 0 0 4px var(--navy), 12px 12px 0 rgba(16,32,51,.12); }
.handle { position: absolute; width: 150px; height: 32px; left: 118px; top: 132px; border: 4px solid var(--navy); border-radius: 20px; background: var(--ochre); transform: rotate(38deg); }
.paper-note { position: absolute; right: 0; bottom: 0; width: 160px; padding: 18px; border-radius: 20px; background: var(--cream); transform: rotate(-4deg); }
.paper-note span { display: block; margin: 9px 0; padding: 6px 8px; border-radius: 8px; background: var(--mint); font-family: var(--mono); font-size: 11px; }

.diagram-label {
  position: absolute;
  z-index: 6;
  padding: 9px 12px;
  border: 2px solid var(--navy);
  border-radius: 12px;
  background: rgba(255, 244, 216, 0.82);
  font-size: 11px;
  transition: transform 200ms ease, background 200ms ease;
}
.diagram-label:hover { transform: scale(1.08); background: var(--mint); }
.label-a { right: 34vw; top: 34vh; }
.label-b { right: 9vw; bottom: 46vh; }
.label-c { left: 14vw; bottom: 24vh; }
.label-d { right: 14vw; top: 22vh; }

.index-tab {
  position: absolute;
  right: -8px;
  top: 28vh;
  padding: 18px 28px;
  border: 3px solid var(--navy);
  border-right: 0;
  border-radius: 18px 0 0 18px;
  background: var(--coral);
}

.cassette { left: 11vw; top: 20vh; width: 360px; height: 250px; }
.cassette-face { position: absolute; inset: 30px 10px 25px 5px; border-radius: 34px; background: var(--mint); transform: skewY(-9deg); }
.cassette-face i { position: absolute; top: 55px; width: 72px; height: 72px; border: 12px solid var(--navy); border-radius: 50%; background: var(--cream); }
.cassette-face i:first-child { left: 58px; } .cassette-face i:nth-child(2) { right: 58px; }
.cassette-face code { position: absolute; left: 62px; bottom: 32px; padding: 8px 14px; border-radius: 10px; background: var(--navy); color: var(--teal); font-family: var(--mono); }
.cassette-side { position: absolute; right: -24px; top: 58px; width: 60px; height: 160px; border: 4px solid var(--navy); border-radius: 18px; background: var(--violet); transform: skewY(31deg); }
.plug-wire { position: absolute; left: 280px; top: 12px; width: 130px; height: 92px; border-top: 6px dotted var(--coral); border-right: 6px dotted var(--coral); border-radius: 0 50px 0 0; }

.ruler-strip { position: absolute; left: 9vw; bottom: 13vh; width: 420px; height: 48px; border: 3px solid var(--navy); border-radius: 12px; background: var(--ochre); display: flex; justify-content: space-around; padding-top: 8px; transform: rotate(-3deg); }
.ruler-strip span { width: 3px; height: 30px; background: var(--navy); }

.manual { right: 12vw; bottom: 12vh; width: 330px; height: 310px; }
.manual-cover { position: absolute; inset: 15px 20px 40px 0; border-radius: 28px; background: var(--coral); padding: 36px 28px; transform: skewY(-10deg); }
.manual-cover strong { display: block; font-family: var(--display); font-size: 34px; }
.manual-cover code { display: inline-block; margin-top: 50px; padding: 8px 10px; border-radius: 9px; background: var(--navy); color: var(--mint); font-family: var(--mono); font-size: 13px; }
.manual-pages { position: absolute; left: 38px; bottom: 20px; width: 240px; height: 58px; border-radius: 12px; background: repeating-linear-gradient(to bottom, var(--cream) 0 8px, #f2dfac 8px 11px); }
.arrow-chip { position: absolute; right: 6px; top: 48px; padding: 9px 13px; border: 3px solid var(--navy); border-radius: 12px; background: var(--teal); font-family: var(--mono); transform: rotate(5deg); }
.acetate-card { position: absolute; left: 16vw; bottom: 15vh; width: 320px; padding: 32px; border: 3px solid var(--violet); border-radius: 22px; background: rgba(56, 232, 198, 0.22); font-family: var(--mono); color: var(--navy); transform: rotate(2deg); }

.archive-box { left: 13vw; top: 19vh; width: 380px; height: 330px; }
.box-lid { position: absolute; left: 24px; top: 0; width: 300px; height: 80px; border-radius: 22px; background: var(--ochre); transform: skewX(-28deg); }
.box-front { position: absolute; left: 0; top: 70px; width: 340px; height: 190px; padding: 44px 34px; border-radius: 26px; background: var(--mint); }
.box-front b { display: block; font-family: var(--display); font-size: 48px; }
.box-front span { font-family: var(--mono); font-size: 12px; }
.floppy { position: absolute; right: 0; bottom: 0; width: 130px; height: 130px; border-radius: 18px; background: var(--violet); }
.floppy::before { content: ""; position: absolute; left: 22px; top: 16px; width: 66px; height: 34px; border: 3px solid var(--navy); background: var(--cream); }

.notebook-link { display: inline-block; margin-top: 28px; padding: 15px 19px; border: 3px solid var(--navy); border-radius: 18px; background: var(--teal); color: var(--navy); text-decoration: none; box-shadow: 7px 7px 0 rgba(16,32,51,.15); transition: transform 180ms ease; }
.notebook-link:hover { transform: scale(1.05) rotate(-1deg); }
.punch-card { position: absolute; right: 10vw; bottom: 10vh; display: flex; gap: 13px; padding: 20px; border: 3px solid var(--navy); border-radius: 20px; background: var(--cream); transform: rotate(4deg); }
.punch-card span { width: 18px; height: 18px; border-radius: 50%; background: var(--coral); border: 2px solid var(--navy); }

.lesson-plate.in-view .chapter-copy { animation: plateAdvance 650ms ease both; }
.lesson-plate.in-view .stamp.tilted { animation: littleRotate 900ms ease both; }
@keyframes plateAdvance { from { opacity: .45; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes littleRotate { 50% { rotate: 2deg; } }

@media (max-width: 760px) {
  .lesson-ruler { left: 10px; transform: translateY(-50%) scale(.82); }
  .lesson-plate { padding: 58px 30px 58px 64px; }
  .wordmark-block { left: 64px; width: calc(100vw - 90px); }
  .lesson-kit, .magnifier, .cassette, .manual, .archive-box { transform: scale(.68); transform-origin: top right; right: 2vw; left: auto; top: 8vh; bottom: auto; }
  .chapter-copy, .right-copy, .archive-copy { margin: 44vh 0 0; width: auto; }
  .diagram-label, .ruler-strip, .acetate-card, .punch-card { display: none; }
}
