/* Motion layer for the homepage. Without JS (or with reduced motion) every chapter reads as a still page. */

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

/* the intro: a match flares and the fire is lit */
.intro { position: fixed; inset: 0; z-index: 100; background: var(--night); display: grid; place-content: center; gap: 18px; justify-items: center; color: var(--parch); }
.intro p { font: 400 15px/1 var(--ui); letter-spacing: .3em; text-transform: uppercase; opacity: .8; }
.match { width: 14px; height: 60px; position: relative; }
.match i { position: absolute; left: 50%; bottom: 0; width: 22px; height: 34px; margin-left: -11px; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6d8 0 18%, #ffc463 35%, #e8792f 62%, transparent 72%); filter: blur(.4px); transform-origin: 50% 100%; animation: flame .18s infinite alternate ease-in-out; }
@keyframes flame { from { transform: scale(1, 1) rotate(-2deg); } to { transform: scale(.92, 1.08) rotate(2deg); } }
html.seen .intro, html.no-intro .intro { display: none; }

/* nav + sound */
.nav-r { display: flex; gap: 10px; align-items: center; }
.sound { display: inline-flex; align-items: center; gap: 8px; background: rgba(13, 9, 7, .55); color: var(--parch); border: 1px solid rgba(244, 232, 207, .35); border-radius: 2px; padding: 9px 12px; font: 600 13px/1 var(--ui); cursor: pointer; backdrop-filter: blur(6px); }
.sound .bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.sound .bars i { width: 2px; height: 4px; background: currentColor; }
.sound[aria-pressed="true"] .bars i { animation: eq .9s infinite ease-in-out; }
.sound[aria-pressed="true"] .bars i:nth-child(2) { animation-delay: -.3s; }
.sound[aria-pressed="true"] .bars i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }

/* embers drifting over the whole page, and the firefly cursor */
.embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 15; mix-blend-mode: screen; }
.cursor { position: fixed; left: 0; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; pointer-events: none; z-index: 60; background: #ffd9a0; box-shadow: 0 0 18px 6px rgba(232, 121, 47, .55), 0 0 60px 20px rgba(232, 121, 47, .18); opacity: 0; transition: width .25s, height .25s, margin .25s, opacity .3s; }
.cursor.on { opacity: 1; }
.cursor.big { width: 46px; height: 46px; margin: -23px 0 0 -23px; background: rgba(255, 217, 160, .14); box-shadow: 0 0 0 1px rgba(255, 217, 160, .6), 0 0 40px 10px rgba(232, 121, 47, .25); }
html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor summary { cursor: none; }

/* split headings: words rise from behind a mask; big headings lean with scroll speed */
.rise .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.rise .w > span { display: inline-block; will-change: transform; }
.display { transform: skewY(calc(var(--vel, 0) * .7deg)); will-change: transform; }

/* hero extras */
.scroll-cue { position: absolute; right: clamp(16px, 4vw, 56px); bottom: clamp(18px, 4vh, 40px); display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; font: 600 12px/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; background: var(--night); padding: 12px 10px; }
.scroll-cue i { width: 1px; height: 36px; background: linear-gradient(var(--parch), transparent); animation: cue 1.8s infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }
.write { clip-path: inset(0 100% 0 0); }

/* 2. film: a framed screen that grows to the whole view */
.filmstage { position: relative; height: 200vh; }
.filmpin { --sw: min(64vw, 1000px, calc((100svh - 300px) * 16 / 9)); position: sticky; top: 0; height: 100svh; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(20px, 3vh, 32px); padding-top: 56px; }
.filmcopy { width: var(--sw); display: flex; justify-content: space-between; align-items: end; gap: 12px 40px; flex-wrap: wrap; z-index: 2; }
.filmcopy .lede { max-width: 44ch; margin: 0; }
.filmcopy h2 { font-size: clamp(38px, 4.6vw, 64px); }
.filmstage .screen { position: relative; flex: none; width: var(--sw); aspect-ratio: 16 / 9; transform-origin: 50% 50%; background: #000; box-shadow: 0 0 0 10px var(--night-2), 0 40px 120px rgba(0, 0, 0, .8); transform: rotate(-1deg); }
.filmstage .screen video { width: 100%; height: 100%; object-fit: cover; aspect-ratio: auto; }
.play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: inline-flex; gap: 10px; align-items: center; background: var(--parch); color: var(--night); border: 0; border-radius: 2px; padding: 15px 20px; font: 700 16px/1 var(--ui); cursor: pointer; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.play span { color: var(--berry); }
.filmnote { position: absolute; left: 16px; right: 16px; bottom: 22px; text-align: center; font-size: 13px; color: #fff; }

/* 3. advent: pinned sideways journey */
.advent { position: relative; background: var(--parch); color: var(--ink); }
.advent-pin { height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 80px 0 40px; }
.advent-head { padding: 0 clamp(16px, 6vw, 96px); display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.advent-head h2 { font-size: clamp(36px, 4.6vw, 64px); max-width: 16ch; }
.advent-head .lede { color: var(--ink-soft); margin: 0; max-width: 32ch; }
.track { display: flex; gap: clamp(18px, 3vw, 40px); padding: 0 clamp(16px, 6vw, 96px); will-change: transform; width: max-content; }
.door { width: min(72vw, 560px); flex: none; }
.door .ph { aspect-ratio: 16 / 10; overflow: hidden; background: #1a120c; }
.door .ph img { width: 118%; max-width: none; height: 100%; object-fit: cover; will-change: transform; }
.door .when { display: block; margin-top: 18px; font: 700 14px/1.2 var(--ui); color: var(--berry); letter-spacing: .04em; }
.door h3 { font-size: clamp(26px, 2.6vw, 34px); margin: 6px 0 6px; }
.door p { color: var(--ink-soft); max-width: 40ch; }
.advent-bar { margin: 0 clamp(16px, 6vw, 96px); height: 2px; background: rgba(43, 26, 16, .12); }
.advent-bar i { display: block; height: 100%; width: 100%; background: var(--berry); transform-origin: left; transform: scaleX(0); }

/* 4. whisper: the quote lights as you read; the matching note lights with it */
#quote span { color: rgba(244, 232, 207, .22); transition: color .25s; }
#quote span.lit { color: var(--parch); }
.note-card dd { transition: background .35s, box-shadow .35s; }
.note-card dd.lit { background: linear-gradient(transparent 58%, rgba(232, 121, 47, .4) 58%); }

/* 5. keepsake: a 3D envelope that opens */
.keep { position: relative; height: 240vh; background: transparent; }
/* the pinned frame centres its content, so its top ~quarter is empty: tuck it under the previous chapter's tail */
.keep { margin-top: -22vh; }
.keep-pin { position: sticky; top: 0; height: 100svh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(20px, 5vw, 80px); padding: 0 clamp(16px, 6vw, 96px); overflow: hidden; }
.keep-copy h2 { font-size: clamp(38px, 4.2vw, 60px); }
.kicker { font: 600 12px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ember); margin: 0 0 16px; }
.keep-points { list-style: none; counter-reset: kp; margin: clamp(22px, 3.5vh, 36px) 0 0; padding: 0; display: grid; gap: clamp(12px, 2vh, 18px); max-width: 460px; }
.keep-points li { counter-increment: kp; display: grid; grid-template-columns: 34px 1fr; column-gap: 14px; align-items: baseline; }
.keep-points li::before { content: "0" counter(kp); grid-row: span 2; font: 400 15px/1 var(--display); color: var(--ember); border-top: 1px solid rgba(232, 121, 47, .5); padding-top: 8px; }
.keep-points b { font: 400 clamp(19px, 1.6vw, 22px)/1.25 var(--display); color: var(--parch); }
.keep-points span { font-size: 15px; line-height: 1.45; color: rgba(244, 232, 207, .72); margin-top: 3px; }
.keep-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: clamp(22px, 3.5vh, 36px); max-width: 500px; }
.keep-opts > div { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--rule); background: rgba(244, 232, 207, .03); }
.keep-opts .post { border-color: rgba(232, 121, 47, .55); background: rgba(232, 121, 47, .07); }
.opt-k { font: 600 12px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: rgba(244, 232, 207, .7); }
.opt-p { font: 400 26px/1.15 var(--display); color: var(--parch); }
.opt-d { font-size: 13.5px; line-height: 1.4; color: rgba(244, 232, 207, .7); }
.env { position: relative; width: min(560px, 100%); aspect-ratio: 16 / 10; margin: 0 auto; perspective: 1400px; transform-style: preserve-3d; }
.env-back, .env-front, .env-flap { position: absolute; inset: 0; }
.env-back { background: #e9dcc0; box-shadow: 0 40px 90px rgba(0, 0, 0, .6); }
.env-front { background: linear-gradient(160deg, #f3e8cf, #e4d3b0); clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%); z-index: 3; }
.env-flap { background: linear-gradient(#efe2c5, #ddca a4); background: linear-gradient(#efe2c5, #dccaa4); clip-path: polygon(0 0, 100% 0, 50% 56%); transform-origin: 50% 0; z-index: 4; backface-visibility: visible; }
.env-letter { position: absolute; left: 7%; right: 7%; top: 8%; height: 92%; background: var(--parch); color: var(--ink); padding: 7% 8%; z-index: 2; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.env-letter .hi { font: 400 clamp(18px, 2vw, 24px)/1.2 "Hand", cursive; color: var(--berry); margin-bottom: 10px; }
.env-letter p { font: 400 clamp(14px, 1.4vw, 18px)/1.45 var(--display); }
.env-letter .sig { font: 400 clamp(16px, 1.8vw, 22px)/1.4 "Hand", cursive; color: var(--berry); text-align: right; margin-top: 10px; }
.seal { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -36px 0 0 -32px; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #c23a32, #8e1b1b 60%, #5f0f0f); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); z-index: 5; display: grid; place-items: center; color: #f6d9b8; font-size: 22px; }

/* the full keepsake page: every size is a fraction of the sheet width (--pw), so the whole sheet scales as one.
   (Not cqw: cqw measures the content box, so the sheet's own padding would shrink its own text.) */
.keep-stage { position: relative; height: 92svh; display: grid; place-items: center; }
.keep-stage > * { grid-area: 1 / 1; }
.keepsheet { position: relative; height: min(88svh, 800px); aspect-ratio: 1 / 1.414; max-width: 100%; --pw: calc(min(88svh, 800px) / 1.414); background: radial-gradient(120% 90% at 50% 0, #fbf3e0, #f1e3c4 70%, #e8d5ae); color: var(--ink); padding: calc(var(--pw) * 6.5 / 100) calc(var(--pw) * 8 / 100); box-shadow: 0 40px 100px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(120, 80, 30, .12); z-index: 6; transform-origin: 50% 0; }
.keepsheet p { font: 400 calc(var(--pw) * 2.75 / 100)/1.5 var(--display); margin: 0 0 calc(var(--pw) * 2 / 100); }
.page-head { display: grid; justify-items: center; text-align: center; border-bottom: 1px solid rgba(156, 28, 32, .35); padding-bottom: calc(var(--pw) * 2.4 / 100); margin-bottom: calc(var(--pw) * 3.4 / 100); }
.page-head .from { font: 600 calc(var(--pw) * 1.9 / 100)/1 var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); }
.page-head .who { font: 400 calc(var(--pw) * 6.2 / 100)/1.15 "Hand", cursive; color: var(--berry); margin: calc(var(--pw) * 1.6 / 100) 0 calc(var(--pw) * 1 / 100); }
.page-head .meta { display: flex; justify-content: space-between; width: 100%; font: 400 calc(var(--pw) * 2 / 100)/1 var(--ui); color: var(--ink-soft); }
.keepsheet .hi { font: 400 calc(var(--pw) * 4.8 / 100)/1.3 "Hand", cursive; color: var(--berry); margin-bottom: calc(var(--pw) * 1.6 / 100); }
.keepsheet .close { margin: calc(var(--pw) * 3 / 100) 0 0; text-align: right; }
.keepsheet .sig { font: 400 calc(var(--pw) * 5.6 / 100)/1.3 "Hand", cursive; color: var(--berry); text-align: right; margin: calc(var(--pw) * 0.6 / 100) 0 calc(var(--pw) * 1.4 / 100); }
.keepsheet .ps { font-size: calc(var(--pw) * 2.7 / 100); font-style: normal; color: var(--ink-soft); }
.keepsheet .stamp { position: absolute; right: calc(var(--pw) * 5 / 100); bottom: calc(var(--pw) * 3.5 / 100); width: calc(var(--pw) * 12 / 100); height: calc(var(--pw) * 12 / 100); border: 1.5px solid rgba(156, 28, 32, .55); box-shadow: inset 0 0 0 3px #f1e3c4, inset 0 0 0 4px rgba(156, 28, 32, .4); border-radius: 50%; display: grid; place-content: center; text-align: center; font: 700 calc(var(--pw) * 1.45 / 100)/1.35 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: rgba(156, 28, 32, .6); transform: rotate(12deg); }

/* 6. price sheet tilts toward the pointer */
.tilt { transition: transform .25s ease-out; transform-style: preserve-3d; }

/* 0. arrival: the page opens outside the cabin and flies in through the glowing window */
.stage { height: 440vh; }
.arrive { position: absolute; inset: 0; z-index: 1; background: #0b1220; }
.arrive img, .arrive canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.arrive canvas { opacity: 0; }
html.has-arrive .arrive canvas { opacity: 1; }
.pin > .dim, .pin > .tag, .pin > .scroll-cue, .pin > .letters { z-index: 2; }

/* footer */
footer.site { padding: clamp(56px, 8vh, 88px) 0 32px; border-top: 0; position: relative; background: linear-gradient(var(--night), #080605); }
footer.site::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 121, 47, .55), transparent); }
footer.site .wrap { display: block; }
.foot-top { display: flex; justify-content: space-between; align-items: end; gap: 28px; flex-wrap: wrap; padding-bottom: 44px; border-bottom: 1px solid var(--rule); }
.foot-mark { font: 400 clamp(34px, 4vw, 52px)/1 var(--display); color: var(--parch); text-decoration: none; }
.foot-brand p { margin: 12px 0 0; max-width: 40ch; color: rgba(244, 232, 207, .75); font-size: 15px; }
.foot-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; padding: 40px 0; border-bottom: 1px solid var(--rule); }
.foot-cols h3 { font: 600 12px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--ember); margin: 0 0 16px; }
.foot-cols a, .foot-cols p { display: block; margin: 0 0 10px; font-size: 15px; line-height: 1.45; color: rgba(244, 232, 207, .85); text-decoration: none; }
.foot-cols a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.foot-base { display: flex; gap: 12px 28px; flex-wrap: wrap; align-items: center; padding-top: 24px; font-size: 13px; color: rgba(244, 232, 207, .6); }
.foot-base span:nth-child(2) { flex: 1; min-width: 260px; }
.foot-base .beta { border: 1px solid rgba(244, 232, 207, .35); padding: 4px 9px; font: 600 11px/1 var(--ui); letter-spacing: .18em; text-transform: uppercase; }

@media (max-width: 900px) {
  .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keep-pin { grid-template-columns: 1fr; align-content: center; gap: 28px; }
  .keep-copy { text-align: left; }
  .filmpin { --sw: calc(100vw - 32px); }
}
@media (max-width: 700px) {
  .door { width: 80vw; }
  .scroll-cue { display: none; }
  .sound .lbl { display: none; }
  .keep { height: auto; margin-top: 0; }
  .keep-pin { position: relative; height: auto; padding-top: 56px; padding-bottom: 56px; }
  .keep-stage { height: auto; }
  .env { display: none; }
  .keepsheet { --pw: calc(100vw - 32px); height: auto; width: 100%; aspect-ratio: auto; padding-bottom: calc(var(--pw) * 22 / 100); }
  .keep-opts { grid-template-columns: 1fr; }
  .keepsheet p { font-size: max(calc(var(--pw) * 2.7 / 100), 14px); }
  .page-head .from, .page-head .meta, .keepsheet .ps { font-size: 11px; }
  .page-head .meta { flex-direction: column; align-items: center; gap: 4px; }
  .keepsheet .stamp { width: 64px; height: 64px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .intro { display: none; }
  .filmstage, .keep, .north { height: auto; }
  .keep { margin-top: 0; }
  .env, .arrive { display: none; }
  .filmpin, .keep-pin, .north-pin { position: relative; height: auto; min-height: 100svh; }
  .track { flex-wrap: wrap; width: auto; }
  .write { clip-path: none; }
  #quote span { color: var(--parch); }
  .display { transform: none; }
}

/* Snow headings: Snowtop Caps (1001Fonts free-for-commercial-use licence; served unmodified, only converted to woff2).
   Its snow caps are open holes, so a white stroke painted BEHIND the fill packs them with snow and rims each letter. */
.display, .price-sheet .amount, .extras .p, .opt-p, .foot-mark { font-family: "Snowtop", var(--display); font-weight: 400; letter-spacing: .03em; -webkit-text-stroke: .16em #fff; paint-order: stroke fill; }
.display { color: #1a0f0a; line-height: 1.16; }
.display.snow-red { color: #b3262b; }
.price-sheet .amount, .extras .p, .opt-p { color: var(--ember); -webkit-text-stroke-width: .12em; }
.extras .p, .opt-p { -webkit-text-stroke-width: .07em; font-size: 28px; }
.price-sheet .amount small { -webkit-text-stroke: 0; letter-spacing: 0; }
footer.site .foot-mark { color: #1a0f0a; -webkit-text-stroke-width: .13em; }
/* SplitText masks clip at the glyph box; give the stroke room so the snow isn't sliced off */
.rise > div { padding: .16em .12em; margin: -.16em -.12em; }
/* Browsers that ignore paint-order on HTML text would draw the stroke OVER the letters: keep it hairline there */
@supports not (paint-order: stroke fill) { .display, .price-sheet .amount, .extras .p, .opt-p, .foot-mark { -webkit-text-stroke-width: .02em; } }

/* price card: the posted letter is a toggle on the keepsake row */
.price-sheet .post-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: 600 14px/1.2 var(--ui); color: var(--ink); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: rgba(43, 26, 16, .22); transition: background .2s; flex: none; }
.switch .sw-track i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .sw-track { background: var(--berry); }
.switch input:checked + .sw-track i { transform: translateX(18px); }
.switch input:focus-visible + .sw-track { outline: 2px solid var(--ember); outline-offset: 2px; }
.switch b { color: var(--berry); }
.post-note { margin: -8px 0 18px; font-size: 14px; color: var(--ink-soft); }
.extras h3 { margin-bottom: 4px; }
#amt { display: inline-block; }
