@font-face {
  font-family: "Starlight Serif";
  src: url("../assets/fonts/cormorant.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Starlight Serif";
  src: url("../assets/fonts/cormorant-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Starlight Kai";
  src: url("../assets/fonts/wenkai.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #080b1a;
  --white: #fbefdf;
  --muted: #c9bbca;
  --gold: #e4c4a0;
  --rose: #efb9cc;
  --line: #e6c9c446;
  --serif: "Starlight Serif", Georgia, serif;
  --brush: "Starlight Kai", "Kaiti SC", STKaiti, KaiTi, "Songti SC", serif;
  --body: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --frame-gutter: clamp(19px, 4.9vw, 86px);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--night); color: var(--white); font: 15px/1.65 var(--body); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 400; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid #fce0aa; outline-offset: 4px; }
[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }

.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: -1; animation: sky-in 1.25s ease-out both;
  background: radial-gradient(ellipse at 72% 37%, #242249, transparent 58%),
              radial-gradient(ellipse at 20% 83%, #19142f, transparent 66%), #080b1a; }
.sky-cloud { position: absolute; inset: -10%; background: url("../assets/images/nebula.webp") center / cover no-repeat; opacity: .84; transition: opacity .85s ease; animation: cloud-drift 37s ease-in-out infinite alternate; }
.sky::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #080b1ad4 1%, #080b1a24 57%, #080b1a42), linear-gradient(0deg, #080b1abd, transparent 23%, transparent 81%, #080b1a91); }
.sky-stars { position: absolute; inset: 0; z-index: 1; }
.sky-stars svg { width: 100%; height: 100%; max-width: none; }
.sky-meteors { position: absolute; inset: 0; z-index: 2; }
.meteor {
  --tail: clamp(34px, 10vw, 53px);
  --travel: clamp(108px, 29vw, 222px);
  --peak: .72;
  position: absolute;
  width: var(--tail);
  height: 1px;
  border-radius: 50%;
  opacity: 0;
  background: linear-gradient(90deg, transparent 4%, #bcaddc72 63%, #fff0d7 100%);
  transform-origin: right center;
  animation: meteor-pass var(--duration) var(--delay) linear both;
}
.meteor::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 3px;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateY(-50%);
  background: #fff0d7;
  box-shadow: 0 0 6px #edc8bbd9;
}
.meteor--bright {
  --tail: clamp(62px, 19vw, 98px);
  --travel: clamp(144px, 38vw, 281px);
  --peak: .91;
  height: 2px;
  background: linear-gradient(90deg, transparent 3%, #d4a9ca8a 62%, #fff2da 100%);
}
.meteor--bright::after { width: 4px; box-shadow: 0 0 9px #ffd5bdea; }
html[data-scene="letter"] .sky-meteors { opacity: .65; }
.star-twinkle { animation: twinkle var(--twinkle-duration) var(--twinkle-delay) ease-in-out infinite; }
html[data-scene="bloom"] .sky-cloud, html[data-scene="meaning"] .sky-cloud { opacity: .49; }
html[data-paused] .sky-cloud, html[data-paused] .star-twinkle,
html[data-paused] .flower-sway, html[data-paused] .falling i,
html[data-paused] .meteor { animation-play-state: paused; }

.shell {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: min(100%, 1760px);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  padding: max(16px, env(safe-area-inset-top)) max(var(--frame-gutter), env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(var(--frame-gutter), env(safe-area-inset-left));
}
.masthead, .colophon { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.masthead { min-height: 67px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; letter-spacing: .18em; font: 400 12px var(--body); letter-spacing: .16em; }
.brand i { color: var(--gold); font: italic 18px/1 var(--serif); letter-spacing: .06em; }
.brand-mark { width: 33px; height: 33px; overflow: visible; fill: none; stroke: var(--gold); stroke-width: .75; }
.brand-mark path { fill: var(--gold); stroke: none; }
.chapters { display: flex; gap: clamp(7px, 2.2vw, 34px); }
.chapters a { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; justify-content: center; color: var(--muted); font: 15px var(--serif); }
.chapters a[aria-current] { color: #f5cda5; }
.chapters a[aria-current]::after { position: absolute; content: ""; bottom: 4px; left: 0; right: 0; height: 1px; background: currentColor; }
.chapter-name { font: 12px var(--body); letter-spacing: .11em; }
#scenes { display: grid; flex: 1; }
.scene { position: relative; min-width: 0; }
.scene.entered { animation: scene-in .39s cubic-bezier(.24,.65,.29,1) both; }
.colophon { min-height: 54px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.chapter-count { display: flex; align-items: center; gap: 9px; font: 15px var(--serif); color: var(--muted); }
.chapter-count b { font-weight: 400; color: var(--gold); }
.chapter-count i { width: 25px; height: 1px; background: var(--line); }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: var(--gold); font-size: 10px; letter-spacing: .25em; line-height: 1.5; }
.diamond { width: 5px; height: 5px; background: var(--gold); transform: rotate(45deg); flex: none; }
.brush { font-family: var(--brush); font-weight: 400; }

.intro { display: grid; align-items: center; grid-template-columns: .9fr 1.1fr; min-height: 620px; padding-block: 20px; }
.intro-copy { grid-area: 1/1; position: relative; z-index: 1; padding-inline-start: clamp(0px, 3vw, 48px); }
.wordmark { font: 400 clamp(85px, 9.55vw, 170px) / .76 var(--serif); letter-spacing: -.059em; margin: 29px 0 26px; }
.wordmark > span, .wordmark em { display: block; }
.wordmark em { position: relative; width: max-content; margin: .07em 0 0 .36em; color: #f2c3d0; font-weight: 400; }
.wordmark-star { position: absolute; color: var(--gold); top: .02em; left: calc(100% + .64em); font: normal .18em var(--serif); }
.intro-dedication { margin-block: 35px 28px; color: #e9d7da; font: 21px/1.5 var(--brush); letter-spacing: .17em; }
.button, .text-button { min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: 13px; border-radius: 999px; font: 13px var(--body); letter-spacing: .09em; cursor: pointer; }
.button:active, .text-button:active { transform: scale(.98); }
.button { border: 1px solid transparent; padding: 0 18px; white-space: nowrap; }
.button--light { background: #f6e5cb; color: #221629; box-shadow: 0 5px 25px #dca6b937; transition: background-color .2s, box-shadow .2s; }
.button--light:hover { background: #fff2dd; box-shadow: 0 5px 29px #dca6b95b; }
.spark-symbol { font-size: 12px; }
.button-arrow { margin-left: 10px; font-size: 16px; line-height: 1; }
.text-button { border: 1px solid var(--line); padding: 0 15px; background: #0c0e2466; color: var(--white); white-space: nowrap; }
.text-button:hover { background: #47335388; }
.intro-art { position: relative; grid-area: 1/2; width: min(100%, 670px); aspect-ratio: 620 / 590; justify-self: center; }
.lunar-glow { position: absolute; inset: 8%; background: radial-gradient(ellipse, #7a5ea051, transparent 64%); }
.lunar-disc { position: absolute; inset: 14% 15.8%; filter: drop-shadow(-9px 5px 22px #cfacd463); }
.lunar-disc img { display: block; width: 100%; height: 100%; object-fit: contain; }
.orbits { position: absolute; inset: 0; width: 100%; color: #ebc9bc; }
.art-star { position: absolute; color: #f3d5b5; text-shadow: 0 0 18px #f9b3bf; line-height: 1; }
.art-star--top { font-size: clamp(17px, 2.2vw, 34px); top: 18%; right: 13.5%; }
.art-star--bottom { font-size: clamp(13px, 1.7vw, 24px); bottom: 21%; left: 17%; }
.noscript { color: var(--muted); text-align: center; margin: 0 0 14px; }

.bloom { display: grid; grid-template-columns: 1fr minmax(280px, 540px) 1fr; grid-template-rows: auto 1fr auto; align-items: center; justify-items: center; padding-block: 26px 19px; }
.bloom-heading { grid-area: 1/1/2/4; text-align: center; z-index: 2; }
.bloom-title { font-size: clamp(36px, 4.2vw, 58px); line-height: 1.15; margin-top: 6px; letter-spacing: .1em; }
.flower-stage { grid-area: 2/2; position: relative; align-self: center; width: min(100%, max(320px, calc(100svh - 391px))); aspect-ratio: 1; isolation: isolate; }
.flower-stage::before { position: absolute; z-index: -2; content: ""; inset: -5%; background: radial-gradient(ellipse, #a16a9b40, #5e457528 43%, transparent 66%); }
.flower { position: relative; width: 100%; height: auto; overflow: visible; }
.flower-orbit { color: #e3bfc582; width: 100%; position: absolute; inset: 0; z-index: -1; }
.bloom-line { z-index: 2; align-self: center; justify-self: center; text-align: center; white-space: nowrap; }
.bloom-line--first { grid-area: 2/1; }
.bloom-line--second { grid-area: 2/3; }
.bloom-line .brush { color: #fbe3c9; font-size: clamp(31px, 4vw, 64px); text-shadow: 0 0 27px #b275a16e; letter-spacing: .06em; line-height: 1.2; margin-top: 4px; }
[data-reveal] { opacity: 0; transform: translateY(8px); visibility: hidden; }
[data-reveal].shown { opacity: 1; transform: none; visibility: visible; transition: opacity 1.05s ease, transform 1.05s ease; }
.bloom-end { grid-area: 3/1/4/4; text-align: center; z-index: 2; }
.bloom-dedication { color: #f4d9d1; font-family: var(--brush); font-size: clamp(16px, 2vw, 23px); margin-bottom: 14px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.falling { position: absolute; inset: 16% 8% 7%; pointer-events: none; overflow: hidden; }
.falling i { visibility: hidden; position: absolute; top: 25%; left: 23%; width: 8px; height: 13px; border-radius: 58% 42% 40% 65%; background: linear-gradient(125deg, #f5cbda, #b06b9c); }
.bloom.is-open .falling i { visibility: visible; animation: petal-fall 9s .7s ease-in-out infinite both; }
.bloom.is-open .falling i:nth-child(2) { left: 70%; animation-delay: 2.4s; animation-duration: 12s; width: 6px; height: 10px; }
.bloom.is-open .falling i:nth-child(3) { left: 53%; animation-delay: 5s; animation-duration: 11s; width: 7px; height: 11px; }
.flower-sway { transform-origin: 49% 94%; animation: sway 7.5s ease-in-out infinite alternate; }


@keyframes scene-in { from { opacity: .42; } to { opacity: 1; } }
@keyframes meteor-pass {
  0% { opacity: 0; transform: rotate(var(--angle)) translateX(0); }
  19% { opacity: var(--peak); }
  60% { opacity: .52; }
  100% { opacity: 0; transform: rotate(var(--angle)) translateX(var(--travel)); }
}
@keyframes sky-in { from { opacity: .22; } to { opacity: 1; } }
@keyframes cloud-drift { from { transform: translate3d(-1.2%, .1%, 0); } to { transform: translate3d(1.7%, -1.2%, 0); } }
@keyframes twinkle {
  0%, 60%, 100% { opacity: var(--star-opacity); }
  77% { opacity: 1; }
}
@keyframes sway { from { transform: rotate(-1.2deg); } to { transform: rotate(1.6deg); } }
@keyframes petal-fall {
  0% { opacity: 0; transform: translate(0, 0) rotate(0); }
  16% { opacity: .64; }
  49% { transform: translate(-24px, 68px) rotate(74deg); }
  80% { opacity: .35; }
  100% { opacity: 0; transform: translate(36px, 180px) rotate(205deg); }
}

@media (max-width: 900px) {
  .masthead { min-height: 57px; }
  .brand { gap: 7px; font-size: 10px; }
  .brand i { font-size: 15px; }
  .brand-mark { width: 28px; height: 28px; }
  .chapters { gap: 0; }
  .chapters a { min-width: 44px; }
  .chapters a[aria-current]::after { left: 10px; right: 10px; }
  .chapter-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .colophon { min-height: 43px; letter-spacing: .08em; font-size: 10px; }
  .intro { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; min-height: 0; padding: 3px 0 24px; }
  .intro-art { grid-area: 1/1; width: min(100%, 42svh, 390px); margin: -3px auto -17px; }
  .intro-copy { grid-area: 2/1; text-align: center; padding: 0; }
  .intro-copy .eyebrow { font-size: 9px; letter-spacing: .2em; }
  .wordmark { width: max-content; max-width: 100%; margin: 19px auto 20px; font-size: clamp(64px, 17.5vw, 116px); text-align: left; }
  .wordmark em { margin-left: .54em; }
  .intro-dedication { margin-block: 24px 17px; font-size: 18px; }
  .sky::after { background: linear-gradient(0deg, #080b1ad8, #080b1a12 68%, #080b1a6b); }
  .sky-cloud { background-position: 60% 50%; }
  .bloom { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; align-content: center; padding: 16px 0; }
  .bloom-heading { grid-area: 1/1/2/3; }
  .flower-stage { grid-area: 2/1/3/3; width: min(100%, 42svh, 390px); }
  .bloom-line { grid-row: 3; margin-bottom: 10px; }
  .bloom-line--first { grid-column: 1; }
  .bloom-line--second { grid-column: 2; }
  .bloom-line .brush { font-size: clamp(26px, 7.2vw, 43px); }
  .bloom-line .eyebrow { font-size: 9px; letter-spacing: .15em; }
  .bloom-end { grid-area: 4/1/5/3; }
  .bloom-dedication { margin-bottom: 12px; }
}

@media (max-width: 600px) and (max-height: 650px) {
  .intro-art { width: min(100%, 36svh); }
  .intro { padding-bottom: 14px; }
  .intro-dedication { margin-block: 20px 14px; }
  .flower-stage { width: min(100%, 36svh); }
}

@media (max-width: 600px) {
  .masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2px;
    padding-block: 1px 4px;
  }
  .masthead .brand { width: max-content; max-width: 100%; min-height: 29px; }
  .masthead .brand-mark { width: 23px; height: 23px; }
  .chapters { display: grid; grid-template-columns: repeat(6, minmax(44px, 1fr)); }
  .chapters a { border-radius: 8px; font-size: 16px; }
  .chapters a[aria-current] { background: radial-gradient(ellipse at 50% 70%, #b07f6938, #3e30443b 72%); }
  .chapters a[aria-current]::after { inset-inline: 26%; bottom: 6px; box-shadow: 0 0 7px #e6ad7a75; }
  .colophon { gap: 7px; min-height: 48px; }
  .colophon > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chapter-count { flex-shrink: 0; gap: 5px; font-size: 14px; }
  .chapter-count i { width: 13px; }
}

@media (min-width: 620px) and (max-height: 540px) and (orientation: landscape) {
  .shell { padding-block: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-bottom)); }
  .masthead, .colophon { min-height: 43px; }
  .intro { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr; min-height: 0; padding-block: 8px; }
  .intro-art { grid-area: 1/2; width: min(100%, 67svh); margin: 0; }
  .intro-copy { grid-area: 1/1; padding-inline-start: 8%; text-align: left; }
  .wordmark { font-size: clamp(57px, 9vw, 95px); margin: 12px 0 11px; }
  .intro-dedication { margin-block: 15px 12px; }
  .bloom { grid-template-columns: 1fr minmax(205px, 32vw) 1fr; grid-template-rows: auto auto; align-content: center; padding-block: 8px; }
  .bloom-heading { grid-area: 1/1/2/4; }
  .bloom-title { font-size: 33px; }
  .flower-stage { grid-area: 2/2; width: min(100%, max(190px, 48svh)); }
  .bloom-line--first { grid-area: 2/1; align-self: start; margin-top: 24px; }
  .bloom-line--second { grid-area: 2/3; align-self: start; margin-top: 24px; }
  .bloom-line .brush { font-size: clamp(25px, 4vw, 42px); }
  .bloom-end { grid-area: 3/1/4/4; }
  .bloom-dedication { margin-bottom: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .falling { display: none; }
  .sky-meteors { display: none; }
}
