:root {
  /* Design typography trace: Space Grotesk* Grotesk** `miko.bar` first tiny codes Sans* Sans** */
  --washi: #E7D6B0;
  --tea: #B8915B;
  --lacquer: #21140E;
  --umber: #3A2417;
  --seal: #C73A24;
  --brass: #B99A52;
  --cyan: #7DF5FF;
  --violet: #B58CFF;
  --rice: #FFF4D8;
  --display: "Space Grotesk", Inter, Arial, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --jp: "Noto Serif JP", "Hiragino Mincho ProN", serif;
  --micro: "IBM Plex Sans", Inter, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--lacquer);
  color: var(--umber);
  font-family: var(--display);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 244, 216, 0.48), transparent 28%),
    radial-gradient(circle at 78% 52%, rgba(183, 139, 80, 0.35), transparent 38%),
    linear-gradient(108deg, #E7D6B0 0%, #B8915B 58%, #21140E 100%);
}

.grain-layer,
.grain-layer::before,
.grain-layer::after {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.grain-layer {
  z-index: 15;
  opacity: 0.38;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(circle at 20% 30%, rgba(58, 36, 23, 0.15) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(94deg, rgba(255, 244, 216, 0.14) 0 1px, transparent 1px 5px);
}

.grain-layer::before {
  content: "";
  opacity: 0.55;
  background:
    radial-gradient(ellipse at 12% 21%, rgba(58, 36, 23, 0.18), transparent 8%),
    radial-gradient(ellipse at 43% 68%, rgba(199, 58, 36, 0.10), transparent 9%),
    radial-gradient(ellipse at 76% 34%, rgba(58, 36, 23, 0.14), transparent 7%);
}

.grain-layer::after {
  content: "";
  opacity: 0.24;
  background-image: linear-gradient(0deg, transparent 0 94%, rgba(58,36,23,0.2) 95% 96%, transparent 97% 100%);
  background-size: 100% 31px;
}

.lacquer-band {
  position: fixed;
  top: 0;
  left: calc(50% + 13vw);
  width: clamp(76px, 9vw, 132px);
  height: 100vh;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.07), transparent 14%, rgba(0,0,0,0.38) 84%),
    linear-gradient(180deg, #3A2417, #21140E 42%, #0f0906);
  box-shadow: inset 16px 0 36px rgba(255,244,216,0.05), -20px 0 50px rgba(33,20,14,0.34);
}

.lacquer-band span {
  position: absolute;
  top: 8vh;
  left: 50%;
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  font-family: var(--jp);
  letter-spacing: 0.55em;
  color: rgba(231, 214, 176, 0.34);
  font-size: 1rem;
}

.scroll-coordinate {
  position: fixed;
  top: 24px;
  left: 26px;
  z-index: 20;
  font-family: var(--micro);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: rgba(58, 36, 23, 0.72);
  border-left: 2px solid var(--seal);
  padding-left: 10px;
}

.foil-edge {
  position: fixed;
  top: 0;
  right: 19vw;
  width: 2px;
  height: 100vh;
  z-index: 12;
  opacity: 0;
  background: linear-gradient(180deg, transparent, var(--cyan), var(--violet), transparent);
  box-shadow: 0 0 26px var(--cyan), 0 0 42px var(--violet);
  transition: opacity 0.45s ease;
}

.foil-edge.is-lit { opacity: 0.95; }

.archive-scroll { position: relative; z-index: 2; }

.chapter {
  position: relative;
  min-height: 104vh;
  overflow: hidden;
  padding: clamp(32px, 6vw, 90px);
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.78fr);
  align-items: center;
  border-bottom: 1px solid rgba(58, 36, 23, 0.22);
  background:
    linear-gradient(90deg, rgba(255, 244, 216, 0.28), transparent 35%, rgba(33, 20, 14, 0.18)),
    radial-gradient(circle at 20% 20%, rgba(255,244,216,0.38), transparent 30%);
}

.chapter::before {
  content: "";
  position: absolute;
  inset: clamp(16px, 2.2vw, 34px);
  border: 1px solid rgba(58, 36, 23, 0.18);
  box-shadow: inset 0 0 0 8px rgba(255,244,216,0.09);
  pointer-events: none;
}

.chapter::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(58,36,23,0.08) 8.3%, transparent 8.7% 100%),
    repeating-linear-gradient(90deg, transparent 0 88px, rgba(255,244,216,0.06) 89px 90px);
}

.parallax,
[data-speed] { will-change: transform; }

.chapter-door { min-height: 112vh; }

.paper-fibers {
  position: absolute;
  inset: -12% -4%;
  z-index: 1;
  background:
    repeating-linear-gradient(102deg, rgba(58,36,23,0.14) 0 1px, transparent 1px 13px),
    repeating-linear-gradient(8deg, rgba(255,244,216,0.24) 0 1px, transparent 1px 19px);
  opacity: 0.27;
}

.paper-door {
  position: absolute;
  top: 6vh;
  bottom: 6vh;
  width: 46vw;
  z-index: 2;
  background:
    radial-gradient(circle at 20% 12%, rgba(58,36,23,0.12), transparent 7%),
    radial-gradient(circle at 80% 68%, rgba(199,58,36,0.08), transparent 9%),
    linear-gradient(90deg, rgba(255,244,216,0.55), rgba(231,214,176,0.92));
  box-shadow: 0 20px 70px rgba(33,20,14,0.18), inset 0 0 0 1px rgba(58,36,23,0.16);
}

.left-door { left: 0; clip-path: polygon(0 0, 94% 4%, 86% 100%, 0 96%); }
.right-door { right: 0; clip-path: polygon(14% 2%, 100% 0, 100% 96%, 4% 100%); }

.hanging-cord {
  position: absolute;
  top: 0;
  right: 29%;
  z-index: 4;
  width: 3px;
  height: 48vh;
  background: linear-gradient(#C73A24, #7f2117);
  box-shadow: 0 0 0 1px rgba(58,36,23,0.12);
}

.hanging-cord i {
  position: absolute;
  left: 50%;
  bottom: -34px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--seal);
  box-shadow: 0 10px 20px rgba(33,20,14,0.28);
}

.chapter-numeral {
  position: absolute;
  left: clamp(26px, 5vw, 78px);
  top: 14vh;
  z-index: 3;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(5rem, 16vw, 15rem);
  line-height: 0.8;
  color: rgba(58, 36, 23, 0.12);
  letter-spacing: -0.12em;
}

.intro-stamp,
.ledger-panel,
.pour-copy,
.omens-copy,
.receipt {
  position: relative;
  z-index: 5;
  max-width: 690px;
}

.intro-stamp { grid-column: 1 / 2; margin-top: 8vh; }

.micro-label {
  margin: 0 0 18px;
  font-family: var(--micro);
  font-size: clamp(0.68rem, 1.1vw, 0.82rem);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(58, 36, 23, 0.68);
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.075em;
  color: var(--umber);
}

h1 {
  font-size: clamp(5.1rem, 15vw, 15rem);
  line-height: 0.76;
  text-shadow: 0 2px rgba(255,244,216,0.35), 0 -1px rgba(33,20,14,0.25);
  transform: scaleX(var(--stretch, 1));
  transform-origin: left center;
}

h1 span {
  display: inline-block;
  color: var(--seal);
  text-shadow: 0 0 18px rgba(125,245,255,0.38);
}

h2 {
  font-size: clamp(3.4rem, 9vw, 8.4rem);
  line-height: 0.86;
}

.serif-lede {
  margin: 24px 0 0;
  max-width: 540px;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
  line-height: 1.08;
  color: rgba(58, 36, 23, 0.86);
}

.vermilion-seal {
  position: absolute;
  z-index: 6;
  right: 18vw;
  top: 53vh;
  width: clamp(88px, 10vw, 142px);
  height: clamp(88px, 10vw, 142px);
  display: grid;
  place-items: center;
  background: var(--seal);
  color: var(--rice);
  transform: rotate(-8deg);
  box-shadow: 0 18px 35px rgba(33,20,14,0.28), inset 0 0 0 8px rgba(255,244,216,0.1);
  transition: transform 0.7s ease;
}

.vermilion-seal span {
  font-family: var(--jp);
  writing-mode: vertical-rl;
  letter-spacing: 0.14em;
  font-size: 1.5rem;
}

.margin-note {
  position: absolute;
  right: 7vw;
  bottom: 12vh;
  z-index: 5;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  color: rgba(255, 244, 216, 0.74);
  background: rgba(33,20,14,0.52);
  padding: 18px 22px;
}

.chapter-ledger { background-color: var(--washi); }
.folio-back {
  position: absolute;
  inset: 10vh 11vw 8vh 20vw;
  background: rgba(255,244,216,0.35);
  border: 1px solid rgba(58,36,23,0.18);
  transform: rotate(2deg);
  box-shadow: 0 30px 80px rgba(33,20,14,0.18);
}

.ledger-panel {
  grid-column: 1 / 2;
  padding: clamp(26px, 5vw, 70px);
  background: rgba(255,244,216,0.28);
  border-left: 4px solid var(--seal);
  box-shadow: inset 0 0 0 1px rgba(58,36,23,0.14);
}

.offering-lines { margin-top: 34px; }
.offering-lines p {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 18px;
  margin: 0;
  padding: 17px 0;
  border-top: 1px solid rgba(58,36,23,0.22);
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.8rem);
}

.offering-lines span {
  font-family: var(--micro);
  color: var(--seal);
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  padding-top: 7px;
}

.archive-tags {
  position: relative;
  z-index: 5;
  grid-column: 2 / 3;
  justify-self: center;
  display: grid;
  gap: 15px;
  transform: rotate(-3deg);
}

.tag {
  width: min(340px, 34vw);
  padding: 22px 28px;
  background: var(--rice);
  border: 1px solid rgba(58,36,23,0.22);
  box-shadow: 12px 16px 0 rgba(58,36,23,0.11);
  font-family: var(--micro);
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.red-cord {
  position: absolute;
  right: 27vw;
  top: 12vh;
  width: 2px;
  height: 77vh;
  background: var(--seal);
  z-index: 4;
}

.chapter-pour {
  background:
    radial-gradient(circle at 58% 48%, rgba(125,245,255,0.10), transparent 24%),
    radial-gradient(circle at 62% 52%, rgba(181,140,255,0.14), transparent 27%),
    linear-gradient(108deg, #B8915B, #E7D6B0 52%, #21140E 112%);
}

.luminous-counter {
  position: absolute;
  left: 0;
  top: 55%;
  width: 100vw;
  height: 66px;
  background: linear-gradient(90deg, transparent, rgba(255,244,216,0.72), rgba(125,245,255,0.32), rgba(181,140,255,0.2), transparent);
  box-shadow: 0 0 44px rgba(125,245,255,0.20);
}

.glass-stage {
  position: relative;
  z-index: 5;
  grid-column: 2 / 3;
  justify-self: center;
  width: min(360px, 42vw);
  aspect-ratio: 0.68;
}

.glass-silhouette {
  position: absolute;
  inset: 6% 20% 0;
  border: 2px solid rgba(255,244,216,0.64);
  border-top-width: 6px;
  border-radius: 26% 26% 42% 42% / 4% 4% 10% 10%;
  overflow: hidden;
  backdrop-filter: blur(2px);
  box-shadow: inset 0 0 34px rgba(125,245,255,0.16), 0 25px 80px rgba(33,20,14,0.36);
}

.liquid {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 0;
  height: 46%;
  background:
    linear-gradient(120deg, rgba(183,145,91,0.88), rgba(125,245,255,0.25), rgba(181,140,255,0.30), rgba(199,58,36,0.18)),
    linear-gradient(#B99A52, #3A2417);
  border-radius: 50% 50% 0 0 / 18% 18% 0 0;
  animation: liquidTilt 5.8s ease-in-out infinite;
}

.glass-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 18%, rgba(255,244,216,0.28) 28%, transparent 36%, transparent 62%, rgba(125,245,255,0.23) 66%, transparent 72%);
  animation: shinePass 4.4s ease-in-out infinite;
}

.refract-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(125,245,255,0.38);
  box-shadow: 0 0 28px rgba(181,140,255,0.22);
}

.ring-one { inset: 12% -7% 23% -7%; animation: ringDrift 9s ease-in-out infinite; }
.ring-two { inset: 29% -18% 12% 8%; border-color: rgba(181,140,255,0.42); animation: ringDrift 7s ease-in-out reverse infinite; }

.pour-copy { grid-column: 1 / 2; }

.torii-ghost {
  position: absolute;
  right: 8vw;
  top: 11vh;
  z-index: 3;
  font-family: var(--jp);
  font-size: clamp(4rem, 12vw, 11rem);
  color: rgba(125,245,255,0.08);
  text-shadow: 0 0 28px rgba(181,140,255,0.24);
}

.chapter-omens {
  background: linear-gradient(100deg, #21140E 0%, #3A2417 27%, #B8915B 92%);
  color: var(--rice);
}

.chapter-omens h2,
.chapter-omens .serif-lede,
.chapter-omens .micro-label { color: var(--rice); }
.chapter-omens .chapter-numeral { color: rgba(255,244,216,0.10); }

.shelf-shadow {
  position: absolute;
  inset: 9vh 7vw 7vh 38vw;
  background: rgba(33,20,14,0.38);
  border: 1px solid rgba(231,214,176,0.16);
}

.omens-copy { grid-column: 1 / 2; }

.book-shelf {
  position: relative;
  z-index: 5;
  grid-column: 2 / 3;
  align-self: end;
  display: flex;
  align-items: end;
  gap: 10px;
  height: 52vh;
  padding-bottom: 36px;
  border-bottom: 8px solid var(--brass);
}

.book {
  width: clamp(38px, 5.1vw, 68px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 7px 0 16px rgba(0,0,0,0.24), 10px 12px 20px rgba(0,0,0,0.24);
  border: 1px solid rgba(255,244,216,0.18);
}

.book span {
  writing-mode: vertical-rl;
  font-family: var(--serif);
  color: rgba(255,244,216,0.82);
  font-size: 1.1rem;
  letter-spacing: 0.12em;
}

.spine-a { height: 72%; background: #3A2417; }
.spine-b { height: 88%; background: #C73A24; }
.spine-c { height: 62%; background: #B99A52; }
.spine-d { height: 94%; background: #21140E; }
.spine-e { height: 76%; background: #B8915B; }

.catalog-cards {
  position: absolute;
  z-index: 7;
  right: 9vw;
  top: 15vh;
  display: grid;
  gap: 14px;
}

.catalog-card {
  width: min(360px, 38vw);
  padding: 18px 20px;
  background: var(--rice);
  color: var(--umber);
  border: 1px solid rgba(58,36,23,0.22);
  box-shadow: -10px 12px 0 rgba(33,20,14,0.18);
}

.catalog-card b {
  display: block;
  font-family: var(--display);
  color: var(--seal);
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.catalog-card span {
  font-family: var(--serif);
  font-size: 1.25rem;
}

.chapter-bell {
  background: linear-gradient(115deg, #E7D6B0 0%, #B8915B 42%, #3A2417 82%, #21140E 100%);
}

.darkening-paper {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 52% 34%, transparent 0 20%, rgba(33,20,14,0.45) 82%);
}

.bell-wrap {
  position: relative;
  z-index: 5;
  grid-column: 2 / 3;
  justify-self: center;
  width: 210px;
  height: 360px;
}

.bell-cord {
  position: absolute;
  left: 50%;
  top: 0;
  width: 3px;
  height: 180px;
  background: var(--seal);
}

.bell {
  position: absolute;
  left: 50%;
  top: 165px;
  width: 152px;
  height: 126px;
  transform: translateX(-50%);
  transform-origin: 50% -90px;
  border-radius: 54% 54% 42% 42% / 58% 58% 35% 35%;
  background: linear-gradient(120deg, #FFF4D8, #B99A52 34%, #6f4b20 72%, #B99A52);
  box-shadow: inset -18px -12px 28px rgba(33,20,14,0.36), 0 22px 48px rgba(33,20,14,0.42);
}

.bell::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -13px;
  height: 28px;
  border-radius: 50%;
  background: #B99A52;
  border: 2px solid rgba(58,36,23,0.38);
}

.bell span {
  position: absolute;
  left: 50%;
  bottom: -35px;
  width: 22px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--umber);
}

.bell.is-swinging { animation: bellSwing 1.8s cubic-bezier(.2,.7,.15,1) both; }

.receipt {
  grid-column: 1 / 2;
  background: rgba(255,244,216,0.32);
  padding: clamp(28px, 5vw, 68px);
  border: 1px solid rgba(58,36,23,0.22);
}

.final-wordmark {
  margin-top: 40px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.4rem, 8vw, 7rem);
  letter-spacing: -0.08em;
  color: rgba(33,20,14,0.82);
  filter: blur(var(--dissolve, 0px));
  opacity: var(--receiptOpacity, 1);
}

.receipt-stamp {
  position: absolute;
  right: clamp(22px, 4vw, 56px);
  bottom: clamp(22px, 4vw, 56px);
  width: 116px;
  height: 116px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 4px solid var(--seal);
  color: var(--seal);
  font-family: var(--micro);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: rotate(8deg);
}

@keyframes liquidTilt {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(5px); }
}

@keyframes shinePass {
  0%, 100% { transform: translateX(-20%); opacity: 0.42; }
  50% { transform: translateX(18%); opacity: 0.9; }
}

@keyframes ringDrift {
  0%, 100% { transform: translate3d(-4px, 0, 0) scale(0.98); }
  50% { transform: translate3d(12px, -14px, 0) scale(1.04); }
}

@keyframes bellSwing {
  0% { transform: translateX(-50%) rotate(0); }
  18% { transform: translateX(-50%) rotate(12deg); }
  42% { transform: translateX(-50%) rotate(-9deg); }
  70% { transform: translateX(-50%) rotate(4deg); }
  100% { transform: translateX(-50%) rotate(0); }
}

@media (max-width: 820px) {
  .chapter {
    grid-template-columns: 1fr;
    padding: 72px 24px;
  }

  .lacquer-band { left: auto; right: 0; opacity: 0.72; }
  .intro-stamp,
  .ledger-panel,
  .pour-copy,
  .omens-copy,
  .receipt,
  .glass-stage,
  .book-shelf { grid-column: 1 / 2; }
  .archive-tags { grid-column: 1 / 2; justify-self: start; margin-top: 28px; }
  .tag,
  .catalog-card { width: min(100%, 360px); }
  .catalog-cards { position: relative; right: auto; top: auto; grid-column: 1 / 2; margin-top: 28px; }
  .glass-stage { width: min(280px, 72vw); margin: 32px auto 0; }
  .book-shelf { height: 34vh; margin-top: 32px; }
  .bell-wrap { grid-column: 1 / 2; margin-top: 22px; }
  .vermilion-seal { right: 10vw; }
}
