/* =========================================================
   Benant & Mandeep — Wedding Invitation
   ========================================================= */

/* Self-hosted fonts (SIL Open Font License) */
@font-face { font-family: "Great Vibes"; src: url("assets/fonts/great-vibes-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("assets/fonts/cinzel-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("assets/fonts/cinzel-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("assets/fonts/cormorant-garamond-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("assets/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("assets/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("assets/fonts/cormorant-garamond-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("assets/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500 600; font-style: italic; font-display: swap; }

:root {
  --paper: #faf3e7;
  --paper-2: #f4e8d5;
  --backdrop: #efe2cf;
  --gold: #b48c48;
  --gold-soft: #d6b67a;
  --burgundy: #7b1d2c;
  --burgundy-d: #5c1420;
  --ink: #5b3d2c;
  --muted: #8a6a52;
  --focus: #7b1d2c;

  --f-script: "Great Vibes", "Pinyon Script", cursive;
  --f-caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-serif: "Cormorant Garamond", Georgia, serif;

  --turn: 900ms;
  --ease: cubic-bezier(.45, .05, .25, 1);

  /* text scale (desktop: relative to book width) */
  --fs-script: 5.4cqw;
  --fs-names: 3.2cqw;
  --fs-caps: 1.2cqw;
  --fs-caps-lg: 1.45cqw;
  --fs-body: 1.75cqw;
  --fs-venue: 2.05cqw;
  --gap: 1.2cqw;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--f-serif);
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 10%, #f8efe2 0%, var(--backdrop) 60%, #e5d3bb 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--f-caps); font-size: max(11px, .95cqw); letter-spacing: .16em; text-transform: uppercase;
  padding: .85em 1.5em; border-radius: 999px; border: 1px solid var(--gold);
  color: var(--burgundy); background: rgba(255, 252, 245, .7); text-decoration: none;
  transition: background .25s, color .25s, transform .25s, box-shadow .25s;
  white-space: nowrap;
}
.btn:hover { background: #fff; box-shadow: 0 4px 14px rgba(123, 29, 44, .12); transform: translateY(-1px); }
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn--solid { background: var(--burgundy); color: #fbf1e3; border-color: var(--burgundy); }
.btn--solid:hover { background: var(--burgundy-d); }

/* =========================================================
   COVER — a gatefold that opens from the centre
   ========================================================= */
.cover {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% 20%, #f8efe2 0%, var(--backdrop) 60%, #e3cfb5 100%);
  transition: opacity .55s ease 1.2s, visibility 0s linear 1.8s;
}
.cover__inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cover__eyebrow { font-family: var(--f-caps); letter-spacing: .4em; font-size: 12px; color: var(--muted); text-transform: uppercase; transition: opacity .4s; }
.cover__hint { font-style: italic; color: var(--muted); font-size: 16px; transition: opacity .4s; }
.cover__open { font-size: 12px; transition: opacity .4s; }

.gate {
  --gh: min(66vh, 660px); --gh: min(66dvh, 660px);
  position: relative; height: var(--gh); width: calc(var(--gh) * .8); max-width: 86vw;
  perspective: 2200px;
  animation: floatIn 1.1s var(--ease) both;
}
@media (max-aspect-ratio: 4/5) { .gate { width: min(86vw, 460px); height: auto; aspect-ratio: .8; } }
.gate__inside {
  position: absolute; inset: 0; border-radius: 8px;
  background: radial-gradient(120% 100% at 50% 45%, #fbf5ea 50%, #f1e3cc 100%);
  box-shadow: inset 0 0 0 1px rgba(180,140,72,.6), inset 0 0 0 8px #f8efe0, inset 0 0 0 9px rgba(180,140,72,.45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10%;
  opacity: 0; transform: scale(.96); transition: opacity 1s ease .45s, transform 1.6s var(--ease) .3s;
}
.gate__names { font-family: var(--f-caps); color: var(--burgundy); font-size: clamp(18px, calc(var(--gh) * .045), 30px); letter-spacing: .14em; line-height: 1.4; }
.gate__names .amp { font-family: var(--f-script); color: var(--gold); font-size: 1.4em; letter-spacing: 0; }
.gate__divider { width: 62%; margin: 4% 0; }
.gate__sub { font-family: var(--f-caps); font-size: clamp(10px, calc(var(--gh) * .02), 13px); letter-spacing: .38em; color: var(--ink); }

.door {
  position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden;
  transition: transform 1.55s cubic-bezier(.55,.05,.2,1) .28s, box-shadow 1.2s ease .28s;
  box-shadow: 0 24px 50px rgba(70,40,20,.28);
}
.door img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.door--l { left: 0; transform-origin: 0 50%; border-radius: 8px 0 0 8px; }
.door--l img { transform: scaleX(-1); }
.door--r { right: 0; transform-origin: 100% 50%; border-radius: 0 8px 8px 0; }
/* the gold cord, split down the seam */
.door__cord { position: absolute; top: 0; bottom: 0; width: calc(var(--gh) * .0115); background: url("assets/web/cord.webp") center / 200% 100% no-repeat; }
.door--l .door__cord { right: 0; background-position: left center; }
.door--r .door__cord { left: 0; background-position: right center; }
.door__shade { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease .3s; pointer-events: none; }
.door--l .door__shade { background: linear-gradient(90deg, rgba(60,35,15,0) 40%, rgba(60,35,15,.35)); }
.door--r .door__shade { background: linear-gradient(270deg, rgba(60,35,15,0) 40%, rgba(60,35,15,.35)); }

.gate__seal {
  position: absolute; left: 50%; top: 50%; width: 30%; aspect-ratio: 1; z-index: 3;
  transform: translate(-50%, -50%); border-radius: 50%;
  filter: drop-shadow(0 6px 10px rgba(80,45,10,.35));
  transition: transform .55s var(--ease), opacity .45s ease .1s;
}
.gate__seal img { width: 100%; height: 100%; pointer-events: none; }
.gate__seal::after {
  content: ""; position: absolute; inset: -7%; border-radius: 50%;
  border: 2px solid rgba(214,182,122,.9); animation: ring 2.4s ease-out infinite;
}
.gate__seal:hover { transform: translate(-50%, -50%) scale(1.04); }
@keyframes ring { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.22); opacity: 0; } }
@keyframes floatIn { from { opacity: 0; transform: translateY(16px) scale(.98); } }

body.is-opening .gate__seal { transform: translate(-50%, -50%) scale(1.25); opacity: 0; pointer-events: none; }
body.is-opening .gate__seal::after { display: none; }
body.is-opening .door--l { transform: rotateY(-100deg); box-shadow: 0 10px 20px rgba(70,40,20,.08); }
body.is-opening .door--r { transform: rotateY(100deg); box-shadow: 0 10px 20px rgba(70,40,20,.08); }
body.is-opening .door__shade { opacity: 1; }
body.is-opening .gate__inside { opacity: 1; transform: scale(1); }
body.is-opening .cover__open, body.is-opening .cover__hint, body.is-opening .cover__eyebrow { opacity: 0; }
body.is-opening .cover { opacity: 0; visibility: hidden; }
body.is-open .cover { display: none; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app {
  height: 100vh; height: 100dvh;
  display: grid; grid-template-rows: auto 1fr auto;
  opacity: 0; transition: opacity .9s ease 1.5s;
}
body.is-opening .app, body.is-open .app { opacity: 1; }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px 0; gap: 12px; }
.topbar__title { font-family: var(--f-caps); letter-spacing: .3em; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.topbar__title span { font-family: var(--f-script); text-transform: none; letter-spacing: 0; font-size: 1.5em; color: var(--gold); }

.music { display: flex; align-items: center; gap: 10px; }
.music__btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--gold); background: rgba(255, 252, 245, .75); color: var(--burgundy);
  transition: background .25s;
}
.music__btn:hover { background: #fff; }
.music__btn svg { width: 20px; height: 20px; fill: currentColor; }
.music__btn .ico-on { display: none; }
.music__btn[aria-pressed="true"] .ico-on { display: block; }
.music__btn[aria-pressed="true"] .ico-off { display: none; }
.music__btn[aria-pressed="true"] { animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 50% { box-shadow: 0 0 0 6px rgba(214, 182, 122, .25); } }
.music__prompt {
  font-style: italic; font-size: 15px; color: var(--burgundy);
  padding: 6px 14px; border-radius: 999px; background: rgba(255, 252, 245, .75); border: 1px solid rgba(180, 140, 72, .5);
  transition: opacity .5s, transform .5s;
}
.music__prompt.is-hidden { opacity: 0; transform: translateX(8px); pointer-events: none; }
.music.is-unavailable .music__btn { opacity: .55; }

.stage {
  position: relative; display: grid; place-items: center; min-height: 0;
  padding: 10px 24px; touch-action: pan-y;
}

/* ---------- controls ---------- */
.controls { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 4px 16px 18px; }
.nav-btn {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(180, 140, 72, .7); color: var(--burgundy); background: rgba(255, 252, 245, .6);
  transition: background .25s, opacity .25s;
}
.nav-btn:hover:not(:disabled) { background: #fff; }
.nav-btn:disabled { opacity: .3; cursor: default; }
.nav-btn svg { width: 22px; height: 22px; }
.progress { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 150px; }
.counter { font-family: var(--f-caps); font-size: 12px; letter-spacing: .25em; color: var(--muted); }
.dots { display: flex; gap: 4px; }
.dot { width: 22px; height: 22px; display: grid; place-items: center; }
.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgba(180, 140, 72, .4); transition: .3s; }
.dot[aria-current="true"]::before { width: 16px; border-radius: 4px; background: var(--burgundy); }

/* =========================================================
   BOOK (desktop: open two-page spread)
   ========================================================= */
.book {
  position: relative;
  width: min(94vw, calc((100vh - 150px) * 1.56), 1280px);
  width: min(94vw, calc((100dvh - 150px) * 1.56), 1280px);
  aspect-ratio: 1.56;
  container-type: inline-size;
  perspective: 2600px;
  border-radius: 1cqw;
  box-shadow: 0 0 0 1px rgba(180, 140, 72, .55), 0 0 0 .55cqw #f2e5cf, 0 0 0 calc(.55cqw + 1px) rgba(180, 140, 72, .55), 0 2.5cqw 5cqw rgba(70, 40, 20, .25);
}
body.is-opening .book { animation: bookIn 1.3s var(--ease) 1.5s both; }
@keyframes bookIn { from { opacity: 0; transform: scale(.955) translateY(10px); } }

.spread {
  position: absolute; inset: 0; display: flex;
  border-radius: 1cqw; overflow: hidden; background: var(--paper);
}
/* spine shading */
.spread::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 7cqw; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(110, 70, 30, .07) 38%, rgba(90, 55, 25, .2) 50%, rgba(110, 70, 30, .07) 62%, transparent);
  pointer-events: none; z-index: 5;
}

.page {
  position: relative; flex: 1 1 50%; min-width: 0; overflow: hidden;
  background: radial-gradient(130% 100% at 50% 40%, var(--paper) 55%, var(--paper-2) 100%);
}
/* paper grain */
.page::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .32 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* double gold frame */
.frame::before {
  content: ""; position: absolute; inset: 1.6cqw; z-index: 3; pointer-events: none;
  border: 1px solid rgba(180, 140, 72, .7);
  box-shadow: inset 0 0 0 .32cqw rgba(250, 243, 231, .0), inset 0 0 0 calc(.32cqw + 1px) rgba(180, 140, 72, .45);
  border-radius: .4cqw;
}

.page__content {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 7cqw 6cqw;
}

/* art pages */
.art { position: absolute; inset: 0; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art--scene img { transform: scale(1.045); }  /* trims the thin border baked into the reference crops */
.art--fallback { background: linear-gradient(160deg, #f6e7d4, #efd9c0); }
.art--fallback img { visibility: hidden; }

/* floral corners */
.corner { position: absolute; z-index: 3; pointer-events: none; }
.corner--tr { top: 0; right: 0; width: 46%; }
.corner--tl { top: 0; left: 0; width: 46%; transform: scaleX(-1); }
.corner--br { bottom: 0; right: 0; width: 44%; }
.corner--bl { bottom: 0; left: 0; width: 44%; transform: scaleX(-1); }
.corner--sm.corner--tr, .corner--sm.corner--tl { width: 34%; }
.corner--sm.corner--br, .corner--sm.corner--bl { width: 33%; }

/* typography */
.script {
  font-family: var(--f-script); font-weight: 400; color: var(--burgundy);
  font-size: var(--fs-script); line-height: 1.02;
}
.caps {
  font-family: var(--f-caps); text-transform: none; color: var(--ink);
  font-size: var(--fs-caps); letter-spacing: .3em; line-height: 1.75; font-weight: 500;
}
.caps--lg { font-size: var(--fs-caps-lg); letter-spacing: .24em; }
.body { font-size: var(--fs-body); line-height: 1.45; }
.venue { font-family: var(--f-serif); font-size: var(--fs-venue); font-weight: 600; color: var(--burgundy); line-height: 1.25; }
.address { font-size: var(--fs-body); font-style: italic; color: var(--muted); }
.stack > * + * { margin-top: var(--gap); }
.tight > * + * { margin-top: .25em; }

.ornament { display: flex; align-items: center; justify-content: center; gap: .9cqw; color: var(--gold); margin: 1.4cqw 0; }
.ornament::before, .ornament::after { content: ""; height: 1px; width: 4.5cqw; background: linear-gradient(90deg, transparent, var(--gold)); }
.ornament::after { transform: scaleX(-1); }
.ornament svg { width: 1.6cqw; height: 1.6cqw; fill: currentColor; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .9cqw; margin-top: 2.4cqw; }

/* ---------- page 1 ---------- */
.names-caps {
  font-family: var(--f-caps); color: var(--burgundy); font-weight: 500;
  font-size: var(--fs-names); letter-spacing: .14em; line-height: 1.35;
}
.names-caps .amp { font-family: var(--f-script); color: var(--gold); font-size: 1.35em; letter-spacing: 0; padding: 0 .1em; }
.p1 .caps { letter-spacing: .38em; }

/* ---------- page 2 ---------- */
.couple-wrap { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-end; justify-content: center; padding: 0 0 9%; }
/* couple at ~75% of the page height, standing inside the arch and clear of the gold frame */
.couple-wrap picture { height: 82%; display: flex; justify-content: center; }
.couple-wrap img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom center; }
.arch-line { top: 9% !important; bottom: 7% !important; left: 12% !important; right: 12% !important; }
.arch-line { position: absolute; z-index: 1; left: 9%; right: 9%; top: 5%; bottom: 3%; color: var(--gold); }
.arch-line svg { width: 100%; height: 100%; }
.p2 .script { font-size: calc(var(--fs-script) * .95); }

/* ---------- page 7 dress code ---------- */
.dress { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; padding: 4cqw 12cqw 4.6cqw; }
.dress__cols { flex: 1; min-height: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: .8cqw; }
.dress__col { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 2.2cqw; min-height: 0; }
.dress__col + .dress__col { border-left: 1px solid rgba(180, 140, 72, .55); }
.dress__cols { align-content: center; }
/* explicit height: Safari collapses percentage heights inside flex/grid cells */
.dress__imgs { flex: none; height: 25cqw; width: 100%; display: flex; justify-content: center; align-items: flex-end; gap: .8cqw; }
.dress__imgs img { height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom; flex: 0 1 auto; min-width: 0; }
.p7 .corner--tr, .p7 .corner--tl { width: 21%; }
.p7 .corner--br, .p7 .corner--bl { width: 17%; }
.dress__imgs--two img { max-width: 48%; height: 92%; }
.dress__label { font-family: var(--f-script); color: var(--burgundy); font-size: 3.3cqw; line-height: 1.1; margin-top: 1cqw; }
.dress__text { font-size: 1.55cqw; line-height: 1.35; min-height: 6.2em; }

/* ---------- page 8 rsvp ---------- */
.rsvp-arch { position: absolute; inset: 4.5cqw 6cqw 3.2cqw; z-index: 2; }
.rsvp-arch svg.arch { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--gold); }
.rsvp-arch__content { position: absolute; inset: 14% 10% 26%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.rsvp-name { font-family: var(--f-serif); font-size: var(--fs-venue); color: var(--burgundy); font-weight: 600; }
.tel { font-family: var(--f-caps); font-size: var(--fs-caps-lg); letter-spacing: .14em; text-decoration: none; border-bottom: 1px solid rgba(180, 140, 72, .5); }
.tel:hover { color: var(--burgundy); }
.closing { font-size: 2.2cqw; font-style: italic; line-height: 1.45; color: var(--ink); max-width: 36cqw; text-wrap: balance; }
.closing p + p { margin-top: .5em; }
.p4 .page-r .script { font-size: calc(var(--fs-script) * .86); }

/* ---------- page-turn: a blank leaf sweeps over while the spreads crossfade ---------- */
:root { --turn: 1050ms; --turn-ease: cubic-bezier(.45, .02, .2, 1); }
.spread.turn-out { z-index: 8; animation: turnOut calc(var(--turn) * .34) ease-in forwards; pointer-events: none; }
.spread.turn-in  { animation: turnIn calc(var(--turn) * .55) ease-out calc(var(--turn) * .38) both; }
@keyframes turnOut { to { opacity: 0; } }
@keyframes turnIn  { from { opacity: 0; } }

.leaf {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 20;
  transform-style: preserve-3d; will-change: transform, opacity; pointer-events: none;
}
.leaf--next { left: 50%; transform-origin: 0 50%; animation: leafNext var(--turn) var(--turn-ease) forwards; }
.leaf--prev { left: 0; transform-origin: 100% 50%; animation: leafPrev var(--turn) var(--turn-ease) forwards; }
@keyframes leafNext {
  0%   { transform: rotateY(0deg);    opacity: 0; }
  14%  { opacity: 1; }
  86%  { opacity: 1; }
  100% { transform: rotateY(-180deg); opacity: 0; }
}
@keyframes leafPrev {
  0%   { transform: rotateY(0deg);   opacity: 0; }
  14%  { opacity: 1; }
  86%  { opacity: 1; }
  100% { transform: rotateY(180deg); opacity: 0; }
}
.face {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: radial-gradient(130% 100% at 50% 40%, var(--paper) 55%, var(--paper-2) 100%);
}
.face--back { transform: rotateY(180deg); }
.face::before { /* fine gold frame on the leaf */
  content: ""; position: absolute; inset: 3.2cqw 2.4cqw; border: 1px solid rgba(180,140,72,.55);
  box-shadow: inset 0 0 0 .32cqw transparent, inset 0 0 0 calc(.32cqw + 1px) rgba(180,140,72,.3);
}
.face::after { /* light falling across the curling page */
  content: ""; position: absolute; inset: 0; animation: shade var(--turn) ease forwards;
}
.leaf--next .face--front::after { background: linear-gradient(90deg, rgba(60,35,15,.22), rgba(255,255,255,.12) 45%, transparent 70%); }
.leaf--next .face--back::after  { background: linear-gradient(270deg, rgba(60,35,15,.22), rgba(255,255,255,.12) 45%, transparent 70%); }
.leaf--prev .face--front::after { background: linear-gradient(270deg, rgba(60,35,15,.22), rgba(255,255,255,.12) 45%, transparent 70%); }
.leaf--prev .face--back::after  { background: linear-gradient(90deg, rgba(60,35,15,.22), rgba(255,255,255,.12) 45%, transparent 70%); }
@keyframes shade { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: .2; } }
/* soft shadow the leaf casts on the page beneath */
.leaf-shadow {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 15; pointer-events: none;
  animation: castShadow var(--turn) var(--turn-ease) forwards;
}
.leaf-shadow--next { left: 50%; background: linear-gradient(90deg, rgba(60,35,15,.18), transparent 60%); }
.leaf-shadow--prev { left: 0;   background: linear-gradient(270deg, rgba(60,35,15,.18), transparent 60%); }
@keyframes castShadow { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }

/* =========================================================
   GOLD FRAME + FRAMED ILLUSTRATIONS (left pages)
   ========================================================= */
.gpage { container-type: inline-size; }
.gpage { --m: 2.6cqi; }
.gframe { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
/* line offsets match the bevelled lines inside gold_corner.webp (306×356 px, drawn at 16cqi) */
.gframe::before, .gframe::after { content: ""; position: absolute; border-style: solid; border-color: #c49a52; }
.gframe::before { inset: calc(var(--m) + .86cqi) calc(var(--m) + .68cqi); border-width: max(1px, .56cqi); border-color: #c79d55; border-radius: 1px; }
.gframe::after  { inset: calc(var(--m) + 2.2cqi) calc(var(--m) + 1.67cqi); border-width: max(1px, .2cqi); opacity: .85; }
.gcorner { position: absolute; width: 16cqi; z-index: 4; pointer-events: none; }
.gcorner--br { right: var(--m); bottom: var(--m); }
.gcorner--bl { left: var(--m); bottom: var(--m); transform: scaleX(-1); }
.gcorner--tr { right: var(--m); top: var(--m); transform: scaleY(-1); }
.gcorner--tl { left: var(--m); top: var(--m); transform: scale(-1, -1); }

.scene {
  position: absolute; inset: 9cqi 8cqi; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4.5cqi;
}
.scene__divider { width: 40%; opacity: .95; }
.scene__divider--b { width: 34%; }
.scene__art { width: 100%; position: relative; }
.scene__art img {
  width: 100%; height: auto; display: block; mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%), linear-gradient(180deg, transparent 0, #000 14%, #000 86%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%), linear-gradient(180deg, transparent 0, #000 14%, #000 86%, transparent 100%);
          mask-composite: intersect;
}
.scene__sprig { position: absolute; z-index: 5; width: 30cqi; left: 0; bottom: 0; pointer-events: none; transform: translate(-6%, 4%); }
.scene__sprig--top { top: 0; bottom: auto; transform: translate(-8%, -6%) rotate(180deg) scaleX(-1); }
.scene__art.art--fallback { min-height: 40cqi; background: radial-gradient(closest-side, #f3e3cc, transparent); }
.scene__art.art--fallback img { visibility: hidden; }

/* =========================================================
   CALENDAR SHEET + TOAST
   ========================================================= */
.toast {
  position: fixed; left: 50%; bottom: 92px; z-index: 60; transform: translate(-50%, 20px);
  background: var(--burgundy); color: #fbf1e3; padding: 10px 18px; border-radius: 999px; font-size: 16px;
  opacity: 0; pointer-events: none; transition: .35s; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   MOBILE / PORTRAIT: vertical swipe, one page per swipe
   ---------------------------------------------------------
   The book becomes a vertical scroller; every page is exactly
   one screen tall and snaps into place. Sizes scale with both
   the width and the height of the screen so nothing is cut off.
   ========================================================= */
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  body { overscroll-behavior: none; }
  .topbar { padding: 10px 14px 0; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar__title { font-size: 10px; letter-spacing: .22em; }
  .music__btn { width: 38px; height: 38px; }
  .music__prompt { font-size: 14px; padding: 5px 12px; }
  .stage { padding: 6px 10px 2px; }
  .controls { gap: 14px; padding: 4px 12px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .nav-btn { width: 46px; height: 46px; }
  .nav-btn svg { transform: rotate(90deg); }            /* arrows point up / down */
  .progress { min-width: 0; }
  .dots { gap: 0; }
  .dot { width: 18px; }

  .book {
    width: min(100%, 520px); height: 100%; aspect-ratio: auto;
    perspective: none; container-type: normal; border-radius: 12px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(180, 140, 72, .55), 0 12px 30px rgba(70, 40, 20, .18);
  }
  .book.scroller { overflow: hidden; touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
  .book.scroller a, .book.scroller button { touch-action: manipulation; }
  .track {
    height: 100%; will-change: transform;
    transition: transform .6s cubic-bezier(.22, .8, .22, 1);
  }

  .spread {
    position: relative; inset: auto; height: 100%; min-height: 100%;
    flex-direction: column; overflow: hidden; border-radius: 0;
    container-type: size;
    transition: transform .6s cubic-bezier(.22, .8, .22, 1), opacity .6s ease, filter .6s ease;
    --fs-script: min(11cqw, 6.6cqh);
    --fs-names: min(7.6cqw, 4.6cqh);
    --fs-caps: max(10px, min(3.3cqw, 2cqh));
    --fs-caps-lg: max(11px, min(3.8cqw, 2.3cqh));
    --fs-body: max(14px, min(4.7cqw, 2.8cqh));
    --fs-venue: max(16px, min(5.5cqw, 3.3cqh));
    --gap: min(1.6cqw, .9cqh);
  }
  .spread + .spread { box-shadow: 0 -1px 0 rgba(180, 140, 72, .35); }
  /* depth while turning: pages not in view sit slightly back */
  .track > .spread:not(.is-current) { transform: scale(.955); opacity: .55; filter: brightness(.97); }
  .spread::after { display: none; }
  .page { flex: none; }
  .page-l { height: 41%; }
  .page-r { flex: 1 1 auto; min-height: 0; }
  .page__content { position: absolute; inset: 0; padding: 5cqh 8cqw 4.5cqh; }
  .p4 .page-r .script { font-size: calc(var(--fs-script) * .84); }
  .frame::before { inset: 9px; border-radius: 6px; box-shadow: inset 0 0 0 4px rgba(250, 243, 231, 0), inset 0 0 0 5px rgba(180, 140, 72, .45); }
  .page-l.frame::before { display: none; }
  .p8 .page-l.frame::before { display: block; }

  .ornament { gap: 8px; margin: min(2.4cqw, 1.5cqh) 0; }
  .ornament::before, .ornament::after { width: 44px; }
  .ornament svg { width: 14px; height: 14px; }
  .actions { gap: 8px; margin-top: min(4cqw, 2.4cqh); flex-wrap: wrap; }
  .btn { font-size: max(10px, min(2.75cqw, 1.65cqh)); letter-spacing: .07em; padding: .95em 1.1em; min-height: 40px; gap: .4em; }
  .spread .btn--exact { font-size: max(14px, min(4.2cqw, 2.4cqh)); }

  .corner--tr, .corner--tl { width: 40%; }
  .corner--br, .corner--bl { width: 38%; }
  .p7 .corner--tr, .p7 .corner--tl { width: 34%; }
  .p7 .corner--br, .p7 .corner--bl { width: 28%; }

  /* page 1 */
  .p1 .page-l { height: 46%; }
  .p1 .page-l .art img { object-position: 30% 40%; }
  /* page 2 */
  .p2 .page-l { height: 53%; }
  .couple-wrap { padding: 0 0 8%; }
  .couple-wrap picture { height: 84%; }
  .p2 .page__content .caps { line-height: 1.6; }
  /* framed scenes */
  .scene { inset: 9cqi 9cqi; gap: 0; }
  .scene__divider { display: none; }
  .scene__sprig { width: 24cqi; }
  /* page 7 — dress code fills the screen */
  .p7 .page-full { height: 100%; }
  .dress { position: absolute; inset: 0; padding: 6cqh 7cqw 4cqh; justify-content: flex-start; }
  .dress .script { font-size: min(12cqw, 7cqh); }
  .dress .ornament { margin: 1cqh 0; }
  .dress__cols { flex: 1; grid-template-columns: 1fr; grid-template-rows: repeat(3, 1fr); gap: 0; margin-top: 0; align-content: stretch; }
  .dress__col { display: grid; grid-template-columns: 40% 1fr; grid-template-rows: auto auto; column-gap: 4cqw; align-items: center; align-content: center; text-align: left; padding: 1cqh 0; }
  .dress__col + .dress__col { border-left: 0; border-top: 1px solid rgba(180, 140, 72, .5); }
  .dress__imgs { grid-row: 1 / span 2; height: 21cqh; flex: none; }
  .dress__label { font-size: min(9cqw, 5.2cqh); margin-top: 0; align-self: end; }
  .dress__text { font-size: max(14px, min(4.3cqw, 2.5cqh)); min-height: 0; align-self: start; }
  /* page 8 — RSVP arch and closing message share one screen on phones */
  .p8 .page-l { height: 58%; }
  .p8 .page-l .corner--tl, .p8 .page-l .corner--br { width: 30%; }
  .rsvp-arch { inset: 3cqh 12cqw 12px; }
  .rsvp-arch__content { inset: 17% 6% 14%; }
  .p8 .rsvp-arch .script { font-size: min(12.5cqw, 6.6cqh); }
  .p8 .rsvp-arch .ornament { margin: .8cqh 0 1cqh; }
  .rsvp-name { font-size: max(17px, min(5.8cqw, 3cqh)); }
  .tel { font-size: max(14px, min(4.6cqw, 2.4cqh)); }
  .p8 .page-r .page__content { padding: 2.5cqh 9cqw 3cqh; }
  .p8 .page-r .corner--tr { display: none; }
  .p8 .page-r .ornament { margin: .9cqh 0; }
  .closing { font-size: max(16px, min(5.2cqw, 2.75cqh)); max-width: 78cqw; line-height: 1.35; }
  .closing p + p { margin-top: .3em; }
  .p8 .actions { margin-top: 1.6cqh; }
  .p8 .spread .btn--exact, .spread.p8 .btn--exact { font-size: max(14px, min(4cqw, 2.1cqh)); padding: .8em 1.3em; }

  /* swipe-up prompt on the first page (stays until the guest moves on) */
  .swipe-hint {
    position: absolute; left: 50%; bottom: 3.2cqh; z-index: 6; transform: translateX(-50%);
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
    font-family: var(--f-serif); font-weight: 600; font-size: max(15px, min(4.4cqw, 2.3cqh)); letter-spacing: .02em;
    color: #fbf1e3; background: var(--burgundy); padding: 9px 18px 9px 13px; border-radius: 999px;
    box-shadow: 0 8px 20px rgba(92, 20, 32, .3);
    pointer-events: none; transition: opacity .4s, transform .4s;
    animation: hintIn .6s ease 2.6s both;
  }
  .swipe-hint__hand { width: 22px; height: 22px; animation: handUp 1.6s ease-in-out infinite; }
  .book.scrolled .swipe-hint { opacity: 0; }

}
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes handUp { 0%, 100% { transform: translateY(5px); opacity: .85; } 55% { transform: translateY(-6px); opacity: 1; } }
.track.peeking { transition: transform .7s cubic-bezier(.45, .05, .3, 1); }

/* pulsing next-page arrow until the guest moves on */
.nav-btn.nudge { background: var(--burgundy); color: #fbf1e3; border-color: var(--burgundy); animation: nudge 1.8s ease-out infinite; }
.nav-btn.nudge:hover:not(:disabled) { background: var(--burgundy-d); }
@keyframes nudge { 0% { box-shadow: 0 0 0 0 rgba(123, 29, 44, .45); } 70% { box-shadow: 0 0 0 14px rgba(123, 29, 44, 0); } 100% { box-shadow: 0 0 0 0 rgba(123, 29, 44, 0); } }

/* desktop: the right page lifts at the corner as a teaser */
.peek-leaf {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 50%; z-index: 20; pointer-events: none;
  transform-origin: 0 50%; transform-style: preserve-3d;
  animation: peekLeaf 1.45s cubic-bezier(.45, .05, .3, 1) both;
}
.peek-leaf__face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: -6px 0 18px rgba(60, 35, 15, .12); }
.peek-leaf__face > .spread { width: 200%; left: -100%; border-radius: 0; }
.peek-leaf__face > .spread::after { display: none; }
.peek-leaf__face::after { content: ""; position: absolute; inset: 0; z-index: 30; background: linear-gradient(90deg, rgba(60, 35, 15, .16), rgba(255, 255, 255, .08) 45%, transparent 70%); animation: shade 1.45s ease both; }
@keyframes peekLeaf {
  0% { transform: rotateY(0); }
  45% { transform: rotateY(-17deg); }
  100% { transform: rotateY(0); }
}
.turn-hint { font-style: italic; font-size: 14px; color: var(--burgundy); opacity: 0; max-height: 0; transition: opacity .5s, max-height .5s; }
body.guiding .turn-hint { opacity: 1; max-height: 24px; }
@media (max-width: 820px), (max-aspect-ratio: 4/5) { .turn-hint { display: none; } }
@media (min-width: 821px) and (min-aspect-ratio: 4/5) { .swipe-hint { display: none; } }

/* =========================================================
   REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}

/* last page: whole-wedding calendar links */
.p8 .actions { flex-direction: column; align-items: center; gap: 0; }
.cal-title { display: inline-flex; align-items: center; gap: .45em; margin-top: 2.6cqw; font-family: var(--f-serif); font-weight: 600; color: var(--burgundy); font-size: max(15px, 1.6cqw); letter-spacing: .02em; }
.cal-title svg { width: 1.1em; height: 1.1em; }
.cal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .9cqw; margin-top: 1.1cqw; }
.cal-links .btn { font-size: max(11px, 1.02cqw); }
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  .cal-title { margin-top: 1.6cqh; font-size: max(15px, min(4.6cqw, 2.4cqh)); }
  .cal-links { gap: 2cqw; margin-top: 1.1cqh; flex-wrap: nowrap; }
  .cal-links .btn { font-size: max(9.5px, min(2.65cqw, 1.55cqh)); letter-spacing: .05em; padding: 1em .95em; min-height: 40px; }
}
/* exact-case label for the closing call to action */
.btn--exact { text-transform: none; font-family: var(--f-serif); font-weight: 600; letter-spacing: .04em; font-size: max(15px, 1.45cqw); }
