/* ============ Theme: royal white & gold ============ */
:root {
  --bg: #f4ecdd;
  --card: #fffdf8;
  --gold-ink: #7a5a1e;       /* gold dark enough for small text */
  --gold: #b08d43;
  --gold-light: #e2c98d;
  --gold-pale: #f3e7c8;
  --text: #4a3b28;
  --muted: #7d6a52;
  --line: rgba(176, 141, 67, 0.45);
  --foil: linear-gradient(115deg, #7a5a1e 0%, #b8893b 26%, #dcbd6c 42%, #a07a34 60%, #c9a24a 78%, #7a5a1e 100%);
  --foil-bright: linear-gradient(115deg, #a67a30 0%, #e3c57d 30%, #fbf0c8 45%, #c9a24a 62%, #e9cf8a 80%, #a67a30 100%);

  --script: "Great Vibes", "Brush Script MT", cursive;
  --serif: "Cormorant Garamond", "Tiro Bangla", Georgia, "Times New Roman", serif;   /* Tiro Bangla: only if a guest types Bangla */
  --caps: "Cinzel", "Trajan Pro", Georgia, serif;
  --arabic: "Amiri", "Traditional Arabic", serif;

  --controls: 58px;          /* nav row height + gap */
  --turn: 0.95s;
  --ease-turn: cubic-bezier(0.645, 0.045, 0.355, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  font-family: var(--serif);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255, 255, 255, 0.85), transparent 75%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23b08d43' stroke-opacity='.2' stroke-width='1'%3E%3Cpath d='M36 22c5 6 5 8 0 14-5-6-5-8 0-14zM36 50c5-6 5-8 0-14-5 6-5 8 0 14zM22 36c6-5 8-5 14 0-6 5-8 5-14 0zM50 36c-6-5-8-5-14 0 6 5 8 5 14 0z'/%3E%3Ccircle cx='36' cy='36' r='19'/%3E%3C/g%3E%3Cg fill='%23b08d43' fill-opacity='.22'%3E%3Ccircle cx='0' cy='0' r='2'/%3E%3Ccircle cx='72' cy='0' r='2'/%3E%3Ccircle cx='0' cy='72' r='2'/%3E%3Ccircle cx='72' cy='72' r='2'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

.foil {
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ============ Falling gold flecks & petals ============ */
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.petal {
  position: absolute;
  top: -40px;
  width: var(--s);
  height: calc(var(--s) * 1.25);
  border-radius: 150% 0 150% 0;
  background: linear-gradient(135deg, #fff6e6, #e8cfa6 80%);
  box-shadow: 0 1px 2px rgba(122, 90, 30, 0.15);
  animation: fall var(--d) linear var(--delay) infinite;
}
.petal:nth-child(2n) { background: var(--foil-bright); border-radius: 50%; width: calc(var(--s) * 0.45); height: calc(var(--s) * 0.45); box-shadow: none; }
@keyframes fall {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(var(--x), calc(100vh + 80px), 0) rotate(var(--r)); }
}

/* ============ Step 0: the envelope ============ */
.env-screen {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(22px, 5vmin, 44px);
  padding: 16px;
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.env-screen.leaving { opacity: 0; transform: scale(1.08); pointer-events: none; }

.env-greeting {
  margin: 0;
  font-family: var(--script);
  font-size: clamp(2.3rem, 7vmin, 4rem);
  line-height: 1.2;
  text-align: center;
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.envelope {
  position: relative;
  width: min(84vw, 480px, 78vh);
  width: min(84vw, 480px, 78svh);
  aspect-ratio: 3 / 2;
  margin-top: clamp(30px, 9vmin, 90px);
  padding: 0;
  border: 0;
  background: none;
  perspective: 1200px;
}
.envelope:focus-visible { outline: 2px solid var(--gold); outline-offset: 10px; border-radius: 8px; }

.env-back {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(#ece0c6, #f6eedd);
  box-shadow: 0 24px 50px rgba(110, 80, 30, 0.28), inset 0 0 0 1px var(--gold-light);
}

.env-letter {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 5%;
  height: 90%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5%;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(110, 80, 30, 0.18), inset 0 0 0 5px #fff, inset 0 0 0 6px var(--gold), inset 0 0 0 9px #fff, inset 0 0 0 10px var(--line);
  container-type: inline-size;
  transition: transform 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.95s;
}
.letter-crown svg { display: block; width: 11cqw; height: 5cqw; fill: var(--gold); }
.letter-initials { font-family: var(--script); font-size: 14cqw; line-height: 1.1; color: var(--gold-ink); }
.letter-sub { margin-top: 1cqw; font-family: var(--caps); font-size: 3.4cqw; letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold-ink); }

.env-front {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 -2px 3px rgba(110, 80, 30, 0.14));
}

.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 62%;
  z-index: 3;
  transform-origin: top center;
  filter: drop-shadow(0 4px 5px rgba(110, 80, 30, 0.22));
  transition: transform 0.8s ease 0.35s, z-index 0s linear 0.75s;
}
.env-flap svg { display: block; width: 100%; height: 100%; }

.seal {
  position: absolute;
  left: 50%;
  top: 62%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 48% 52% 50% 50% / 52% 47% 53% 48%;
  background: radial-gradient(circle at 35% 28%, #fdf3cf, #dcbd6c 38%, #a67a30 72%, #7a5a1e);
  box-shadow:
    inset 0 0 0 5px rgba(122, 90, 30, 0.3),
    inset 0 0 0 7px rgba(255, 246, 215, 0.4),
    0 6px 14px rgba(110, 80, 30, 0.35);
  container-type: inline-size;
  transform: translate(-50%, -50%);
  animation: seal-glow 2.4s ease-in-out infinite;
  transition: transform 0.45s ease, opacity 0.45s ease;
}
.seal span { font-family: var(--script); font-size: 36cqw; color: #5c4114; text-shadow: 0 1px 0 rgba(255, 243, 205, 0.7); }
@keyframes seal-glow {
  0%, 100% { box-shadow: inset 0 0 0 5px rgba(122,90,30,.3), inset 0 0 0 7px rgba(255,246,215,.4), 0 6px 14px rgba(110,80,30,.35), 0 0 0 0 rgba(201,162,74,.5); }
  50%      { box-shadow: inset 0 0 0 5px rgba(122,90,30,.3), inset 0 0 0 7px rgba(255,246,215,.4), 0 6px 14px rgba(110,80,30,.35), 0 0 0 14px rgba(201,162,74,0); }
}

.envelope.open .seal { animation: none; opacity: 0; transform: translate(-50%, -50%) scale(1.4); }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope.open .env-letter { transform: translateY(-62%); }

.env-hint {
  margin: 0;
  font-family: var(--caps);
  font-size: clamp(0.68rem, 1.6vmin, 0.9rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-ink);
  animation: hint 2.4s ease-in-out infinite;
}
@keyframes hint { 50% { opacity: 0.45; } }

/* ============ Card stage ============ */
.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  opacity: 0;
  transition: opacity 0.9s ease;
}
.stage.shown { opacity: 1; }

/* The card keeps a 2:3 shape and fits the screen; everything inside scales with it */
.book {
  position: relative;
  flex: none;
  width: min(calc(100vw - 32px), calc((100vh - 32px - var(--controls)) * 2 / 3), 580px);
  width: min(calc(100vw - 32px), calc((100svh - 32px - var(--controls)) * 2 / 3), 580px);
  aspect-ratio: 2 / 3;
  perspective: 2400px;
  container-type: inline-size;
}

.page {
  position: absolute;
  inset: 0;
  border-radius: 1.2cqw;
  background-color: var(--card);
  background-image:
    radial-gradient(circle at 50% 0%, #fff 0%, transparent 60%),
    radial-gradient(circle at 50% 110%, rgba(243, 231, 200, 0.55), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .25 0 0 0 .045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: 0 3cqw 9cqw rgba(110, 80, 30, 0.22), 0 0.4cqw 1.2cqw rgba(110, 80, 30, 0.12), inset 0 0 0 1px rgba(176, 141, 67, 0.25);
  transform-origin: left center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform var(--turn) var(--ease-turn);
}
.page.turned { transform: rotateY(-180deg); }

/* Gold foil double frame, corner flourishes and a crown on top */
.frame {
  position: absolute;
  inset: 3.5cqw;
  border: 0.55cqw solid transparent;
  border-image: var(--foil) 1;
  pointer-events: none;
}
.frame::before { content: ""; position: absolute; inset: 1.3cqw; border: 1px solid var(--gold-light); }
.frame i {
  position: absolute;
  width: 16cqw;
  height: 16cqw;
  background: url("assets/corner.svg") no-repeat center / contain;
}
.frame i:nth-child(1) { top: -2.6cqw; left: -2.6cqw; }
.frame i:nth-child(2) { top: -2.6cqw; right: -2.6cqw; transform: scaleX(-1); }
.frame i:nth-child(3) { bottom: -2.6cqw; left: -2.6cqw; transform: scaleY(-1); }
.frame i:nth-child(4) { bottom: -2.6cqw; right: -2.6cqw; transform: scale(-1, -1); }
.frame b {
  position: absolute;
  top: -2.9cqw;
  left: 50%;
  width: 14cqw;
  height: 5.2cqw;
  padding: 0 2.2cqw;
  transform: translateX(-50%);
  background: var(--card);
}
.frame b svg { display: block; width: 100%; height: 100%; fill: var(--gold); }

/* No scrolling: content is laid out to fit; script.js shrinks a page slightly if it ever overflows */
.page-inner {
  position: absolute;
  inset: 5cqw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 7cqw 5cqw 6cqw;
  font-size: 4.6cqw;
  line-height: 1.4;
  text-align: center;
}
.page-content { font-size: calc(var(--fit, 1) * 1em); }

/* Content reveal when a page opens */
.page.is-active .page-content > * { animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.page.is-active .page-content > :nth-child(1) { animation-delay: 0.35s; }
.page.is-active .page-content > :nth-child(2) { animation-delay: 0.45s; }
.page.is-active .page-content > :nth-child(3) { animation-delay: 0.55s; }
.page.is-active .page-content > :nth-child(4) { animation-delay: 0.65s; }
.page.is-active .page-content > :nth-child(5) { animation-delay: 0.75s; }
.page.is-active .page-content > :nth-child(6) { animation-delay: 0.85s; }
.page.is-active .page-content > :nth-child(n+7) { animation-delay: 0.95s; }
@keyframes rise { from { opacity: 0; transform: translateY(0.8em); } }

/* ============ Shared typography ============ */
.eyebrow {
  margin: 0;
  font-family: var(--caps);
  font-size: 0.64em;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.title {
  margin: 0.1em 0 0;
  font-family: var(--script);
  font-weight: 400;
  font-size: 2.7em;
  line-height: 1.15;
}
.lead { margin: 0.2em auto 0; max-width: 16em; font-size: 1.05em; font-style: italic; line-height: 1.4; color: var(--muted); }

.orn { display: block; width: 9.5em; height: 1.1em; margin: 0.6em auto; color: var(--gold); }
.orn path, .orn circle { stroke: currentColor; stroke-width: 1.2; fill: none; }
.orn .fill { fill: currentColor; stroke: none; }

/* ============ Cover ============ */
.blessing { margin: 0; font-family: var(--arabic); font-size: 1.15em; line-height: 1.5; color: var(--gold-ink); direction: rtl; }
.crest { display: block; width: 4.2em; height: 4.6em; margin: 0.3em auto 0.5em; }
.crest .g { fill: none; stroke: var(--gold); }
.crest .gf { fill: var(--gold); }
.crest text { font-family: var(--script); font-size: 29px; fill: var(--gold-ink); }
.names { margin: 0.35em 0 0; font-size: 1em; font-weight: 400; }
.names .script { display: block; font-family: var(--script); font-size: 3.3em; line-height: 1.08; }
.names .amp { display: block; margin: 0.05em 0; font-style: italic; font-size: 1.7em; line-height: 1; }
.cover-date { margin: 0.9em 0 0; font-family: var(--caps); font-size: 0.85em; font-weight: 600; letter-spacing: 0.3em; color: var(--gold-ink); }

/* ============ Bride & Groom page ============ */
/* The illustration's edges are feathered (transparent), so it looks drawn on the card */
.couple-art { display: block; width: 12.6em; max-width: 100%; aspect-ratio: 4 / 5; height: auto; margin: 0.15em auto 0; object-fit: cover; }
/* Both sides share the same rows (role, name, relation, parents), so they stay level
   even when one name wraps onto two lines */
/* Negative margin lets the columns use the padding beside them (still inside the gold frame) */
.couple { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: repeat(4, auto); column-gap: 0.1em; margin: 0 -0.75em; }
.partner { display: grid; grid-row: 1 / span 4; grid-template-rows: subgrid; align-items: center; }
.partner:first-child { grid-column: 1; }
.partner:last-child { grid-column: 3; }
.couple-amp { grid-column: 2; grid-row: 1 / span 4; align-self: center; padding: 0 0.1em; font-family: var(--script); font-size: 2.1em; line-height: 1; }
@supports not (grid-template-rows: subgrid) {
  .partner { display: block; }
  .partner .person-name { display: flex; align-items: center; justify-content: center; min-height: 2.6em; }  /* room for two lines */
}
.role { margin: 0 0 0.25em; font-family: var(--caps); font-size: 0.56em; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-ink); }
.person-name { margin: 0; font-family: var(--caps); font-size: 0.86em; font-weight: 600; letter-spacing: 0.04em; line-height: 1.3; color: var(--text); }
.relation { margin: 0.4em 0 0; font-size: 0.82em; font-style: italic; line-height: 1.2; color: var(--muted); }
.parents { margin: 0; font-size: 0.9em; line-height: 1.3; color: var(--text); }

/* ============ Gallery ============ */
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; margin-top: 0.2em; }
.gallery button {
  display: block;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 0.2em solid #fff;
  border-radius: 0.3em;
  outline: 1px solid var(--gold-light);
  box-shadow: 0 0.35em 0.9em rgba(110, 80, 30, 0.16);
  background: var(--gold-pale);
}
.gallery button:only-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; }
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s ease; }
.gallery button:hover img { transform: scale(1.05); }
.gallery button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(40, 30, 14, 0.9);
  animation: fade 0.3s ease;
}
.lightbox img { max-width: 100%; max-height: 86vh; border: 4px solid #fff; border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.lightbox-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(226, 201, 141, 0.7);
  border-radius: 50%;
  background: none;
  color: var(--gold-light);
}
.lightbox-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@keyframes fade { from { opacity: 0; } }

/* ============ Event & venue ============ */
.event-name { margin: 0.15em 0 0; font-family: var(--script); font-weight: 400; font-size: 2.1em; line-height: 1.15; }
.date-block {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8em;
  max-width: 15em;
  margin: 0.8em auto 0.3em;
}
.date-block .side {
  padding: 0.45em 0;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
  font-family: var(--caps);
  font-size: 0.62em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
}
.date-block .day { font-family: var(--caps); font-size: 2.7em; font-weight: 600; line-height: 1; }
.event-meta { margin: 0; font-size: 1em; color: var(--muted); }
.venue { margin: 0.9em 0 0; }
.venue strong { display: block; font-family: var(--caps); font-size: 1.05em; font-weight: 600; letter-spacing: 0.04em; color: var(--text); }
.venue span { display: block; font-size: 0.98em; color: var(--muted); }
.event-dress { margin: 0.7em 0 0; font-family: var(--caps); font-size: 0.58em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-ink); }
.map {
  display: block;
  width: 100%;
  height: 10.5em;
  margin: 0.5em 0 0;
  border: 0.2em solid #fff;
  border-radius: 0.4em;
  outline: 1px solid var(--gold-light);
  box-shadow: 0 0.35em 0.9em rgba(110, 80, 30, 0.14);
  background: var(--gold-pale);
}
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5em; margin-top: 1em; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 3.6em;
  padding: 0.9em 1.8em;
  border: 1px solid var(--gold-ink);
  border-radius: 999px;
  background: linear-gradient(#a8823a, #7a5a1e);
  color: #fff;
  font-family: var(--caps);
  font-size: 0.68em;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 200, 0.35), 0 0.3em 0.8em rgba(110, 80, 30, 0.2);
  transition: filter 0.2s, transform 0.2s;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.97); }
.btn-ghost { background: #fff; color: var(--gold-ink); border-color: var(--gold-light); box-shadow: none; }
.btn-ghost:hover { background: #fdf8ec; filter: none; }
.btn svg { width: 1.5em; height: 1.5em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible, .nav-btn:focus-visible, .dots button:focus-visible, .music-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ============ Countdown ============ */
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5em; margin: 1em 0 0.5em; }
.countdown div {
  padding: 0.6em 0.1em 0.5em;
  border: 1px solid var(--gold-light);
  border-radius: 0.45em;
  background: linear-gradient(#fff, #fbf5e8);
  box-shadow: 0 0.25em 0.6em rgba(110, 80, 30, 0.08);
}
.countdown span {
  display: block;
  font-family: var(--caps);
  font-size: 1.6em;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.countdown small { font-family: var(--caps); font-size: 0.5em; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); }
.cd-done { margin: 0.6em 0 0.3em; font-family: var(--script); font-size: 2.3em; color: var(--gold-ink); }
.cd-date { margin: 0.4em 0 0; font-size: 1em; color: var(--muted); }

/* ============ Send your wishes ============ */
.wish { margin-top: 0.4em; text-align: left; }
.field { display: block; margin-bottom: 0.6em; }
.field > span {
  display: block;
  margin-bottom: 0.4em;
  padding: 0;
  font-family: var(--caps);
  font-size: 0.58em;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-ink);
}
.field > .field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.field-head small { font-family: var(--serif); font-size: 1.35em; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.field input, .field textarea {
  display: block;
  width: 100%;
  padding: 0.4em 0.7em;
  border: 1px solid var(--gold-light);
  border-radius: 0.45em;
  background: #fff;
  color: var(--text);
  font-family: var(--serif);
  font-size: max(16px, 1em);   /* 16px+ stops iPhones zooming in on focus */
  line-height: 1.3;
}
.field textarea { resize: none; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }

/* Photo picker: the whole row is the button; the real file input is hidden but still focusable */
.photo-pick {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 0.6em;
  padding: 0.4em 0.7em;
  border: 1px dashed var(--gold);
  border-radius: 0.5em;
  background: #fffaf0;
  cursor: pointer;
}
.photo-pick:hover { background: #fdf3df; }
.photo-pick:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.photo-pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick-thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.6em;
  height: 2.6em;
  overflow: hidden;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: #fff;
  color: var(--gold-ink);
}
.pick-thumb svg { width: 1.3em; height: 1.3em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick-text { font-size: 0.92em; line-height: 1.25; color: var(--text); }

.wish .btn { width: 100%; margin-top: 0.2em; }
/* Turnstile bot check: invisible unless Cloudflare needs the guest to tick a box */
.wish-captcha { display: flex; justify-content: center; margin-bottom: 0.4em; }
.wish-captcha:empty { display: none; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.form-note { min-height: 1.4em; margin: 0.55em 0 0; font-size: 0.86em; font-style: italic; line-height: 1.3; text-align: center; color: var(--muted); }
.form-note.error { color: #a3172f; font-style: normal; }

/* Finished letter preview */
.letter-view {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  /* top padding leaves room for the close button */
  padding: max(68px, calc(env(safe-area-inset-top) + 56px)) 16px max(16px, env(safe-area-inset-bottom));
  /* same champagne as the page behind the card, so the preview feels part of the invitation */
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255, 255, 255, 0.85), transparent 75%),
    rgba(244, 236, 221, 0.97);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade 0.3s ease;
}
.letter-view img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  max-height: calc(100svh - 220px);
  border-radius: 4px;
  box-shadow: 0 16px 40px rgba(110, 80, 30, 0.28), 0 0 0 1px rgba(176, 141, 67, 0.25);
}
.letter-hint { max-width: 32em; margin: 0; font-size: 15px; font-style: italic; line-height: 1.35; text-align: center; color: var(--muted); }
.letter-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.letter-view .letter-actions .btn { min-height: 44px; padding: 0 20px; font-size: 13px; }
.letter-x {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--gold-ink);
  box-shadow: 0 2px 8px rgba(110, 80, 30, 0.12);
}
.letter-x:hover { background: #fff; }
.letter-x:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.letter-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ============ Thank you ============ */
.title.thanks-title { font-size: 3.2em; }
.couple-sign { margin: 0.6em 0 0; font-family: var(--script); font-size: 2.2em; line-height: 1.1; }
.hashtag { margin: 0.5em 0 0; font-family: var(--caps); font-size: 0.62em; font-weight: 600; letter-spacing: 0.14em; color: var(--gold-ink); }

/* ============ Controls ============ */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100vw - 32px), 580px);
  height: calc(var(--controls) - 12px);
}
.nav-btn {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: var(--gold-ink);
  box-shadow: 0 2px 8px rgba(110, 80, 30, 0.12);
  transition: background 0.2s, opacity 0.2s;
}
.nav-btn:hover { background: #fff; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.nav-btn svg, .music-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.dots { display: flex; align-items: center; }
.dots button { display: grid; place-items: center; width: 20px; height: 24px; padding: 0; border: 0; background: none; }
.dots button span { width: 7px; height: 7px; border-radius: 4px; background: rgba(176, 141, 67, 0.35); transition: width 0.35s, background 0.35s; }
.dots button[aria-current="step"] span { width: 18px; background: var(--gold); }

/* Music button, top right */
.top-tools {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 8px;
}
/* Short phones: keep the music button clear of the card's top edge */
@media (max-height: 640px) {
  .top-tools { top: 6px; right: 8px; }
  .music-btn { width: 32px; height: 32px; }
}

.music-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--gold-ink);
}
.music-btn[aria-pressed="true"] svg { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Phones held sideways ============ */
.rotate-note {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--bg);
}
.rotate-note svg { width: 54px; height: 54px; fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; animation: tilt 2.4s ease-in-out infinite; }
.rotate-note p { margin: 0; font-family: var(--caps); font-size: 0.85rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-ink); }
.rotate-note small { font-family: var(--serif); font-size: 1rem; font-style: italic; color: var(--muted); }
@keyframes tilt { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 500px) {
  .rotate-note { display: flex; }
}

.noscript { position: fixed; inset: auto 0 40px; z-index: 9; text-align: center; color: var(--gold-ink); }

@media (prefers-reduced-motion: reduce) {
  :root { --turn: 0.01s; }
  .petals { display: none; }
  .page.is-active .page-content > * { animation: none; }
  .seal, .env-hint, .music-btn[aria-pressed="true"] svg, .rotate-note svg { animation: none; }
  .env-flap, .env-letter, .seal { transition-duration: 0.01s; transition-delay: 0s; }
}
