:root {
  color-scheme: dark;
  background: #25142f;
  color: #fff5e7;
  font: 100% system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
a:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #fff1ad; outline-offset: 5px; }
.track { position: relative; --run: 380svh; }
.stage { height: 100svh; min-height: 31rem; position: relative; overflow: clip; isolation: isolate; }
.visuals, .sky, .reading-shade { position: absolute; inset: 0; pointer-events: none; }
.visuals { z-index: -2; background: #332455 url('./art/master.webp') center / cover no-repeat; }
.sky, .islands, .cloud, .balloon, .castle, .river, .foreground { display: none; position: absolute; }
.motion .sky, .motion .islands, .motion .cloud, .motion .balloon, .motion .castle, .motion .river, .motion .foreground { display: block; }
.motion .visuals { background-image: none; }
.sky { background: #332455 url('./art/sky.webp') center / cover; inset: -2%; transform: translateX(var(--sky-offset, 0px)); }
.islands { inset: 0; }
.island { position: absolute; width: var(--size); transform: translateX(var(--offset, 0px)) scale(var(--scale, 1)); transform-origin: 65% 80%; }
.island-far { --size: 10%; left: 82%; top: 23%; opacity: .77; }
.island-middle { --size: 12%; left: 28%; top: 47%; }
.island-garden { --size: 17%; left: 46%; top: 41%; }
.cloud, .balloon { transform: translateX(var(--offset, 0px)); }
.cloud img, .balloon img, .castle img { display: block; width: 100%; height: auto; }
.cloud-high { width: 24%; left: 23%; top: 34%; opacity: .78; }
.cloud-low { width: 34%; left: -6%; top: 54%; opacity: .84; }
.balloon { width: 10.5%; left: 42%; top: 13%; }
.motion .cloud-high img { animation: drift 20s ease-in-out infinite alternate; }
.motion .cloud-low img { animation: drift 16s ease-in-out infinite alternate-reverse; }
.motion .balloon img { animation: float 10s ease-in-out infinite; }
.castle, .river, .foreground { left: 0; top: 0; }
.castle { width: var(--castle-width, 54vw); transform-origin: 0 0; transform: translate(var(--castle-x, 52vw),var(--castle-y, 7svh)) scale(var(--castle-scale, 1)); }
.cascade { position: absolute; inset: 0; clip-path: polygon(47% 51%,50% 51%,47% 59%,45% 79%,45% 93%,34% 96%,29% 93%,32% 77%,35% 59%); overflow: hidden; mix-blend-mode: screen; opacity: .53; }
.cascade::before { content: ""; position: absolute; inset: -22% 0; background: repeating-linear-gradient(166deg,transparent 0 7%,#f0e0ff76 11%,transparent 17% 23%); animation: fall 2.8s linear infinite; }
.river { width: 100%; height: 100%; mask-image: linear-gradient(transparent 0,transparent var(--river-top,55%),black calc(var(--river-top,55%) + 7%)); }
.river-plane { position: absolute; top: 0; left: 0; width: var(--river-width); height: var(--river-depth); transform-origin: 0 0; will-change: transform; }
.glints { position: absolute; inset: 0; width: 100%; height: 100%; }
.glint { fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-dasharray: 3 37 17 60; animation: glint 5.5s linear infinite; }
.glint-gold { stroke: #ffdfad; opacity: .72; }
.glint-rose { stroke: #ffe4ef; opacity: .55; animation-duration: 7s; }
.foreground { mask-image: linear-gradient(black 0 77%,transparent 100%); width: var(--foreground-width, 48vw); transform-origin: 0 0; transform: translate(var(--foreground-x, -3vw),var(--foreground-y, 53svh)) scale(var(--foreground-scale, 1)); }
.reading-shade { z-index: -1; background: linear-gradient(180deg,#2010339c,transparent 24%,transparent 78%,#2c152b61); }
.stage[data-beat="arrival"] .reading-shade, .track:not(.motion) .reading-shade {
  background: linear-gradient(180deg,#211032ad,transparent 24%),linear-gradient(90deg,#261136e6 0%,#2b1848bd 25%,#2b184844 49%,transparent 66%);
}
header { display: flex; justify-content: space-between; align-items: center; gap: .7rem; padding: 1.55rem clamp(1rem,5vw,5rem); }
.plaque { border: 4px double #bd8264; border-radius: 1.3rem; padding: .4rem 1.15rem; background: linear-gradient(#fff1d6,#eeb7b9); color: #692941; box-shadow: 0 .2rem 1rem #260f2e90; font: italic bold clamp(1.35rem,3vw,2.2rem)/1.02 Georgia,serif; text-align: center; white-space: nowrap; }
.plaque small { display: block; margin-top: .18rem; font: 750 .52rem/1.3 system-ui,sans-serif; letter-spacing: .19em; text-transform: uppercase; }
.skip, .chapter { border: 1px solid #efcfaa; background: #281731f7; color: #fff5e7; border-radius: 3rem; padding: .65rem .95rem; font-size: .82rem; text-underline-offset: .22em; }
.intro { position: absolute; left: 8%; top: 27%; width: min(85%, 35rem); }
.eyebrow { margin: 0 0 .85rem; color: #ffe0b9; text-transform: uppercase; letter-spacing: .25em; font-weight: 750; font-size: .75rem; }
h1, h2 { font-family: Georgia,serif; font-weight: 400; }
h1 { margin: 0; font-size: clamp(3rem,8vw,8.4rem); line-height: .87; letter-spacing: -.065em; font-style: italic; color: #fff1ce; text-shadow: 0 3px #7e3e5a,0 4px 22px #331732; }
.lede { max-width: 16rem; font: 1.15rem/1.45 Georgia,serif; margin: 1.2rem 0; }
.action { display: inline-flex; align-items: center; gap: 1rem; min-height: 44px; padding: .65rem 1.1rem; text-decoration: none; background: #f8dbb9; color: #57243d; border: 3px double #ab6f61; border-radius: 2rem; font-size: .9rem; font-weight: 750; }
.action:hover { background: #ffeacc; }
.skip:hover { background: #44264e; }
.chapter { position: absolute; bottom: 1.55rem; left: 50%; transform: translateX(-50%); width: max-content; max-width: 90%; display: none; }
.progress { position: absolute; inset: auto 0 0; height: 3px; background: #ffdeaa; transform-origin: left; transform: scaleX(var(--progress, 0)); }
.beat, .closing { padding: clamp(2.5rem,8vw,6rem) 1.25rem; text-align: center; background: #312039; }
.beat h2, .closing h2 { margin: 0; color: #ffe6c4; font-size: clamp(2rem,6vw,4.4rem); }
.beat p, .closing > p:not(.eyebrow) { max-width: 33rem; margin: 1rem auto 1.5rem; line-height: 1.55; }
.closing { min-height: 62svh; display: grid; align-content: center; justify-items: center; background: radial-gradient(ellipse at top,#542e50,#25142f 66%); border-top: 1px solid #c88985; }
.track:not(.motion) .beat::before { content: ""; display: block; width: min(100%, 29rem); aspect-ratio: 16/8; margin: 0 auto 1rem; background: url('./art/river-small.webp') center / cover; border-radius: 1rem; }
.track:not(.motion) #reveal::before { background: url('./art/castle.webp') center / contain no-repeat; aspect-ratio: 3/2; }
.motion { height: calc(200svh + var(--run)); }
.motion .closing {
  position: absolute;
  inset: calc(100svh + var(--run)) 0 auto;
  min-height: 100svh;
  padding-block: 18svh 8svh;
  border: 0;
  background: linear-gradient(180deg, transparent, #28162eda 29%, #25142ff5 52%, #25142f 100%);
}
.motion .stage { position: sticky; top: 0; min-height: 0; }
.motion .beat { position: absolute; left: 0; right: 0; height: 1px; padding: 0; overflow: clip; background: none; outline: none; }
.motion .beat h2, .motion .beat p { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.motion .beat a { display: none; }
.motion #journey { top: calc(var(--run) * .22); }
.motion #reveal { top: calc(var(--run) * .77); }
.motion [data-beat]:not([data-beat="arrival"]) .intro:not(:focus-within) { visibility: hidden; }
.motion [data-beat]:not([data-beat="arrival"]) .intro:focus-within { background: #2b1a39; padding: 1rem; border-radius: .7rem; }
.motion [data-beat]:not([data-beat="arrival"]) .chapter { display: block; }
.motion [data-ending] .chapter { opacity: 0; }
.motion:has(.beat:focus-visible) .chapter, .track:focus-visible .intro { outline: 3px solid #fff1ad; outline-offset: 6px; }
@keyframes drift { to { transform: translate(9%, -4%); } }
@keyframes float { 50% { transform: translate(11%, -8%) rotate(3deg); } }
@keyframes fall { to { transform: translateY(16%); } }
@keyframes glint { to { stroke-dashoffset: -117; } }
@media (max-aspect-ratio: 4/5) {
  .visuals { background-image: url('./art/master-portrait.webp'); }
  .sky { background-image: url('./art/sky-portrait.webp'); background-position: 57% 53%; }
  header { padding: 1rem; }
  .plaque { font-size: 1.32rem; padding: .42rem .66rem; }
  .intro { left: 1.25rem; top: 15%; width: calc(100% - 2.5rem); }
  h1 { font-size: clamp(3rem,14vw,5rem); }
  .lede { margin: .75rem 0; font-size: 1rem; max-width: 13rem; }
  .stage[data-beat="arrival"] .reading-shade, .track:not(.motion) .reading-shade { background: linear-gradient(180deg,#281538d9 8%,#281538e6 34%,#28153899 44%,transparent 62%); }
  .island-far { --size: 20%; left: 78%; top: 38%; }
  .island-middle { --size: 23%; left: 6%; top: 48%; }
  .island-garden { --size: 39%; left: 8%; top: 56%; }
  .balloon { width: 22%; left: 4%; top: 36%; }
  .cloud-high { width: 55%; left: -6%; top: 42%; }
  .cloud-low { width: 72%; left: -14%; top: 62%; }
}
@media (min-aspect-ratio: 4/5) and (max-height: 660px) {
  .intro { top: 23%; }
  h1 { font-size: clamp(3rem,11svh,6rem); }
}
@media (prefers-reduced-motion: reduce) {
  .visuals *, .visuals *::before { animation: none !important; }
}
.journey-nav { display:flex; justify-content:flex-end; align-items:center; gap:.3rem .45rem; flex-wrap:wrap; }
.journey-nav a,.motion-control { display:inline-flex; align-items:center; justify-content:center; min-height:44px; background:#281731; color:#fff5e7; border:1px solid #efcfaa; border-radius:3rem; padding:.35rem .72rem; font:600 .84rem/1.2 system-ui,sans-serif; white-space:nowrap; text-underline-offset:.25em; }
.motion-control[hidden] { display:none; }
.motion-control { cursor:pointer; }
.motion-control[aria-pressed=true] { color:#281731; background:#fff1ce; }
.motion-control:focus-visible { outline:3px solid #fff1ad; outline-offset:3px; }
.studio-exit { display:block; margin:1.4rem auto 0; width:max-content; max-width:100%; font:600 .95rem/1.4 system-ui,sans-serif; text-underline-offset:.25em; }
@media(max-width:530px){ header{align-items:flex-start;gap:.3rem;padding:.8rem}.journey-nav{max-width:12rem;gap:.2rem}.journey-nav a,.motion-control{font-size:.78rem;padding:.35rem .54rem}.intro{top:20%} }
@media(max-width:360px){.plaque{font-size:1.02rem;padding:.32rem .42rem}.journey-nav{max-width:10.5rem}}
