:root {
  /* compliance tokens from typography parser: KR* KR** copy */
  --hanji: #F3E7C7;
  --moss: #10261A;
  --amber: #D99A3D;
  --bark: #24170F;
  --plum: #35213C;
  --leaf: #6FA36B;
  --rain: #7F9AA0;
  --ochre: #B8792E;
  --title: 'Gowun Batang', serif;
  --body: 'IBM Plex Sans KR', sans-serif;
  --specimen: 'Fraunces', serif;
  --hand: 'Nanum Pen Script', cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--hanji);
  background: var(--moss);
  font-family: var(--body);
  overflow-x: hidden;
}

button { font: inherit; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: .34;
  mix-blend-mode: soft-light;
  background:
    radial-gradient(circle at 20% 30%, rgba(243,231,199,.22) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 10%, rgba(217,154,61,.18) 0 1px, transparent 2px),
    repeating-linear-gradient(96deg, rgba(243,231,199,.05) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(13deg, rgba(36,23,15,.15) 0 2px, transparent 2px 11px);
  background-size: 78px 78px, 112px 112px, 100% 100%, 100% 100%;
}

.leaf-cursor {
  position: fixed;
  width: 260px;
  height: 260px;
  left: -130px;
  top: -130px;
  pointer-events: none;
  z-index: 15;
  opacity: .18;
  filter: blur(1px);
  background:
    radial-gradient(ellipse at 46% 55%, rgba(111,163,107,.92) 0 18%, transparent 19%),
    radial-gradient(ellipse at 60% 38%, rgba(111,163,107,.72) 0 14%, transparent 15%),
    radial-gradient(ellipse at 36% 36%, rgba(127,154,160,.58) 0 11%, transparent 12%);
  transform: translate3d(var(--x, 50vw), var(--y, 50vh), 0) rotate(var(--r, 0deg));
  transition: opacity .5s ease;
}

.ring-nav {
  position: fixed;
  right: 28px;
  top: 50%;
  z-index: 45;
  display: grid;
  gap: 15px;
  transform: translateY(-50%);
}

.notch {
  position: relative;
  width: 14px;
  height: 30px;
  border: 1px solid rgba(243,231,199,.28);
  border-radius: 12px 2px 12px 2px;
  background: rgba(36,23,15,.72);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px rgba(16,38,26,.35);
  transition: background .4s ease, transform .4s ease, border-color .4s ease;
}

.notch::after {
  content: attr(data-label);
  position: absolute;
  right: 22px;
  top: 2px;
  color: var(--hanji);
  font-family: var(--hand);
  font-size: 21px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: .35s ease;
}

.notch:hover::after, .notch.active::after { opacity: .85; transform: translateX(0); }
.notch.active { background: var(--amber); border-color: var(--hanji); transform: rotate(9deg) scale(1.12); }

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(48px, 7vw, 92px);
}

.scene::before {
  content: attr(data-ring);
  position: absolute;
  right: 9vw;
  bottom: 6vh;
  z-index: -1;
  color: rgba(243,231,199,.055);
  font-family: var(--specimen);
  font-size: clamp(120px, 25vw, 360px);
  line-height: .75;
}

.forest-edge {
  display: grid;
  align-items: center;
  background:
    radial-gradient(circle at 34% 48%, rgba(184,121,46,.18), transparent 31%),
    radial-gradient(circle at 70% 18%, rgba(53,33,60,.8), transparent 32%),
    linear-gradient(180deg, #10261A 0%, #24170F 100%);
}

.trunk-spine {
  position: absolute;
  top: -8vh;
  bottom: -8vh;
  left: 39%;
  width: clamp(90px, 11vw, 170px);
  z-index: -1;
  border-radius: 48% 52% 45% 55%;
  background:
    linear-gradient(90deg, transparent, rgba(243,231,199,.08), transparent),
    repeating-linear-gradient(100deg, rgba(243,231,199,.045) 0 2px, transparent 2px 15px),
    linear-gradient(90deg, #1b100b, #3b2415 44%, #170d08);
  box-shadow: inset 16px 0 36px rgba(0,0,0,.35), inset -10px 0 26px rgba(217,154,61,.14);
  transform: rotate(-2deg);
}

.trunk-spine.narrow { left: 33%; width: clamp(74px, 8vw, 120px); }
.trunk-spine.root-wide { left: 47%; width: clamp(120px, 14vw, 220px); }
.trunk-spine.bark-heavy { left: 18%; width: clamp(190px, 24vw, 380px); border-radius: 44% 56% 50% 50%; }
.trunk-spine.canopy-trunk { left: 68%; width: clamp(130px, 16vw, 260px); }
.trunk-spine.elder { left: 50%; width: clamp(210px, 24vw, 390px); transform: translateX(-50%) rotate(1deg); }

.annual-rings {
  position: absolute;
  width: min(86vw, 820px);
  aspect-ratio: 1;
  border-radius: 50%;
  z-index: -2;
  background:
    repeating-radial-gradient(circle at 52% 47%, transparent 0 22px, rgba(243,231,199,.14) 23px 25px, transparent 26px 45px),
    radial-gradient(circle, rgba(184,121,46,.16), transparent 65%);
  filter: drop-shadow(0 20px 55px rgba(0,0,0,.28));
  animation: ringBreathe 8s ease-in-out infinite;
}

.rings-hero { left: -16vw; top: 8vh; opacity: .72; }
.off-left { left: -22vw; top: 10vh; opacity: .5; }
.oath-rings { left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: .55; }

@keyframes ringBreathe {
  0%, 100% { scale: 1; opacity: .48; }
  50% { scale: 1.025; opacity: .72; }
}

.hero-carving {
  width: min(680px, 82vw);
  margin-left: clamp(10px, 8vw, 150px);
  text-shadow: 0 2px 0 #0c0603, 0 0 28px rgba(217,154,61,.18);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--rain);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: var(--title);
  font-weight: 700;
  letter-spacing: -.045em;
}

h1 {
  color: transparent;
  font-size: clamp(72px, 14vw, 188px);
  line-height: .82;
  background: linear-gradient(180deg, rgba(243,231,199,.88), rgba(184,121,46,.5) 54%, rgba(36,23,15,.7));
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(243,231,199,.14));
}

h1 span { color: var(--amber); -webkit-text-fill-color: var(--amber); }

h2 { color: var(--bark); font-size: clamp(42px, 7vw, 92px); line-height: .9; }

.intro, .hanji-panel p:not(.eyebrow) {
  font-size: clamp(17px, 1.55vw, 22px);
  line-height: 1.75;
  font-weight: 300;
}

.intro { max-width: 560px; color: rgba(243,231,199,.78); }

.ritual-button {
  margin-top: 22px;
  border: 1px solid rgba(217,154,61,.72);
  border-radius: 999px;
  padding: 13px 22px 15px;
  color: var(--hanji);
  background: rgba(36,23,15,.62);
  cursor: pointer;
  box-shadow: inset 0 0 22px rgba(217,154,61,.08), 0 9px 30px rgba(0,0,0,.22);
  transition: transform .35s ease, background .35s ease, color .35s ease;
}

.ritual-button:hover { transform: translateY(-2px); background: var(--amber); color: var(--bark); }

.seed-dot {
  position: fixed;
  left: 50vw;
  top: 50vh;
  z-index: 35;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--hanji), var(--amber) 42%, var(--ochre) 70%);
  box-shadow: 0 0 18px rgba(217,154,61,.85), 0 0 3px #24170F;
  transform: translate(-50%, -50%);
}

.seed-dot.rolling { animation: seedRoll 1.15s cubic-bezier(.5,.04,.2,1) both; }

@keyframes seedRoll {
  0% { transform: translate(-50%, -50%) rotate(0); }
  55% { transform: translate(-26vw, 24vh) rotate(520deg) scale(.92); }
  100% { transform: translate(-38vw, 54vh) rotate(900deg) scale(1.2); }
}

.handwritten { font-family: var(--hand); }
.edge-note { position: absolute; right: 15vw; bottom: 14vh; color: rgba(243,231,199,.6); font-size: 30px; transform: rotate(-8deg); }

.ring-scene { display: grid; align-items: center; background: linear-gradient(140deg, var(--moss), var(--bark)); }
.seed-gate { background: radial-gradient(circle at 24% 45%, rgba(217,154,61,.22), transparent 30%), linear-gradient(145deg, #10261A, #24170F 72%); }
.root-whisper { background: radial-gradient(circle at 64% 66%, rgba(127,154,160,.2), transparent 28%), linear-gradient(180deg, #10261A, #160f0b); }
.bark-archive { background: linear-gradient(100deg, #24170F, #10261A 76%); }
.canopy-hall { background: radial-gradient(circle at 48% 0%, rgba(111,163,107,.35), transparent 38%), linear-gradient(180deg, #10261A, #25381f); }
.night-oath { background: radial-gradient(circle at 52% 54%, rgba(217,154,61,.2), transparent 21%), radial-gradient(circle at 72% 18%, rgba(53,33,60,.72), transparent 34%), linear-gradient(180deg, #10261A, #24170F); }

.hanji-panel {
  position: relative;
  width: min(620px, 82vw);
  padding: clamp(28px, 4vw, 54px);
  color: var(--bark);
  background:
    linear-gradient(90deg, rgba(36,23,15,.04), transparent 18% 82%, rgba(36,23,15,.05)),
    var(--hanji);
  border: 1px solid rgba(184,121,46,.45);
  border-radius: 36px 18px 42px 22px;
  box-shadow: 0 22px 60px rgba(0,0,0,.28), inset 0 0 32px rgba(184,121,46,.12);
}

.hanji-panel::after {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px dashed rgba(36,23,15,.18);
  border-radius: inherit;
  pointer-events: none;
}

.hanji-panel .eyebrow { color: var(--ochre); }
.seed-panel { margin-left: 45vw; transform: rotate(1.5deg); }
.root-panel { margin-left: 10vw; transform: rotate(-1.5deg); }
.archive-panel { transform: rotate(1deg); }
.canopy-panel { margin-left: 14vw; transform: rotate(-.6deg); }
.oath-panel { margin-left: auto; margin-right: 10vw; transform: rotate(1deg); }

.chapter-mark {
  position: absolute;
  top: 9vh;
  left: 8vw;
  color: rgba(217,154,61,.64);
  font-family: var(--specimen);
  font-size: clamp(54px, 9vw, 126px);
}

.paper-tag {
  display: inline-block;
  color: var(--bark);
  background: var(--hanji);
  border: 1px solid rgba(184,121,46,.5);
  border-radius: 12px 4px 15px 6px;
  padding: 8px 16px 11px;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}

.seed-gate .paper-tag { position: absolute; left: 16vw; bottom: 13vh; font-size: 29px; transform: rotate(-7deg); }

.tree-personality {
  position: absolute;
  left: 12vw;
  top: 18vh;
  width: 180px;
  height: 260px;
  color: var(--hanji);
  font-family: var(--hand);
  font-size: 25px;
  text-align: center;
}

.canopy-disc { position: absolute; left: 8px; top: 0; width: 160px; height: 150px; border-radius: 48% 52% 45% 55%; background: radial-gradient(circle, rgba(111,163,107,.65), rgba(16,38,26,.2)); border: 1px solid rgba(111,163,107,.45); }
.trunk-icon { position: absolute; left: 76px; top: 110px; width: 28px; height: 118px; border-radius: 16px; background: linear-gradient(90deg, #24170F, #B8792E, #24170F); }
.rope { position: absolute; left: 57px; width: 68px; height: 16px; border: 2px solid var(--amber); border-left: 0; border-right: 0; border-radius: 50%; }
.rope-one { top: 132px; transform: rotate(8deg); }
.rope-two { top: 154px; transform: rotate(-7deg); }
.tree-personality p { position: absolute; bottom: 0; width: 100%; margin: 0; }

.root-map { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: .8; }
.root-map path { fill: none; stroke: var(--ochre); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 900; stroke-dashoffset: 900; filter: drop-shadow(0 0 8px rgba(217,154,61,.28)); }
.root-whisper.in-view .root-map path { animation: drawRoot 2.4s ease forwards; }
.root-whisper.in-view .root-map path:nth-child(2) { animation-delay: .2s; }
.root-whisper.in-view .root-map path:nth-child(3) { animation-delay: .45s; }
.root-whisper.in-view .root-map path:nth-child(4) { animation-delay: .65s; }
@keyframes drawRoot { to { stroke-dashoffset: 0; } }

.resin-pool {
  position: absolute;
  right: 18vw;
  bottom: 16vh;
  width: 170px;
  height: 94px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 40% 34%, rgba(243,231,199,.75), var(--amber) 28%, rgba(184,121,46,.55) 58%, transparent 70%);
  box-shadow: 0 0 34px rgba(217,154,61,.42);
  overflow: hidden;
}
.resin-pool span { position: absolute; border: 1px solid rgba(243,231,199,.7); border-radius: 50%; inset: 45%; opacity: 0; }
.resin-pool.ripple span { animation: ripple 1s ease-out; }
@keyframes ripple { from { inset: 46%; opacity: .8; } to { inset: 3%; opacity: 0; } }
.whisper { position: absolute; left: 55vw; top: 24vh; color: var(--rain); font-size: 31px; transform: rotate(8deg); }

.archive-wrap { display: flex; align-items: center; gap: clamp(30px, 7vw, 110px); margin-left: 14vw; }
.bark-slab {
  position: relative;
  width: min(330px, 31vw);
  min-height: 540px;
  padding: 70px 34px;
  border-radius: 48% 52% 44% 56% / 9% 13% 10% 14%;
  background: repeating-linear-gradient(96deg, rgba(243,231,199,.055) 0 3px, transparent 3px 17px), linear-gradient(90deg, #170d08, #4b2d18 42%, #24170F);
  box-shadow: inset 20px 0 40px rgba(0,0,0,.36), 0 24px 70px rgba(0,0,0,.34);
}
.scratch {
  display: block;
  width: 100%;
  margin: 26px 0;
  border: 0;
  color: rgba(243,231,199,.38);
  background: transparent;
  font-family: var(--hand);
  font-size: clamp(26px, 3vw, 42px);
  text-align: left;
  cursor: pointer;
  transform: rotate(var(--tilt, -3deg));
  transition: color .35s ease, text-shadow .35s ease, transform .35s ease;
}
.scratch:nth-child(even) { --tilt: 4deg; }
.scratch:hover, .scratch.lit { color: var(--amber); text-shadow: 0 0 14px rgba(217,154,61,.82); transform: rotate(0) translateX(9px); }
.fungi-stack { position: absolute; left: 25vw; bottom: 8vh; display: grid; gap: 7px; }
.fungi-stack i { width: 86px; height: 28px; border-radius: 50% 50% 10px 10px; background: linear-gradient(180deg, var(--hanji), var(--ochre)); transform: rotate(-8deg); opacity: .72; }
.fungi-stack i:nth-child(2) { width: 64px; margin-left: 34px; transform: rotate(7deg); }
.fungi-stack i:nth-child(3) { width: 108px; margin-left: 5px; }

.leaf-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.leaf-layer i {
  position: absolute;
  width: 72px;
  height: 34px;
  border-radius: 0 80% 0 80%;
  background: linear-gradient(135deg, rgba(111,163,107,.8), rgba(16,38,26,.2));
  animation: drift 8s ease-in-out infinite;
}
.leaf-layer.front i:nth-child(1) { left: 18%; top: 18%; animation-delay: -1s; }
.leaf-layer.front i:nth-child(2) { left: 45%; top: 9%; animation-delay: -3s; }
.leaf-layer.front i:nth-child(3) { left: 70%; top: 24%; animation-delay: -5s; }
.leaf-layer.front i:nth-child(4) { left: 31%; top: 69%; animation-delay: -2s; }
.leaf-layer.front i:nth-child(5) { left: 82%; top: 67%; animation-delay: -6s; }
.leaf-layer.back { opacity: .45; filter: blur(2px); }
.leaf-layer.back i:nth-child(1) { left: 9%; top: 42%; }
.leaf-layer.back i:nth-child(2) { left: 57%; top: 37%; animation-delay: -2s; }
.leaf-layer.back i:nth-child(3) { left: 77%; top: 8%; animation-delay: -4s; }
.leaf-layer.back i:nth-child(4) { left: 38%; top: 22%; animation-delay: -6s; }
@keyframes drift { 0%,100% { transform: translateY(0) rotate(20deg); } 50% { transform: translateY(28px) translateX(-18px) rotate(44deg); } }
.memory-tags { position: absolute; right: 10vw; bottom: 14vh; display: grid; gap: 14px; font-size: 28px; }
.memory-tags .paper-tag:nth-child(1) { transform: rotate(5deg); }
.memory-tags .paper-tag:nth-child(2) { transform: rotate(-4deg); }
.memory-tags .paper-tag:nth-child(3) { transform: rotate(7deg); }

.lanterns i {
  position: absolute;
  width: 13px;
  height: 20px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 22px var(--amber);
  animation: lantern 3s ease-in-out infinite;
}
.lanterns i:nth-child(1) { left: 43%; top: 32%; }
.lanterns i:nth-child(2) { left: 54%; top: 38%; animation-delay: -.8s; }
.lanterns i:nth-child(3) { left: 49%; top: 56%; animation-delay: -1.4s; }
.lanterns i:nth-child(4) { left: 61%; top: 62%; animation-delay: -2s; }
.lanterns i:nth-child(5) { left: 38%; top: 68%; animation-delay: -2.5s; }
@keyframes lantern { 0%,100% { opacity: .46; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-8px); } }
.amber-seal {
  position: absolute;
  left: 24vw;
  bottom: 16vh;
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  color: var(--bark);
  background: radial-gradient(circle at 35% 30%, var(--hanji), var(--amber) 34%, var(--ochre));
  border: 4px double rgba(36,23,15,.45);
  font-family: var(--title);
  font-weight: 700;
  text-align: center;
  line-height: 1.05;
  opacity: 0;
  transform: scale(1.8) rotate(-18deg);
  filter: blur(7px);
  box-shadow: 0 0 45px rgba(217,154,61,.65);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.9,.1,1), filter .7s ease;
}
.amber-seal.stamped { opacity: 1; transform: scale(1) rotate(-9deg); filter: blur(0); }

.scene .hanji-panel, .scene .chapter-mark, .tree-personality, .paper-tag, .bark-slab, .resin-pool, .memory-tags {
  opacity: 0;
  transform: translateY(26px) rotate(var(--rot, 0deg));
  transition: opacity .8s ease, transform .8s ease;
}
.scene.in-view .hanji-panel, .scene.in-view .chapter-mark, .scene.in-view .tree-personality, .scene.in-view .paper-tag, .scene.in-view .bark-slab, .scene.in-view .resin-pool, .scene.in-view .memory-tags {
  opacity: 1;
  transform: translateY(0) rotate(var(--rot, 0deg));
}
.seed-panel { --rot: 1.5deg; }
.root-panel { --rot: -1.5deg; }
.archive-panel { --rot: 1deg; }
.canopy-panel { --rot: -.6deg; }
.oath-panel { --rot: 1deg; }

@media (max-width: 760px) {
  .scene { padding: 34px 22px; }
  .ring-nav { right: 12px; gap: 10px; }
  .notch::after { display: none; }
  .hero-carving, .seed-panel, .root-panel, .canopy-panel, .oath-panel { margin-left: 0; margin-right: 0; }
  .archive-wrap { margin-left: 0; flex-direction: column; align-items: flex-start; }
  .bark-slab { width: min(100%, 340px); min-height: 420px; }
  .tree-personality, .memory-tags, .edge-note, .whisper { display: none; }
  .trunk-spine { opacity: .55; left: 58%; }
  .chapter-mark { top: 4vh; left: auto; right: 14vw; }
}
