/* =========================================================
   Avery's Little Rainbow Adventure — Meadow Storybook
   Mobile-first · tuned for smooth phones:
   - only the open page is rendered (others are display:none)
   - no backdrop-filter, blend modes or live SVG filters
   - moving things use transform/opacity only (GPU-friendly)
   ========================================================= */
:root {
  --pink: #E9779C; --pink-deep: #C9517D; --pink-soft: #FBD3DF; --blush: #FDEEF2;
  --butter: #FFF1C2; --mint: #DDF1E3; --cream: #FFF8F3;
  --brown: #6B4A3A; --brown-soft: #876A5C;
  --radius: 22px;
  --shadow: 0 6px 18px rgba(170, 96, 120, .14);
  --shadow-sm: 0 2px 8px rgba(170, 96, 120, .10);
  --f-display: "Grandstander", "Baloo 2", "Comic Sans MS", system-ui, sans-serif;
  --f-hand: "Patrick Hand", "Comic Sans MS", "Segoe Print", cursive;
  --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --top-h: 58px; --pager-h: 62px; --turn: .8s;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); font-size: 1rem; line-height: 1.6; color: var(--brown);
  background: linear-gradient(180deg, #F9DCE6 0%, #F3E6F7 50%, #FBE7DA 100%); min-height: 100dvh; overflow-x: hidden; }
.js body { height: 100dvh; overflow: hidden; overscroll-behavior: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; line-height: 1.15; margin: 0 0 .4em; }
h3 { font-size: 1.15rem; color: var(--pink-deep); }
p { margin: 0 0 .8em; }
a { color: var(--pink-deep); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 200; background: #fff; padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--pink-deep); outline-offset: 3px; border-radius: 10px; }
.page-title:focus { outline: none; }
.fine { font-size: .86rem; color: var(--brown-soft); }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; min-height: 46px; padding: .65em 1.4em;
  border-radius: 999px; border: 2px solid transparent; cursor: pointer; text-decoration: none; text-align: center;
  font: 700 1rem/1.15 var(--f-display); transition: transform .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn-pink { background: linear-gradient(180deg, #DE6C94, var(--pink-deep)); color: #fff; box-shadow: 0 4px 10px rgba(201, 81, 125, .3); }
.btn-white { background: #fff; color: var(--pink-deep); border-color: #EFA3BC; }
.btn-outline { background: transparent; color: var(--pink-deep); border-color: #EFA3BC; }
.btn-small { min-height: 40px; padding: .45em 1em; font-size: .9rem; }
.btn-small:not(.btn-pink):not(.btn-outline) { background: var(--pink-soft); color: var(--brown); }
.btn-tiny { min-height: 34px; padding: .3em .95em; font-size: .82rem; background: #F4A8C0; color: #5E2E43; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ico { width: 1.1em; height: 1.1em; display: inline-block; }
.btn-ico svg, .ico-svg { width: 100%; height: 100%; display: block; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.center-row { justify-content: center; margin-top: 18px; }
@media (hover: hover) { .btn:hover { transform: translateY(-2px); } }

/* ---------- Top bar (solid background: no blur, cheaper on phones) ---------- */
.topbar { position: fixed; inset: 0 0 auto; z-index: 60; height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 10px 0; display: flex; align-items: center; gap: 10px;
  background: #FFF9F6; border-bottom: 1px solid rgba(233, 119, 156, .2); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--brown); min-width: 0; flex: 1; }
.brand img { width: 40px; height: auto; flex: none; }
.brand-text { font: 700 .84rem/1.15 var(--f-display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 170px; }
.top-links { display: none; }
.top-actions { display: flex; gap: 6px; flex: none; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--pink-soft); background: #fff; color: var(--brown); display: grid; place-items: center; cursor: pointer; font-size: 1.1rem; padding: 0; }
.round-btn[aria-pressed="true"] { background: var(--mint); border-color: #A9DDBD; }
.burger { display: grid; gap: 4px; }
.burger span { width: 18px; height: 2px; border-radius: 2px; background: var(--brown); transition: transform .25s, opacity .25s; }
.menu-btn[aria-expanded="true"] .burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .burger span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.menu { position: absolute; top: calc(100% + 6px); right: 10px; width: min(300px, calc(100vw - 20px)); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
.menu-links { list-style: none; margin: 0; padding: 0; }
.menu-links a { display: block; padding: 9px 14px; border-radius: 12px; text-decoration: none; color: var(--brown); font-weight: 700; }
.menu-links a:hover, .menu-links a.active { background: var(--blush); }
.menu-sound { display: grid; gap: 6px; border-top: 2px dotted var(--pink-soft); margin-top: 6px; padding-top: 8px; }
.toggle { display: flex; justify-content: space-between; align-items: center; min-height: 42px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--cream); color: var(--brown); font: 700 .95rem var(--f-body); cursor: pointer; }
.toggle .state { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: #eee; }
.toggle[aria-pressed="true"] .state { background: var(--mint); }

/* ---------- Sky ---------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sky-cloud { position: absolute; left: 0; width: 120px; opacity: .9; animation: drift linear infinite; will-change: transform; }
.sky-cloud.s1 { top: 12%; animation-duration: 60s; animation-delay: -12s; }
.sky-cloud.s2 { top: 72%; width: 150px; animation-duration: 80s; animation-delay: -40s; }
@keyframes drift { from { transform: translateX(-180px); } to { transform: translateX(100vw); } }

/* ---------- Stage & book ---------- */
.stage { position: relative; z-index: 1; height: 100dvh;
  padding: calc(var(--top-h) + env(safe-area-inset-top) + 10px) 10px calc(var(--pager-h) + env(safe-area-inset-bottom) + 10px);
  display: flex; justify-content: center; }
.book { position: relative; width: 100%; max-width: 1120px; height: 100%; max-height: 860px; margin: auto; perspective: 2400px; border-radius: 10px 22px 22px 10px; }
.book:focus { outline: none; }
.book::before { content: ""; position: absolute; inset: -6px -8px -8px -4px; border-radius: 12px 26px 26px 12px; z-index: 0; background: linear-gradient(135deg, #F2A9C0, #E98DAE); box-shadow: 0 10px 24px rgba(170, 80, 115, .22); }
.book::after { content: ""; position: absolute; inset: 4px -3px 2px 6px; border-radius: 8px 20px 20px 8px; z-index: 0; background: repeating-linear-gradient(90deg, #FFF8F3 0 2px, #F1E2DA 2px 3px); }
.bookmark { position: absolute; top: -8px; right: 26px; width: 20px; height: 34px; z-index: 8; pointer-events: none;
  background: linear-gradient(180deg, #F7C64F, #F2B33A); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }

.page { position: absolute; inset: 0; z-index: 1; display: none; contain: layout;
  border-radius: 8px 20px 20px 8px; transform-origin: left center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background:
    url("assets/illustrations/paper-grain.webp") 0 0 / 128px 128px,
    linear-gradient(90deg, rgba(170, 96, 120, .13) 0, rgba(170, 96, 120, 0) 22px),
    radial-gradient(circle at 100% 100%, #FBDCE6 0, transparent 45%),
    radial-gradient(circle at 0 100%, #FFEBD6 0, transparent 45%),
    radial-gradient(circle at 100% 0, #EEE4FA 0, transparent 40%),
    linear-gradient(180deg, #FDEFF3, #FFF8F3 45%, #FFF6F1);
}
.page.current { display: block; z-index: 2; }
.page.turning-out, .page.turning-in, .page.fade-in { display: block; z-index: 5; will-change: transform; }
.page.turning-out { animation: turnOut var(--turn) cubic-bezier(.45,.05,.25,1) forwards; }
.page.turning-in { animation: turnIn var(--turn) cubic-bezier(.45,.05,.25,1) forwards; }
.page.fade-in { animation: fadeIn .3s ease forwards; }
.page.on-top { display: block; z-index: 5; }
.page.prep { display: block; z-index: 5; transform: rotateY(-110deg); }
/* while a page turns, freeze all decorations so the phone only animates the turn */
.book.is-turning .page * { animation-play-state: paused !important; }
.book.is-turning .deco .bfly, .book.is-turning .deco .hrt { visibility: hidden; }
@keyframes turnOut { to { transform: rotateY(-110deg); } }
@keyframes turnIn { from { transform: rotateY(-110deg); } to { transform: rotateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.page-inner { position: relative; z-index: 3; height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; padding: 22px 18px 84px 24px; display: flex; flex-direction: column; }
.page-inner > * { flex-shrink: 0; }
.page-inner.center { align-items: center; text-align: center; }
.page-inner.center::before, .page-inner.center::after { content: ""; flex: 1 0 0; }

/* ---------- Page decorations (behind the content) ---------- */
.deco { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.deco .fl-left, .deco .fl-right { position: absolute; bottom: -6px; animation: flowerSway 6s ease-in-out infinite; }
.deco .fl-left { left: -8px; width: 104px; transform-origin: bottom left; }
.deco .fl-right { right: -6px; width: 84px; transform-origin: bottom right; animation-delay: -3s; }
@keyframes flowerSway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(2deg); } }

/* Butterfly: the outer element floats (transform only), the wings flap inside the SVG */
.deco .bfly { position: absolute; top: 9%; right: 7%; width: 34px; animation: flutter 14s ease-in-out infinite; }
.deco .bfly.alt { top: auto; bottom: 22%; right: auto; left: 6%; animation-name: flutterB; animation-duration: 17s; }
.bfly-svg { width: 100%; display: block; overflow: visible; }
@keyframes flutter {
  0%   { transform: translate(0, 0) rotate(-6deg); }
  20%  { transform: translate(-70px, 26px) rotate(8deg); }
  40%  { transform: translate(-130px, -6px) rotate(-4deg); }
  60%  { transform: translate(-80px, 40px) rotate(10deg); }
  80%  { transform: translate(-20px, 18px) rotate(-8deg); }
  100% { transform: translate(0, 0) rotate(-6deg); }
}
@keyframes flutterB {
  0%   { transform: translate(0, 0) rotate(6deg); }
  25%  { transform: translate(60px, -40px) rotate(-6deg); }
  50%  { transform: translate(120px, -10px) rotate(8deg); }
  75%  { transform: translate(50px, 20px) rotate(-4deg); }
  100% { transform: translate(0, 0) rotate(6deg); }
}
.deco .hrt { position: absolute; bottom: -20px; width: 15px; opacity: 0; animation: heartUp 10s ease-in infinite; }
@keyframes heartUp { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .75; } 100% { transform: translate(14px, -520px); opacity: 0; } }

/* ---------- Section headings ---------- */
.sec-title { display: flex; align-items: center; gap: 10px; color: var(--pink); font-size: clamp(1.6rem, 7vw, 2.2rem); margin-bottom: .2em; }
.page-inner.center .sec-title { justify-content: center; }
.badge { flex: none; display: grid; place-items: center; width: 1.45em; height: 1.45em; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #F49AB6, #E06B92); color: #fff; font-size: .7em; }
.sec-sub { text-align: center; color: var(--brown-soft); font-size: .98rem; margin-bottom: 14px; }
.sec-sub strong { color: var(--brown); font-family: var(--f-display); font-size: 1.08rem; }

/* reveal when a page opens (one-time, cheap) */
.js .page .story-line { opacity: 0; transform: translateY(10px); }
.js .page.shown .story-line { animation: lineIn .55s ease forwards; }
.js .page.shown .story-line:nth-of-type(3) { animation-delay: .25s; }
.js .page.shown .story-line:nth-of-type(4) { animation-delay: .5s; }
.js .page.shown .story-line:nth-of-type(5) { animation-delay: .75s; }
@keyframes lineIn { to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Capybaras ---------- */
.capy-btn { display: block; padding: 0; border: 0; background: none; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; }
.capy-svg { width: 100%; height: auto; display: block; overflow: visible; }
/* gentle breathing on the HTML wrapper → composited, no SVG repaint */
.capy-btn > div, .nb-capy, .ph-capy, .pair .capy { animation: capyBob 3s ease-in-out infinite; animation-delay: var(--delay, 0s); transform-origin: 50% 95%; }
.pair .pair-baby { animation-delay: -1.4s; }
.capy-btn .pair, .end-pair > div, .story-pair > div { animation: none; }
@keyframes capyBob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-3px) scale(1.015, .985); } }
.capy-svg .eyes { animation: blink 5s infinite; transform-box: fill-box; transform-origin: center; }
.capy-svg .ear { transform-box: fill-box; transform-origin: bottom center; animation: earL 5s ease-in-out infinite; }
.capy-svg .ear-r { animation-name: earR; animation-delay: .4s; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.15); } }
@keyframes earL { 0%, 80%, 100% { transform: rotate(0); } 88% { transform: rotate(-14deg); } }
@keyframes earR { 0%, 80%, 100% { transform: rotate(0); } 88% { transform: rotate(14deg); } }
.capy-btn.hop > div { animation: hop .55s ease !important; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-20px) rotate(-4deg); } 60% { transform: translateY(0) scale(1.05, .93); } }
.boop { position: absolute; left: 50%; top: 10%; font-size: 1.2rem; pointer-events: none; z-index: 5; animation: boopUp .9s ease-out forwards; }
@keyframes boopUp { from { opacity: 1; transform: translate(-50%, 0) scale(.6); } to { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -64px) scale(1.15); } }
.pair { position: relative; width: 100%; aspect-ratio: 300 / 205; }
.pair .capy { position: absolute; bottom: 0; }
.pair-mama { left: 0; width: 64%; }
.pair-baby { left: 52%; width: 44%; }

/* ---------- Rainbows ---------- */
.rainbow-svg { width: 100%; height: auto; display: block; overflow: visible; }
.rainbow-svg .band { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js .page .rainbow-svg .band { stroke-dashoffset: 1; }
.js .page.shown .rainbow-svg .band { animation: draw 1.2s cubic-bezier(.5,0,.3,1) forwards; animation-delay: calc(var(--i) * .1s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.cloud-svg { width: 100%; display: block; }

/* ---------- COVER ---------- */
.cover-grid { width: 100%; display: flex; flex-direction: column; align-items: center; }
.cover-text { position: relative; width: 100%; }
.cover-rainbow { position: absolute; width: 120px; top: 6px; opacity: .9; z-index: -1; }
.cr-left { left: -34px; transform: rotate(-14deg); }
.cr-right { right: -36px; transform: rotate(12deg); }
.cover-title { margin: 6px 0 4px; line-height: .98; text-align: center; }
.t-name, .t-rainbow, .t-adv { display: block; paint-order: stroke fill; -webkit-text-stroke: 7px #fff; }
.t-name { font-size: clamp(3rem, 15vw, 4.6rem); color: #E8638F; font-weight: 800; }
.t-rainbow, .t-adv { font-size: clamp(2rem, 9.6vw, 3rem); font-weight: 800; -webkit-text-stroke-width: 6px; }
.t-rainbow .ltr { display: inline-block; paint-order: stroke fill; -webkit-text-stroke: 6px #fff; }
.js .page.shown .t-rainbow .ltr { animation: letterHop .6s ease both; animation-delay: calc(.3s + var(--n) * .06s); }
@keyframes letterHop { 0% { transform: translateY(10px); opacity: 0; } 60% { transform: translateY(-5px); opacity: 1; } 100% { transform: none; } }
.t-adv { color: #9A6440; }
.t-sub { font: 800 .82rem var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--brown); margin: 10px 0 2px; }
.t-date { font: 800 1.35rem var(--f-display); color: var(--pink-deep); letter-spacing: .03em; margin: 0 0 4px; }
.cover-scene { position: relative; width: 100%; max-width: 420px; margin: 4px auto 6px; aspect-ratio: 10 / 7.2; }
.hero-art { position: absolute; left: 0; bottom: 0; width: 62%; height: auto; transform-origin: bottom center; will-change: transform; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02, .985); } }
.sign { position: absolute; right: 0; top: 6%; width: 50%; padding: 10px 10px 8px; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(160, 105, 60, .08) 0 2px, transparent 2px 9px), linear-gradient(180deg, #F6DDB6, #EBC48F);
  border: 5px solid #C99460; border-radius: 14px; box-shadow: 0 4px 10px rgba(120, 80, 40, .18);
  font: 1rem/1.25 var(--f-hand); color: #5E3F2C; text-align: center; transform: rotate(1.5deg); }
.sign p { margin: 0 0 .4em; font-size: clamp(.82rem, 3.6vw, 1.05rem); }
.sign p:last-child { margin: 0; }
.sign::before, .sign::after { content: ""; position: absolute; top: 100%; width: 9px; height: 50px; background: linear-gradient(90deg, #B98250, #9C6A3E); border-radius: 0 0 4px 4px; z-index: -1; }
.sign::before { left: 22%; } .sign::after { right: 22%; }
.cover-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.cover-actions .btn { min-width: 140px; }
.sound-chip { flex-basis: 100%; max-width: 280px; margin: 4px auto 0; min-height: 40px; border-radius: 999px; cursor: pointer; border: 2px dashed #EFA3BC; background: rgba(255,255,255,.8); color: var(--brown); font: 700 .88rem var(--f-body); }
.sound-chip[aria-pressed="true"] { background: var(--mint); border-style: solid; border-color: #A9DDBD; }

/* ---------- OUR STORY ---------- */
.story-grid { display: grid; gap: 6px; }
.ribbon { position: relative; display: table; margin: 4px auto 14px; padding: 6px 28px; font: 1.5rem var(--f-hand); color: #C35A7E; background: linear-gradient(180deg, #FCE7D3, #F7D3B8); border-radius: 6px; box-shadow: 0 3px 6px rgba(180, 110, 70, .15); transform: rotate(-2deg); }
.ribbon::before, .ribbon::after { content: ""; position: absolute; top: 8px; width: 22px; height: 100%; background: #F1C4A4; z-index: -1; }
.ribbon::before { left: -14px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.ribbon::after { right: -14px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.story-line { font-size: 1.06rem; line-height: 1.75; text-align: center; max-width: 32em; margin-inline: auto; }
.story-scene { position: relative; width: 100%; max-width: 360px; margin: 0 auto; }
.story-rainbow { position: absolute; left: 6%; right: 6%; top: -6%; opacity: .9; }
.story-pair { position: relative; width: 76%; margin: 18% auto 0; }
.polaroid { position: absolute; right: 2%; top: 0; width: 34%; margin: 0; background: #fff; padding: 6px 6px 18px; border-radius: 4px; box-shadow: var(--shadow); transform: rotate(5deg); z-index: 2; }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.next-link { align-self: center; margin-top: 12px; }

/* ---------- 12 LITTLE RAINBOWS ---------- */
.months { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.month-card { display: block; width: 100%; padding: 6px 6px 10px; margin: 0; border: 0; border-radius: 16px; background: #fff; box-shadow: var(--shadow-sm); text-align: center; font: inherit; color: var(--brown); }
button.month-card { cursor: zoom-in; }
.month-photo { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--tone); }
.month-photo img { width: 100%; height: 100%; object-fit: cover; }
.month-photo img.month-image-loading { position: absolute; inset: 0; visibility: hidden; }
.m-label { display: block; margin-top: 6px; font: 700 .98rem var(--f-display); color: var(--pink-deep); }
.m-cap { display: block; font-size: .78rem; line-height: 1.3; color: var(--brown-soft); }
.ph { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px; background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.7), transparent 60%), var(--tone); border: 2px dashed rgba(201, 81, 125, .3); border-radius: 12px; }
.ph .ph-capy { width: 54%; animation: none; }
.ph span { font: 700 .7rem var(--f-body); background: rgba(255,255,255,.9); padding: 1px 8px; border-radius: 999px; color: var(--brown-soft); }
.ph .capy-svg .eyes, .ph .capy-svg .ear { animation: none; }
.tone-0 { --tone: #FBDCE6; } .tone-1 { --tone: #FCE6D6; } .tone-2 { --tone: #FFF0C4; } .tone-3 { --tone: #DDF1E3; } .tone-4 { --tone: #E2F0FB; } .tone-5 { --tone: #ECE3F8; }
.after-gallery { text-align: center; font: 700 1.15rem var(--f-display); color: var(--brown); margin-top: 16px; }

/* ---------- EVENT DETAILS ---------- */
.countdown { display: flex; justify-content: center; gap: 8px; margin: 0 0 14px; flex-wrap: wrap; }
.cd-box { min-width: 64px; padding: 6px 8px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); text-align: center; }
.cd-num { display: block; font: 800 1.45rem/1.1 var(--f-display); color: var(--pink-deep); }
.cd-lbl { font-size: .74rem; color: var(--brown-soft); }
.cd-msg { font: 700 1rem var(--f-display); background: #fff; padding: 6px 16px; border-radius: 999px; box-shadow: var(--shadow-sm); margin: 0; }
.arches { display: grid; gap: 16px; margin-bottom: 14px; }
.arch { position: relative; text-align: center; padding: 30px 16px 16px; border-radius: 999px 999px 24px 24px / 170px 170px 24px 24px; background: rgba(255, 255, 255, .9); border: 2px solid #F6C3D3; box-shadow: var(--shadow-sm); }
.arch-flowers { position: absolute; top: -10px; left: -8px; width: 92px; transform: rotate(-12deg); }
.arch:nth-child(2) .arch-flowers { left: auto; right: -8px; transform: scaleX(-1) rotate(-12deg); }
.arch-art { width: 96px; margin: 0 auto 4px; }
.arch h3 { font-size: 1.4rem; color: var(--pink); }
.arch-line { font-size: .92rem; color: var(--brown-soft); margin-bottom: 8px; }
.arch-info p { margin: 0 0 .2em; }
.arch-info .a-date { font-weight: 800; }
.ph-text { display: inline-block; padding: 0 8px; border-radius: 8px; border: 1.5px dashed #EFA3BC; background: #FFF1F5; color: var(--brown-soft); font-size: .9rem; font-weight: 700; }
.icon-svg { width: 100%; height: auto; display: block; overflow: visible; }
.dove-svg .dove-wing { animation: doveFlap 1.4s ease-in-out infinite; transform-box: view-box; transform-origin: 66px 56px; }
@keyframes doveFlap { 50% { transform: rotate(-14deg); } }
.cake-svg .flame { animation: flicker .6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes flicker { from { transform: scale(1) rotate(-3deg); } to { transform: scale(.9, 1.1) rotate(3deg); } }
.info-row3 { display: grid; gap: 12px; }
.mini-card { background: rgba(255,255,255,.92); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 14px 10px; border: 1.5px solid #FBE0E8; }
.mini-card.wide { margin-top: 12px; }
.mini-card h3 { display: flex; align-items: center; gap: 8px; font-size: 1.12rem; }
#saveDateCard { text-align: center; }
#saveDateCard h3, #saveDateCard .btn-row { justify-content: center; }
#dressCodeCard { text-align: center; }
#dressCodeCard h3 { justify-content: center; }
#dressCodeCard .swatches { justify-content: center; }
.mc-ico { width: 24px; height: 24px; color: var(--pink); flex: none; }
.map-box { position: relative; border-radius: 14px; overflow: hidden; height: 110px; margin-bottom: 8px; border: 1.5px solid #F3E2D8; }
.map-box .map-svg { width: 100%; height: 100%; display: block; }
.map-box iframe { width: 100%; height: 100%; border: 0; display: block; }
.map-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches { display: flex; gap: 8px; margin: 6px 0 4px; }
.swatches i { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.7), var(--shadow-sm); }
.dc-text { font-weight: 700; margin-bottom: 4px; }
.pending { display: inline-block; font-size: .72rem; font-weight: 700; background: var(--butter); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.schedule { list-style: none; margin: 0; padding: 0; }
.schedule li { margin-bottom: 8px; line-height: 1.3; }
.schedule .s-time { display: block; font-weight: 800; }
.schedule .s-what { font-size: .88rem; color: var(--brown-soft); }

/* ---------- GIFTS ---------- */
.gift-intro { text-align: center; max-width: 40em; margin: 0 auto 14px; font-size: .95rem; }
.gift-grid { display: grid; gap: 12px; }
.gift-card { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.92); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 10px 12px; border: 1.5px solid #FBE0E8; }
.gift-art { width: 42%; max-width: 160px; flex: none; }
.gift-svg { width: 100%; display: block; overflow: visible; }
.gift-body h3 { font-size: 1.15rem; margin-bottom: .2em; }
.gift-body p { font-size: .86rem; margin-bottom: .5em; line-height: 1.4; }
.parents-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 16px; border-radius: var(--radius); background: rgba(255,255,255,.9); border: 2px solid #F6C3D3; box-shadow: var(--shadow-sm); }
.pn-capy { width: 92px; flex: none; }
.parents-note h3 { font-size: 1.2rem; }
.parents-note p { font-size: .92rem; }
.signature { font-family: var(--f-hand); font-size: 1.1rem; color: var(--pink-deep); margin: 0; }
.gift-dialog, .lightbox { border: 0; padding: 0; }
.gift-dialog { width: min(420px, calc(100vw - 28px)); border-radius: 26px; padding: 18px 20px 14px; background: linear-gradient(180deg, #FFF4F7, #FFFAF5); color: var(--brown); box-shadow: 0 16px 40px rgba(120, 50, 80, .3); }
.gift-dialog[open] { animation: pop .25s ease; }
.gift-dialog::backdrop { background: rgba(110, 60, 80, .4); }
.gd-art { width: 170px; margin: 0 auto 4px; }
.gift-dialog h3 { text-align: center; font-size: 1.4rem; color: var(--pink); }
.gift-dialog ul { margin: 0 0 10px; padding-left: 1.3em; }
.gift-dialog li { margin-bottom: 4px; }
.gift-dialog li::marker { content: "🌸 "; }
.tip { background: var(--butter); padding: 9px 12px; border-radius: 14px; font-size: .92rem; margin-bottom: 8px; }
.dlg-close { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; color: var(--brown); font: 700 1.2rem var(--f-display); cursor: pointer; box-shadow: var(--shadow-sm); z-index: 2; }

/* ---------- NOTE FROM AVERY ---------- */
.letter { position: relative; max-width: 520px; margin: 74px auto 0; padding: 66px 20px 16px; text-align: left; background: repeating-linear-gradient(180deg, transparent 0 30px, rgba(233, 119, 156, .2) 30px 31px), #fff; border-radius: var(--radius); box-shadow: var(--shadow); font: 1.22rem/31px var(--f-hand); color: #5E4033; }
.letter p { margin: 0 0 31px; }
.letter-capy { position: absolute; top: -84px; left: 50%; transform: translateX(-50%); width: 140px; }
.letter-greet { color: var(--pink-deep); font-size: 1.35rem; }
.letter-sign { text-align: right; }

/* ---------- RSVP NOTEBOOK ---------- */
.notebook { position: relative; display: grid; border-radius: 18px; padding: 10px; background: linear-gradient(135deg, #F1C79C, #E6B07E); box-shadow: var(--shadow), inset 0 0 0 3px rgba(255,255,255,.25); }
.nb-page { position: relative; background: repeating-linear-gradient(180deg, transparent 0 29px, rgba(233, 119, 156, .16) 29px 30px), #FFFDF8; padding: 16px 16px 14px; }
.nb-left { border-radius: 10px 10px 0 0; }
.nb-right { border-radius: 0 0 10px 10px; min-height: 260px; padding-bottom: 90px; }
.nb-rings { height: 22px; background: radial-gradient(circle at 10px 11px, #fff 0 4px, #B9A7A0 4px 6px, transparent 6.5px) 0 0 / 28px 22px repeat-x, #FFFDF8; }
.nb-head { font: 1.5rem var(--f-hand); color: var(--pink-deep); margin: 0 0 8px; }
.field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 800; margin-bottom: 6px; padding: 0; }
.req { color: var(--pink-deep); }
.opt { font-weight: 400; font-size: .82rem; color: var(--brown-soft); }
input[type="text"], select { width: 100%; min-height: 46px; padding: 10px 12px; border: 1.5px solid #EAD6CF; border-radius: 12px; font: inherit; font-size: 1rem; color: var(--brown); background: #FFFCFA; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--pink) 50%), linear-gradient(135deg, var(--pink) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 32px; }
select:disabled { opacity: .5; }
input:focus, select:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px rgba(233, 119, 156, .2); }
.invalid { border-color: #C9466E !important; }
.error-msg { color: #A8324F; font-size: .86rem; margin: 5px 0 0; }
.error-msg:empty { display: none; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 700; cursor: pointer; }
.radio input { width: 20px; height: 20px; accent-color: var(--pink-deep); flex: none; margin: 0; }
.consent { margin: -4px 0 10px; }
.form-status { margin-top: 12px; }
.form-status:empty { display: none; }
.st-ok { background: var(--mint); padding: 12px 14px; border-radius: 14px; font-weight: 700; text-align: center; animation: pop .35s ease; }
.st-err { background: #FDE2E8; padding: 12px 14px; border-radius: 14px; }
.st-info { background: var(--butter); padding: 12px 14px; border-radius: 14px; }
.note-box { margin: 14px 0 8px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 248, 230, .95); border: 2px dashed #EBCB76; font-size: .92rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.gl-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gl-head .nb-head { margin: 0; }
.gl-refresh { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--pink-soft); background: #fff; color: var(--pink-deep); padding: 9px; cursor: pointer; }
.gl-refresh.spin svg { animation: spin .7s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.gl-total { font: 1.15rem var(--f-hand); color: var(--brown-soft); margin: 2px 0 8px; min-height: 1.4em; }
.guest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.guest { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--tone); animation: pop .3s ease both; }
.guest-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--pink-deep); font: 800 .9rem var(--f-display); }
.guest-name { font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.guest-count { margin-left: auto; flex: none; font-size: .78rem; font-weight: 800; color: var(--brown-soft); background: rgba(255,255,255,.75); padding: 2px 9px; border-radius: 999px; }
.gl-empty { text-align: center; padding: 14px 8px; border: 2px dashed #F3BACB; border-radius: 16px; background: rgba(255, 244, 248, .85); font-size: .92rem; }
.gl-empty p { margin: 0 0 .3em; }
.nb-capy { position: absolute; right: 10px; bottom: 8px; width: 78px; pointer-events: none; }

/* ---------- THE END ---------- */
.end-rainbow { width: 240px; margin: 0 auto -10px; }
.end-title { font-size: clamp(1.45rem, 6vw, 2rem); display: block; text-align: center; }
.end-pair { width: 230px; margin: 4px auto 0; }
.the-end { font: 1.6rem var(--f-hand); color: var(--brown-soft); letter-spacing: .1em; margin: 6px 0; }

/* ---------- Scroll hint, confetti, hidden capybaras ---------- */
.more-hint { position: absolute; bottom: 12px; left: 50%; z-index: 8; transform: translateX(-50%); pointer-events: none; background: var(--pink-deep); color: #fff; font: 700 .76rem var(--f-body); padding: 4px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); opacity: 0; transition: opacity .25s; }
.page.has-more .more-hint { opacity: 1; }
.confetti { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 3px; will-change: transform; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(900px) rotate(540deg); } }
.hidden-capy { position: absolute; left: min(var(--x), calc(100% - 44px)); top: var(--y); width: 36px; height: 36px; padding: 0; border: 0; background: none; opacity: .55; cursor: pointer; z-index: 5; }
.hidden-capy span { display: block; width: 100%; }
.hidden-capy .capy-svg * { animation: none !important; }
.hidden-capy.found { opacity: 1; animation: wiggle .5s ease; }
@keyframes wiggle { 25% { transform: rotate(-14deg) scale(1.25); } 75% { transform: rotate(14deg) scale(1.25); } }

/* ---------- Pager ---------- */
.pager { position: fixed; inset: auto 0 0; z-index: 50; height: calc(var(--pager-h) + env(safe-area-inset-bottom)); padding: 0 10px env(safe-area-inset-bottom); display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #FFF9F6; border-top: 1px solid rgba(233, 119, 156, .2); }
.no-js .pager { display: none; }
.pager-btn { min-height: 46px; min-width: 76px; padding: 0 12px; white-space: nowrap; border-radius: 999px; border: 2px solid #EFA3BC; background: #fff; color: var(--pink-deep); font: 700 1rem var(--f-display); cursor: pointer; }
.pager-next { background: linear-gradient(180deg, #DE6C94, var(--pink-deep)); color: #fff; border-color: transparent; }
.pager-btn:disabled { opacity: .35; cursor: default; }
.dots { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; align-items: center; }
.dot { width: 22px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #F3C3D2; transition: transform .2s, background-color .2s; }
.dot[aria-current="page"]::before { background: var(--pink-deep); transform: scale(1.5); }

/* ---------- Toast & lightbox ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--pager-h) + 16px + env(safe-area-inset-bottom)); z-index: 80; transform: translate(-50%, 20px); max-width: calc(100vw - 32px); background: var(--brown); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; background: rgba(80, 45, 55, .94); color: #fff; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: min(92vw, 720px); text-align: center; }
.lightbox img { max-height: 76dvh; width: auto; margin: 0 auto; border-radius: 16px; border: 8px solid #fff; }
.lightbox figcaption { margin-top: 12px; font: 700 1.1rem var(--f-display); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--brown); font: 700 2rem/1 var(--f-display); cursor: pointer; }
.lb-prev { left: 10px; } .lb-next { right: 10px; }
.lightbox .dlg-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }

/* ---------- No-JS fallback ---------- */
.noscript { position: relative; z-index: 2; margin: 0; padding: 8px; text-align: center; background: var(--butter); }
.no-js .stage { height: auto; display: block; }
.no-js .book { height: auto; max-height: none; }
.no-js .book::before, .no-js .book::after, .no-js .bookmark { display: none; }
.no-js .page { position: relative; display: block; margin-bottom: 16px; }
.no-js .page-inner { height: auto; }

/* ---------- Larger screens ---------- */
@media (min-width: 560px) {
  .months { grid-template-columns: repeat(3, 1fr); }
  .gift-grid { grid-template-columns: 1fr 1fr; }
  .gift-card { flex-direction: column; text-align: center; }
  .gift-art { width: 70%; }
  .arches { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .brand { flex: none; }
  .brand-text { font-size: .95rem; max-width: none; display: block; white-space: nowrap; }
  .top-links { display: flex; gap: 2px; margin: 0 auto; }
  .top-links a { padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--brown); font-weight: 700; font-size: .92rem; }
  .top-links a:hover, .top-links a.active { background: var(--blush); color: var(--pink-deep); }
  .menu-btn { display: none; }
  .menu { display: none !important; }
  .page-inner { padding: 30px 40px 90px 48px; }
  .deco .fl-left { width: 190px; } .deco .fl-right { width: 160px; }
  .deco .bfly { width: 44px; }
  .cover-grid { display: grid; grid-template-columns: 1.05fr 1fr; grid-template-areas: "text scene" "actions scene"; align-items: center; gap: 0 26px; max-width: 980px; }
  .cover-text { grid-area: text; align-self: end; }
  .cover-scene { grid-area: scene; max-width: 470px; }
  .cover-actions { grid-area: actions; align-self: start; }
  .cover-rainbow { width: 150px; }
  .story-grid { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 30px; }
  .story-line { text-align: left; }
  .ribbon { margin-left: 0; }
  .months { grid-template-columns: repeat(4, 1fr); gap: 14px; max-width: 860px; margin: 0 auto; }
  .info-row3 { grid-template-columns: repeat(3, 1fr); }
  .gift-grid { grid-template-columns: repeat(4, 1fr); }
  .parents-note { max-width: 900px; margin-inline: auto; }
  .arches, .info-row3, .mini-card.wide { max-width: 940px; margin-inline: auto; width: 100%; }
  .notebook { grid-template-columns: 1fr 26px 1fr; max-width: 920px; width: 100%; margin: 0 auto; }
  .nb-left { border-radius: 10px 0 0 10px; }
  .nb-right { border-radius: 0 10px 10px 0; }
  .nb-rings { height: auto; background: radial-gradient(circle at 13px 14px, #fff 0 4px, #B9A7A0 4px 6px, transparent 6.5px) 0 0 / 26px 30px repeat-y, linear-gradient(90deg, #EFE6DC, #FFFDF8 40%, #FFFDF8 60%, #EFE6DC); }
  .note-box { max-width: 920px; margin-inline: auto; }
}
@media (max-width: 380px) {
  .brand-text { display: none; }
  .pager-btn { min-width: 60px; padding: 0 10px; }
  .pager-btn span { display: none; }
  .dot { width: 18px; }
  .page-inner { padding: 18px 14px 80px 18px; }
}
@media (max-height: 700px) and (max-width: 899px) {
  .t-name { font-size: 2.6rem; } .t-rainbow, .t-adv { font-size: 1.8rem; }
  .cover-scene { max-width: 330px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition: none !important; }
  .js .page .story-line { opacity: 1; transform: none; }
  .js .page .rainbow-svg .band { stroke-dashoffset: 0; }
  .deco .bfly, .deco .hrt, .sky-cloud { display: none; }
}
