/* ------------------------------
  GLOBAL / LAYOUT TOKENS
--------------------------------- */
:root {
  /* layout */
  --container-max: 980px;

  /* chapter layout */
  --chapter-gap: var(--space-16);
  --chapter-row-1: 280px;
  --chapter-row-2: 160px;
  --chapter-row-3: 360px;

  /* borders */
  --border-width: 2px;

  /* section spacing */
  --section-space-y: 160px;
  --hero-to-ch1-space: 48px;
}

/* ----- baseline ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body,
main {
  margin: 0;
  padding: 0;
  background: var(--surface-primary);
}

html,
body {
  overflow-x: hidden;
}

main {
  width: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text-primary);
}

/* headings reset */
.section__content h1,
.section__content h2,
.section__content h4,
.section__content p {
  margin: 0;
}

.section__content {
  max-width: var(--container-max, 980px);
  margin: 0 auto;
  padding: var(--space-32) var(--space-24);
}

/* ==============================
   SECTION SPACING SYSTEM
   ============================== */

/* IMPORTANT:
   We are no longer spacing sections with margin-top.
   That caused visible gaps, especially with pinned transitions.
   Use internal padding instead, and let JS pin/space sections later.
*/
.section--chapter {
  margin-top: 0;
  padding-top: var(--section-space-y);
}

/* Hero → Chapter 1 should still be tighter */
#chapter-1 {
  padding-top: var(--hero-to-ch1-space);
}

/* Let pinned sections/spacers inherit the section background cleanly */
.pin-spacer {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent;
}

.pin-spacer:has(> #chapter-5-blackout) {
  background: var(--chapter-transition-gray) !important;
}

/* Base panel look */
.section--chapter .panel {
  border: var(--border-width) solid var(--text-primary);
  background: var(--surface-primary);
  padding: var(--space-32);

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;

  transition: border-color 0.35s ease;
}

/* Base typography */
.section--chapter h2 {
  font-size: clamp(28px, 3.2vw, 44px);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  line-height: 1.05;
  color: var(--text-primary);
}

.section--chapter h4 {
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

.section--chapter p {
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
}
.section--hero p {
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0;
}

.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;
}

.skip-link {
  position: fixed;
  top: var(--space-8);
  left: var(--space-8);
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 2px solid var(--text-primary);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

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

a:focus-visible,
button:focus-visible,
select:focus-visible,
[role="button"]:focus-visible {
  outline: 3px solid var(--accent-secondary);
  outline-offset: 3px;
}

.theme-mode-control {
  position: fixed;
  top: var(--space-16);
  right: var(--space-16);
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: var(--space-10, 10px);
  padding: 7px 9px;
  border: 1px solid var(--text-primary);
  border-radius: 999px;
  background: var(--surface-primary);
  background: color-mix(in srgb, var(--surface-primary) 90%, transparent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}

.theme-mode-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #0b0b0d;
  background: #f3f4f6;
  display: grid;
  place-items: center;
  color: #0b0b0d;
  flex: 0 0 auto;
  overflow: visible;
}

.theme-mode-icon[data-mode="dark"] {
  background: #f4f4f4;
  border-color: #0b0b0d;
}

.theme-mode-icon[data-mode="light"] {
  background: #ffffff;
  border-color: #0b0b0d;
}

.theme-mode-icon[data-mode="system"] {
  background: #0b0b0d;
  border-color: #fffdeb;
}

.theme-mode-icon svg {
  width: 22px;
  height: 22px;
  display: block;
  overflow: visible;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-bomb-fill {
  fill: #0b0b0d;
}

.theme-mode-icon .theme-bomb-wick {
  stroke: #fffdeb;
  stroke-width: 2.2;
  fill: none;
  stroke-linecap: round;
}

.theme-mode-icon .theme-bomb-spark {
  fill: #ff6b35;
}

.theme-mode-icon .theme-bomb-follow-line {
  fill: none;
  stroke: #0b0b0d;
  stroke-width: 1.0;
  stroke-linecap: round;
  opacity: 0;
}

.theme-mode-icon .theme-pow-shape {
  fill: #ff6b35;
  stroke: none;
  shape-rendering: geometricPrecision;
}

.theme-mode-icon .theme-pow-action {
  stroke: #0b0b0d;
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-pow-cloud {
  fill: #d9dde3;
  stroke: #bec5cf;
  stroke-width: 0.38;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-wick-only {
  stroke: #fffdeb;
  stroke-width: 2.6;
  fill: none;
  stroke-linecap: round;
}

.theme-mode-icon .theme-wick-flame {
  transform-box: fill-box;
  transform-origin: 50% 70%;
}

.theme-mode-icon .theme-wick-flame--outer {
  fill: #ff6b35;
}

.theme-mode-icon .theme-wick-flame--inner {
  fill: #ffd166;
}

.theme-mode-icon .theme-wick-ash-trail {
  fill: none;
  stroke: #5c626d;
  stroke-width: 2.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-wick-ash-bit {
  fill: #6b7280;
  stroke: #2f3540;
  stroke-width: 0.18;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-wick-alert {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-wick-alert line {
  stroke: #ef4444;
  stroke-width: 1.14;
  stroke-linecap: round;
}

.theme-mode-icon .theme-wick-alert circle {
  fill: #ef4444;
}

.theme-mode-icon .theme-wick-action {
  stroke: #fffdeb;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-icon .theme-wick-flash {
  fill: none;
  stroke: #ffd166;
  stroke-width: 1.4;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 50%;
}

.theme-mode-select {
  appearance: none;
  border: 1px solid var(--text-primary);
  border-radius: 999px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 12px;
  cursor: pointer;
}

#scroll-to-top-btn {
  position: fixed;
  left: 50%;
  bottom: var(--space-24);
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 1101;
  opacity: 0;
  pointer-events: none;
}

#scroll-to-top-btn .scroll-to-top-icon {
  width: 38px;
  height: 38px;
  display: block;
  margin: 0 auto;
}

#scroll-to-top-btn .scroll-to-top-icon path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#scroll-up-lines {
  position: fixed;
  inset: 0;
  z-index: 1190;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
}

#scroll-up-lines .scroll-up-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 260px;
  border-radius: 999px;
  opacity: 0;
  filter: saturate(1.2);
  will-change: transform, opacity;
}

/* ==============================
   CHAPTER 1 — layout
   ============================== */

#chapter-1 .section__content {
  display: grid;
  gap: var(--chapter-gap);

  grid-template-columns: 2fr 2fr 1.5fr;
  grid-template-rows: var(--chapter-row-1) var(--chapter-row-2) var(--chapter-row-3);

  grid-template-areas:
    "big big web1"
    "big big web2"
    "story code css";
}

#chapter-1 .panel:nth-child(1) { grid-area: big; }
#chapter-1 .panel:nth-child(2) { grid-area: web1; }
#chapter-1 .panel:nth-child(3) { grid-area: web2; }
#chapter-1 .panel:nth-child(4) { grid-area: code; }
#chapter-1 .panel:nth-child(5) { grid-area: css; }
#chapter-1 .panel:nth-child(6) { grid-area: story; }

/* clicked color states */
#chapter-1 .panel.is-open:nth-child(1),
#chapter-1 .panel.is-open:nth-child(6) {
  border-color: var(--accent-primary);
}

#chapter-1 .panel.is-open:nth-child(2),
#chapter-1 .panel.is-open:nth-child(4) {
  border-color: var(--accent-secondary);
}

#chapter-1 .panel.is-open:nth-child(3),
#chapter-1 .panel.is-open:nth-child(5) {
  border-color: var(--accent-highlight);
}

#chapter-1 .panel {
  position: relative;
  cursor: pointer;
  transform-origin: 50% 50%;
  will-change: transform, opacity, background-color;
}

#chapter-1 .panel.is-ghost {
  background: transparent;
}

#chapter-1 .panel.is-open {
  cursor: default;
}

#chapter-1 .panel.is-ghost:hover {
  scale: 1;
  border-color: var(--text-primary);
}

/* ==============================
   CHAPTER 2 LAYOUT (GRID)
   ============================== */

#chapter-2 {
  position: relative;
  overflow: hidden;
  background: var(--surface-primary);
}

#chapter-2 .section__content {
  --gap: var(--space-16);
  --row-title: clamp(110px, 12vw, 150px);
  --row-two: clamp(160px, 18vw, 220px);
  --row-three: clamp(220px, 24vw, 320px);
  --row-bottom: clamp(240px, 28vw, 380px);

  position: relative;
  display: grid;
  gap: var(--gap);

  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: var(--row-title) var(--row-two) var(--row-three) var(--row-bottom);

  /* bomb lives in internal bottom space, not in a fake gap between sections */
  padding-bottom: 320px;
}

/* Panel 1 */
#chapter-2 .panel:nth-child(1) {
  grid-column: 1 / -1;
  grid-row: 1;
}

#chapter-2 .panel:nth-child(1):hover {
  transform: translate(8px);
  transition-duration: 0.7s;
}

/* Panel 2 + 3 */
#chapter-2 .panel:nth-child(2) {
  grid-column: 1 / 7;
  grid-row: 2;
}

#chapter-2 .panel:nth-child(3) {
  grid-column: 7 / -1;
  grid-row: 2;
}

#chapter-2 .panel:nth-child(2):hover,
#chapter-2 .panel:nth-child(3):hover {
  transform: translate(-8px);
  transition-duration: 0.7s;
}

/* Panels 4 + 5 + 6 */
#chapter-2 .panel:nth-child(4) {
  grid-column: 1 / 5;
  grid-row: 3;
}

#chapter-2 .panel:nth-child(5) {
  grid-column: 5 / 9;
  grid-row: 3;
}

#chapter-2 .panel:nth-child(6) {
  grid-column: 9 / -1;
  grid-row: 3;
}

#chapter-2 .panel:nth-child(4):hover,
#chapter-2 .panel:nth-child(5):hover,
#chapter-2 .panel:nth-child(6):hover {
  transform: translate(8px);
  transition-duration: 0.7s;
}

/* Big bottom panel */
#chapter-2 .panel:nth-child(8) {
  grid-column: 1 / -1;
  grid-row: 4;

  display: flex;
  align-items: center;
  justify-content: space-evenly;
  text-align: center;
  gap: var(--space-24);
}

#chapter-2 .panel:nth-child(8):hover {
  scale: 1.02;
  transition-duration: 0.7s;
}

/* Arrow */
#chapter-2 #arrow {
  grid-column: 1 / 4;
  grid-row: 4;
  align-self: start;
  justify-self: start;
  transform: translateY(calc(-1 * var(--space-32)));
  z-index: 5;
  pointer-events: none;
}

#chapter-2 #arrow svg {
  width: clamp(90px, 10vw, 140px);
  height: auto;
  rotate: 30deg;
}

/* Chapter 2 FX */
#chapter-2 .ch2-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

#chapter-2 #ch2-bomb {
  position: absolute;
  left: 0;
  bottom: 80px;
  width: 120px;
  transform-origin: 50% 50%;
  z-index: 41;
}

#chapter-2 #ch2-boom {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 50% 50%;
  z-index: 42;
}

#chapter-2 #ch2-wipe {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
}

#chapter-2 .wick { stroke: #fffdeb; stroke-linecap: round; }
#chapter-2 .bomb-body { fill: #0b0b0d; }
#chapter-2 .bomb-cap { fill: #0b0b0d; }
#chapter-2 .bomb-wick { stroke-width: 2.2; fill: none; }
#chapter-2 .bomb-spark { fill: #ff6b35; }

#chapter-2 .boom-letter {
  font-size: 530px;
  font-weight: 900;
  fill: #fff;
  letter-spacing: 2px;
}

/* ==============================
   CHAPTER 3 — THE STRUGGLE BEGINS
   ============================== */

#chapter-3 {
  background: var(--neutrals__neutral80);
  padding: 0;
  position: relative; /* For absolutely positioned parallax icons */
  overflow: hidden;   /* Keep icons inside chapter */
}

/* ===============================
   PARALLAX ICONS
   =============================== */
.parallax-icons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.p-icon {
  position: absolute;
  color: var(--neutrals__neutral100);
  opacity: 0.15;
}

/* Give them random starting coordinates */
.p-icon-1 { top: -10%; left: 5%; width: 64px; height: 64px; }
.p-icon-2 { top: 20%; left: 85%; width: 90px; height: 90px; }
.p-icon-3 { top: 45%; left: 12%; width: 72px; height: 72px; }
.p-icon-4 { top: 60%; left: 75%; width: 100px; height: 100px; }
.p-icon-5 { top: 80%; left: 20%; width: 50px; height: 50px; }
.p-icon-6 { top: -5%; left: 60%; width: 80px; height: 80px; }
.p-icon-7 { top: 35%; left: 45%; width: 60px; height: 60px; }
.p-icon-8 { top: 85%; left: 55%; width: 120px; height: 120px; }
.p-icon-9 { top: 10%; left: 30%; width: 70px; height: 70px; }
.p-icon-10 { top: 50%; left: 90%; width: 85px; height: 85px; }

/* Ensure section content stays above parallax */
#chapter-3 .section__content {
  position: relative;
  z-index: 1;
  --gap: var(--space-24);

  max-width: var(--container-max, 980px);
  margin: 0 auto;
  padding: var(--space-32) var(--space-24) var(--space-48);

  display: grid;
  gap: var(--gap);

  grid-template-columns: repeat(12, 1fr);

  grid-template-rows:
    clamp(120px, 14vw, 170px)
    clamp(260px, 32vw, 360px)
    clamp(240px, 30vw, 360px)
    auto;
}

#chapter-3 .panel {
  border: var(--border-width, 2px) solid var(--text-primary);
  background: var(--surface-primary);
  padding: var(--space-32);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#chapter-3 .panel:nth-child(1) {
  grid-column: 2 / 12;
  grid-row: 1;
  transform: rotate(-6deg);
  transform-origin: center;
  align-self: center;
  justify-self: stretch;
  margin-bottom: var(--space-64);
}

#chapter-3 .panel:nth-child(1) h2 {
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

#chapter-3 .panel:nth-child(1):hover {
  transform: rotate(8deg);
  transition-duration: 0.7s;
}

#chapter-3 #caption-panel {
  grid-column: 1 / 5;
  grid-row: 2;
  justify-self: start;
  align-self: start;
  transform: rotate(-15deg);
  transform-origin: center;
  width: 100%;
  min-height: clamp(220px, 30vw, 340px);
  text-align: left;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: var(--space-12);
}

#chapter-3 #caption-panel p {
  width: 100%;
}

#chapter-3 #caption-panel .ch3-scream-shell {
  position: relative;
  width: 100%;
  height: clamp(138px, 16vw, 188px);
  border: var(--border-width, 2px) solid var(--text-primary);
  background: #d8cfbf;
  overflow: hidden;
  transform-origin: 50% 85%;
  will-change: transform;
}

#chapter-3 #caption-panel .ch3-scream-figure {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 58%;
  display: block;
}

#chapter-3 #caption-panel .ch3-scream-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
}

#chapter-3 #caption-panel .ch3-scream-shell.is-fallback .ch3-scream-figure {
  display: none;
}

#chapter-3 #caption-panel .ch3-scream-shell.is-fallback .ch3-scream-fallback {
  display: block;
}

#chapter-3 #caption-panel:hover {
  transform: rotate(12deg);
  transition-duration: 0.7s;
}

#chapter-3 .panel:nth-child(3) {
  grid-column: 5 / 9;
  grid-row: 2;
  justify-self: center;
  align-self: center;
  transform: rotate(6deg);
  width: 100%;
  min-height: clamp(220px, 28vw, 320px);
}

#chapter-3 .panel:nth-child(3):hover {
  transform: rotate(-12deg);
  transition-duration: 0.7s;
}

#chapter-3 .panel:nth-child(4) {
  grid-column: 9 / 13;
  grid-row: 2;
  justify-self: end;
  align-self: center;
  transform: rotate(18deg);
  width: 100%;
  min-height: clamp(220px, 28vw, 320px);
}

#chapter-3 .panel:nth-child(4):hover {
  transform: rotate(-15deg);
  transition-duration: 0.7s;
}

/* ---------------------------------
   5) BIG QUESTIONS PANEL (panel 5) - SPLIT PANEL
---------------------------------- */
#chapter-3 .panel.split-panel-container {
  grid-column: 2 / 12;
  grid-row: 3;
  margin-top: var(--space-64);
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  position: relative;
  /* questions spaced like your mock */
}

/* The left and right halves that look like one continuous panel */
.panel-half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--surface-primary);
  border: var(--border-width, 2px) solid var(--text-primary);
  z-index: 1;
}
.left-half {
  left: 0;
  border-right: none;
}
.right-half {
  right: 0;
  border-left: none;
}

.split-panel-container .panel-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: var(--space-32);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  text-align: center;
  gap: var(--space-24);
}

/* Place the 3 h4s roughly like the screenshot */
.split-panel-container .panel-content h4:nth-child(1){
  justify-self: start;
  align-self: end;
}
.split-panel-container .panel-content h4:nth-child(2){
  justify-self: center;
  align-self: start;
}
.split-panel-container .panel-content h4:nth-child(3){
  justify-self: end;
  align-self: center;
}

/* ---------------------------------
   6) REVEAL TEXT ( #text-reveal )
---------------------------------- */
#chapter-3 #text-reveal{
  grid-column: 2 / 12;
  grid-row: 4;
  margin-top: var(--space-48);
  text-align: center;
  position: relative;
  /* GSAP will scale this up */
  transform-origin: center center;
}

#chapter-3 #text-reveal h2 {
  color: var(--neutrals__neutral0);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.05;
  font-size: clamp(32px, 4.8vw, 56px);
  letter-spacing: -0.02em;
}

#chapter-3 #text-reveal:hover {
  transform: rotate(-5deg);
  transition-duration: 0.7s;
}

/* ==============================
   CHAPTER 3 — icon rain + split panel
   ============================== */

#chapter-3{
  position: relative;
  overflow: hidden;
}

#chapter-3 .ch3-icon-rain{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#chapter-3 .ch3-float-icon{
  position: absolute;
  color: var(--neutrals__neutral0);
  opacity: 0.16;
}

#chapter-3 .ch3-float-icon svg{
  width: 72px;
  height: 72px;
  stroke-width: 2.25;
}

#chapter-3 .section__content,
#chapter-3 .panel,
#chapter-3 #text-reveal{
  position: relative;
  z-index: 2;
}

#chapter-3 .panel:nth-child(5){
  overflow: visible;
  position: relative;
  isolation: isolate;
  z-index: 6;
}

#chapter-3 .ch3-splitter{
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

#chapter-3 .ch3-split-half{
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: var(--surface-primary);
  border: var(--border-width) solid var(--text-primary);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chapter-3 .ch3-split-half .panel {
  position: absolute;
  width: 200%;
  height: 100%;
  margin: 0;
  background: var(--surface-primary);
  border: none;
  padding: 0;
  inset: 0;
}

#chapter-3 .ch3-split-left{
  left: 0;
  transform: translateX(0%);
  border-right: 1px solid var(--neutrals__neutral100);
}

#chapter-3 .ch3-split-left .panel {
  left: 0;
}

#chapter-3 .ch3-split-right{
  right: 0;
  transform: translateX(0%);
  border-left: 1px solid var(--neutrals__neutral100);
}

#chapter-3 .ch3-split-right .panel {
  right: 0;
}


/* ==============================
   CHAPTER 4 — SYSTEMS HAVE MEMORY
   ============================== */

#chapter-4 {
  background: var(--surface-primary);
  position: relative;
}

#chapter-4 .section__content {
  --gap: var(--space-24);

  display: grid;
  gap: var(--gap);

  grid-template-columns: repeat(12, 1fr);
  grid-template-rows:
    clamp(110px, 12vw, 150px)
    clamp(150px, 18vw, 210px)
    clamp(150px, 18vw, 210px)
    clamp(190px, 22vw, 260px)
    clamp(190px, 22vw, 260px)
    minmax(120vh, 120vh);
}

#chapter-4 .panel:nth-child(1) {
  grid-column: 2 / 12;
  grid-row: 1;
}

#chapter-4 .panel:nth-child(1):hover {
  transform: translateY(-4px);
  transition-duration: 0.4s;
}

#chapter-4 .panel:nth-child(2) {
  grid-column: 1 / 5;
  grid-row: 2;
  justify-self: start;
  align-self: start;
}

#chapter-4 .panel:nth-child(2):hover {
  transform: translateY(4px);
  transition-duration: 0.4s;
}

#chapter-4 .panel:nth-child(3) {
  grid-column: 4 / 8;
  grid-row: 3;
  justify-self: center;
  align-self: start;
}

#chapter-4 .panel:nth-child(3):hover {
  transform: translateY(-4px);
  transition-duration: 0.4s;
}

#chapter-4 .panel:nth-child(4) {
  grid-column: 7 / 12;
  grid-row: 4;
  justify-self: end;
  align-self: start;
  width: 450px;
}

#chapter-4 .panel:nth-child(4):hover {
  transform: translateY(-4px);
  transition-duration: 0.4s;
}

#chapter-4 .panel:nth-child(7) {
  grid-column: 3 / 11;
  grid-row: 5;
  align-self: center;
  min-height: clamp(170px, 19vw, 230px);
  margin-top: var(--space-64);
  margin-bottom: var(--space-64);
}

#chapter-4 .panel:nth-child(7):hover {
  transform: translateY(-4px);
  transition-duration: 0.5s;
}

#chapter-4 #full-view-panel {
  grid-column: 3 / 11;
  grid-row: 6;
  align-self: center;
  position: relative;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  border-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: clamp(320px, 42vh, 520px);
  padding: clamp(var(--space-32), 4.2vw, var(--space-64));
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  isolation: isolate;
  background: var(--surface-primary);
}

#chapter-4 .section__content > :not(#full-view-panel) {
  transition: opacity 0.2s linear;
}

#chapter-4 #full-view-panel:hover {
  transition-duration: 0.35s;
}

#chapter-4 .ch4-panel-outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

#chapter-4 .ch4-border-line {
  position: absolute;
  background: var(--text-primary);
  opacity: 1;
}

#chapter-4 .ch4-border-line--top {
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  transform-origin: 0% 50%;
}

#chapter-4 .ch4-border-line--right {
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  transform-origin: 50% 0%;
}

#chapter-4 .ch4-border-line--bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  transform-origin: 0% 50%;
}

#chapter-4 .ch4-border-line--left {
  top: 0;
  left: 0;
  width: 2px;
  height: 100%;
  transform-origin: 50% 0%;
}

#chapter-4 .ch4-fireworks {
  position: fixed;
  inset: 0;
  z-index: 70;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

#chapter-4 .ch4-firework-spark {
  position: absolute;
  width: clamp(14px, 2vw, 24px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  filter: saturate(1.2);
}

#chapter-4 .ch4-final-text {
  position: relative;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-12);
  width: 100%;
}

#chapter-4 .ch4-final-text .type-line {
  display: block;
  min-height: 1.2em;
  white-space: nowrap;
}

#chapter-4 .ch4-final-text .type-line--second {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.34ch;
}

#chapter-4 .ch4-final-text .type-everything {
  display: inline-block;
  font-weight: 900;
  transform-origin: 50% 70%;
  color: inherit;
}

#chapter-4 .panel:nth-child(2),
#chapter-4 .panel:nth-child(3),
#chapter-4 .panel:nth-child(4) {
  min-height: 280px;
  padding: var(--space-32);
}

#chapter-4 {
  --overlap-x: 18px;
  --overlap-y: -22px;
}

#chapter-4 .panel:nth-child(2) {
  transform: translate(var(--overlap-x), 0);
  z-index: 1;
}

#chapter-4 .panel:nth-child(3) {
  transform: translate(calc(var(--overlap-x) * 2), var(--overlap-y));
  z-index: 2;
}

#chapter-4 .panel:nth-child(4) {
  transform: translate(calc(var(--overlap-x) * 3), calc(var(--overlap-y) * 2));
  z-index: 3;
}

#chapter-4 .character-light {
  grid-column: 8 / 12;
  grid-row: 2;
  justify-self: end;
  align-self: start;
}

#chapter-4 .character-dark {
  grid-column: 1 / 5;
  grid-row: 4;
  justify-self: start;
  align-self: start;
}

#chapter-4 .character-portal {
  position: relative;
  width: clamp(170px, 20vw, 240px);
  height: clamp(210px, 26vw, 300px);
  z-index: 4;
}

#chapter-4 .portal-button {
  all: unset;
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#chapter-4 .portal-button:focus-visible {
  outline: 2px dashed var(--text-primary);
  outline-offset: 4px;
}

#chapter-4 .character-portal.is-inactive .portal-button {
  cursor: default;
}

#chapter-4 .portal-hole {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 76%;
  height: 28px;
  transform: translateX(-50%) scale(0.74, 0.68);
  transform-origin: 50% 50%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.92) 62%, rgba(0, 0, 0, 0.96) 100%);
  opacity: 0;
  pointer-events: none;
}

#chapter-4 .stick-figure {
  position: absolute;
  left: 50%;
  bottom: 36px;
  width: clamp(98px, 11vw, 132px);
  height: auto;
  transform: translateX(-50%);
  transform-origin: 50% 90%;
  color: var(--text-primary);
  pointer-events: none;
}

#chapter-4 .stick-figure--light {
  color: var(--accent-primary);
}

#chapter-4 .stick-figure--dark {
  color: var(--accent-secondary);
}

#chapter-4 .stick-line,
#chapter-4 .stick-head {
  stroke: currentColor;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

#chapter-4 .stick-head {
  fill: transparent;
}

/* ==============================
   CHAPTER 5 — HEAVY COGNITIVE LOAD
   ============================== */

#chapter-5 {
  background: var(--chapter-transition-gray);
  padding: var(--space-128) 0 0;
  position: relative;
  z-index: 30;
}

/* Hide subpixel seam from pinned Chapter 4 -> Chapter 5 handoff */
#chapter-5::before {
  content: "";
  position: absolute;
  left: 0;
  top: -2px;
  width: 100%;
  height: 4px;
  background: var(--chapter-transition-gray);
  pointer-events: none;
}

#chapter-5 .section__content {
  --gap: var(--space-32);

  display: grid;
  gap: var(--gap);

  grid-template-columns: repeat(12, 1fr);
  grid-template-rows:
    clamp(110px, 12vw, 150px)
    clamp(150px, 18vw, 210px)
    clamp(220px, 26vw, 320px);
}

#chapter-5 .panel,
#chapter-5-outro .panel,
#chapter-5-blackout #blackout {
  background: var(--surface-primary);
  border-color: var(--text-primary);
}

#chapter-5 .panel h2,
#chapter-5 .panel h4,
#chapter-5 .panel p,
#chapter-5-outro .panel h2,
#chapter-5-outro .panel h4,
#chapter-5-outro .panel p {
  color: var(--text-primary);
}

#chapter-5 .panel.tilted {
  min-height: clamp(200px, 24vw, 300px);
  width: 260px;
  align-self: center;
  justify-self: center;
  transform-origin: center;
  background: var(--surface-primary);
  border-color: var(--text-primary);
  position: relative;
  overflow: visible;
  isolation: isolate;
}

#chapter-5 .panel.tilted p {
  position: relative;
  z-index: 3;
}

#chapter-5 .ch5-spin-lines {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
}

#chapter-5 .ch5-spin-axis {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}

#chapter-5 .ch5-spin-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 68px;
  height: 3px;
  border-radius: 999px;
  opacity: 0;
  will-change: transform, opacity;
  filter: saturate(1.15);
}

#chapter-5 .panel:nth-child(1) {
  grid-column: 2 / 12;
  grid-row: 1;
}

#chapter-5 .panel:nth-child(1):hover {
  transform: translateY(50px);
  transition-duration: 0.6s;
}

#chapter-5 .panel:nth-child(2) {
  grid-column: 4 / 10;
  grid-row: 2;
  justify-self: center;
  align-self: start;
  min-height: clamp(120px, 16vw, 180px);
}

#chapter-5 .panel:nth-child(2):hover {
  scale: 0.9;
  transition-duration: 0.8s;
}

#chapter-5 .panel:nth-child(3) {
  grid-column: 1 / 5;
  grid-row: 3;
  justify-self: start;
  align-self: center;
  transform: rotate(-10deg);
  z-index: 2;
}

#chapter-5 .panel:nth-child(4) {
  grid-column: 5 / 9;
  grid-row: 3;
  justify-self: center;
  align-self: center;
  transform: rotate(4deg);
  z-index: 3;
}

#chapter-5 .panel:nth-child(5) {
  grid-column: 9 / 13;
  grid-row: 3;
  justify-self: end;
  align-self: center;
  transform: rotate(10deg);
  z-index: 2;
}

#chapter-5-blackout {
  background: var(--chapter-transition-gray);
  position: relative;
  z-index: 20;
  padding: 0;
  min-height: 100vh;
}

#chapter-5-blackout .section__content {
  max-width: none;
  margin: 0;
  padding: 0 var(--space-24);
  min-height: 100vh;
  display: grid;
  align-items: center;
}

#chapter-5-blackout .ch5-blackout-stage {
  position: relative;
  width: 100%;
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--chapter-transition-gray);
  padding: 0;
}

#chapter-5-blackout #blackout {
  position: relative;
  align-self: center;
  min-height: clamp(150px, 18vw, 220px);
  width: 100%;
  max-width: 860px;
  background: var(--surface-primary);
  border-color: var(--text-primary);
  overflow: hidden;
  isolation: isolate;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: var(--space-24);
  text-align: center;
}

#chapter-5-blackout #blackout .repeat-text {
  position: relative;
  z-index: 1;
  color: var(--text-primary);
}

#chapter-5-blackout #blackout .repeat-text:nth-child(1) {
  justify-self: start;
  align-self: start;
  text-align: left;
}
#chapter-5-blackout #blackout .repeat-text:nth-child(2) {
  justify-self: center;
  align-self: center;
}
#chapter-5-blackout #blackout .repeat-text:nth-child(3) {
  justify-self: end;
  align-self: end;
  text-align: right;
}

#chapter-5-blackout #blackout .ch5-blackout-cloud {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

#chapter-5-blackout #blackout .ch5-blackout-word {
  position: absolute;
  left: 50%;
  top: 50%;
  white-space: nowrap;
  font-size: clamp(12px, 1.2vw, 16px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--text-primary);
  opacity: 0;
  will-change: transform, opacity, color;
  transform: translate(-50%, -50%) scale(0.72);
}

#chapter-5-outro {
  background: var(--chapter-transition-gray);
  padding-top: 0;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

#chapter-5-outro .section__content {
  --gap: var(--space-64);

  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: clamp(260px, 32vw, 420px);
  min-height: 100vh;
  align-content: center;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--chapter-transition-gray);
}

#chapter-5-outro #ch5-outro-wipe {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  background: var(--surface-primary);
  border-radius: 50%;
  transform: scale(0.001);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

#chapter-5-outro .panel:nth-child(1) {
  grid-column: 1 / 7;
  grid-row: 1;
  justify-self: start;
  align-self: center;
  min-height: clamp(150px, 18vw, 220px);
}

#chapter-5-outro .panel:nth-child(1):hover {
  transform: translateX(-150px);
  transition-duration: 0.8s;
}

#chapter-5-outro .panel:nth-child(2) {
  grid-column: 8 / 13;
  grid-row: 1;
  justify-self: end;
  align-self: center;
  min-height: clamp(220px, 28vw, 360px);
  position: relative;
  overflow: visible;
}

#chapter-5-outro .panel:nth-child(2):hover {
  transform: translateX(150px);
  transition-duration: 0.8s;
}

#chapter-5-outro .ch5-powerful-word {
  display: inline-block;
  font-weight: 900;
  transform-origin: 50% 68%;
  will-change: transform;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  backface-visibility: hidden;
}

#chapter-5 .panel:nth-child(3),
#chapter-5 .panel:nth-child(4),
#chapter-5 .panel:nth-child(5) {
  transform-origin: center;
}

/* ==============================
   CHAPTER 6 — SVG ANATOMY
   ============================== */

#chapter-6 .section__content {
  --gap: var(--space-24);
  --pad-x: var(--space-32);
  --pad-y: var(--space-32);

  position: relative;
  z-index: 0;
  isolation: isolate;
  display: grid;
  gap: var(--gap);
  padding: var(--pad-y) var(--pad-x);

  grid-template-columns: 1fr 1fr;
  grid-template-rows:
    clamp(110px, 12vw, 150px)
    clamp(160px, 18vw, 220px)
    clamp(160px, 18vw, 220px)
    clamp(160px, 18vw, 220px)
    clamp(70px, 10vw, 110px);
}

#chapter-6 .svg-guides {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -4;
  pointer-events: none;
  transform: none;
}

#chapter-6 .svg-guides .guide {
  fill: none;
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 2;
  stroke-linecap: square;
  vector-effect: non-scaling-stroke;
  opacity: 1;
  stroke-opacity: 1;
}

#chapter-6 .svg-guides .ch6-guide-line {
  opacity: 1 !important;
  stroke-opacity: 1 !important;
}

#chapter-6 .svg-guides .ch6-guide-line.is-accent-primary {
  stroke: var(--accent-primary) !important;
}

#chapter-6 .svg-guides .ch6-guide-line.is-accent-secondary {
  stroke: var(--accent-secondary) !important;
}

#chapter-6 .svg-guides .ch6-guide-line.is-accent-highlight {
  stroke: var(--accent-highlight) !important;
}

#chapter-6 .panel {
  position: relative;
  z-index: 1;
  border-color: transparent;
  overflow: hidden;
}

#chapter-6 .panel h2,
#chapter-6 .panel h4,
#chapter-6 .panel p {
  position: relative;
  z-index: 2;
}

#chapter-6 .ch6-draw-outline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

#chapter-6 .ch6-draw-line {
  position: absolute;
  background: var(--text-primary);
  will-change: transform, background-color;
}

#chapter-6 .ch6-draw-line--top,
#chapter-6 .ch6-draw-line--bottom {
  left: 0;
  width: 100%;
  height: var(--border-width);
}

#chapter-6 .ch6-draw-line--top {
  top: 0;
  transform-origin: 0% 50%;
}

#chapter-6 .ch6-draw-line--right,
#chapter-6 .ch6-draw-line--left {
  top: 0;
  width: var(--border-width);
  height: 100%;
}

#chapter-6 .ch6-draw-line--right {
  right: 0;
  transform-origin: 50% 0%;
}

#chapter-6 .ch6-draw-line--bottom {
  bottom: 0;
  transform-origin: 100% 50%;
}

#chapter-6 .ch6-draw-line--left {
  left: 0;
  transform-origin: 50% 100%;
}

#chapter-6 .panel:nth-of-type(1) { grid-column: 1 / -1; grid-row: 1; }
#chapter-6 .panel:nth-of-type(2) { grid-column: 1; grid-row: 2; }
#chapter-6 .panel:nth-of-type(3) { grid-column: 2; grid-row: 2; }
#chapter-6 .panel:nth-of-type(4) { grid-column: 1; grid-row: 3; }
#chapter-6 .panel:nth-of-type(5) { grid-column: 2; grid-row: 3; }
#chapter-6 .panel:nth-of-type(6) { grid-column: 1; grid-row: 4; }
#chapter-6 .panel:nth-of-type(7) { grid-column: 2; grid-row: 4; }
#chapter-6 .panel:nth-of-type(8) {
  grid-column: 1 / -1;
  grid-row: 5;
  justify-self: center;
  width: min(520px, 100%);
}

#chapter-6 .panel:nth-child(1):hover,
#chapter-6 .panel:nth-child(4):hover,
#chapter-6 .panel:nth-child(7):hover {
  scale: 1.02;
}
#chapter-6 .panel:nth-child(1):hover .ch6-draw-line,
#chapter-6 .panel:nth-child(4):hover .ch6-draw-line,
#chapter-6 .panel:nth-child(7):hover .ch6-draw-line {
  background: var(--accent-primary);
}

#chapter-6 .panel:nth-child(2):hover,
#chapter-6 .panel:nth-child(5):hover,
#chapter-6 .panel:nth-child(8):hover {
  scale: 1.02;
}
#chapter-6 .panel:nth-child(2):hover .ch6-draw-line,
#chapter-6 .panel:nth-child(5):hover .ch6-draw-line,
#chapter-6 .panel:nth-child(8):hover .ch6-draw-line {
  background: var(--accent-secondary);
}

#chapter-6 .panel:nth-child(3):hover,
#chapter-6 .panel:nth-child(6):hover {
  scale: 1.02;
}
#chapter-6 .panel:nth-child(3):hover .ch6-draw-line,
#chapter-6 .panel:nth-child(6):hover .ch6-draw-line {
  background: var(--accent-highlight);
}

/* ==============================
   CHAPTER 7 — WRAP-UP GRID
   ============================== */

#chapter-7 .section__content {
  grid-template-areas: none;
}

#chapter-7 {
  background: var(--surface-primary);
  position: relative;
  overflow: hidden;
  padding-top: 0;
  min-height: 100vh;
}

#chapter-7 .panel {
  grid-area: auto;
}

#chapter-7 .section__content {
  --gap: var(--space-24);

  position: relative;
  z-index: 1;
  display: grid;
  gap: var(--gap);
  min-height: 100vh;
  align-content: center;
  align-items: stretch;
  padding-top: 0;
  padding-bottom: 0;

  grid-template-columns: repeat(3, 1fr);
  grid-template-rows:
    clamp(160px, 22vw, 220px)
    clamp(160px, 22vw, 220px);

  grid-template-areas: none;
}

#chapter-7 .panel:nth-child(1) { grid-column: 1; grid-row: 1; }
#chapter-7 .panel:nth-child(2) { grid-column: 2; grid-row: 1; }
#chapter-7 .panel:nth-child(3) { grid-column: 3; grid-row: 1; }

#chapter-7 .panel:nth-child(4) { grid-column: 1; grid-row: 2; }
#chapter-7 .panel:nth-child(5) { grid-column: 2; grid-row: 2; }
#chapter-7 .panel:nth-child(6) { grid-column: 3; grid-row: 2; }

#chapter-7 .panel:nth-child(1):hover,
#chapter-7 .panel:nth-child(2):hover,
#chapter-7 .panel:nth-child(3):hover,
#chapter-7 .panel:nth-child(4):hover,
#chapter-7 .panel:nth-child(5):hover,
#chapter-7 .panel:nth-child(6):hover {
  scale: 1.03;
  transition: transform 0.4s ease;
}

#chapter-7-finale {
  background: var(--surface-primary);
  padding-top: 0;
  position: relative;
  overflow: hidden;
}

#chapter-7-finale .section__content {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
}

#chapter-7-finale #ch7-final-panel {
  border: none;
  background: var(--surface-primary);
  padding: 0;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#chapter-7-finale #ch7-final-panel h2 {
  max-width: min(920px, 92vw);
  font-size: clamp(32px, 5.2vw, 72px);
  line-height: 1.04;
}

#ch7-end-wipe {
  position: fixed;
  inset: 0;
  background: #000000;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}

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

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

  .section--chapter .panel,
  #chapter-3 #text-reveal,
  #chapter-4 #full-view-panel,
  #chapter-5-blackout #blackout,
  #chapter-7-finale #ch7-final-panel {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }

  #chapter-3 #text-reveal {
    position: static !important;
    width: 100% !important;
  }

  #chapter-3 .panel-half,
  #chapter-3 .ch3-icon-rain,
  #chapter-3 .parallax-icons,
  #chapter-2 .ch2-fx,
  #chapter-4 .ch4-fireworks,
  #chapter-5-outro #ch5-outro-wipe,
  #ch7-end-wipe {
    display: none !important;
  }
}

/* ==============================
   MOBILE RESPONSIVE OVERRIDES
   ============================== */

@media (max-width: 768px) {
  :root {
    --section-space-y: 96px;
    --chapter-gap: var(--space-16);
  }

  .section__content {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--chapter-gap) !important;
    padding: var(--space-24) var(--space-16) !important;
  }

  .section--chapter .panel {
    grid-area: auto !important;
    grid-column: auto !important;
    grid-row: auto !important;
    min-height: clamp(140px, 28vw, 220px) !important;
    margin: 0 !important;
  }

  .section--chapter .section__content > .panel:nth-of-type(odd) {
    width: min(92vw, 560px) !important;
    aspect-ratio: 1 / 1;
    align-self: flex-start !important;
  }

  .section--chapter .section__content > .panel:nth-of-type(even) {
    width: min(92vw, 680px) !important;
    aspect-ratio: 16 / 10;
    align-self: flex-end !important;
  }

  #chapter-2 .panel:nth-child(8),
  #chapter-4 #full-view-panel,
  #chapter-5-blackout #blackout,
  #chapter-7-finale #ch7-final-panel {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: auto !important;
  }

  #chapter-2 #arrow {
    display: none;
  }

  #chapter-2 .panel:nth-child(8) {
    flex-direction: column;
    padding: var(--space-24);
  }

  #chapter-3 {
    padding: var(--space-48) 0;
  }

  #chapter-3 .panel:nth-child(1) {
    transform: rotate(-2deg) !important;
  }

  #chapter-3 .panel:nth-child(5) {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
  }

  #chapter-4 {
    --overlap-x: 0px;
    --overlap-y: 0px;
  }

  .character-light,
  .character-dark {
    grid-area: auto !important;
    display: flex;
    justify-content: center;
    margin: var(--space-24) 0;
  }

  #chapter-5 .panel.tilted {
    transform: rotate(1deg) !important;
    align-self: center;
  }

  #chapter-5-blackout .ch5-blackout-stage {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #chapter-5-blackout #blackout {
    position: relative;
    top: auto;
    transform: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    width: min(100%, 720px) !important;
  }

  #chapter-6 .svg-guides {
    display: none;
  }

  #chapter-7-finale #ch7-final-panel {
    min-height: 90vh !important;
  }

  .section--chapter h2 {
    font-size: 32px !important;
  }

  .section--chapter p {
    font-size: 18px !important;
  }

  .theme-mode-control {
    top: var(--space-8);
    right: var(--space-8);
  }

  #scroll-to-top-btn {
    bottom: var(--space-16);
    width: 50px;
    height: 50px;
  }

  #scroll-to-top-btn .scroll-to-top-icon {
    width: 32px;
    height: 32px;
  }
}
