:root {
  --frost: #DDEDEA;
  --petal: #FFF7E8;
  --leaf: #8FBF8B;
  --moss: #24382B;
  --marble: #C7C5BC;
  --brass: #B89B5E;
  --lavender: #C9B8D8;
  --dew: #9ECBD3;
  --glass: rgba(221, 237, 234, 0.58);
  --cream-glass: rgba(255, 247, 232, 0.72);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--moss);
  background:
    radial-gradient(circle at 18% 12%, rgba(158, 203, 211, 0.55), transparent 31rem),
    radial-gradient(circle at 86% 20%, rgba(201, 184, 216, 0.5), transparent 28rem),
    linear-gradient(135deg, var(--frost), var(--petal) 48%, #e9f3ee 100%);
  font-family: "Cormorant Garamond", Georgia, serif;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  z-index: 4;
  background-image:
    radial-gradient(circle, rgba(36, 56, 43, 0.12) 0 1px, transparent 1px),
    linear-gradient(115deg, transparent 0 48%, rgba(255, 255, 255, 0.34) 50%, transparent 52%);
  background-size: 18px 18px, 210px 210px;
  mix-blend-mode: multiply;
}

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

.greenhouse-vines span {
  position: absolute;
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(143, 191, 139, 0.38);
  border-radius: 48% 52% 44% 56%;
  transform: rotate(var(--r, 0deg));
}

.greenhouse-vines span::after {
  content: "✦ ✧ ✦";
  position: absolute;
  color: rgba(143, 191, 139, 0.55);
  font-family: "Noto Serif JP", serif;
  letter-spacing: 1.3rem;
  animation: blossomBob 5s ease-in-out infinite;
}

.greenhouse-vines span:nth-child(1) { top: 9%; left: -5rem; --r: 28deg; }
.greenhouse-vines span:nth-child(2) { top: 44%; right: -6rem; --r: -18deg; }
.greenhouse-vines span:nth-child(3) { bottom: -7rem; left: 23%; --r: 12deg; }
.greenhouse-vines span:nth-child(4) { top: -7rem; right: 18%; --r: 42deg; }

.frost-threshold {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1.25rem, 4vw, 4rem);
  position: relative;
  isolation: isolate;
}

.threshold-bg, .threshold-bg > * { position: absolute; }
.threshold-bg { inset: 0; z-index: -1; overflow: hidden; }

.jasmine-shadow {
  width: min(42vw, 34rem);
  aspect-ratio: 1;
  left: 9%;
  top: 12%;
  opacity: 0.2;
  filter: blur(2px);
  background:
    radial-gradient(ellipse at 50% 14%, var(--leaf) 0 8%, transparent 9%),
    radial-gradient(ellipse at 82% 45%, var(--leaf) 0 10%, transparent 11%),
    radial-gradient(ellipse at 50% 86%, var(--leaf) 0 9%, transparent 10%),
    radial-gradient(ellipse at 16% 46%, var(--leaf) 0 10%, transparent 11%),
    radial-gradient(circle at 50% 50%, var(--brass) 0 7%, transparent 8%);
  animation: blossomBob 7s ease-in-out infinite;
}

.deco-arch {
  border: 1px solid rgba(184, 155, 94, 0.34);
  border-bottom: 0;
  border-radius: 18rem 18rem 0 0;
}
.arch-one { width: 32rem; height: 24rem; right: 9%; top: 8%; }
.arch-two { width: 18rem; height: 14rem; left: 14%; bottom: 12%; }

.ghost-card {
  width: 16rem;
  height: 10rem;
  border: 1px solid rgba(199, 197, 188, 0.65);
  background: rgba(255, 247, 232, 0.42);
  box-shadow: 0 1rem 4rem rgba(36, 56, 43, 0.08);
  border-radius: 1.4rem;
  filter: blur(2px);
}
.ghost-a { left: 18%; top: 60%; transform: rotate(-8deg); }
.ghost-b { right: 15%; top: 45%; height: 16rem; transform: rotate(6deg); }
.ghost-c { left: 52%; top: 13%; width: 11rem; transform: rotate(11deg); }

.glass-pane {
  position: relative;
  width: min(54rem, 92vw);
  min-height: min(76vh, 46rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2rem, 6vw, 6rem);
  overflow: hidden;
  border: 1px solid rgba(184, 155, 94, 0.54);
  border-radius: 42% 42% 2.2rem 2.2rem / 16% 16% 2.2rem 2.2rem;
  background: linear-gradient(145deg, rgba(221, 237, 234, 0.74), rgba(255, 247, 232, 0.42));
  box-shadow: inset 0 0 4rem rgba(255, 255, 255, 0.8), 0 2rem 7rem rgba(36, 56, 43, 0.16);
  backdrop-filter: blur(18px);
}

.glass-pane::before {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(255, 247, 232, 0.72);
  border-radius: inherit;
  background-image:
    linear-gradient(90deg, transparent 49.7%, rgba(184, 155, 94, 0.22) 50%, transparent 50.3%),
    radial-gradient(circle at 30% 28%, rgba(158, 203, 211, 0.33) 0 0.2rem, transparent 0.24rem),
    radial-gradient(circle at 78% 58%, rgba(158, 203, 211, 0.33) 0 0.18rem, transparent 0.22rem);
  pointer-events: none;
}

.frost-wipe {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(105deg, rgba(255, 255, 255, 0.18), rgba(221, 237, 234, 0.78), rgba(255, 247, 232, 0.22)),
    repeating-radial-gradient(circle at 20% 20%, rgba(255,255,255,0.42) 0 1px, transparent 1px 7px);
  transition: transform 1.5s cubic-bezier(.2, .9, .25, 1), opacity 1.5s ease;
  transform-origin: left center;
}

.threshold-cleared .frost-wipe { transform: translateX(115%) rotate(4deg); opacity: 0.18; }

.droplet-field { position: absolute; inset: 0; overflow: hidden; }
.droplet {
  position: absolute;
  width: var(--s);
  height: calc(var(--s) * 1.55);
  left: var(--x);
  top: var(--y);
  border-radius: 50% 50% 56% 56%;
  background: linear-gradient(150deg, rgba(255,255,255,0.75), rgba(158, 203, 211, 0.52));
  box-shadow: inset -2px -3px 6px rgba(36, 56, 43, 0.08), 0 0.2rem 0.8rem rgba(158, 203, 211, 0.32);
  animation: dropletSlide var(--d) ease-in-out infinite;
}

.pane-label, .chapter-kicker, .tile-label, .hour-latch a, .wipe-latch {
  font-family: "Nunito Sans", Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

.pane-label { color: var(--brass); margin: 0 0 1.3rem; z-index: 1; }

h1, h2, .token-face strong {
  font-family: "Limelight", "Cormorant Garamond", serif;
  font-weight: 400;
}

h1 {
  margin: 0;
  z-index: 1;
  font-size: clamp(3.1rem, 11vw, 9rem);
  line-height: 0.9;
  text-align: center;
  color: rgba(36, 56, 43, 0.82);
  text-shadow: 0 2px 0 rgba(255,255,255,0.72), 0 0 1.8rem rgba(255, 247, 232, 0.66);
}

.pane-copy {
  z-index: 1;
  max-width: 34rem;
  text-align: center;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.45;
}

.wipe-latch {
  z-index: 2;
  border: 1px solid rgba(184, 155, 94, 0.78);
  color: var(--moss);
  background: rgba(255, 247, 232, 0.64);
  padding: 0.9rem 1.25rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 0.5rem 1.8rem rgba(184, 155, 94, 0.16);
  transition: transform 0.35s ease, background 0.35s ease;
}
.wipe-latch:hover { transform: translateY(-3px) rotate(-1deg); background: var(--petal); }

.hour-latch {
  position: fixed;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 8;
  display: grid;
  gap: 0.65rem;
  padding: 0.55rem;
  border: 1px solid rgba(184, 155, 94, 0.5);
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.5);
  backdrop-filter: blur(12px);
}
.hour-latch a {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  text-decoration: none;
  color: var(--moss);
  border-radius: 50%;
  background: rgba(221, 237, 234, 0.62);
}

.garden-table {
  position: relative;
  z-index: 1;
  padding: 4rem clamp(1rem, 4vw, 5rem) 7rem;
}

.story-chamber {
  min-height: 82vh;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 6.4rem;
  gap: clamp(1rem, 2vw, 1.6rem);
  max-width: 78rem;
  margin: 0 auto 6rem;
  position: relative;
}

.story-chamber::before {
  content: "";
  position: absolute;
  inset: -2rem;
  border-radius: 3rem;
  background: linear-gradient(145deg, rgba(255, 247, 232, 0.28), rgba(221, 237, 234, 0.22));
  border: 1px solid rgba(255,255,255,0.36);
  pointer-events: none;
}

.midday::before { background: linear-gradient(145deg, rgba(255, 247, 232, 0.48), rgba(143, 191, 139, 0.16)); }
.afternoon::before { background: linear-gradient(145deg, rgba(221, 237, 234, 0.35), rgba(184, 155, 94, 0.12)); }
.evening::before { background: linear-gradient(145deg, rgba(201, 184, 216, 0.34), rgba(255, 247, 232, 0.34)); }

.chapter-card, .tile {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-radius: 1.35rem;
  border: 1px solid rgba(184, 155, 94, 0.38);
  background: var(--glass);
  box-shadow: 0 1.2rem 3rem rgba(36, 56, 43, 0.11), inset 0 1px 0 rgba(255,255,255,0.72);
  backdrop-filter: blur(16px);
}

.chapter-card {
  grid-column: span 3;
  grid-row: span 2;
  padding: clamp(1.5rem, 3vw, 2.3rem);
  background: rgba(255, 247, 232, 0.68);
}
.chapter-card.wide { grid-column: span 4; }
.intro-card { grid-row: span 3; }

.chapter-kicker, .tile-label { color: var(--brass); }
h2 { margin: 0.45rem 0 0.8rem; font-size: clamp(2rem, 4.5vw, 4.5rem); line-height: 0.96; }
h3 { margin: 0.45rem 0 0.7rem; font-size: clamp(1.45rem, 2vw, 2.1rem); line-height: 1; }
p { font-size: 1.28rem; line-height: 1.5; }

.tile {
  grid-column: span 2;
  grid-row: span 2;
  padding: 1.25rem;
  transition: transform 0.42s cubic-bezier(.2, 1.2, .35, 1), box-shadow 0.42s ease;
}
.tile.tall { grid-row: span 3; }
.tile.wide { grid-column: span 3; }
.tile:hover { transform: translateY(-7px) rotate(var(--tilt, -0.4deg)); box-shadow: 0 1.6rem 4rem rgba(36, 56, 43, 0.16); }
.tile::after {
  content: "";
  position: absolute;
  inset: 0.55rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border-color 0.35s ease, clip-path 0.55s ease;
  clip-path: inset(0 100% 0 0);
}
.tile:hover::after { border-color: rgba(184, 155, 94, 0.66); clip-path: inset(0 0 0 0); }

.vellum-slip { background: rgba(221, 237, 234, 0.66); transform: rotate(-1.2deg); }
.marble-token { background: linear-gradient(135deg, rgba(199,197,188,0.76), rgba(255,247,232,0.7)); }
.dew-chart { background: rgba(221, 237, 234, 0.7); transform: rotate(1deg); }
.pressed-quote { background: rgba(255, 247, 232, 0.78); transform: rotate(-2deg); }
.tea-note { background: rgba(255, 247, 232, 0.75); }
.fan-card { background: rgba(221, 237, 234, 0.62); }
.marble-chip { background: rgba(199, 197, 188, 0.68); transform: rotate(1.5deg); }
.sunlight-card { background: rgba(255, 247, 232, 0.74); }
.recipe-scrap { background: rgba(221, 237, 234, 0.58); transform: rotate(-1deg); }
.fall-ledger, .closing-medallion { background: rgba(201, 184, 216, 0.36); }

.petal-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.55rem;
  margin: 1rem 0;
}
.petal-calendar span, .star-field b {
  display: block;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at 50% 50%, var(--brass) 0 12%, transparent 13%),
    radial-gradient(ellipse at 50% 15%, var(--petal) 0 23%, transparent 24%),
    radial-gradient(ellipse at 85% 50%, var(--petal) 0 23%, transparent 24%),
    radial-gradient(ellipse at 50% 85%, var(--petal) 0 23%, transparent 24%),
    radial-gradient(ellipse at 15% 50%, var(--petal) 0 23%, transparent 24%);
  filter: drop-shadow(0 0.12rem 0.1rem rgba(36,56,43,0.12));
  transform: scale(0);
}
.is-visible .petal-calendar span, .is-visible .star-field b { animation: petalPop 0.55s cubic-bezier(.2, 1.55, .35, 1) forwards; animation-delay: calc(var(--i, 1) * 55ms); }

.token-face {
  min-height: 10rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  margin: 0.6rem auto 1rem;
  width: 10rem;
  background:
    radial-gradient(circle, rgba(255,247,232,0.86), rgba(199,197,188,0.72)),
    linear-gradient(45deg, transparent, rgba(36,56,43,0.15), transparent);
  border: 1px solid rgba(184, 155, 94, 0.55);
}
.token-face strong { font-size: 3rem; }
.token-face small { font-family: "Nunito Sans", sans-serif; letter-spacing: 0.12em; text-transform: uppercase; }

.line-viz { width: 100%; height: auto; margin-top: 1rem; overflow: visible; }
.dew-line { fill: none; stroke: var(--brass); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 420; stroke-dashoffset: 420; }
.line-viz circle { fill: rgba(158,203,211,0.8); stroke: var(--petal); stroke-width: 2; transform-origin: center; opacity: 0; }
.is-visible .dew-line { animation: drawLine 1.4s ease forwards; }
.is-visible .line-viz circle { animation: beadPop 0.6s ease forwards; animation-delay: 0.45s; }

.vertical-note {
  position: absolute;
  right: 0.8rem;
  top: 1rem;
  writing-mode: vertical-rl;
  font-family: "Noto Serif JP", serif;
  color: var(--leaf);
}
blockquote p { margin-top: 2.8rem; font-size: 1.7rem; }

.steam-gauge {
  height: 8rem;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 0.55rem;
  margin: 0.5rem 0 1rem;
}
.steam-gauge i {
  display: block;
  width: 2.2rem;
  height: 7rem;
  border: 2px solid var(--dew);
  border-bottom: 0;
  border-radius: 2rem 2rem 0 0;
  transform: scaleY(0.25);
  transform-origin: bottom;
}
.is-visible .steam-gauge i { animation: steamRise 2.4s ease-in-out infinite; animation-delay: calc(var(--i, 1) * 0.2s); }

.fan-chart {
  height: 13rem;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 0.35rem;
  padding: 1rem;
  transform-origin: bottom center;
}
.fan-chart span {
  width: 3.5rem;
  height: var(--h);
  border-radius: 4rem 4rem 0.4rem 0.4rem;
  background: linear-gradient(180deg, rgba(184,155,94,0.78), rgba(143,191,139,0.52));
  border: 1px solid rgba(255,247,232,0.7);
  transform: rotate(var(--r, 0deg)) scaleY(0.08);
  transform-origin: bottom center;
}
.fan-chart span:nth-child(1) { --r: -24deg; }
.fan-chart span:nth-child(2) { --r: -12deg; }
.fan-chart span:nth-child(4) { --r: 12deg; }
.fan-chart span:nth-child(5) { --r: 24deg; }
.is-visible .fan-chart span { animation: fanOpen 0.9s cubic-bezier(.2, 1.35, .35, 1) forwards; animation-delay: calc(var(--i, 1) * 90ms); }

.column-fragment {
  height: 11rem;
  border-radius: 1rem;
  background: repeating-linear-gradient(90deg, rgba(36,56,43,0.1) 0 0.45rem, rgba(255,247,232,0.45) 0.45rem 1.1rem), linear-gradient(135deg, var(--marble), var(--petal));
  border: 1px solid rgba(184,155,94,0.45);
}

.star-field { position: relative; height: 13rem; }
.star-field b { position: absolute; width: 2rem; }
.star-field b:nth-child(1) { left: 8%; top: 15%; }
.star-field b:nth-child(2) { left: 32%; top: 28%; }
.star-field b:nth-child(3) { left: 58%; top: 12%; }
.star-field b:nth-child(4) { left: 77%; top: 46%; }
.star-field b:nth-child(5) { left: 18%; top: 68%; }
.star-field b:nth-child(6) { left: 45%; top: 74%; }
.star-field b:nth-child(7) { left: 66%; top: 70%; }
.star-field b:nth-child(8) { left: 86%; top: 18%; }

.sun-bars { display: grid; gap: 0.65rem; margin: 1rem 0 1.5rem; }
.sun-bars span {
  display: block;
  height: 1.2rem;
  width: 30%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brass), var(--leaf));
  transform: scaleX(0);
  transform-origin: left center;
}
.sun-bars span:nth-child(2) { width: 52%; margin-left: 8%; }
.sun-bars span:nth-child(3) { width: 73%; margin-left: 18%; }
.sun-bars span:nth-child(4) { width: 91%; margin-left: 3%; }
.is-visible .sun-bars span { animation: sunlightGrow 0.9s ease forwards; animation-delay: calc(var(--i, 1) * 130ms); }

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(184, 155, 94, 0.34);
  font-family: "Nunito Sans", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.ledger-row strong { font-family: "Limelight", serif; font-size: 2rem; font-weight: 400; }

.rosette {
  width: 9rem;
  aspect-ratio: 1;
  margin: 0.7rem auto 1.2rem;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--petal), var(--marble), var(--lavender), var(--petal), var(--brass), var(--petal));
  border: 1px solid rgba(184, 155, 94, 0.52);
  animation: tokenClick 4s ease-in-out infinite;
}

.reveal-card { opacity: 0; transform: translateY(2.6rem) scale(0.985); }
.reveal-card.is-visible { animation: cardSettle 0.85s cubic-bezier(.2, 1.35, .32, 1) forwards; }
.tremble { animation: dewTremble 0.42s ease; }

@keyframes cardSettle { 70% { opacity: 1; transform: translateY(-0.35rem) scale(1.005); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes blossomBob { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-0.7rem) rotate(2deg); } }
@keyframes dropletSlide { 0%,100% { transform: translateY(0); } 45% { transform: translateY(2.7rem); } 55% { transform: translateY(2.2rem); } }
@keyframes petalPop { 0% { transform: scale(0) rotate(-18deg); } 70% { transform: scale(1.18) rotate(7deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes beadPop { to { opacity: 1; transform: scale(1.04); } }
@keyframes steamRise { 0%,100% { transform: scaleY(0.35) translateY(0); opacity: 0.56; } 50% { transform: scaleY(1) translateY(-0.5rem); opacity: 0.95; } }
@keyframes fanOpen { to { transform: rotate(var(--r, 0deg)) scaleY(1); } }
@keyframes sunlightGrow { to { transform: scaleX(1); } }
@keyframes tokenClick { 0%,100% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(4deg) scale(1.02); } }
@keyframes dewTremble { 0%,100% { filter: none; } 25% { filter: drop-shadow(0 0 0.55rem rgba(158,203,211,0.8)); } 50% { transform: translateY(-3px) rotate(0.7deg); } }

@media (max-width: 900px) {
  .story-chamber { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: auto; }
  .chapter-card, .chapter-card.wide, .tile, .tile.wide, .tile.tall { grid-column: span 2; grid-row: auto; }
  .hour-latch { top: auto; right: 50%; bottom: 0.8rem; transform: translateX(50%); grid-auto-flow: column; }
}

@media (max-width: 560px) {
  .glass-pane { min-height: 70vh; }
  .story-chamber { display: block; min-height: auto; }
  .chapter-card, .tile { margin-bottom: 1rem; }
  .hour-latch { display: none; }
}
