:root {
  /* to create a Korean-literary craft archive instead of the common mono-heavy technical look. IBM Plex Mono very sparingly for page numbers. */
  --ink-night: #091017;
  --hanji: #F3E8D2;
  --pulp: #B9AA8E;
  --indigo: #223955;
  --plum: #4A263F;
  --brass: #C99A3E;
  --seal: #D85B35;
  --thread: #A8CAD8;
  --wet-gray: #4F565A;
  --serif-kr: "Noto Serif KR", "Apple SD Gothic Neo", "Times New Roman", serif;
  --fraunces: "Fraunces", Georgia, serif;
  --dodum: "Gowun Dodum", "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #091017;
  color: #F3E8D2;
  font-family: var(--dodum);
  overflow-x: hidden;
}

body.clear-state { background: #F3E8D2; color: #091017; }
button { font: inherit; }

.workshop-grain,
.moon-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.workshop-grain {
  opacity: .32;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(243,232,210,.2) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 36%, rgba(185,170,142,.16) 0 1px, transparent 1.7px),
    radial-gradient(circle at 34% 74%, rgba(168,202,216,.11) 0 1px, transparent 1.4px),
    linear-gradient(104deg, transparent 0 47%, rgba(243,232,210,.07) 48% 50%, transparent 51%);
  background-size: 43px 47px, 61px 67px, 83px 73px, 17px 17px;
}

.moon-wash {
  opacity: .84;
  background:
    radial-gradient(circle at 18% 18%, rgba(168,202,216,.13), transparent 30%),
    radial-gradient(circle at 80% 66%, rgba(74,38,63,.38), transparent 34%),
    radial-gradient(circle at 48% 42%, rgba(34,57,85,.54), transparent 46%),
    #091017;
  transition: opacity 1.2s ease;
}
body.clear-state .moon-wash { opacity: .14; }

.paper-house { position: relative; z-index: 1; }
.room {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow: hidden;
  padding: 8vh 8vw;
}

.paper-spine {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 8px 16px rgba(9,16,23,.44));
}
.paper-spine path {
  fill: none;
  stroke: rgba(243,232,210,.74);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1 7;
}
.paper-spine::after { content: ""; }

.drying-rack {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  display: grid;
  gap: 16px;
  width: 72px;
}
.rack-thread {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 17px;
  border-left: 1px dashed rgba(168,202,216,.45);
}
.knot {
  position: relative;
  height: 38px;
  border: 0;
  background: transparent;
  color: rgba(243,232,210,.6);
  cursor: pointer;
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .08em;
}
.knot i {
  position: absolute;
  left: 4px;
  top: 10px;
  width: 25px;
  height: 18px;
  border: 1px solid rgba(243,232,210,.34);
  background: rgba(79,86,90,.42);
  border-radius: 48% 52% 41% 59%;
  transform: rotate(-16deg);
  transition: background .6s ease, box-shadow .6s ease, transform .6s ease;
}
.knot b { position: relative; left: 34px; font-weight: 400; }
.knot.active { color: #C99A3E; }
.knot.active i { background: #C99A3E; box-shadow: 0 0 28px rgba(201,154,62,.58); transform: rotate(11deg) scale(1.06); }

.sheet {
  position: relative;
  width: min(690px, 72vw);
  padding: clamp(36px, 6vw, 76px);
  color: #091017;
  background:
    radial-gradient(circle at 16% 20%, rgba(255,255,255,.42), transparent 20%),
    radial-gradient(circle at 82% 72%, rgba(185,170,142,.28), transparent 26%),
    linear-gradient(135deg, rgba(243,232,210,.98), rgba(243,232,210,.82));
  box-shadow: 0 34px 90px rgba(0,0,0,.42), inset 0 0 42px rgba(185,170,142,.28);
  border: 1px solid rgba(185,170,142,.55);
  transition: transform 1.15s ease, opacity 1.15s ease, filter 1.15s ease;
}
.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0 4px, rgba(243,232,210,.72) 5px 7px, transparent 8px 14px);
  opacity: .25;
  clip-path: polygon(1% 2%, 99% 0, 97% 97%, 2% 100%);
}
.sheet::after {
  inset: 0;
  background-image: radial-gradient(circle, rgba(79,86,90,.22) 0 1px, transparent 1.5px);
  background-size: 19px 23px;
  mix-blend-mode: multiply;
}
.room:not(.room-active) .sheet { opacity: .46; filter: blur(1.5px); transform: translateY(24px) rotate(var(--tilt, 0deg)); }
.room.room-active .sheet { opacity: 1; filter: blur(0); }

h1,
h2 {
  position: relative;
  z-index: 2;
  margin: 0;
  font-family: var(--serif-kr);
  font-weight: 400;
  letter-spacing: -.055em;
}
h1 {
  color: rgba(9,16,23,.12);
  font-size: clamp(3.6rem, 9vw, 9.5rem);
  line-height: .86;
  text-shadow: 0 1px rgba(9,16,23,.18), 0 -1px rgba(255,255,255,.42);
}
h2 { font-size: clamp(3rem, 7vw, 8.2rem); line-height: .9; color: #223955; }
p { position: relative; z-index: 2; font-size: clamp(1.05rem, 1.55vw, 1.42rem); line-height: 1.85; }
.time-mark,
.page-number,
.margin-script,
.vertical-fragment { font-family: var(--mono); letter-spacing: .12em; text-transform: lowercase; }
.time-mark { color: #4F565A; font-size: 11px; }
.page-number { display: block; color: #C99A3E; font-size: clamp(2.6rem, 8vw, 8rem); opacity: .42; line-height: .7; }

.hanging-line { position: absolute; left: 4vw; right: 18vw; top: 19vh; height: 1px; background: rgba(168,202,216,.32); transform: rotate(-4deg); }
.wet-sheet { margin: 17vh 0 0 18vw; --tilt: -2deg; transform: rotate(-2deg); border-radius: 47% 53% 6% 5% / 4% 6% 42% 58%; }
.clip { position: absolute; top: -24px; width: 22px; height: 44px; border: 2px solid #C99A3E; border-bottom: 0; border-radius: 8px 8px 0 0; z-index: 3; }
.clip-left { left: 18%; } .clip-right { right: 23%; }
.paper-button {
  position: relative;
  z-index: 3;
  border: 1px solid rgba(216,91,53,.45);
  background: rgba(216,91,53,.08);
  color: #4A263F;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  font-family: var(--mono);
  letter-spacing: .08em;
}
.seal {
  position: absolute;
  right: 52px;
  bottom: 42px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 43% 57% 50% 50%;
  background: #D85B35;
  color: rgba(243,232,210,.86);
  font-family: var(--serif-kr);
  animation: sealSoak 5.2s ease-in-out infinite;
}
.larger { width: 76px; height: 76px; right: 14vw; top: 18vh; bottom: auto; opacity: .88; }
.ink-bloom { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(79,86,90,.35), rgba(34,57,85,.14) 45%, transparent 70%); filter: blur(16px); animation: inkBloom 8s ease-in-out infinite; }
.bloom-a { width: 280px; height: 180px; left: 12vw; bottom: 13vh; } .bloom-b { width: 340px; height: 220px; right: 8vw; top: 14vh; animation-delay: -3s; }
.vertical-fragment { position: absolute; left: 6vw; top: 24vh; writing-mode: vertical-rl; color: rgba(168,202,216,.58); font-size: 12px; }
.paperweight { position: absolute; right: 18vw; bottom: 16vh; width: 94px; height: 38px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #C99A3E, #4A263F 72%); box-shadow: 0 18px 34px rgba(0,0,0,.45); }

.margin { background: radial-gradient(circle at 78% 34%, rgba(168,202,216,.12), transparent 34%); }
.whisper-sheet { margin: 14vh 0 0 8vw; width: min(620px, 65vw); transform: rotate(3deg); --tilt: 3deg; clip-path: polygon(0 3%, 96% 0, 100% 80%, 88% 100%, 2% 96%); }
.margin-script { position: absolute; right: 24px; top: 34px; writing-mode: vertical-rl; color: #4F565A; font-size: 12px; }
.torn-window { position: absolute; right: 14vw; top: 22vh; width: 310px; height: 430px; display: grid; place-items: center; color: rgba(243,232,210,.48); border: 1px dashed rgba(243,232,210,.38); clip-path: polygon(6% 0, 100% 5%, 92% 96%, 0 88%); background: rgba(243,232,210,.06); font-family: var(--fraunces); font-size: 2.4rem; }
.fiber-letters span { position: absolute; color: rgba(243,232,210,.42); font-family: var(--serif-kr); animation: fiberDrift 9s ease-in-out infinite alternate; }
.fiber-letters span:nth-child(1){left:67vw;top:18vh;font-size:4rem}.fiber-letters span:nth-child(2){left:84vw;top:62vh;font-size:3rem;animation-delay:-2s}.fiber-letters span:nth-child(3){left:21vw;top:72vh;font-size:2rem;animation-delay:-3s}.fiber-letters span:nth-child(4){left:42vw;top:13vh;font-size:1.5rem;animation-delay:-4s}.fiber-letters span:nth-child(5){left:76vw;top:39vh;font-size:3rem;animation-delay:-1s}
.moth { position: absolute; right: 20vw; bottom: 17vh; color: #C99A3E; font-family: var(--fraunces); font-size: 4rem; animation: moth 3.5s ease-in-out infinite; }

.doubt-sheet { margin: 16vh 0 0 36vw; transform: rotate(-5deg); --tilt: -5deg; width: min(610px, 62vw); clip-path: polygon(0 0, 87% 0, 100% 15%, 96% 100%, 4% 96%); }
.fold-corner { position: absolute; right: 0; top: 0; z-index: 4; width: 116px; height: 116px; border: 0; background: linear-gradient(135deg, rgba(185,170,142,.2), rgba(255,255,255,.76)); clip-path: polygon(0 0, 100% 0, 100% 100%); color: #4A263F; cursor: pointer; font-size: 11px; font-family: var(--mono); }
.doubt-sheet.opened .fold-corner { transform: rotateX(58deg) rotateZ(-9deg); transform-origin: top right; }
.doubt-shadow { position: absolute; left: 10vw; bottom: 18vh; font-family: var(--fraunces); font-size: clamp(2rem,5vw,5.8rem); color: rgba(168,202,216,.2); transform: scaleY(-1); filter: blur(1px); }
.crease-map span { position: absolute; width: 52vw; height: 1px; background: rgba(185,170,142,.32); transform-origin: center; }
.crease-map span:nth-child(1){left:16vw;top:34vh;transform:rotate(24deg)}.crease-map span:nth-child(2){left:25vw;top:54vh;transform:rotate(-18deg)}.crease-map span:nth-child(3){left:8vw;top:68vh;transform:rotate(5deg)}

.threaded { background: radial-gradient(circle at 48% 52%, rgba(168,202,216,.1), transparent 44%); }
.thread-lines { position: absolute; inset: 12vh 7vw; width: 86vw; height: 76vh; }
.thread-path { fill: none; stroke: #A8CAD8; stroke-width: 2.1; stroke-linecap: round; stroke-dasharray: 10 12; filter: drop-shadow(0 0 8px rgba(168,202,216,.24)); }
.thread-path.second { stroke: rgba(168,202,216,.58); }
.thread-sheet { margin: 16vh 0 0 8vw; width: min(580px, 52vw); transform: rotate(1.6deg); --tilt: 1.6deg; }
.scraps { position: absolute; right: 8vw; top: 18vh; list-style: none; margin: 0; padding: 0; display: grid; gap: 7vh; }
.scraps li { color: #091017; background: rgba(243,232,210,.86); border: 1px solid rgba(185,170,142,.6); padding: 14px 22px; box-shadow: 0 18px 44px rgba(0,0,0,.25); transform: rotate(var(--r)); font-family: var(--mono); }
.scraps li:nth-child(1){--r:-6deg}.scraps li:nth-child(2){--r:4deg}.scraps li:nth-child(3){--r:-2deg}.scraps li:nth-child(4){--r:7deg}

.repair-sheet { margin: 12vh auto 0; width: min(720px, 70vw); min-height: 560px; transform: rotate(-1deg); --tilt: -1deg; clip-path: polygon(2% 0, 98% 3%, 94% 100%, 0 94%); }
.gold-seam { position: absolute; z-index: 4; height: 3px; background: #C99A3E; box-shadow: 0 0 18px rgba(201,154,62,.55); transform-origin: left; }
.seam-one { left: 18%; top: 44%; width: 64%; transform: rotate(-11deg); }
.seam-two { left: 34%; top: 42%; width: 33%; transform: rotate(66deg); }
.seam-three { left: 22%; top: 66%; width: 45%; transform: rotate(16deg); }
.pressed-ginkgo { position: absolute; left: 13vw; bottom: 12vh; width: 190px; height: 190px; opacity: .34; background: radial-gradient(ellipse at 50% 100%, transparent 18%, rgba(185,170,142,.7) 19% 62%, transparent 63%); clip-path: polygon(50% 100%, 8% 28%, 24% 8%, 50% 28%, 76% 8%, 92% 28%); }

.clear { display: grid; place-items: center; color: #091017; }
.clear-sheet { width: min(620px, 76vw); min-height: 72vh; display: grid; align-content: center; text-align: center; transform: rotate(.2deg); --tilt: .2deg; box-shadow: 0 0 90px rgba(168,202,216,.35), 0 30px 70px rgba(9,16,23,.2); }
.clear-sheet strong { position: relative; z-index: 3; display: block; margin-top: 3vh; font-family: var(--serif-kr); font-size: clamp(2rem, 5vw, 5.6rem); font-weight: 400; color: #223955; }
.final-seam { position: absolute; left: 48%; top: 8%; width: 2px; height: 84%; background: linear-gradient(#C99A3E, transparent 28%, #C99A3E 58%, transparent); opacity: .62; }
.bell-pulse { position: absolute; width: min(56vw, 520px); aspect-ratio: 1; border: 1px solid rgba(168,202,216,.6); border-radius: 50%; animation: bellPulse 4s ease-in-out infinite; }
.scrap-gathering span { position: absolute; color: rgba(74,38,63,.34); font-family: var(--mono); animation: gather 7s ease-in-out infinite alternate; }
.scrap-gathering span:nth-child(1){left:22vw;top:18vh}.scrap-gathering span:nth-child(2){left:74vw;top:24vh;animation-delay:-1s}.scrap-gathering span:nth-child(3){left:18vw;top:70vh;animation-delay:-2s}.scrap-gathering span:nth-child(4){left:79vw;top:68vh;animation-delay:-3s}.scrap-gathering span:nth-child(5){left:48vw;top:10vh;animation-delay:-4s}

@keyframes sealSoak { 0%,100% { transform: scale(.94); filter: saturate(.9); } 50% { transform: scale(1.08); filter: saturate(1.25); box-shadow: 0 0 28px rgba(216,91,53,.48); } }
@keyframes inkBloom { 0%,100% { transform: scale(.72); opacity: .34; } 50% { transform: scale(1.22); opacity: .66; } }
@keyframes fiberDrift { from { transform: translate3d(-9px,12px,0) rotate(-4deg); } to { transform: translate3d(16px,-18px,0) rotate(7deg); } }
@keyframes moth { 0%,100% { transform: translateY(0) rotate(-12deg); } 50% { transform: translateY(-16px) rotate(14deg); } }
@keyframes bellPulse { 0%,100% { transform: scale(.82); opacity: .14; } 50% { transform: scale(1.12); opacity: .5; } }
@keyframes gather { from { transform: translate3d(-18px,12px,0) rotate(-7deg); } to { transform: translate3d(18px,-18px,0) rotate(9deg); } }

@media (max-width: 760px) {
  .room { padding: 8vh 7vw 12vh; }
  .drying-rack { right: 2px; transform: translateY(-50%) scale(.8); }
  .wet-sheet, .whisper-sheet, .doubt-sheet, .thread-sheet, .repair-sheet { width: 78vw; margin-left: 3vw; }
  .torn-window, .scraps { right: 15vw; top: auto; bottom: 8vh; transform: scale(.75); transform-origin: bottom right; }
  .paper-spine { opacity: .55; }
}
