/* =========================================================
   Invitation player: shared layout and motion for every design.
   Envelope video → gold arch to scratch → words appear → details.
   Each design's theme.css overrides the palette and the ornament sheet.
   ========================================================= */

:root {
  /* default palette (a design's theme.css replaces these) */
  --cream:    #f3ece0;
  --cream-2:  #ebe1cf;
  --ink:      #3b2e24;
  --sepia:    #7a5b40;
  --muted:    #8f7c69;
  --line:     #cdbb9f;
  --line-soft: rgba(122, 91, 64, .22);
  --blue:     #2f6aa6;
  --gold:     #b8914f;

  --serif:  "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", "Brush Script MT", cursive;
  --sans:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --ease:      cubic-bezier(.22, .61, .36, 1);
  --ease-slow: cubic-bezier(.65, 0, .35, 1);
  --ease-in:   cubic-bezier(.55, 0, .8, .35);

  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .45  0 0 0 0 .32  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --jasmine: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-10 -10 20 20'><g fill='%23fffdf7' stroke='%23d8c9ae' stroke-width='.35'><ellipse cy='-5' rx='2.5' ry='4.6'/><ellipse cy='-5' rx='2.5' ry='4.6' transform='rotate(72)'/><ellipse cy='-5' rx='2.5' ry='4.6' transform='rotate(144)'/><ellipse cy='-5' rx='2.5' ry='4.6' transform='rotate(216)'/><ellipse cy='-5' rx='2.5' ry='4.6' transform='rotate(288)'/></g><circle r='1.3' fill='%23e8d18b'/></svg>");

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --vh: 100vh;
}
@supports (height: 100svh) { :root { --vh: 100svh; } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
body {
  font-family: var(--serif);
  background-image: var(--grain);
  overflow-x: hidden;
  font-variant-numeric: lining-nums;
}
body.locked { overflow: hidden; height: var(--vh); }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }

.tiny {
  font-family: var(--sans);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: .36em;
  padding-left: .36em;
  text-transform: uppercase;
}
.spaced { letter-spacing: .48em; padding-left: .48em; }
.muted  { color: var(--muted); }

/* =========================================================
   OPENING · the envelope video, or an image that opens (see openerOf in player.js)
   ========================================================= */

.opening {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: var(--cream);
  cursor: pointer;
  outline: none;
  transition: opacity 1s var(--ease);
}
.opening.gone { opacity: 0; pointer-events: none; }

/* a phone-shaped column (the video's 9:16 proportions); full width on phones */
.stage-box {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, calc(var(--vh) * 1080 / 1916));
  transform: translateX(-50%);
  overflow: hidden;
}

/* the still and the video are cropped identically, so the tap is seamless */
.still, .film {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.still { opacity: 0; transition: opacity 1.4s var(--ease); }
.opening.ready .still { opacity: 1; }
.film { opacity: 0; pointer-events: none; }
.opening.filming .film { opacity: 1; }

/* image openings: .fx-<effect>, then .opened on tap */
.opening[class*="fx-"] .still { transition: opacity 1.4s var(--ease), transform 1.4s cubic-bezier(.7, 0, .25, 1), filter 1.4s var(--ease); }
.opening.fx-lift.opened .still { transform: translateY(-108%) rotate(-3deg); }
.opening.fx-zoom.opened .still { transform: scale(1.7); opacity: 0; filter: blur(6px); }
.opening.fx-fade.opened .still { opacity: 0; transform: scale(1.04); }
.opening.fx-curtain .still { visibility: hidden; }          /* its load still tells us the picture is ready */
.half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; opacity: 0;
        transition: opacity 1.4s var(--ease), transform 1.5s cubic-bezier(.7, 0, .25, 1); }
.half.l { left: 0; } .half.r { right: 0; }
.half-pic { position: absolute; top: 0; bottom: 0; width: 200%; background-size: cover; background-position: center; }
.half.l .half-pic { left: 0; } .half.r .half-pic { right: 0; }
.opening.ready .half { opacity: 1; }
.opening.fx-curtain.opened .half.l { transform: translateX(-100%); }
.opening.fx-curtain.opened .half.r { transform: translateX(100%); }
.half.l { box-shadow: inset -14px 0 18px -16px rgba(40, 25, 10, .45); }
.half.r { box-shadow: inset 14px 0 18px -16px rgba(40, 25, 10, .45); }

.veil {
  position: absolute;
  inset: 0;
  background: var(--cream);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.1s var(--ease);
}
.opening.s4 .veil { opacity: 1; }

.invited, .tap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .8s var(--ease);
}
.invited {
  top: calc(var(--safe-t) + 7%);
  color: var(--sepia);
  font-size: 10px;
}
.tap {
  bottom: calc(var(--safe-b) + 7%);
  padding: 13px 22px 13px calc(22px + .36em);
  border-radius: 999px;
  background: rgba(251, 247, 239, .86);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink);
  box-shadow: 0 8px 24px -14px rgba(60, 40, 20, .5);
}
.opening.ready .invited { opacity: 1; transition-delay: .8s; }
.opening.ready .tap { opacity: 1; transition-delay: 1.4s; animation: pulse 3s ease-in-out 2.6s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.opening.tapped .invited, .opening.tapped .tap { opacity: 0; animation: none; transition-delay: 0s; }

/* =========================================================
   INVITATION
   ========================================================= */

.invite {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 24px calc(var(--safe-b) + 90px);
  visibility: hidden;
  text-align: center;
}
.invite.show { visibility: visible; }

/* ---------- hero: scratch the gold arch to reveal the sketch ---------- */
.hero {
  position: relative;
  min-height: var(--vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 26px) 0 34px;
}
.kicker {
  font-family: var(--script);
  font-size: clamp(28px, 8.4vw, 36px);
  color: var(--sepia);
  line-height: 1.1;
}
.sketch {
  position: relative;
  margin: 18px 0 0;
  width: min(74vw, calc(var(--vh) * .5 * .707), 320px);
  opacity: 0;
  transform: scale(.98);
  transition: opacity 1.4s var(--ease), transform 1.6s var(--ease);
}
.hero.go .sketch { opacity: 1; transform: none; }
/* Every portrait takes the arch's shape, whatever the size of the uploaded image, so nothing sticks
   out of the gold foil (the same arch, slightly larger). Top radius: half the width, as a % of the height. */
.sketch img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--portrait-ratio, .7076);
  object-fit: cover;
  object-position: 50% 30%;
  border-radius: 50% 50% 14px 14px / calc(var(--portrait-ratio, .7076) * 50%) calc(var(--portrait-ratio, .7076) * 50%) 14px 14px;
}

/* the foil: an arch a little larger than the drawing, so every branch is covered */
#scratchCanvas {
  position: absolute;
  left: -6%;
  top: -4%;
  width: 112%;
  height: 106%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(90, 66, 40, .18));
  transition: opacity 1.4s var(--ease);
}
#scratchCanvas.cleared { opacity: 0; pointer-events: none; }
.scratch-hint {
  position: absolute;
  left: 50%;
  top: calc(102% + 20px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 17px;
  font-style: italic;
  color: var(--sepia);
  pointer-events: none;
  transition: opacity 1s var(--ease);
  animation: pulse 3s ease-in-out 2s infinite;
}
.scratch-hint.off { opacity: 0; animation: none; }
.names {
  margin: 20px 0 0;           /* room for the script's tall capitals below the portrait */
  font-family: var(--script);
  font-weight: 400;
  font-size: clamp(46px, 14vw, 60px);
  line-height: 1.15;
  color: var(--ink);
}
/* Pinyon's own ampersand reads poorly, so it's set in italic Cormorant */
.amp { font-family: var(--serif); font-style: italic; font-weight: 300; color: var(--gold); font-size: .62em; padding: 0 .08em; }
.date { margin-top: 10px; color: var(--ink); font-size: 9px; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* the words appear one by one as the foil is scratched away */
.step {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1.4s var(--ease), transform 1.6s var(--ease);
}
.step.on { opacity: 1; transform: none; }

/* falling jasmine */
.petals {
  position: absolute;
  left: -24px;
  right: -24px;
  top: 0;
  height: var(--vh);
  overflow: hidden;
  pointer-events: none;
}
.petals i {
  position: absolute;
  top: -20px;
  width: var(--s);
  height: var(--s);
  background: var(--jasmine) center / contain no-repeat;
  opacity: 0;
  animation: fall var(--d) linear var(--delay) infinite;
}
.petals.confetti i { width: calc(var(--s) * .55); border-radius: 2px; background: var(--c); }
@keyframes fall {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  10%  { opacity: .9; }
  50%  { transform: translate(var(--x), 50vh) rotate(180deg); }
  90%  { opacity: .8; }
  100% { transform: translate(0, calc(var(--vh) + 30px)) rotate(360deg); opacity: 0; }
}

/* ---------- sections ---------- */
.sect {
  margin-top: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 1.3s var(--ease), transform 1.5s var(--ease);
}
.sect.in { opacity: 1; transform: none; }
.sect > .tiny.spaced { color: var(--blue); }
.sect h2 {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 30px;
  line-height: 1.2;
}

/* ---------- after the scratch ---------- */
.skip {
  margin-top: 14px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
  font-size: 8px;
  color: var(--muted);
}
.unlock-cue {
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 8px;
  color: var(--muted);
  animation: rise 1.4s var(--ease) both;
}
.unlock-cue span { width: 1px; height: 34px; background: linear-gradient(var(--line), transparent); animation: drip 2.4s ease-in-out infinite; transform-origin: top; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- age medallion on the portrait (birthdays) ---------- */
.age-badge {
  position: absolute; right: -14px; bottom: 12%; z-index: 3; margin: 0;
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-content: center; text-align: center; gap: 1px;
  background: radial-gradient(circle at 35% 30%, #efdcae, var(--gold) 58%, #8a6a35); color: #fffaf0;
  box-shadow: 0 10px 22px -10px rgba(90, 60, 25, .7), inset 0 0 0 3px rgba(255, 246, 222, .3);
  pointer-events: none;
}
.age-badge b { font: 500 30px/1 var(--serif); }
.age-badge span { font: 500 8px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; }
.age-badge.step { transform: scale(.6) rotate(-12deg); }
.age-badge.step.on { transform: none; transition: opacity .9s var(--ease), transform 1s cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- make a wish: live candle flames on the design's cake ---------- */
.wish-title { font: italic 400 21px/1.35 var(--serif); color: var(--ink); text-align: center; max-width: 300px; margin: 2px 0 0; }
.wish .cake { --blow: 0; position: relative; width: min(64vw, 240px); margin: 12px 0 8px; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.wish .cake img { display: block; width: 100%; user-select: none; -webkit-user-drag: none; }
.wish .cake:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 12px; }
/* a flame leans and shrinks with the guest's breath (--blow, 0 → 1), and flickers on its own */
.flame {
  position: absolute; width: 5.2%; aspect-ratio: .55; transform-origin: 50% 100%;
  transform: translate(-50%, -96%) skewX(calc(var(--blow) * -24deg)) scaleY(calc(1 - var(--blow) * .45));
  transition: opacity .35s ease, transform .12s linear;
}
.flame b {
  position: absolute; inset: 0; transform-origin: 50% 100%;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 50% 72%, #fffbe6 0 18%, #ffd666 38%, #ff9f3a 66%, rgba(255, 120, 40, 0) 72%);
  box-shadow: 0 0 14px 6px rgba(255, 196, 90, .45);
  animation: flicker 1.3s ease-in-out infinite alternate;
}
.flame:nth-of-type(2) b { animation-duration: 1.05s; } .flame:nth-of-type(3) b { animation-duration: 1.45s; }
@keyframes flicker {
  0%   { transform: scale(1, 1) rotate(-2deg); }
  50%  { transform: scale(.94, 1.06) rotate(2deg); }
  100% { transform: scale(1.04, .95) rotate(-1deg); }
}
.flame.out { opacity: 0; transform: translate(-50%, -96%) scale(.2, .5); transition: opacity .35s ease, transform .35s ease; }
.flame.out::after {                      /* a wisp of smoke */
  content: ""; position: absolute; left: 30%; bottom: 60%; width: 40%; height: 160%; border-radius: 50%;
  background: rgba(150, 140, 140, .45); filter: blur(3px); animation: smoke 1.6s ease-out forwards;
}
@keyframes smoke { from { opacity: .8; transform: none; } to { opacity: 0; transform: translateY(-240%) scaleX(2.2); } }
.wish-step { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: rise .5s var(--ease) both; }
.wish-tap { min-width: 230px; }
.wish-note { margin: 0; font-size: 12px; color: var(--muted); text-align: center; max-width: 270px; line-height: 1.5; }
.wish-status { margin: 0; font: italic 500 22px/1.2 var(--serif); color: var(--sepia); }
.meter { position: relative; width: 210px; height: 10px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.meter i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, #f3c677, var(--gold)); transition: width .08s linear; }
.meter .goal { position: absolute; top: -2px; bottom: -2px; left: 80%; width: 2px; background: var(--ink); opacity: .35; }
.wish-msg { margin: 4px 0 0; font-size: 13px; color: var(--sepia); text-align: center; max-width: 280px; }
.wish-done { font: italic 400 24px/1.3 var(--serif); color: var(--sepia); margin: 4px 0 0; text-align: center; }
.again { font: 500 12px var(--sans); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- "now blow to send it": after a voice wish is recorded (.wish.ready) ---------- */
.send-hint {
  position: absolute; left: 50%; top: -6px; z-index: 2; transform: translate(-50%, -100%);
  padding: 9px 16px; border-radius: 999px; white-space: nowrap;
  background: var(--ink); color: #fffaf0; font: 600 13px/1 var(--sans); letter-spacing: .01em;
  box-shadow: 0 12px 26px -12px rgba(40, 20, 30, .7); opacity: 0; pointer-events: none; transition: opacity .5s ease;
}
.send-hint::after {                                  /* the bubble's tail, pointing at the candles */
  content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -7px;
  border: 7px solid transparent; border-top-color: var(--ink); border-bottom: 0;
}
.wish.ready .send-hint { opacity: 1; animation: bob 1.8s ease-in-out infinite; }
.wish .cake { transition: margin-top .6s var(--ease); }
.wish.ready .cake { margin-top: 58px; }            /* room for the bubble under the sentence */
@keyframes bob { 50% { transform: translate(-50%, calc(-100% - 7px)); } }
.wish.ready .cake::before {                          /* a warm halo around the flames */
  content: ""; position: absolute; left: 50%; top: 8%; width: 62%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  transform: translate(-50%, -38%); background: radial-gradient(circle, rgba(255, 210, 120, .55), rgba(255, 210, 120, 0) 65%);
  animation: halo 1.8s ease-in-out infinite;
}
@keyframes halo { 50% { opacity: .5; transform: translate(-50%, -38%) scale(1.15); } }
.breeze { position: absolute; left: -4%; top: -3%; width: 48%; overflow: visible; opacity: 0; pointer-events: none; transition: opacity .5s ease; }
.breeze path { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 55 160; stroke-dashoffset: 215; opacity: 0; }
.wish.ready .breeze { opacity: 1; }
.wish.ready .breeze path { animation: gust 2.4s ease-in-out infinite; }
.wish.ready .breeze path:nth-child(2) { animation-delay: .4s; } .wish.ready .breeze path:nth-child(3) { animation-delay: .8s; }
@keyframes gust { 0% { stroke-dashoffset: 215; opacity: 0; } 25% { opacity: .85; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.wish.ready .flame b { animation-duration: .55s; }  /* the candles are eager */
.wish.ready .wish-tap { animation: call 1.8s ease-in-out infinite; }
@keyframes call { 50% { box-shadow: 0 0 0 7px rgba(196, 154, 76, .22), 0 12px 26px -12px rgba(196, 154, 76, .9); } }
@media (prefers-reduced-motion: reduce) {
  .wish.ready .send-hint, .wish.ready .cake::before, .wish.ready .breeze path, .wish.ready .wish-tap { animation: none; }
  .wish.ready .breeze path { opacity: .6; stroke-dashoffset: 0; }
}

.music-btn.held { opacity: .35; pointer-events: none; }   /* paused while the microphone is in use */

/* ---------- voice wishes ---------- */
.voice { width: 100%; display: flex; flex-direction: column; align-items: center; }
.voice-slot { width: 100%; display: flex; flex-direction: column; align-items: center; margin-bottom: 12px; }
.v-step { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; animation: rise .5s var(--ease) both; }
.voice-btn { display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px 12px 14px; border-radius: 999px;
             border: 1px solid var(--line); background: rgba(255, 252, 246, .75); color: var(--ink); font: 500 14px var(--sans);
             box-shadow: 0 10px 22px -18px rgba(60, 40, 30, .6); transition: border-color .3s ease, transform .3s ease; }
.voice-btn:hover { border-color: var(--gold); transform: translateY(-1px); }
.mic { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); flex: none; }
.mic::before { content: ""; position: absolute; left: 11px; top: 6px; width: 8px; height: 12px; border-radius: 5px; background: #fffaf0; }
.mic::after { content: ""; position: absolute; left: 8px; top: 12px; width: 10px; height: 7px; border: 2px solid #fffaf0; border-top: 0;
              border-radius: 0 0 8px 8px; box-shadow: 0 5px 0 -3px #fffaf0; }
.v-field { width: min(100%, 300px); }
.rec-row { display: flex; align-items: center; gap: 8px; margin: 0; font: 500 18px var(--sans); color: var(--ink); }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #e0485a; animation: rec 1.1s ease-in-out infinite; }
@keyframes rec { 50% { opacity: .25; transform: scale(.8); } }
.v-wave { width: 260px; height: 48px; }
.v-label { margin: 0; font: 600 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--sepia); }
.v-player { display: flex; align-items: center; gap: 12px; width: min(100%, 300px); padding: 10px 14px; border-radius: 999px;
            background: rgba(255, 252, 246, .85); border: 1px solid var(--line-soft); }
.v-play { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ink); }
.v-play::after { content: ""; position: absolute; left: 14px; top: 11px; border: 7px solid transparent; border-left: 11px solid #fffaf0; border-right: 0; }
.v-play.playing::after { left: 12px; top: 12px; width: 4px; height: 12px; border: 0; background: #fffaf0; box-shadow: 8px 0 0 #fffaf0; }
.v-bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.v-bar i { display: block; height: 100%; width: 0; background: var(--gold); }
.v-len { font-size: 12px; min-width: 32px; text-align: right; }
.v-next { margin: 2px 0 0; font: italic 400 19px/1.35 var(--serif); color: var(--sepia); text-align: center; max-width: 290px; }

/* scratching: a fingertip that shows the gesture until the guest starts */
.swipe {
  position: absolute; left: 50%; top: 62%; z-index: 2; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  background: rgba(255, 255, 255, .75); box-shadow: 0 0 0 6px rgba(255, 255, 255, .25), 0 6px 14px -6px rgba(0, 0, 0, .4);
  pointer-events: none; animation: swipe 2.6s ease-in-out 1.2s infinite; opacity: 0; transition: opacity .6s ease;
}
@keyframes swipe {
  0%   { transform: translate(-60px, 10px) scale(.9); opacity: 0; }
  15%  { opacity: 1; }
  50%  { transform: translate(60px, -12px) scale(1); opacity: 1; }
  70%  { transform: translate(-30px, 20px) scale(1); opacity: .9; }
  100% { transform: translate(40px, 0) scale(.9); opacity: 0; }
}
.swipe.off { animation: none; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .swipe { display: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- good to know: dress code, colours, gift list ---------- */
.extras .dress { font: italic 400 24px/1.3 var(--serif); color: var(--ink); margin: 4px 0 12px; text-align: center; }
.swatches { display: flex; justify-content: center; gap: 10px; margin-bottom: 18px; }
.swatches i { width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), 0 4px 10px -6px rgba(0, 0, 0, .4); }

/* ---------- wishes wall: notes that scroll sideways ---------- */
.wall { width: 100vw; max-width: 460px; }
.wall-track { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 12px 24px 20px; width: 100%;
              scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.wall-track::-webkit-scrollbar { display: none; }
.wall-note { flex: 0 0 76%; scroll-snap-align: center; margin: 0; padding: 20px 20px 16px; border-radius: 4px 18px 4px 18px;
        background: rgba(255, 252, 246, .85); border: 1px solid var(--line-soft); box-shadow: 0 14px 26px -20px rgba(60, 40, 30, .6);
        text-align: left; transform: rotate(-1.2deg); }
.wall-note:nth-child(2n) { transform: rotate(1.1deg); }
.wall-note p { margin: 0; font: italic 400 19px/1.45 var(--serif); color: var(--ink); white-space: pre-line; }
.wall-note cite { display: block; margin-top: 10px; font: normal 500 11px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--sepia); }
.share-msg { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); text-align: left; margin: -4px 0 14px; cursor: pointer; }
.share-msg input { margin-top: 2px; accent-color: var(--gold); }

/* ---------- a burst of confetti (accepted invitations, wishes) ---------- */
.confetto {
  position: fixed; z-index: 60; width: 9px; height: 6px; border-radius: 1.5px; pointer-events: none;
  background: var(--c); animation: burst var(--t, 1.7s) cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes burst {
  0%   { transform: translate(-50%, -50%) rotate(0); opacity: 1; }
  55%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--r)); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx) * 1.15), calc(-50% + var(--dy) + 140px)) rotate(calc(var(--r) * 2)); opacity: 0; }
}

/* Section ornaments. Each design's theme.css sets the sheet image on .motif, its size
   (--sheet-w, --sheet-h) and, per role (.motif-count, -when, -where, -story, -rsvp, -foot),
   the crop --x --y --w --h and width --mw. */
.motif {
  display: block;
  width: var(--mw, 100px);
  aspect-ratio: var(--w, 1) / var(--h, 1);
  margin-bottom: 20px;
  background-repeat: no-repeat;
  background-size: calc(var(--sheet-w) / var(--w) * 100%) auto;
  background-position: calc(var(--x) / (var(--sheet-w) - var(--w)) * 100%) calc(var(--y) / (var(--sheet-h) - var(--h)) * 100%);
}

.unlock-cue em { font-style: normal; }
.sketch.no-portrait { aspect-ratio: var(--portrait-ratio, .7076); }
.sketch.no-portrait img { display: none; }

/* loading and "not found" states */
.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: var(--cream);
  transition: opacity .6s var(--ease);
}
.boot.done { opacity: 0; pointer-events: none; }
.boot p { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--muted); text-align: center; padding: 0 24px; }

.countdown {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 300px);
}
.countdown > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.countdown > div + div { border-left: 1px solid var(--line-soft); }
.countdown b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
}
.countdown span { font-family: var(--sans); font-size: 7.5px; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--muted); }
.note { margin-top: 24px; font-size: 18px; font-style: italic; color: var(--sepia); }

.when .day, .where .city { margin-top: 18px; color: var(--muted); }
.when .big { margin-top: 8px; font-size: 30px; font-weight: 400; }
.when .time { margin-top: 4px; font-size: 20px; font-style: italic; color: var(--sepia); }
.where .venue { margin-top: 14px; font-size: 26px; font-weight: 400; }
.where .city { margin-top: 8px; }

.link-btn {
  display: inline-block;
  margin-top: 24px;
  padding: 13px 26px 13px calc(26px + .32em);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--ink);
  transition: background-color .5s var(--ease), border-color .5s var(--ease), color .5s var(--ease);
}
.link-btn:hover { background: rgba(255, 252, 245, .6); border-color: var(--blue); color: var(--blue); }

.story-text {
  margin-top: 18px;
  max-width: 32ch;
  font-size: 18px;
  font-style: italic;
  font-weight: 300;
  line-height: 1.65;
}

/* ---------- RSVP ---------- */
#rsvpForm {
  width: 100%;
  max-width: 310px;
  margin-top: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: left;
}
.hp { position: absolute; left: -9999px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.choice { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.choice label { display: block; position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  font-size: 18px;
  cursor: pointer;
  transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease);
}
.choice input:checked + span { background: var(--blue); border-color: var(--blue); color: #fbf8f1; }
.choice input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 3px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field .tiny { font-size: 8px; color: var(--muted); padding-left: 0; }
.field i { font-family: var(--serif); font-size: 12px; text-transform: none; letter-spacing: 0; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 2px;
  font: 17px var(--serif); /* ≥16px keeps iOS from zooming in */
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
.field select { background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238f7c69'/></svg>") no-repeat right 4px center; }
.field textarea { resize: vertical; min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-bottom-color: var(--blue); }

.btn {
  align-self: center;
  margin-top: 6px;
  padding: 14px 30px 14px calc(30px + .34em);
  border-radius: 999px;
  background: var(--ink);
  color: #fbf8f1;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .34em;
  text-transform: uppercase;
  transition: background-color .4s var(--ease);
}
.btn:hover { background: var(--blue); }
.btn:disabled { opacity: .5; }
.rsvp-status { min-height: 1em; font-size: 15px; text-align: center; color: #9b4a3c; }
.rsvp-thanks { margin-top: 10px; }
.rsvp-thanks .tiny { margin-top: 12px; }

/* ---------- footer ---------- */
.foot { margin-top: 90px; }
.mono { font-family: var(--script); font-size: 48px; line-height: 1; }
.foot .tiny { margin-top: 12px; }

/* ---------- floating bits ---------- */
.music-btn {
  position: fixed;
  z-index: 20;
  top: calc(var(--safe-t) + 18px);
  right: max(18px, calc(50vw - 230px + 18px));
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(251, 247, 239, .8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 1s var(--ease);
}
.music-btn.on { opacity: 1; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 10px; }
.bars i { width: 1.5px; height: 3px; background: var(--ink); }
.music-btn.playing .bars i { animation: bar 1.1s ease-in-out infinite; }
.music-btn.playing .bars i:nth-child(2) { animation-delay: -.35s; }
.music-btn.playing .bars i:nth-child(3) { animation-delay: -.7s; }
@keyframes bar { 0%, 100% { height: 3px; } 50% { height: 10px; } }

.rsvp-pill {
  position: fixed;
  z-index: 20;
  left: max(18px, calc(50vw - 230px + 18px));
  bottom: calc(var(--safe-b) + 18px);
  padding: 12px 18px 12px calc(18px + .36em);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(251, 247, 239, .85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink);
  font-size: 9px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
}
.rsvp-pill.on { opacity: 1; transform: none; }
.rsvp-pill.on.away { opacity: 0; transform: translateY(8px); pointer-events: none; }

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(var(--safe-b) + 34px);
  transform: translate(-50%, 8px);
  padding: 11px 18px 11px calc(18px + .36em);
  border-radius: 999px;
  background: var(--ink);
  color: #fbf8f1;
  font-size: 8.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
}

/* discreet links under the invitation (guests type their names in the RSVP) */
.legal-link { margin: 18px 0 0; font: 11px/1.4 Inter, sans-serif; letter-spacing: .06em; opacity: .55; }
.legal-link a { color: inherit; text-decoration: none; } .legal-link a:hover { text-decoration: underline; }
