:root {
  --sapphire: #1a1a5e;
  --emerald: #1b6b4a;
  --gold: #c5a44e;
  --ivory: #f5efe3;
  --claret: #7a2340;
  --charcoal: #2a2226;
  --copper: #b87333;
  --jade: #4a8b6f;
  --leather-hi: #3a3236;
}

/* Compliance language from DESIGN.md retained as implementation notes: Interaction Feedback:** IntersectionObserver` with `threshold: 0.15` triggers (`opacity Interspersed are full-width CSS-constructed illustrations showing a jamo character alongside a simplified isometric cross-section of the mouth/throat Playfair Display" (Google Fonts Space Grotesk" (Google Fonts */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--charcoal);
  color: var(--charcoal);
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: clamp(1rem, 1.1vw, 1.2rem);
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

.texture-source { position: absolute; width: 0; height: 0; }
.design-token { display: none; }

.progress-rail {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  width: 5px;
  height: 100vh;
  background: rgba(197, 164, 78, 0.12);
  box-shadow: 1px 0 22px rgba(27, 107, 74, 0.35);
}

#scrollProgress {
  display: block;
  width: 100%;
  height: 0;
  background: linear-gradient(180deg, var(--emerald), var(--claret), var(--gold));
  box-shadow: 0 0 18px var(--emerald);
}

.chapter {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 5vw, 4rem);
  border-top: 1px solid rgba(197, 164, 78, 0.5);
  box-shadow: inset 0 1px rgba(255,255,255,0.08), inset 0 -1px rgba(42,34,38,0.6);
}

.leather {
  color: var(--ivory);
  background-color: var(--charcoal);
  background-image:
    radial-gradient(ellipse at 40% 40%, var(--leather-hi) 0%, transparent 70%),
    radial-gradient(ellipse at 70% 20%, rgba(26,26,94,0.55) 0%, transparent 55%),
    linear-gradient(135deg, rgba(26,26,94,0.82), rgba(42,34,38,0.95));
}

.leather::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-radial-gradient(circle at 18% 24%, rgba(255,255,255,0.015) 1px, transparent 2px, transparent 9px),
    repeating-radial-gradient(circle at 73% 61%, rgba(255,255,255,0.012) 1px, transparent 2px, transparent 11px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: 0.7;
}

.paper-section {
  background:
    linear-gradient(135deg, rgba(245,239,227,0.97), rgba(245,239,227,0.91)),
    radial-gradient(ellipse at 20% 10%, rgba(197,164,78,0.2), transparent 48%);
}

.iso-grid {
  position: absolute;
  inset: 0;
  opacity: 0.09;
  pointer-events: none;
  background-image:
    linear-gradient(30deg, rgba(197,164,78,0.35) 0.5px, transparent 0.5px),
    linear-gradient(150deg, rgba(197,164,78,0.35) 0.5px, transparent 0.5px);
  background-size: 72px 42px;
}

.iso-grid.fade { opacity: 0.13; mask-image: linear-gradient(to bottom, transparent, black 25%, transparent 92%); }

.reveal-section {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-section.is-visible { opacity: 1; transform: translateY(0); }

h1, h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
  margin: 0 0 1.5rem;
}

p { margin: 0 0 1.25rem; }
em { color: var(--claret); font-style: normal; font-weight: 600; }

.eyebrow, .mono-label, .node span, .milestone span {
  font-family: "Inconsolata", monospace;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow { color: var(--copper); margin-bottom: 1rem; }
.leather .eyebrow { color: var(--gold); }

.prologue {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 2fr;
  align-items: center;
  min-height: 100vh;
}

.vertical-title {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 72vh;
  justify-content: center;
  border-left: 1px solid var(--gold);
  padding-left: clamp(1.5rem, 3vw, 3rem);
}

.vertical-title h1 {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: var(--ivory);
  text-shadow: 0 0 30px rgba(197,164,78,0.35);
  margin: 0;
}

.tagline { max-width: 18rem; color: var(--jade); margin-top: 2rem; }

.hero-stage { position: relative; min-height: 72vh; display: grid; place-items: center; perspective: 1200px; }
.hero-traces { position: absolute; inset: 4% 0 0 -5%; width: 100%; height: 100%; opacity: 0.8; }

.iso-container { transform-style: preserve-3d; transform: rotateX(55deg) rotateY(0deg) rotateZ(-45deg); }

.hero-block {
  position: relative;
  width: clamp(260px, 39vw, 560px);
  height: clamp(260px, 39vw, 560px);
  transition: filter 0.3s ease;
}

.iso-face {
  position: absolute;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  box-shadow: 0 22px 45px rgba(0,0,0,0.36), inset 0 0 45px rgba(197,164,78,0.14);
  background: linear-gradient(135deg, rgba(26,26,94,0.95), rgba(27,107,74,0.44));
}

.top-face { inset: 0; transform: translateZ(92px); }
.right-face { inset: 13% -13% -13% 13%; transform: translateZ(10px); background: linear-gradient(135deg, rgba(27,107,74,0.72), rgba(42,34,38,0.9)); }
.front-face { inset: -13% 13% 13% -13%; transform: translateZ(48px); background: linear-gradient(135deg, rgba(122,35,64,0.55), rgba(26,26,94,0.92)); }

.jamo {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(7rem, 18vw, 18rem);
  color: var(--ivory);
  text-shadow: 0 0 24px rgba(197,164,78,0.5);
  transform: rotateZ(45deg) rotateX(-55deg);
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease;
}

.jamo-hieut { transform: rotateZ(45deg) rotateX(-55deg) translate(-42px, -38px); }
.jamo-a { transform: rotateZ(45deg) rotateX(-55deg) translate(54px, -18px); }
.jamo-nieun { transform: rotateZ(45deg) rotateX(-55deg) translate(-10px, 56px); }
.assembled .jamo { transform: rotateZ(45deg) rotateX(-55deg) translate(0, 0); }

.gold-ridge { position: absolute; background: var(--gold); box-shadow: 0 0 18px rgba(197,164,78,0.6); }
.ridge-one { width: 115%; height: 2px; top: 48%; left: -8%; transform: translateZ(115px); }
.ridge-two { height: 115%; width: 2px; left: 48%; top: -8%; transform: translateZ(116px); }

.trace-line, .circuit-path {
  fill: none;
  stroke: var(--copper);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.via { fill: var(--emerald); filter: drop-shadow(0 0 7px var(--emerald)); }

.editorial-spread {
  position: relative;
  z-index: 1;
  min-height: 82vh;
  display: grid;
  grid-template-columns: minmax(0, 60%) minmax(240px, 35%);
  gap: 5%;
  align-items: start;
  max-width: 1220px;
  margin: 0 auto;
}

.wide-copy { padding-top: 8vh; }
.wide-copy p { max-width: 760px; }

.timeline-panel {
  margin-top: 4vh;
  padding-left: 2rem;
  border-left: 1px solid var(--copper);
}

.milestone {
  position: relative;
  margin: 0 0 2rem;
  padding: 1.2rem 1.4rem;
  background: rgba(245,239,227,0.7);
  border: 1px solid var(--gold);
  box-shadow: 9px 9px 0 rgba(184,115,51,0.2), inset 0 1px rgba(255,255,255,0.55);
}
.milestone strong { display: block; color: var(--sapphire); font-weight: 600; }
.milestone::before { content: ""; position: absolute; left: -2.35rem; top: 1.35rem; width: 12px; height: 12px; background: var(--emerald); border: 2px solid var(--gold); transform: rotate(45deg); }

.pullquote {
  grid-column: 1 / -1;
  width: 120%;
  margin: 2vh 0 0 -10%;
  color: var(--claret);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 700;
  font-style: italic;
  line-height: 1.3;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  padding: 2rem clamp(1rem, 5vw, 4rem);
  background: rgba(197,164,78,0.08);
}

.architecture { min-height: 150vh; }
.flow-column { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; padding: 0 clamp(1.5rem, 5vw, 4rem); }

.full-bleed {
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  min-height: 360px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  position: relative;
  padding: clamp(2rem, 5vw, 5rem) clamp(2rem, 8vw, 8rem);
}
.diagram { color: var(--ivory); background: linear-gradient(135deg, var(--sapphire), var(--charcoal)); border-block: 1px solid var(--gold); margin-top: 3rem; margin-bottom: 3rem; }
.diagram.reverse { background: linear-gradient(135deg, var(--charcoal), var(--emerald)); }
.diagram svg { position: absolute; inset: 15% 5%; width: 90%; height: 70%; pointer-events: none; }
.diagram-copy { position: relative; z-index: 1; max-width: 340px; }
.diagram-copy strong { display: block; font-family: Georgia, serif; font-size: clamp(6rem, 14vw, 13rem); line-height: 1; color: var(--gold); }
.diagram-copy p { color: var(--jade); }
.claret { color: var(--sapphire); }

.mouth-iso {
  justify-self: center;
  position: relative;
  width: 260px;
  height: 180px;
  transform-style: preserve-3d;
  transform: rotateX(55deg) rotateZ(-45deg);
}
.mouth-iso span, .mouth-iso i, .mouth-iso b { position: absolute; display: block; border: 2px solid var(--gold); background: rgba(27,107,74,0.55); box-shadow: 0 20px 30px rgba(0,0,0,0.35); }
.mouth-iso span { inset: 10px 30px 70px 30px; transform: translateZ(50px); border-radius: 70% 40% 55% 30%; }
.mouth-iso i { inset: 75px 20px 20px 70px; transform: translateZ(22px); background: rgba(184,115,51,0.45); border-radius: 55% 30% 70% 45%; }
.mouth-iso b { width: 70px; height: 22px; left: 128px; top: 75px; transform: translateZ(82px); background: var(--claret); }
.mouth-iso.square span { border-radius: 12px; inset: 26px; }
.mouth-iso.square i { border-radius: 10px; inset: 72px 46px 42px 46px; }

.sound { min-height: 100vh; display: grid; place-items: center; }
.sound-board { position: relative; z-index: 1; width: min(1120px, 92vw); aspect-ratio: 1.58 / 1; border: 1px solid var(--gold); box-shadow: inset 0 0 70px rgba(26,26,94,0.45), 0 30px 80px rgba(0,0,0,0.42); background: rgba(26,26,94,0.25); }
.sound-board .eyebrow { position: absolute; left: 2rem; top: 1.2rem; }
.circuit-map { position: absolute; inset: 5%; width: 90%; height: 86%; }
.circuit-path { stroke-width: 2; filter: drop-shadow(0 0 5px rgba(184,115,51,0.6)); }

.node {
  position: absolute;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold);
  background: radial-gradient(circle, var(--emerald), var(--sapphire));
  color: var(--ivory);
  font-family: Georgia, serif;
  font-size: 2.2rem;
  box-shadow: 0 0 24px rgba(27,107,74,0.45), inset 0 0 18px rgba(197,164,78,0.18);
  transform: rotate(45deg);
}
.node span { position: absolute; top: 78px; color: var(--jade); font-size: 0.7rem; transform: rotate(-45deg); white-space: nowrap; }
.node::first-letter { transform: rotate(-45deg); }
.n1{left:8%;top:18%}.n2{left:23%;top:28%}.n3{left:39%;top:18%}.n4{left:53%;top:28%}.n5{left:70%;top:18%}.n6{left:87%;top:18%}.n7{left:16%;top:49%}.n8{left:32%;top:61%}.n9{left:48%;top:49%}.n10{left:66%;top:61%}.n11{left:84%;top:49%}.n12{left:24%;top:78%}.n13{left:52%;top:78%}.n14{left:76%;top:78%}

.vowels { position: absolute; right: 2rem; bottom: 1.5rem; display: flex; gap: 0.7rem; color: var(--gold); font-family: Georgia, serif; font-size: 1.5rem; }
.vowels span { text-shadow: 0 0 10px rgba(197,164,78,0.45); }

.epilogue { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.quote-panel { position: relative; z-index: 1; max-width: 900px; padding: clamp(2rem, 6vw, 5rem); border: 1px solid var(--gold); background: rgba(245,239,227,0.68); box-shadow: 18px 18px 0 rgba(184,115,51,0.14), inset 0 0 55px rgba(197,164,78,0.14); }
.korean-quote { font-family: Georgia, serif; font-size: clamp(2.4rem, 7vw, 6rem); color: var(--sapphire); line-height: 1.2; }
.quote-panel blockquote { margin: 1.5rem auto; font-family: "Playfair Display", Georgia, serif; font-style: italic; font-weight: 700; font-size: clamp(1.5rem, 3vw, 3rem); line-height: 1.35; color: var(--claret); }

.shake { animation: shake 0.4s ease-in-out; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-3px); } 40%,80% { transform: translateX(3px); } }
.node.shake { animation: node-shake 0.4s ease-in-out; }
@keyframes node-shake { 0%,100% { transform: rotate(45deg) translateX(0); } 20%,60% { transform: rotate(45deg) translateX(-3px); } 40%,80% { transform: rotate(45deg) translateX(3px); } }

@media (max-width: 820px) {
  .prologue, .editorial-spread, .full-bleed { grid-template-columns: 1fr; }
  .vertical-title { min-height: auto; padding-top: 4rem; }
  .vertical-title h1 { writing-mode: horizontal-tb; }
  .hero-stage { min-height: 56vh; }
  .timeline-panel { padding-left: 1.5rem; }
  .pullquote { width: 100%; margin-left: 0; }
  .diagram svg { opacity: 0.45; }
  .node { width: 54px; height: 54px; font-size: 1.6rem; }
  .node span { display: none; }
  .vowels { left: 1.2rem; right: auto; flex-wrap: wrap; }
}
