:root {
  /* Typography compliance vocabulary: IBM Plex Sans JP** sparingly tiny labels Source Serif 4** readable scholarly annotations. */
  --forest-study-green: #123A2A;
  --absinthe-leaf: #7FAE77;
  --inked-ivy: #07130E;
  --champagne-foam: #F3E7C9;
  --rose-annotation: #D58A8A;
  --bottle-glass: #1F6B5A;
  --brass-footnote: #B9975B;
  --serif-display: "Cormorant Garamond", Georgia, serif;
  --serif-body: "Source Serif 4", Georgia, serif;
  --interface: "IBM Plex Sans JP", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--champagne-foam);
  background:
    radial-gradient(circle at 22% 8%, rgba(127, 174, 119, 0.28), transparent 30rem),
    radial-gradient(circle at 85% 18%, rgba(31, 107, 90, 0.34), transparent 34rem),
    linear-gradient(135deg, var(--inked-ivy), var(--forest-study-green) 48%, #06110d);
  font-family: var(--serif-body);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }

.ambient-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.ambient-field::before,
.ambient-field::after {
  content: "";
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 56% 44% 62% 38% / 44% 58% 42% 56%;
  background: linear-gradient(145deg, rgba(31, 107, 90, 0.24), rgba(243, 231, 201, 0.04));
  filter: blur(1px);
  animation: glassDrift 18s ease-in-out infinite alternate;
}

.ambient-field::before { left: -18vw; top: 18vh; }
.ambient-field::after { right: -20vw; bottom: 5vh; animation-delay: -7s; }

.leaf-shadow {
  position: absolute;
  width: 34rem;
  height: 8rem;
  border-radius: 100%;
  background: linear-gradient(90deg, transparent, rgba(127, 174, 119, 0.18), transparent);
  transform: rotate(-28deg);
  animation: leafSlide 24s linear infinite;
}

.leaf-shadow-one { top: 28%; left: -25%; }
.leaf-shadow-two { top: 68%; left: 72%; animation-delay: -11s; }

.condensation-ring {
  position: absolute;
  border: 1px solid rgba(243, 231, 201, 0.12);
  border-radius: 50%;
  opacity: 0.7;
}

.ring-one { width: 16rem; height: 16rem; left: 10%; bottom: 14%; }
.ring-two { width: 24rem; height: 24rem; right: 7%; top: 16%; }

.folio-nav {
  position: fixed;
  top: 1.2rem;
  left: 1.2rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--interface);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(243, 231, 201, 0.68);
}

.folio-nav a:not(.folio-mark) {
  position: relative;
  opacity: 0.72;
}

.folio-nav a:not(.folio-mark)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -0.24rem;
  height: 1px;
  background: var(--brass-footnote);
  transition: right 0.45s ease;
}

.folio-nav a:hover::after { right: 0; }

.folio-mark {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  color: var(--inked-ivy);
  background: rgba(243, 231, 201, 0.88);
  border: 1px solid rgba(185, 151, 91, 0.8);
  border-radius: 57% 43% 49% 51% / 50% 38% 62% 50%;
  box-shadow: 0 0 32px rgba(243, 231, 201, 0.12);
}

.domain-spine {
  position: fixed;
  right: 1.15rem;
  top: 50%;
  z-index: 18;
  transform: translateY(-50%);
  display: grid;
  gap: 1rem;
  justify-items: center;
  font-family: var(--interface);
  letter-spacing: 0.42em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  color: rgba(243, 231, 201, 0.38);
}

.domain-spine em {
  writing-mode: horizontal-tb;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  background: var(--brass-footnote);
  color: var(--inked-ivy);
  font-style: normal;
  letter-spacing: 0.1em;
}

main { position: relative; z-index: 2; }

.chamber {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(4rem, 0.35fr) minmax(18rem, 46rem) minmax(14rem, 32rem) minmax(2rem, 0.2fr);
  align-items: center;
  gap: clamp(1rem, 4vw, 4rem);
  padding: 7rem clamp(1.3rem, 5vw, 6rem);
  overflow: hidden;
}

.hero {
  place-items: center;
  grid-template-columns: 1fr;
  text-align: center;
}

.glass-blob,
.manuscript-panel,
.specimen-menu,
.bar-tab,
.love-letter {
  border: 1px solid rgba(243, 231, 201, 0.18);
  box-shadow: inset 0 1px 26px rgba(243, 231, 201, 0.08), 0 30px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.hero-blob {
  position: relative;
  width: min(82vw, 58rem);
  min-height: 31rem;
  display: grid;
  place-items: center;
  align-content: center;
  padding: clamp(2rem, 7vw, 6rem);
  background: linear-gradient(140deg, rgba(31, 107, 90, 0.6), rgba(18, 58, 42, 0.42) 60%, rgba(243, 231, 201, 0.08));
  border-radius: 47% 53% 61% 39% / 51% 43% 57% 49%;
}

.archive-label,
.kicker,
.rail-title,
.rail-number,
.side-note,
.menu-line b {
  font-family: var(--interface);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.archive-label,
.kicker {
  margin: 0 0 1rem;
  color: var(--brass-footnote);
  font-size: 0.74rem;
}

h1, h2 {
  margin: 0;
  font-family: var(--serif-display);
  font-weight: 500;
  line-height: 0.95;
}

h1 {
  color: var(--champagne-foam);
  font-size: clamp(5rem, 15vw, 13rem);
  letter-spacing: -0.055em;
  text-shadow: 0 0 40px rgba(243, 231, 201, 0.16);
}

h2 {
  color: var(--champagne-foam);
  font-size: clamp(3rem, 7vw, 7.5rem);
  letter-spacing: -0.045em;
}

.draw-line {
  width: min(28rem, 65vw);
  height: 2px;
  margin: 1.4rem auto 2rem;
  background: linear-gradient(90deg, transparent, var(--champagne-foam), var(--rose-annotation), transparent);
  transform-origin: left;
  animation: underlineDraw 2.2s ease forwards;
}

.hero-copy,
.manuscript-panel p:not(.kicker) {
  max-width: 43rem;
  margin: 0;
  color: rgba(243, 231, 201, 0.8);
  font-size: clamp(1.08rem, 1.8vw, 1.42rem);
  line-height: 1.7;
}

.brass-plaque {
  position: absolute;
  right: clamp(2rem, 8vw, 9rem);
  bottom: 12vh;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(185, 151, 91, 0.84);
  color: var(--inked-ivy);
  font-family: var(--interface);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.bubble-field,
.bubble-field span {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bubble-field span,
.mini-bubble {
  position: absolute;
  display: block;
  width: var(--size, 1rem);
  height: var(--size, 1rem);
  border: 1px solid rgba(243, 231, 201, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(243, 231, 201, 0.42), rgba(127, 174, 119, 0.07) 44%, transparent 70%);
  animation: rise var(--speed, 12s) linear infinite;
  opacity: 0.78;
}

.annotation-rail {
  grid-column: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.7rem;
  color: rgba(243, 231, 201, 0.52);
}

.rail-number {
  color: var(--brass-footnote);
  font-size: 0.72rem;
}

.rail-title {
  writing-mode: vertical-rl;
  font-size: 0.68rem;
}

.manuscript-panel {
  position: relative;
  grid-column: 2;
  padding: clamp(2rem, 4vw, 4rem);
  background: linear-gradient(145deg, rgba(31, 107, 90, 0.44), rgba(7, 19, 14, 0.58));
  border-radius: 32% 68% 58% 42% / 38% 34% 66% 62%;
}

.cream-panel {
  color: var(--inked-ivy);
  background: linear-gradient(145deg, rgba(243, 231, 201, 0.92), rgba(243, 231, 201, 0.7));
}

.cream-panel h2,
.cream-panel p:not(.kicker) { color: var(--inked-ivy); }

.dark-panel {
  background: linear-gradient(135deg, rgba(7, 19, 14, 0.86), rgba(18, 58, 42, 0.72));
}

.underline-text {
  background-image: linear-gradient(transparent 70%, rgba(213, 138, 138, 0.45) 0, rgba(213, 138, 138, 0.45) 88%, transparent 0);
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size 1.4s ease;
}

.underline-text.is-drawn { background-size: 100% 100%; }

.living-footnote {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  margin-top: 1.6rem;
  border: 1px solid var(--brass-footnote);
  border-radius: 50% 50% 44% 56%;
  color: var(--inked-ivy);
  background: var(--champagne-foam);
  cursor: pointer;
}

.living-footnote::after {
  content: "";
  position: absolute;
  right: -0.42rem;
  top: -0.18rem;
  width: 0.74rem;
  height: 1rem;
  border-radius: 80% 0 80% 0;
  background: var(--absinthe-leaf);
  transform: rotate(18deg);
}

.footnote-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }

.note-popover {
  position: fixed;
  z-index: 40;
  max-width: 18rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(185, 151, 91, 0.75);
  border-radius: 1.2rem 1.2rem 1.2rem 0.3rem;
  background: rgba(7, 19, 14, 0.92);
  color: var(--champagne-foam);
  font-family: var(--serif-body);
  line-height: 1.45;
  opacity: 0;
  transform: translateY(0.7rem);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.note-popover.is-visible { opacity: 1; transform: translateY(0); }

.love-letter {
  grid-column: 3;
  min-height: 28rem;
  padding: 3rem;
  border-radius: 59% 41% 46% 54% / 45% 58% 42% 55%;
  background: linear-gradient(160deg, rgba(243, 231, 201, 0.82), rgba(127, 174, 119, 0.22));
  transform: rotate(3deg);
}

.letter-lines i {
  display: block;
  height: 1px;
  margin: 2.1rem 0;
  background: rgba(7, 19, 14, 0.48);
}

.letter-lines i:nth-child(2) { width: 78%; }
.letter-lines i:nth-child(3) { width: 88%; }
.letter-lines i:nth-child(4) { width: 52%; }

.crossed-line {
  position: absolute;
  left: 24%;
  top: 48%;
  width: 44%;
  height: 2px;
  background: var(--rose-annotation);
  transform: rotate(-8deg);
}

.mini-bubble.a { --size: 1.1rem; left: 18%; bottom: 18%; --speed: 8s; }
.mini-bubble.b { --size: 0.72rem; left: 52%; bottom: 28%; --speed: 10s; }
.mini-bubble.c { --size: 1.6rem; right: 20%; bottom: 12%; --speed: 12s; }

.side-note {
  grid-column: 2;
  align-self: end;
  max-width: 17rem;
  padding: 1rem 1.2rem;
  border-left: 1px solid var(--brass-footnote);
  color: rgba(243, 231, 201, 0.72);
}

.side-note p { margin: 0 0 0.35rem; color: var(--brass-footnote); }
.side-note span { font-size: 0.66rem; letter-spacing: 0.14em; }
.chapter-two .manuscript-panel { grid-column: 3; }

.leaf-vein {
  position: absolute;
  right: 1.2rem;
  top: 1rem;
  width: 9rem;
  height: 16rem;
  opacity: 0.18;
  fill: none;
  stroke: var(--forest-study-green);
  stroke-width: 2;
}

.specimen-menu {
  grid-column: 3;
  padding: clamp(1.5rem, 3vw, 3rem);
  border-radius: 43% 57% 35% 65% / 60% 39% 61% 40%;
  background: rgba(243, 231, 201, 0.1);
}

.menu-line {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(243, 231, 201, 0.18);
  color: rgba(243, 231, 201, 0.78);
  font-size: 1.2rem;
}

.menu-line span { font-family: var(--serif-display); font-size: 1.7rem; }
.menu-line.rose span { color: var(--rose-annotation); }

.closing { grid-template-columns: minmax(3rem, 0.35fr) minmax(18rem, 58rem) minmax(2rem, 0.3fr); }

.bar-tab {
  grid-column: 2;
  padding: clamp(2rem, 5vw, 5rem);
  border-radius: 3rem;
  background: linear-gradient(145deg, rgba(243, 231, 201, 0.9), rgba(243, 231, 201, 0.72));
  color: var(--inked-ivy);
}

.bar-tab h2 { color: var(--inked-ivy); }
.bar-tab ul { list-style: none; padding: 0; margin: 2.5rem 0 0; }
.bar-tab li {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(18, 58, 42, 0.2);
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}
.bar-tab em { color: var(--brass-footnote); font-family: var(--interface); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; font-style: normal; }

.reveal-item { opacity: 0; transform: translateY(2.2rem); transition: opacity 1s ease, transform 1s ease; }
.reveal-item.is-visible { opacity: 1; transform: translateY(0); }

.morphing-blob { animation: radiusMorph 12s ease-in-out infinite alternate; }

@keyframes underlineDraw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes radiusMorph {
  0% { border-radius: 47% 53% 61% 39% / 51% 43% 57% 49%; }
  50% { border-radius: 57% 43% 46% 54% / 42% 62% 38% 58%; }
  100% { border-radius: 38% 62% 58% 42% / 59% 45% 55% 41%; }
}
@keyframes glassDrift { to { transform: translate3d(3vw, -4vh, 0) rotate(8deg); } }
@keyframes leafSlide { to { transform: translateX(-120vw) rotate(-28deg); } }
@keyframes rise {
  0% { transform: translateY(8vh) scale(0.85); opacity: 0; }
  12% { opacity: 0.72; }
  100% { transform: translateY(-112vh) scale(1.12); opacity: 0; }
}

@media (max-width: 900px) {
  .folio-nav { right: 1rem; flex-wrap: wrap; gap: 0.7rem; }
  .domain-spine { display: none; }
  .chamber,
  .closing {
    grid-template-columns: 1fr;
    padding: 6rem 1.2rem;
  }
  .annotation-rail,
  .manuscript-panel,
  .chapter-two .manuscript-panel,
  .side-note,
  .specimen-menu,
  .bar-tab,
  .love-letter { grid-column: 1; }
  .annotation-rail { align-self: start; flex-direction: row; }
  .rail-title { writing-mode: horizontal-tb; }
  .love-letter { min-height: 20rem; }
}
