:root {
  --night: #070304;
  --ink: #1c0b0c;
  --wine: #410910;
  --red: #a81732;
  --rose: #e57688;
  --gold: #d9b778;
  --old-gold: #94703c;
  --paper: #eddfc4;
  --paper-shadow: #c9a978;
  --hand: "Caveat", cursive;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "DM Sans", sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; color: var(--paper); background: var(--night); font-family: var(--sans); }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid #ffe1a8; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 50; top: 1rem; left: 1rem; transform: translateY(-200%); padding: .8rem 1rem; color: var(--night); background: var(--paper); border-radius: .25rem; transition: transform .2s; }
.skip-link:focus { transform: translateY(0); }

/* Global atmosphere */
.site-noise { position: fixed; z-index: 30; inset: 0; pointer-events: none; opacity: .12; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }
.star-canvas, .falling-petals { position: fixed; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff3cf; box-shadow: 0 0 7px 2px rgba(255,237,192,.55); animation: twinkle var(--twinkle, 3s) ease-in-out infinite alternate; }
.star--bright { width: 3px; height: 3px; }
.petal { position: absolute; top: -10vh; width: 10px; height: 15px; border-radius: 80% 0 80% 0; background: radial-gradient(ellipse at 25% 25%, #e991a0, #8e1730 70%); opacity: .58; animation: petal-fall var(--fall, 12s) linear infinite; }
@keyframes twinkle { 100% { transform: scale(.32); opacity: .2; } }
@keyframes petal-fall { to { transform: translate3d(var(--drift, 70px), 115vh, 0) rotate(620deg); } }

/* Header */
.site-header { position: absolute; z-index: 20; top: 0; left: 0; display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 1.5rem clamp(1.25rem, 4vw, 4rem); }
.wordmark { color: var(--paper); font-family: var(--serif); font-size: 1.6rem; font-style: italic; font-weight: 600; letter-spacing: -.04em; text-decoration: none; }
.wordmark span { padding-left: .22rem; color: var(--rose); font-size: .9rem; vertical-align: top; }
.header-actions { display: flex; align-items: center; gap: .65rem; }
.sound-toggle, .menu-toggle { display: inline-flex; min-height: 2.5rem; align-items: center; justify-content: center; border: 1px solid rgba(237,223,196,.18); color: rgba(237,223,196,.72); background: rgba(13,4,6,.26); cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.sound-toggle { gap: .42rem; padding: 0 .75rem; border-radius: 10rem; font-family: var(--mono); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; }
.sound-icon { color: var(--gold); font-size: 1rem; }
.sound-toggle:hover, .menu-toggle:hover, .sound-toggle.is-playing { border-color: rgba(217,183,120,.75); color: var(--paper); background: rgba(113, 13, 31, .33); }
.menu-toggle { width: 2.5rem; border-radius: 50%; font-size: 1rem; }

/* Opening scene */
.opening-scene { position: relative; isolation: isolate; display: grid; min-height: max(45rem, 100svh); place-items: center; overflow: hidden; background: radial-gradient(ellipse at 50% 28%, #341020 0%, #120509 36%, #050304 78%); transition: min-height .8s ease; }
.opening-scene::before { position: absolute; z-index: -1; inset: 0; content: ""; opacity: .65; background: radial-gradient(ellipse at 50% 103%, rgba(173,76,29,.47) 0%, rgba(86,25,17,.29) 22%, transparent 48%); }
.table-edge { position: absolute; right: -5%; bottom: -12rem; left: -5%; z-index: -1; height: 27rem; transform: perspective(31rem) rotateX(59deg); border-top: 1px solid rgba(238,177,95,.25); background: repeating-linear-gradient(93deg, rgba(108,45,21,.9) 0 2px, rgba(43,14,12,.9) 2px 19px, rgba(98,35,18,.8) 19px 23px); box-shadow: 0 -2rem 6rem rgba(233,104,30,.18), inset 0 2rem 3rem rgba(255,174,76,.12); }
.night-window { position: absolute; top: 9%; right: clamp(-12rem, -8vw, -4rem); width: min(49vw, 43rem); height: min(64vw, 38rem); overflow: hidden; border: .7rem solid #160b0b; border-radius: 47% 47% 0 0; background: radial-gradient(circle at 25% 25%, #274266, #0d172e 49%, #05060e); box-shadow: 0 0 4rem rgba(0,0,0,.7), inset 0 0 5rem #05050c; }
.night-window::before { position: absolute; inset: 0; content: ""; opacity: .8; background-image: radial-gradient(circle at 16% 24%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 42% 17%, #fff7d6 0 1px, transparent 1.5px), radial-gradient(circle at 78% 37%, #fff 0 1px, transparent 1.5px), radial-gradient(circle at 69% 13%, #fff 0 1px, transparent 1px), radial-gradient(circle at 20% 57%, #fff 0 1px, transparent 1px), radial-gradient(circle at 48% 63%, #fff 0 1px, transparent 1px); background-size: 12rem 10rem; }
.moon { position: absolute; top: 16%; right: 28%; width: clamp(4.5rem, 8vw, 7rem); aspect-ratio: 1; border-radius: 50%; background: #fff1c8; box-shadow: 0 0 3.4rem .9rem rgba(255,235,188,.45); }
.window-cross { position: absolute; z-index: 1; background: rgba(12,8,11,.92); box-shadow: 0 0 3px rgba(255,233,192,.2); }
.window-cross--horizontal { top: 43%; width: 100%; height: .5rem; }
.window-cross--vertical { left: 51%; width: .5rem; height: 100%; }
.candle { position: absolute; bottom: 13%; width: 3.9rem; height: 11.5rem; border-radius: .35rem .35rem .7rem .7rem; background: linear-gradient(90deg, #3d120e, #c07b4c 46%, #6d2115); box-shadow: inset .35rem 0 .6rem rgba(0,0,0,.38), inset -.4rem 0 .8rem rgba(255,239,160,.35), 0 0 2rem rgba(235,115,36,.24); }
.candle--left { left: clamp(7%, 16vw, 19%); transform: scale(.78); transform-origin: bottom; }
.candle--right { right: clamp(6%, 15vw, 18%); transform: scale(.52); transform-origin: bottom; opacity: .78; }
.wick { position: absolute; top: -.75rem; left: calc(50% - 1px); width: 2px; height: .9rem; background: #170b08; }
.flame { position: absolute; top: -3.6rem; left: 50%; width: 2rem; height: 3.5rem; transform: translateX(-50%); transform-origin: bottom center; border-radius: 70% 20% 70% 20%; background: radial-gradient(ellipse at 50% 73%, #fffbd1 0 13%, #ffc15c 25%, #e05215 56%, rgba(209,41,10,.32) 72%); box-shadow: 0 0 2rem .5rem rgba(255,150,42,.42); animation: flicker 1.75s ease-in-out infinite alternate; }
@keyframes flicker { 0%, 100% { transform: translateX(-50%) rotate(-4deg) scaleX(.9); } 50% { transform: translateX(-50%) rotate(6deg) scale(1.08, .94); } }
.intro-copy { position: absolute; z-index: 2; top: 13%; left: clamp(1.5rem, 12vw, 16rem); width: min(38vw, 28rem); color: var(--paper); text-align: center; text-shadow: 0 3px 1rem rgba(0,0,0,.5); }
.ornament { margin: 0 0 1.5rem; color: var(--gold); font-family: var(--mono); font-size: clamp(.48rem, .8vw, .62rem); letter-spacing: .17em; text-transform: uppercase; }
.for-you { margin: 0; color: rgba(237,223,196,.72); font-family: var(--serif); font-size: clamp(2rem, 3.3vw, 3.2rem); font-style: italic; line-height: .7; }
.intro-copy h1 { margin: .15rem 0 1.2rem; color: #f5d4bd; font-family: var(--serif); font-size: clamp(4.4rem, 9.2vw, 9.2rem); font-style: italic; font-weight: 500; letter-spacing: -.075em; line-height: .73; }
.intro-quote { margin: 0; font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.75rem); line-height: 1.18; }
.intro-quote em { color: var(--rose); font-weight: 500; }
.intro-note { max-width: 18rem; margin: 1.1rem auto 0; color: rgba(237,223,196,.63); font-family: var(--hand); font-size: clamp(1.1rem, 1.7vw, 1.45rem); line-height: .94; transform: rotate(-3deg); }
.signature { margin: .9rem 0 0; color: var(--gold); font-family: var(--hand); font-size: 1.5rem; transform: rotate(-4deg); }

/* The leather cover and wax seal */
.closed-diary { position: absolute; z-index: 3; right: clamp(1.75rem, 11vw, 15rem); bottom: 9%; display: grid; width: min(42vw, 31rem); min-height: min(48vw, 29rem); place-content: center; padding: 3rem; overflow: visible; border: 1px solid rgba(217,183,120,.4); border-radius: .6rem 1rem 1rem .55rem; background: radial-gradient(ellipse at 40% 16%, rgba(149,43,45,.65), transparent 39%), repeating-radial-gradient(ellipse at 7% 12%, transparent 0 4px, rgba(0,0,0,.15) 5px 6px), linear-gradient(115deg, #21090b, #60121b 47%, #260609); box-shadow: -1.3rem 1.5rem 3rem rgba(0,0,0,.67), inset 0 0 3rem rgba(0,0,0,.65); color: var(--gold); text-align: center; transition: transform 1.05s cubic-bezier(.2,.8,.2,1), opacity .45s ease; }
.closed-diary::before { position: absolute; top: 0; bottom: 0; left: 6%; width: 1rem; content: ""; border-right: 1px solid rgba(0,0,0,.64); background: rgba(0,0,0,.27); box-shadow: .3rem 0 .45rem rgba(217,183,120,.1); }
.cover-grain { position: absolute; inset: 0; opacity: .45; border-radius: inherit; background-image: radial-gradient(ellipse at 25% 37%, transparent 0 1px, rgba(255,206,153,.14) 1px 2px, transparent 2px 100%), radial-gradient(ellipse at 72% 84%, transparent 0 2px, rgba(0,0,0,.22) 2px 3px, transparent 3px 100%); background-size: 11px 9px, 13px 12px; mix-blend-mode: overlay; }
.cover-frame { position: absolute; inset: 1.25rem; border: 1px solid rgba(217,183,120,.46); border-radius: .2rem .6rem .6rem .2rem; box-shadow: inset 0 0 1.5rem rgba(0,0,0,.45); }
.cover-small, .cover-names, .cover-date, .wax-seal, .seal-hint { position: relative; z-index: 1; }
.cover-small { margin: 0 0 .55rem; font-family: var(--serif); font-size: clamp(.8rem, 1.3vw, 1rem); font-style: italic; }
.cover-names { margin: 0; font-family: var(--serif); font-size: clamp(1.5rem, 2.8vw, 2.75rem); font-weight: 500; line-height: .9; }
.cover-names span { display: block; padding: .35rem; color: var(--rose); font-size: .7em; }
.cover-date { margin: .75rem 0 1.3rem; color: rgba(217,183,120,.84); font-family: var(--mono); font-size: clamp(.45rem, .65vw, .58rem); letter-spacing: .13em; text-transform: uppercase; }
.wax-seal { justify-self: center; display: grid; width: 4.7rem; aspect-ratio: 1; place-content: center; gap: .02rem; border: .2rem solid rgba(255,178,158,.36); border-radius: 50%; color: #ffd2bf; background: radial-gradient(circle at 36% 27%, #e97965 0 5%, #a3192d 38%, #641017 74%); box-shadow: .1rem .35rem .55rem rgba(0,0,0,.5), inset .1rem .1rem .3rem rgba(255,187,156,.6), inset -.25rem -.3rem .3rem rgba(58,4,10,.55); cursor: pointer; font-family: var(--serif); font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; transition: filter .2s, transform .2s; }
.wax-seal:hover { filter: brightness(1.2); transform: rotate(-5deg) scale(1.06); }
.seal-crest { font-size: 1.25rem; line-height: .8; }
.seal-hint { margin: .7rem 0 0; opacity: .65; font-family: var(--mono); font-size: .48rem; letter-spacing: .17em; text-transform: uppercase; }
body.is-open .opening-scene { min-height: 37rem; }
body.is-open .intro-copy { opacity: .42; transform: translateX(-1.2rem); transition: opacity .7s, transform .7s; }
body.is-open .closed-diary { transform: perspective(58rem) rotateY(-82deg) translateX(-15%); opacity: .1; pointer-events: none; transform-origin: left center; }

/* Diary */
.diary-section { position: relative; padding: clamp(5rem, 10vw, 9rem) 1.25rem clamp(4rem, 9vw, 8rem); overflow: hidden; background: radial-gradient(ellipse at 50% 0, rgba(122,18,39,.31), transparent 29rem), linear-gradient(#090304 0%, #140608 28%, #080304 100%); }
.diary-section::before { position: absolute; top: -14rem; left: 50%; width: 50rem; height: 26rem; transform: translateX(-50%); content: ""; opacity: .5; border-radius: 50%; background: radial-gradient(ellipse, rgba(182,43,68,.25), transparent 64%); filter: blur(1rem); }
.diary-heading { position: relative; z-index: 1; max-width: 40rem; margin: 0 auto 3.5rem; text-align: center; }
.eyebrow { margin: 0 0 1rem; color: var(--gold); font-family: var(--mono); font-size: .6rem; letter-spacing: .19em; text-transform: uppercase; }
.diary-heading h2 { margin: 0; color: var(--paper); font-family: var(--serif); font-size: clamp(3rem, 7vw, 6rem); font-weight: 500; letter-spacing: -.055em; line-height: .79; }
.diary-heading h2 em { color: var(--rose); }
.diary-heading > p:last-child { max-width: 28rem; margin: 1.6rem auto 0; color: rgba(237,223,196,.65); font-size: .9rem; line-height: 1.7; }
.chapter-nav { position: relative; z-index: 5; display: flex; width: min(100%, 66rem); margin: 0 auto 1.8rem; justify-content: center; flex-wrap: wrap; gap: .35rem .8rem; }
.nav-chapter { padding: .35rem .1rem; border: 0; border-bottom: 1px solid transparent; color: rgba(237,223,196,.48); background: none; cursor: pointer; font-family: var(--serif); font-size: .98rem; transition: color .2s, border .2s; }
.nav-chapter span { padding-right: .27rem; color: var(--gold); font-family: var(--mono); font-size: .48rem; vertical-align: 2px; }
.nav-chapter:hover, .nav-chapter.is-current { border-color: var(--gold); color: var(--paper); }
.book-wrap { position: relative; width: min(100%, 67rem); margin: auto; padding: 0 1.1rem; }
.book-shadow { position: absolute; right: 6%; bottom: -2rem; left: 6%; height: 4rem; border-radius: 50%; background: rgba(0,0,0,.68); filter: blur(1.5rem); }
.open-book { position: relative; min-height: clamp(31rem, 54vw, 38rem); overflow: hidden; border: 1px solid rgba(217,183,120,.58); border-radius: .25rem 1rem 1rem .25rem; background: #e9dbbf; box-shadow: -1.2rem 1.8rem 3rem rgba(0,0,0,.5), inset 0 0 4rem rgba(92,43,23,.26); }
.open-book::before { position: absolute; z-index: 2; top: 0; bottom: 0; left: 5.7%; width: 1.5rem; transform: translateX(-50%); content: ""; background: linear-gradient(90deg, rgba(52,19,13,.34), rgba(255,247,221,.3) 48%, rgba(62,27,16,.2)); box-shadow: .7rem 0 1.5rem rgba(63,24,13,.18); pointer-events: none; }
.book-spine { position: absolute; z-index: 4; top: 0; bottom: 0; left: 5.7%; width: 2px; background: rgba(82,38,19,.3); box-shadow: .7rem 0 1.7rem rgba(68,25,12,.17); pointer-events: none; }
.diary-page { position: absolute; inset: 0; display: flex; overflow: hidden; flex-direction: column; padding: clamp(2.15rem, 6vw, 4.9rem) clamp(2.1rem, 7.5vw, 7.3rem) clamp(1.7rem, 5vw, 3.6rem) clamp(3.25rem, 9.6vw, 9.1rem); color: #341d16; background: radial-gradient(ellipse at 81% 13%, rgba(255,248,224,.9), transparent 36%), repeating-linear-gradient(1deg, transparent 0 29px, rgba(112,66,38,.06) 30px), linear-gradient(110deg, #cfb88e 0%, #f3e7ce 16%, #eddfc3 78%, #c9aa78 100%); animation: page-in .58s cubic-bezier(.2,.74,.23,1) both; }
.diary-page[hidden] { display: none; }
@keyframes page-in { from { transform: translateX(7%) rotateY(-8deg); opacity: .32; } to { transform: none; opacity: 1; } }
.page-number { position: relative; z-index: 2; margin-bottom: auto; color: #8e5d4d; font-family: var(--mono); font-size: .58rem; letter-spacing: .08em; }
.page-number span { color: rgba(78,45,34,.55); }
.chapter-kicker { position: relative; z-index: 2; margin: 1.2rem 0 .4rem; color: #9d2035; font-family: var(--mono); font-size: .58rem; letter-spacing: .18em; text-transform: uppercase; }
.chapter h3 { position: relative; z-index: 2; max-width: 26rem; margin: 0; color: #311611; font-family: var(--serif); font-size: clamp(3.7rem, 8vw, 6.5rem); font-weight: 500; letter-spacing: -.07em; line-height: .73; }
.chapter h3 em { color: #9f243b; font-weight: 400; }
.page-rule { position: relative; z-index: 2; width: 8rem; height: 1px; margin: 1.3rem 0; background: linear-gradient(90deg, #b88b54, transparent); }
.chapter-copy { position: relative; z-index: 2; max-width: 27rem; margin: 1.25rem 0 .5rem; color: #55342b; font-family: var(--serif); font-size: clamp(1.05rem, 1.8vw, 1.35rem); font-weight: 500; line-height: 1.32; }
.handwritten { position: relative; z-index: 2; margin: auto 0 0; color: #9e3b48; font-family: var(--hand); font-size: clamp(1.25rem, 2.5vw, 1.85rem); line-height: 1; transform: rotate(-3deg); }
.page-corner { position: absolute; right: 0; bottom: 0; width: 4rem; height: 4rem; border-top: 1px solid rgba(99,58,33,.18); border-left: 1px solid rgba(99,58,33,.18); background: linear-gradient(135deg, transparent 48%, rgba(189,153,108,.28) 50%, rgba(255,244,213,.6) 72%); }

/* Real moments, kept like small photographs inside the diary. */
.memory-photo { position: absolute; z-index: 3; margin: 0; padding: .4rem .4rem 1.45rem; border: 1px solid rgba(88,52,31,.16); color: #704a3e; background: #fff9ec; box-shadow: .42rem .7rem 1.2rem rgba(65,33,21,.3); font-family: var(--hand); font-size: .9rem; line-height: .9; pointer-events: none; }
.memory-photo img { display: block; width: 100%; object-fit: cover; filter: saturate(.83) sepia(.11) contrast(.98); }
.memory-photo figcaption { margin: .42rem -.05rem 0; }
.memory-photo--valentine { right: 7%; bottom: 7%; width: clamp(7.6rem, 14vw, 10.5rem); transform: rotate(7deg); }.memory-photo--valentine img { aspect-ratio: .59; }
.memory-photo--april { right: 7%; bottom: 7%; width: clamp(10rem, 18vw, 14rem); transform: rotate(-5deg); }.memory-photo--april img { aspect-ratio: 1.25; }
.memory-photo--river { top: 12%; right: 8%; width: clamp(7rem, 13vw, 9.5rem); transform: rotate(5deg); }.memory-photo--river img { aspect-ratio: .58; }
.memory-photo--love { right: 7%; bottom: 6%; width: clamp(11rem, 21vw, 15.5rem); transform: rotate(4deg); }.memory-photo--love img { aspect-ratio: 1.35; }

/* Chapter personality: Valentine */
.chapter--valentine { background: radial-gradient(circle at 81% 22%, rgba(185,45,63,.2), transparent 28%), repeating-linear-gradient(1deg, transparent 0 29px, rgba(112,66,38,.06) 30px), linear-gradient(110deg, #cfb88e, #f3e7ce 16%, #f3dcc9 74%, #c8927d); }
.heart-scatter { position: absolute; right: 7%; bottom: 8%; width: 16rem; height: 15rem; color: #a31f3a; opacity: .65; }
.heart-scatter i { position: absolute; font-style: normal; font-size: 1.2rem; animation: heart-float 3s ease-in-out infinite alternate; }
.heart-scatter i:nth-child(1) { top: 5%; left: 25%; font-size: 2rem; animation-delay: -.5s; }.heart-scatter i:nth-child(2) { top: 27%; left: 70%; font-size: .8rem; animation-delay: -1.3s; }.heart-scatter i:nth-child(3) { top: 56%; left: 38%; font-size: 1.3rem; animation-delay: -2s; }.heart-scatter i:nth-child(4) { top: 73%; left: 78%; font-size: 1.8rem; animation-delay: -.8s; }.heart-scatter i:nth-child(5) { top: 89%; left: 12%; font-size: .7rem; animation-delay: -1.5s; }
@keyframes heart-float { to { transform: translateY(-.75rem) rotate(10deg); } }

/* Chapter personality: April */
.chapter--april { background: linear-gradient(160deg, #f7e3bb, #f5dab2 48%, #e8b277); }
.chapter--april h3 { color: #783631; }.chapter--april h3 em { color: #bd5744; }
.sunrise { position: absolute; right: -9rem; bottom: -11rem; width: 32rem; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff9d5 0 13%, #f8cf7c 14% 29%, rgba(230,107,61,.48) 30% 31%, transparent 32%); opacity: .88; }
.calendar-date { position: absolute; z-index: 2; top: 11%; right: 13%; display: grid; width: clamp(6.5rem, 15vw, 9rem); aspect-ratio: .81; place-content: center; border: 1px solid rgba(145,66,45,.5); color: #974234; background: rgba(255,247,219,.47); box-shadow: .45rem .5rem 0 rgba(177,84,57,.18); text-align: center; transform: rotate(5deg); }
.calendar-date span, .calendar-date small { font-family: var(--mono); font-size: .55rem; letter-spacing: .15em; }.calendar-date strong { font-family: var(--serif); font-size: clamp(3rem, 7vw, 4.7rem); font-weight: 500; line-height: .75; }

/* Chapter personality: When I knew */
.chapter--stars { color: #dce5f1; background: radial-gradient(circle at 77% 18%, rgba(255,243,183,.18), transparent 20%), radial-gradient(circle at 12% 80%, #1e486e, transparent 35%), #081527; }
.chapter--stars .chapter-kicker, .chapter--stars .page-number { color: #d5ba7d; }.chapter--stars h3 { color: #f0dfbb; }.chapter--stars h3 em { color: #a1c5ed; }.chapter--stars .chapter-copy { color: #dce5f1; }.chapter--stars .handwritten { color: #dcc391; }.chapter--stars .page-corner { border-color: rgba(209,225,248,.2); background: linear-gradient(135deg, transparent 48%, rgba(125,171,209,.24) 50%, rgba(230,237,243,.36) 72%); }
.constellation { position: absolute; top: 11%; right: 8%; width: 16rem; height: 14rem; opacity: .9; }.constellation::before { position: absolute; top: 36%; left: 7%; width: 77%; height: 1px; transform: rotate(24deg); content: ""; background: rgba(235,229,182,.4); box-shadow: 1.9rem 1rem 0 -0.4px rgba(235,229,182,.35), 4rem -1.4rem 0 -.4px rgba(235,229,182,.35); }
.constellation i { position: absolute; width: 5px; aspect-ratio: 1; border-radius: 50%; background: #fffbe1; box-shadow: 0 0 10px #fff0af; }.constellation i:nth-child(1) { top: 34%; left: 8%; }.constellation i:nth-child(2) { top: 43%; left: 31%; }.constellation i:nth-child(3) { top: 15%; left: 57%; }.constellation i:nth-child(4) { top: 55%; left: 77%; }.constellation i:nth-child(5) { top: 84%; left: 46%; }

/* Chapter personality: First date */
.chapter--date { background: linear-gradient(115deg, #cfb588, #f6eacd 50%, #dcc59d); }.chapter--date .chapter-copy { max-width: 28rem; }
.polaroids { position: absolute; z-index: 1; right: 4%; bottom: 5%; width: 16rem; height: 13rem; }.polaroids span { position: absolute; display: grid; width: 9rem; aspect-ratio: .78; place-content: center; padding: .5rem; border: .5rem solid #fff9ed; border-bottom-width: 1.7rem; color: #78574d; background: linear-gradient(135deg, #de9b73, #667890); box-shadow: .25rem .5rem 1rem rgba(70,38,26,.25); font-family: var(--hand); font-size: 1.1rem; line-height: .9; text-align: center; }.polaroids span::before { position: absolute; top: .55rem; right: .55rem; bottom: 1.75rem; left: .55rem; content: ""; border: 1px solid rgba(255,255,255,.3); }
.polaroids span:first-child { right: 4%; transform: rotate(9deg); }.polaroids span:last-child { bottom: 8%; left: 4%; background: linear-gradient(135deg, #9c6674, #dbc16a); transform: rotate(-12deg); }

/* Chapter personality: Ferris wheel */
.chapter--ferris { background: radial-gradient(circle at 73% 27%, rgba(250,201,110,.8) 0 2%, rgba(215,99,57,.33) 3%, transparent 27%), linear-gradient(120deg, #33162d, #773047 58%, #cc704e); }.chapter--ferris .chapter-kicker, .chapter--ferris .page-number { color: #f6d28a; }.chapter--ferris h3 { color: #ffe1b4; }.chapter--ferris h3 em { color: #ffb38b; }.chapter--ferris .chapter-copy { color: #fae0c5; }.chapter--ferris .handwritten { color: #ffd281; }.chapter--ferris .page-corner { border-color: rgba(255,222,182,.25); background: linear-gradient(135deg, transparent 48%, rgba(207,83,62,.4) 50%, rgba(255,212,147,.45) 72%); }
.ferris-wheel { position: absolute; right: 8%; bottom: -11%; width: min(44vw, 24rem); aspect-ratio: 1; border: 2px solid rgba(255,223,158,.56); border-radius: 50%; box-shadow: 0 0 1rem rgba(255,205,118,.35); animation: ferris-turn 42s linear infinite; }.ferris-wheel::before, .ferris-wheel::after { position: absolute; top: 50%; left: 50%; width: 100%; height: 1px; transform: translate(-50%,-50%); content: ""; background: rgba(255,223,158,.45); }.ferris-wheel::after { transform: translate(-50%,-50%) rotate(90deg); }.wheel-hub { position: absolute; z-index: 1; top: 50%; left: 50%; width: .7rem; aspect-ratio: 1; transform: translate(-50%,-50%); border-radius: 50%; background: #ffe2a4; box-shadow: 0 0 .7rem #ffe6af; }.ferris-wheel i { position: absolute; width: .65rem; aspect-ratio: 1; border: 1px solid #ffd983; border-radius: 50%; background: #b54643; }.ferris-wheel i:nth-child(1) { top: -3px; left: calc(50% - .32rem); }.ferris-wheel i:nth-child(2) { top: 23%; right: 4%; }.ferris-wheel i:nth-child(3) { right: -3px; bottom: calc(50% - .32rem); }.ferris-wheel i:nth-child(4) { right: 23%; bottom: 4%; }.ferris-wheel i:nth-child(5) { bottom: -3px; left: calc(50% - .32rem); }.ferris-wheel i:nth-child(6) { bottom: 23%; left: 4%; }
@keyframes ferris-turn { to { transform: rotate(360deg); } }

/* Chapter personality: Riverfront */
.chapter--river { background: radial-gradient(circle at 75% 17%, #ffe8bd 0 6%, rgba(255,225,174,.18) 7%, transparent 20%), linear-gradient(165deg, #122446 0%, #193758 44%, #0b142c 45%, #0d213b 100%); }.chapter--river::after { position: absolute; right: 0; bottom: 0; left: 0; height: 38%; content: ""; opacity: .65; background: repeating-linear-gradient(174deg, transparent 0 13px, rgba(255,233,192,.13) 14px 15px, transparent 16px 25px); }.chapter--river .chapter-kicker, .chapter--river .page-number { color: #e3c379; }.chapter--river h3 { color: #e8e0ce; }.chapter--river h3 em { color: #8cb7dc; }.chapter--river .chapter-copy { color: #d6e1e8; }.chapter--river .handwritten { color: #d8bc84; }.chapter--river .page-corner { border-color: rgba(210,230,245,.2); background: linear-gradient(135deg, transparent 48%, rgba(98,148,183,.35) 50%, rgba(230,232,224,.42) 72%); }
.river-moon { position: absolute; z-index: 1; top: 13%; right: 14%; width: 4.8rem; aspect-ratio: 1; border-radius: 50%; background: #fff1cb; box-shadow: 0 0 2.4rem .4rem rgba(255,231,176,.4); }.river-moon span { position: absolute; top: 5rem; left: -7rem; width: 18rem; height: 15rem; opacity: .45; background: repeating-linear-gradient(177deg, transparent 0 11px, rgba(255,241,193,.35) 12px 13px, transparent 14px 22px); transform: perspective(20rem) rotateX(45deg); }.river-moon i { display: none; }
.fireflies i { position: absolute; z-index: 2; width: 4px; aspect-ratio: 1; border-radius: 50%; background: #fff4a5; box-shadow: 0 0 12px 3px rgba(255,237,119,.66); animation: firefly 3s ease-in-out infinite alternate; }.fireflies i:nth-child(1) { right: 18%; bottom: 29%; }.fireflies i:nth-child(2) { right: 30%; bottom: 15%; animation-delay: -.8s; }.fireflies i:nth-child(3) { right: 6%; bottom: 24%; animation-delay: -1.7s; }.fireflies i:nth-child(4) { right: 39%; bottom: 36%; animation-delay: -2.2s; }.fireflies i:nth-child(5) { right: 25%; bottom: 47%; animation-delay: -.4s; }
@keyframes firefly { to { transform: translate(1rem,-1.2rem); opacity: .2; } }

/* Chapter personality: Things I love */
.chapter--love { background: radial-gradient(circle at 80% 18%, rgba(242,188,135,.35), transparent 31%), linear-gradient(115deg, #d4b68c, #faead1 50%, #e3b5a1); }.chapter--love h3 { color: #4a2420; }.chapter--love h3 em { color: #ae3046; }
.love-reveal { position: relative; z-index: 2; display: flex; min-height: 7rem; align-items: center; justify-content: space-between; gap: 1rem; max-width: 34rem; margin: 1.6rem 0 .2rem; padding: 1.2rem 1.25rem; border: 1px solid rgba(164,48,65,.32); background: rgba(255,247,229,.42); box-shadow: .3rem .4rem 0 rgba(160,64,72,.12); }.love-quote { color: #8f2840; font-family: var(--hand); font-size: clamp(1.55rem, 3.5vw, 2.6rem); line-height: .9; }.love-counter { flex: 0 0 auto; color: #8d6056; font-family: var(--mono); font-size: .54rem; letter-spacing: .08em; }

/* Chapter personality: future + secret */
.chapter--future { background: radial-gradient(ellipse at 66% 6%, #fff7c8 0%, rgba(255,231,160,.56) 16%, transparent 39%), linear-gradient(155deg, #f3d394, #edd0a1 48%, #bccd9c); }.chapter--future h3 { color: #623f2b; }.chapter--future h3 em { color: #aa6444; }.sunbeams { position: absolute; top: 0; right: 2%; width: 28rem; height: 24rem; opacity: .36; background: conic-gradient(from 220deg at 77% 1%, transparent 0deg 8deg, #fffbd5 8deg 13deg, transparent 13deg 24deg, #fffbd5 24deg 30deg, transparent 30deg 43deg, #fffbd5 43deg 48deg, transparent 48deg); }
.future-dreams { position: absolute; z-index: 2; right: 8%; bottom: 10%; display: grid; grid-template-columns: repeat(2, 5.2rem); gap: .5rem; }.future-dreams span { display: grid; width: 5.2rem; aspect-ratio: 1; place-content: center; border: 1px solid rgba(120,77,40,.32); border-radius: 50%; color: #a85c44; background: rgba(255,249,222,.45); box-shadow: .2rem .25rem 0 rgba(106,78,45,.09); font-family: var(--serif); font-size: 1.6rem; text-align: center; }.future-dreams small { display: block; padding-top: .1rem; color: #75513c; font-family: var(--hand); font-size: .9rem; line-height: .8; }.secret-invitation { position: relative; z-index: 3; align-self: flex-start; margin-top: auto; padding: .4rem 0; border: 0; border-bottom: 1px solid #a16145; color: #9d4a40; background: none; cursor: pointer; font-family: var(--serif); font-size: 1rem; font-style: italic; transition: color .2s, letter-spacing .2s; }.secret-invitation:hover { color: #621a28; letter-spacing: .015em; }.secret-invitation span { padding-left: .4rem; }
.chapter--secret { background: radial-gradient(circle at 75% 18%, rgba(255,224,155,.25), transparent 25%), linear-gradient(135deg, #190b14, #3c1020 50%, #11070d); }.chapter--secret .chapter-kicker, .chapter--secret .page-number { color: #d7b676; }.chapter--secret h3 { color: #f1d8bd; }.chapter--secret h3 em { color: #e77b86; }.chapter--secret .page-corner { border-color: rgba(237,208,168,.21); background: linear-gradient(135deg, transparent 48%, rgba(160,49,67,.48) 50%, rgba(252,210,161,.38) 72%); }.secret-stars { position: absolute; top: 12%; right: 10%; color: #f9e0a1; font-size: 1.2rem; letter-spacing: .55rem; text-shadow: 0 0 1.4rem #f8c36a; }.secret-letter { position: relative; z-index: 2; max-width: 31rem; margin-top: 1.5rem; color: #f0d7b7; font-family: var(--hand); font-size: clamp(1.45rem, 3vw, 2.15rem); line-height: .98; }.secret-letter p { margin: 0 0 .85rem; }.letter-signoff { color: var(--rose); text-align: right; transform: rotate(-4deg); }

.book-controls { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.6rem .4rem 0; }.page-control { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .1rem; border: 0; border-bottom: 1px solid rgba(217,183,120,.45); color: var(--paper); background: none; cursor: pointer; font-family: var(--serif); font-size: 1.05rem; font-style: italic; transition: color .2s, border .2s; }.page-control:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }.page-control:disabled { opacity: .32; cursor: not-allowed; }.page-indicator { margin: 0; color: rgba(237,223,196,.6); font-family: var(--mono); font-size: .6rem; letter-spacing: .08em; }.page-indicator i { display: inline-block; width: 1.5rem; height: 1px; margin: 0 .5rem; vertical-align: middle; background: var(--gold); }
.site-footer { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 2.5rem 1.25rem; color: rgba(237,223,196,.42); background: #050303; font-family: var(--mono); font-size: .53rem; letter-spacing: .13em; text-align: center; text-transform: uppercase; }.site-footer strong { color: var(--rose); font-family: var(--serif); font-size: 1rem; font-style: italic; font-weight: 500; letter-spacing: 0; text-transform: none; }.noscript-note { margin: 0; padding: 1rem; color: var(--paper); background: #3d1019; text-align: center; }

/* Menu is a compact chapter overview on small screens. */
body.menu-open .chapter-nav { display: flex; } body.menu-open { overflow: hidden; } body.menu-open .chapter-nav { position: fixed; z-index: 19; top: 4.2rem; right: 1rem; left: 1rem; max-height: calc(100svh - 6rem); padding: 1.1rem; overflow: auto; border: 1px solid rgba(217,183,120,.4); border-radius: .5rem; background: rgba(21,5,9,.96); box-shadow: 0 1rem 3rem rgba(0,0,0,.6); backdrop-filter: blur(12px); }.menu-toggle { display: none; }

@media (max-width: 780px) {
  .site-header { padding: 1.1rem 1.25rem; }.night-window { top: 4.5rem; right: -6rem; width: 22rem; height: 27rem; }.intro-copy { top: 11.5%; left: 50%; width: min(90%, 26rem); transform: translateX(-50%); }.closed-diary { right: 50%; bottom: 7%; width: min(80%, 22rem); min-height: 20rem; padding: 2.4rem 1.8rem; transform: translateX(50%); }.cover-names { font-size: 2rem; } body.is-open .closed-diary { transform: translateX(50%) perspective(58rem) rotateY(-82deg); }.candle--left { bottom: 9%; left: 4%; }.candle--right { right: 1%; bottom: 13%; }.diary-heading { margin-bottom: 2.4rem; }.chapter-nav { display: none; }.menu-toggle { display: inline-flex; }.open-book { min-height: 35rem; }.diary-page { padding: 2rem 1.7rem 1.55rem 3.8rem; }.future-dreams, .polaroids { transform: scale(.78); transform-origin: right bottom; }.chapter--future .chapter-copy, .chapter--date .chapter-copy { max-width: 22rem; }.ferris-wheel { width: 16rem; }.calendar-date { top: 9%; right: 7%; }.constellation { transform: scale(.72); transform-origin: top right; }.heart-scatter { transform: scale(.75); transform-origin: bottom right; }.memory-photo--valentine { transform: rotate(7deg) scale(.72); transform-origin: right bottom; }.memory-photo--april { transform: rotate(-5deg) scale(.7); transform-origin: right bottom; }.memory-photo--river { transform: rotate(5deg) scale(.72); transform-origin: right top; }.memory-photo--love { transform: rotate(4deg) scale(.64); transform-origin: right bottom; }.secret-letter { font-size: 1.6rem; }.site-footer { flex-wrap: wrap; }
}

@media (max-width: 460px) {
  .sound-toggle [data-sound-label] { display: none; }.sound-toggle { width: 2.5rem; padding: 0; border-radius: 50%; }.opening-scene { min-height: 42rem; }.intro-copy { top: 12%; }.intro-copy h1 { font-size: 5.7rem; }.intro-note { font-size: 1.05rem; }.closed-diary { bottom: 5%; min-height: 17.5rem; }.cover-frame { inset: .75rem; }.cover-date { margin-bottom: .8rem; }.wax-seal { width: 4rem; }.seal-hint { margin-top: .4rem; }.candle { transform: scale(.5); }.candle--right { transform: scale(.35); }.diary-section { padding-right: .7rem; padding-left: .7rem; }.book-wrap { padding: 0; }.diary-page { padding: 1.7rem 1.15rem 1.25rem 2.5rem; }.chapter h3 { font-size: 3.8rem; }.chapter-copy { font-size: 1.06rem; }.handwritten { font-size: 1.35rem; }.calendar-date { transform: scale(.73) rotate(5deg); transform-origin: top right; }.polaroids, .future-dreams { opacity: .62; transform: scale(.54); }.memory-photo--valentine { transform: rotate(7deg) scale(.52); }.memory-photo--april { transform: rotate(-5deg) scale(.5); }.memory-photo--river { transform: rotate(5deg) scale(.53); }.memory-photo--love { transform: rotate(4deg) scale(.44); }.ferris-wheel { right: -2.5rem; bottom: -2rem; width: 13rem; opacity: .7; }.river-moon { right: 9%; transform: scale(.75); }.love-reveal { min-height: 6.2rem; }.love-quote { font-size: 1.65rem; }.secret-stars { right: 3%; font-size: .85rem; }.secret-letter { font-size: 1.38rem; }.book-controls { padding-right: .3rem; padding-left: .3rem; }.page-control { font-size: .95rem; }.page-indicator { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Premium responsive polish */
:root {
  --safe-inline: max(1rem, env(safe-area-inset-left));
  --ease-cinematic: cubic-bezier(.22, .72, .2, 1);
  --gold-light: #f1d39a;
  --velvet: #190609;
}

html { background: var(--night); }
body { min-height: 100%; text-rendering: optimizeLegibility; }
img { display: block; max-width: 100%; height: auto; }
button { touch-action: manipulation; }

.site-header {
  padding-top: max(1.1rem, env(safe-area-inset-top));
  padding-right: max(clamp(1rem, 4vw, 4rem), env(safe-area-inset-right));
  padding-left: max(clamp(1rem, 4vw, 4rem), env(safe-area-inset-left));
}

.sound-toggle,
.menu-toggle,
.page-control,
.nav-chapter,
.secret-invitation,
.wax-seal { min-height: 44px; }

.sound-toggle,
.menu-toggle {
  border-color: rgba(241, 211, 154, .24);
  background: linear-gradient(145deg, rgba(58, 15, 25, .42), rgba(8, 3, 4, .5));
  box-shadow: inset 0 1px rgba(255, 244, 217, .06), 0 .5rem 1.5rem rgba(0, 0, 0, .18);
  backdrop-filter: blur(12px) saturate(1.15);
}

.opening-scene {
  min-height: max(46rem, 100svh);
  background:
    radial-gradient(circle at 54% 76%, rgba(168, 58, 28, .16), transparent 26%),
    radial-gradient(ellipse at 50% 28%, #38111f 0%, #130508 38%, #060304 80%);
}

.opening-scene::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .24), transparent 28% 72%, rgba(0, 0, 0, .28));
}

.moon { animation: moon-breathe 5.5s ease-in-out infinite alternate; }
.flame::after {
  position: absolute;
  inset: -2.5rem;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 161, 61, .2), transparent 65%);
  animation: candle-aura 2.2s ease-in-out infinite alternate;
}

.closed-diary {
  transform: translateZ(0) rotate(1.2deg);
  border: 1px solid rgba(241, 211, 154, .2);
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 146, 105, .08), transparent 20%),
    repeating-radial-gradient(ellipse at 70% 40%, rgba(255,255,255,.025) 0 1px, transparent 1px 5px),
    linear-gradient(135deg, #661625 0%, #30070e 46%, #170407 100%);
  box-shadow:
    -1.2rem 1.8rem 3.5rem rgba(0, 0, 0, .62),
    0 0 4rem rgba(145, 30, 40, .16),
    inset 0 0 0 1px rgba(255, 225, 164, .08),
    inset 1rem 0 2rem rgba(255, 131, 93, .05),
    inset -1.2rem -1rem 2rem rgba(0, 0, 0, .34);
  animation: diary-float 5s ease-in-out infinite;
  will-change: transform;
}

.cover-grain { opacity: .3; mix-blend-mode: soft-light; }
.cover-frame {
  border-color: rgba(241, 211, 154, .7);
  box-shadow: 0 0 0 1px rgba(71, 35, 15, .8), inset 0 0 1.2rem rgba(229, 181, 94, .08), 0 0 .8rem rgba(225, 180, 94, .08);
}

.cover-names { text-shadow: 0 1px rgba(255,255,255,.16), 0 2px 2px rgba(0,0,0,.8); }
.wax-seal {
  position: relative;
  isolation: isolate;
  box-shadow: .1rem .45rem .8rem rgba(0,0,0,.58), inset .12rem .12rem .35rem rgba(255,187,156,.68), inset -.3rem -.35rem .4rem rgba(58,4,10,.6), 0 0 1.5rem rgba(205, 55, 51, .15);
  transition: transform .28s var(--ease-cinematic), filter .28s, box-shadow .28s;
}
.wax-seal::after {
  position: absolute;
  z-index: -1;
  inset: -.45rem;
  content: "";
  border: 1px solid rgba(241, 211, 154, .16);
  border-radius: inherit;
  transform: scale(.9);
  opacity: 0;
  transition: transform .3s var(--ease-cinematic), opacity .3s;
}
.wax-seal:hover::after,
.wax-seal:focus-visible::after { transform: scale(1); opacity: 1; }
.wax-seal:active { transform: rotate(-2deg) scale(.96); }

body.is-open .closed-diary { animation-play-state: paused; }

.diary-section {
  padding-right: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-right));
  padding-left: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-left));
  background:
    radial-gradient(ellipse at 50% 0, rgba(148, 26, 48, .34), transparent 32rem),
    radial-gradient(circle at 14% 54%, rgba(113, 18, 34, .12), transparent 28rem),
    linear-gradient(#090304 0%, #170709 32%, #080304 100%);
}

.diary-heading h2 { text-wrap: balance; text-shadow: 0 .4rem 2.3rem rgba(0,0,0,.38); }
.diary-heading > p:last-child { text-wrap: pretty; }

.nav-chapter {
  padding: .55rem .25rem;
  border-bottom-width: 1px;
  transition: color .25s, border-color .25s, transform .25s var(--ease-cinematic);
}
.nav-chapter:hover { transform: translateY(-2px); }

.book-wrap { perspective: 1200px; }
.book-shadow { opacity: .86; transform: translateZ(0); }
.open-book {
  isolation: isolate;
  border-color: rgba(241, 211, 154, .72);
  background: #dfcba6;
  box-shadow:
    -1.4rem 2rem 4rem rgba(0,0,0,.58),
    .7rem 1rem 1.8rem rgba(0,0,0,.25),
    0 0 0 1px rgba(54, 19, 10, .55),
    inset 0 0 4rem rgba(92,43,23,.28);
  transform: translateZ(0);
}
.open-book::after {
  position: absolute;
  z-index: 5;
  inset: 0;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 1px rgba(255,255,255,.45), inset 0 0 2rem rgba(81, 37, 17, .16);
}

.diary-page {
  contain: layout paint;
  backface-visibility: hidden;
  transform-origin: 5.7% 50%;
  will-change: transform, opacity;
}
.diary-page::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(75, 30, 13, .12), transparent 8% 94%, rgba(99, 49, 18, .1));
}
.diary-page.is-turning-out { pointer-events: none; animation-duration: .3s; animation-fill-mode: both; }
.diary-page.is-turning-forward { animation-name: page-turn-forward; }
.diary-page.is-turning-backward { animation-name: page-turn-backward; }
.diary-page.is-entering-forward { animation-name: page-enter-forward; }
.diary-page.is-entering-backward { animation-name: page-enter-backward; }

.chapter-copy { text-wrap: pretty; }
.memory-photo {
  filter: saturate(.9) contrast(1.03);
  transition: transform .45s var(--ease-cinematic), filter .45s, box-shadow .45s;
}
.memory-photo img { width: 100%; height: 100%; object-fit: cover; }
.memory-photo:hover { filter: saturate(1) contrast(1.02); box-shadow: .45rem .9rem 1.7rem rgba(55, 26, 14, .3); }

.page-control {
  min-width: 7.25rem;
  padding: .75rem .25rem;
  transition: color .25s, border-color .25s, transform .25s var(--ease-cinematic), opacity .25s;
}
.page-control:hover:not(:disabled) { transform: translateY(-2px); }
.page-control:active:not(:disabled) { transform: translateY(0) scale(.98); }

.js-ready .diary-heading,
.js-ready .chapter-nav,
.js-ready .book-wrap,
.js-ready .site-footer {
  opacity: 0;
  transform: translate3d(0, 1.5rem, 0);
  transition: opacity .8s var(--ease-cinematic), transform .8s var(--ease-cinematic);
}
.js-ready .chapter-nav { transition-delay: .08s; }
.js-ready .book-wrap { transition-delay: .16s; }
.js-ready .is-revealed { opacity: 1; transform: translate3d(0, 0, 0); }

@keyframes diary-float {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(1.2deg); }
  50% { transform: translate3d(0, -.45rem, 0) rotate(.4deg); }
}
@keyframes diary-float-mobile {
  0%, 100% { transform: translateX(50%) translate3d(0, 0, 0) rotate(1deg); }
  50% { transform: translateX(50%) translate3d(0, -.35rem, 0) rotate(.3deg); }
}
@keyframes moon-breathe {
  to { transform: scale(1.035); box-shadow: 0 0 4.3rem 1.2rem rgba(255,235,188,.5); }
}
@keyframes candle-aura { to { transform: scale(1.1); opacity: .65; } }
@keyframes page-turn-forward {
  to { transform: perspective(1100px) rotateY(-13deg) translate3d(-3%, 0, 0); opacity: 0; }
}
@keyframes page-turn-backward {
  to { transform: perspective(1100px) rotateY(10deg) translate3d(3%, 0, 0); opacity: 0; }
}
@keyframes page-enter-forward {
  from { transform: perspective(1100px) rotateY(9deg) translate3d(3%, 0, 0); opacity: 0; }
}
@keyframes page-enter-backward {
  from { transform: perspective(1100px) rotateY(-9deg) translate3d(-3%, 0, 0); opacity: 0; }
}

@media (hover: hover) and (pointer: fine) {
  .closed-diary:hover { animation-play-state: paused; transform: translate3d(0, -.4rem, 0) rotate(.3deg); }
  .memory-photo--valentine:hover { transform: rotate(5deg) scale(1.02); }
  .memory-photo--april:hover { transform: rotate(-3deg) scale(1.02); }
  .memory-photo--river:hover { transform: rotate(3deg) scale(1.02); }
  .memory-photo--love:hover { transform: rotate(2deg) scale(1.02); }
}

@media (max-width: 780px) {
  .site-header { padding-right: max(1rem, env(safe-area-inset-right)); padding-left: max(1rem, env(safe-area-inset-left)); }
  .opening-scene { min-height: max(45rem, 100svh); }
  .intro-copy { top: clamp(5.5rem, 12vh, 7.5rem); }
  body.is-open .intro-copy { transform: translateX(-50%) translateY(-.5rem); }
  .closed-diary { width: min(calc(100% - 3rem), 22rem); bottom: max(2.2rem, 6vh); transform: translateX(50%) rotate(1deg); animation-name: diary-float-mobile; }
  body.is-open .closed-diary { animation: none; }
  .diary-section { padding-top: clamp(4.5rem, 12vw, 6.5rem); }
  .open-book { min-height: clamp(35rem, 105vw, 40rem); }
  .diary-page { padding: clamp(1.8rem, 5vw, 2.6rem) clamp(1.35rem, 5vw, 2.4rem) 1.6rem clamp(3rem, 9vw, 4.2rem); }
  .chapter-copy { max-width: min(72%, 27rem); }
  .book-controls { gap: .75rem; }
  body.menu-open .chapter-nav { top: max(4.2rem, calc(env(safe-area-inset-top) + 3.2rem)); right: max(1rem, env(safe-area-inset-right)); left: max(1rem, env(safe-area-inset-left)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem .75rem; border-radius: .85rem; }
  body.menu-open .nav-chapter { width: 100%; padding: .75rem .4rem; text-align: left; }
}

@media (max-width: 560px) {
  .opening-scene { min-height: max(44rem, 100svh); }
  .night-window { right: -9rem; opacity: .72; }
  .intro-copy { top: 5.8rem; width: calc(100% - 2rem); }
  .ornament { margin-bottom: 1rem; }
  .intro-copy h1 { font-size: clamp(4.65rem, 23vw, 6rem); }
  .intro-note { max-width: 16rem; }
  .closed-diary { bottom: 2.2rem; width: min(calc(100% - 3rem), 20rem); min-height: 17.8rem; padding: 2.15rem 1.5rem; }
  .cover-names { font-size: clamp(1.75rem, 9vw, 2rem); }
  .candle--left { left: -1rem; }
  .candle--right { right: -1rem; }
  .diary-heading { margin-bottom: 2.2rem; }
  .diary-heading h2 { font-size: clamp(2.8rem, 14vw, 4rem); line-height: .82; }
  .diary-heading > p:last-child { margin-top: 1.25rem; font-size: .88rem; line-height: 1.65; }
  .book-wrap { width: 100%; }
  .open-book { min-height: 38rem; border-radius: .18rem .65rem .65rem .18rem; }
  .open-book::before, .book-spine { left: 6%; }
  .diary-page { padding: 1.65rem 1rem 1.35rem 2.65rem; transform-origin: 6% 50%; }
  .chapter h3 { font-size: clamp(3.15rem, 17vw, 4rem); }
  .chapter-copy { max-width: 100%; font-size: 1rem; line-height: 1.42; }
  .handwritten { max-width: 76%; }
  .memory-photo { opacity: .52; }
  .memory-photo--valentine { right: -1.5rem; bottom: -.8rem; transform: rotate(7deg) scale(.46); }
  .memory-photo--april { right: -1.2rem; bottom: -.7rem; transform: rotate(-5deg) scale(.44); }
  .memory-photo--river { right: -1.4rem; top: auto; bottom: -.9rem; transform: rotate(5deg) scale(.47); transform-origin: right bottom; }
  .memory-photo--love { right: -1.4rem; bottom: -.8rem; transform: rotate(4deg) scale(.4); }
  .polaroids, .future-dreams { right: -2rem; bottom: -1rem; opacity: .38; transform: scale(.48); }
  .calendar-date { top: 8%; right: 3%; opacity: .66; transform: scale(.66) rotate(5deg); }
  .constellation { right: -1rem; opacity: .5; transform: scale(.62); }
  .ferris-wheel { opacity: .5; }
  .river-moon { right: 4%; opacity: .72; transform: scale(.68); }
  .love-reveal { width: 100%; }
  .secret-letter { font-size: 1.32rem; line-height: 1.08; }
  .book-controls { padding-top: 1.2rem; }
  .page-control { min-width: 0; min-height: 48px; flex: 1; font-size: .95rem; }
  body.menu-open .chapter-nav { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .site-header { padding-top: max(.85rem, env(safe-area-inset-top)); }
  .wordmark { font-size: 1.4rem; }
  .opening-scene { min-height: 43rem; }
  .intro-copy { top: 5rem; }
  .intro-copy h1 { font-size: 4.55rem; }
  .intro-note { margin-top: .75rem; font-size: 1rem; }
  .signature { margin-top: .55rem; }
  .closed-diary { width: calc(100% - 2.25rem); bottom: 1.6rem; min-height: 17rem; }
  .diary-section { padding-right: .65rem; padding-left: .65rem; }
  .open-book { min-height: 39rem; }
  .diary-page { padding-right: .85rem; padding-left: 2.35rem; }
  .chapter h3 { font-size: 3.25rem; }
  .chapter-copy { font-size: .95rem; }
  .handwritten { font-size: 1.25rem; }
  .secret-letter { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .closed-diary, .moon, .flame::after { animation: none !important; }
  .js-ready .diary-heading, .js-ready .chapter-nav, .js-ready .book-wrap, .js-ready .site-footer { opacity: 1; transform: none; }
}

/* Mobile UX audit fixes and final visual refinement */
html {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
}

main,
section,
header,
footer,
.book-wrap,
.open-book,
.diary-page { min-width: 0; }

p,
h1,
h2,
h3,
figcaption,
button { overflow-wrap: break-word; }

.sound-toggle,
.menu-toggle {
  min-width: 44px;
  min-height: 44px;
}

.site-header {
  gap: 1rem;
  padding-bottom: 1rem;
}

.header-actions { flex: 0 0 auto; }
.wordmark { flex: 1 1 auto; min-width: 0; }

.opening-scene {
  min-height: 46rem;
  min-height: max(46rem, 100svh);
}

.diary-section { scroll-margin-top: 0; }

.chapter-nav,
body.menu-open .chapter-nav {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 183, 120, .5) transparent;
}

body.menu-open .chapter-nav {
  max-height: calc(100vh - 6rem);
  max-height: calc(100dvh - 6rem);
  padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
}

.nav-chapter {
  border-radius: .2rem .2rem 0 0;
  -webkit-user-select: none;
  user-select: none;
}

.nav-chapter:active,
.page-control:active:not(:disabled),
.secret-invitation:active { opacity: .72; }

.open-book {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.diary-page {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.diary-page::-webkit-scrollbar { display: none; }

.chapter h3,
.diary-heading h2 {
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}

.chapter-copy {
  letter-spacing: .002em;
  hanging-punctuation: first last;
}

.memory-photo {
  max-width: calc(100% - 2rem);
  border-color: rgba(88, 52, 31, .13);
  box-shadow:
    .32rem .65rem 1.1rem rgba(55, 25, 15, .24),
    0 0 0 1px rgba(255,255,255,.5) inset;
}

.memory-photo img {
  image-rendering: auto;
  -webkit-user-drag: none;
}

.book-controls {
  padding-bottom: max(.25rem, env(safe-area-inset-bottom));
}

.page-control {
  justify-content: center;
  border-radius: .15rem .15rem 0 0;
  -webkit-user-select: none;
  user-select: none;
}

.secret-invitation {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: .65rem 0;
  line-height: 1.2;
  text-align: left;
}

.site-footer {
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(2.5rem, calc(env(safe-area-inset-bottom) + 1.25rem));
  padding-left: max(1.25rem, env(safe-area-inset-left));
}

.moon {
  animation: moon-breathe-refined 5.5s var(--ease-cinematic) infinite alternate;
  will-change: transform;
}

.moon::after {
  position: absolute;
  inset: -45%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 190, .2), transparent 67%);
  opacity: .5;
  transform: scale(.9);
  animation: moon-aura 5.5s var(--ease-cinematic) infinite alternate;
}

.closed-diary,
.flame,
.petal,
.star,
.ferris-wheel,
.fireflies i { backface-visibility: hidden; }

.is-page-hidden .closed-diary,
.is-page-hidden .moon,
.is-page-hidden .moon::after,
.is-page-hidden .flame,
.is-page-hidden .flame::after,
.is-page-hidden .petal,
.is-page-hidden .star,
.is-page-hidden .ferris-wheel,
.is-page-hidden .fireflies i { animation-play-state: paused !important; }

.diary-section::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,.018), transparent 18%),
    radial-gradient(circle at 50% 42%, transparent 0 28%, rgba(0,0,0,.1) 78%);
}

.diary-heading,
.chapter-nav,
.book-wrap { z-index: 1; }

.open-book {
  border-color: rgba(241, 211, 154, .64);
  box-shadow:
    -1.25rem 1.9rem 3.8rem rgba(0,0,0,.54),
    .65rem .9rem 1.5rem rgba(0,0,0,.22),
    0 0 0 1px rgba(54,19,10,.5),
    0 0 4rem rgba(119, 26, 40, .08),
    inset 0 0 4rem rgba(92,43,23,.25);
}

.wax-seal,
.sound-toggle,
.menu-toggle,
.page-control,
.nav-chapter,
.secret-invitation {
  transition-timing-function: var(--ease-cinematic);
}

@keyframes moon-breathe-refined {
  to { transform: scale(1.035); }
}

@keyframes moon-aura {
  to { opacity: .85; transform: scale(1.08); }
}

@media (max-width: 780px) {
  .site-noise {
    opacity: .075;
    mix-blend-mode: normal;
  }

  .star--bright { box-shadow: 0 0 6px 1px rgba(255,237,192,.45); }
  .petal { opacity: .42; }

  .diary-section {
    padding-bottom: max(4.5rem, calc(env(safe-area-inset-bottom) + 3rem));
  }

  .diary-page {
    overflow-y: auto;
    padding-bottom: 1.75rem;
  }

  .chapter-copy { line-height: 1.4; }
  .handwritten { line-height: 1.05; }
  .page-number { flex: 0 0 auto; }
}

@media (max-width: 560px) {
  .opening-scene {
    min-height: 44rem;
    min-height: max(44rem, 100svh);
  }

  .site-header { gap: .65rem; }
  .header-actions { gap: .45rem; }
  .wordmark { font-size: 1.45rem; }

  .intro-copy {
    top: max(5.4rem, calc(env(safe-area-inset-top) + 4.3rem));
  }

  .intro-quote { line-height: 1.15; }

  .closed-diary {
    bottom: max(1.6rem, calc(env(safe-area-inset-bottom) + .8rem));
  }

  .diary-section {
    padding-top: 4.4rem;
    padding-right: max(.75rem, env(safe-area-inset-right));
    padding-left: max(.75rem, env(safe-area-inset-left));
  }

  .eyebrow { line-height: 1.5; }

  .open-book { min-height: 0; }

  .diary-page {
    position: relative;
    inset: auto;
    min-height: clamp(34rem, 78svh, 40rem);
    overflow: hidden;
    padding: 1.65rem 1.05rem 1.5rem 2.65rem;
  }

  .chapter-kicker {
    margin-top: 1rem;
    line-height: 1.35;
  }

  .chapter h3 {
    font-size: clamp(3.05rem, 16.5vw, 4rem);
    line-height: .75;
  }

  .chapter-copy {
    max-width: 100%;
    margin-top: 1.05rem;
    font-size: clamp(.98rem, 4.3vw, 1.08rem);
    line-height: 1.42;
  }

  .handwritten {
    max-width: 100%;
    margin-top: 1rem;
    font-size: clamp(1.22rem, 5.8vw, 1.48rem);
  }

  .memory-photo,
  .memory-photo--valentine,
  .memory-photo--april,
  .memory-photo--river,
  .memory-photo--love {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    align-self: flex-end;
    width: clamp(7.5rem, 38vw, 10.5rem);
    max-width: 55%;
    margin: 1.1rem .2rem 0 0;
    opacity: 1;
    transform-origin: center;
  }

  .memory-photo--valentine { transform: rotate(4deg); }
  .memory-photo--april { width: clamp(9rem, 46vw, 12rem); transform: rotate(-3deg); }
  .memory-photo--river { transform: rotate(3deg); }
  .memory-photo--love { width: clamp(9rem, 48vw, 12.5rem); transform: rotate(2deg); }

  .memory-photo figcaption {
    font-size: clamp(.72rem, 3.4vw, .86rem);
    line-height: .95;
  }

  .chapter--april h3 { max-width: 70%; }
  .calendar-date { right: 1%; }

  .chapter--date .handwritten,
  .chapter--ferris .handwritten,
  .chapter--future .secret-invitation { margin-top: auto; }

  .love-reveal {
    min-height: 5.75rem;
    margin-top: 1.15rem;
    padding: 1rem;
  }

  .love-quote { font-size: clamp(1.4rem, 7.4vw, 1.75rem); }

  .secret-letter {
    max-width: 100%;
    margin-top: 1.15rem;
    font-size: clamp(1.18rem, 5.8vw, 1.4rem);
    line-height: 1.08;
  }

  .secret-letter p { margin-bottom: .7rem; }

  .book-controls {
    gap: .5rem;
    padding-top: 1rem;
  }

  .page-control {
    min-width: 0;
    min-height: 48px;
    padding: .6rem .3rem;
    font-size: clamp(.9rem, 4.1vw, 1rem);
    line-height: 1.15;
  }

  body.menu-open .chapter-nav {
    top: max(4rem, calc(env(safe-area-inset-top) + 3.1rem));
    max-height: calc(100vh - 5rem - env(safe-area-inset-top));
    max-height: calc(100dvh - 5rem - env(safe-area-inset-top));
  }
}

@media (max-width: 380px) {
  .intro-copy { width: calc(100% - 1.4rem); }
  .ornament { letter-spacing: .12em; }

  .closed-diary {
    width: calc(100% - 1.5rem);
    padding-right: 1.25rem;
    padding-left: 1.25rem;
  }

  .diary-section {
    padding-right: max(.5rem, env(safe-area-inset-right));
    padding-left: max(.5rem, env(safe-area-inset-left));
  }

  .diary-page {
    min-height: 35rem;
    padding-right: .85rem;
    padding-left: 2.35rem;
  }

  .chapter h3 { font-size: clamp(2.9rem, 16vw, 3.3rem); }
  .calendar-date { opacity: .48; transform: scale(.6) rotate(5deg); }
  .love-reveal { gap: .55rem; }
  .love-counter { font-size: .48rem; }
}

@media (orientation: landscape) and (max-height: 540px) and (min-width: 560px) {
  .site-header { padding-top: max(.7rem, env(safe-area-inset-top)); }

  .opening-scene,
  body.is-open .opening-scene {
    min-height: 25rem;
    min-height: max(25rem, 100dvh);
  }

  .intro-copy {
    top: 50%;
    left: max(4%, env(safe-area-inset-left));
    width: 42%;
    transform: translateY(-50%);
  }

  body.is-open .intro-copy { transform: translate3d(-.6rem, -50%, 0); }

  .ornament { margin-bottom: .65rem; }
  .for-you { font-size: 1.75rem; }
  .intro-copy h1 { margin-bottom: .65rem; font-size: clamp(3.6rem, 10vw, 5rem); }
  .intro-quote { font-size: 1.05rem; }
  .intro-note { margin-top: .65rem; font-size: 1rem; }
  .signature { margin-top: .45rem; font-size: 1.2rem; }

  .closed-diary {
    top: 50%;
    right: max(4%, env(safe-area-inset-right));
    bottom: auto;
    width: min(42%, 20rem);
    min-height: 17rem;
    padding: 2rem 1.4rem;
    transform: translateY(-50%) rotate(1deg);
    animation: none;
  }

  body.is-open .closed-diary {
    transform: translateY(-50%) perspective(58rem) rotateY(-82deg);
  }

  .cover-names { font-size: 1.75rem; }
  .cover-date { margin-bottom: .6rem; }
  .wax-seal { width: 4rem; }
  .seal-hint { margin-top: .35rem; }
  .candle { opacity: .35; }
  .night-window { opacity: .58; }

  .diary-section { padding-top: 3.5rem; }
  .diary-heading { margin-bottom: 2rem; }
  .diary-heading h2 { font-size: clamp(3rem, 8vw, 4.8rem); }
  .open-book { min-height: 30rem; }
  .diary-page { padding-top: 1.5rem; padding-bottom: 1.35rem; }
  .chapter h3 { font-size: clamp(3.3rem, 8vw, 5rem); }
  .chapter-copy { font-size: 1rem; }
}

@media (prefers-reduced-data: reduce) {
  .falling-petals { display: none; }
  .site-noise { opacity: .05; }
}

@media (prefers-reduced-motion: reduce) {
  .moon,
  .moon::after { animation: none !important; }
}

/* Final interaction details */
body.menu-open { overscroll-behavior: none; touch-action: none; }
body.menu-open .chapter-nav { touch-action: pan-y; }

.sound-toggle,
.menu-toggle {
  position: relative;
  overflow: hidden;
}

.sound-toggle::after,
.menu-toggle::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(115deg, transparent 25%, rgba(255,255,255,.08) 48%, transparent 72%);
  opacity: 0;
  transform: translate3d(-45%, 0, 0);
  transition: opacity .35s var(--ease-cinematic), transform .5s var(--ease-cinematic);
}

.sound-toggle:hover::after,
.menu-toggle:hover::after,
.sound-toggle:focus-visible::after,
.menu-toggle:focus-visible::after {
  opacity: 1;
  transform: translate3d(45%, 0, 0);
}

.sound-toggle.is-playing .sound-icon {
  animation: sound-pulse 1.8s ease-in-out infinite;
}

.open-book::after {
  background:
    linear-gradient(105deg, rgba(255,255,255,.2), transparent 7% 90%, rgba(74, 31, 14, .08)),
    linear-gradient(180deg, rgba(255,255,255,.08), transparent 14% 88%, rgba(69, 27, 12, .08));
}

.page-corner {
  filter: drop-shadow(-.15rem -.15rem .2rem rgba(64, 28, 12, .08));
}

@keyframes sound-pulse {
  50% { transform: translateY(-1px) scale(1.08); opacity: .72; }
}

@media (max-width: 560px) {
  .page-indicator { display: none; }
  .book-controls { justify-content: stretch; }
  .page-control { flex: 1 1 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .sound-toggle.is-playing .sound-icon { animation: none; }
}
