/* Shared pieces for every invitation template: petals, music button, toast, scratch card frame,
   reveal-on-scroll, the ?og preview switch and reduced motion. Each template's style.css sets
   --fx-* tokens and everything else. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body { margin: 0; overflow-x: clip; }
p { margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* petals thrown by taps, bursts and showers (made in core.js) */
.fx-petal {
  position: fixed; z-index: 80; width: 10px; height: 14px; margin: -7px 0 0 -5px;
  border-radius: 80% 0 80% 0; pointer-events: none;
  box-shadow: inset -2px -2px 3px rgba(0, 0, 0, .12);
}

/* reveal on scroll */
.reveal { opacity: 0; translate: 0 26px; transition: opacity 1s cubic-bezier(.22, 1, .36, 1), translate 1s cubic-bezier(.22, 1, .36, 1); }
.reveal.in, html:not(.js) .reveal { opacity: 1; translate: 0 0; }

/* scratch card frame (core.js paints the foil) */
.scratch { position: relative; border-radius: 10px; }
.scratch__foil {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit;
  touch-action: none; cursor: grab; transition: opacity .9s ease;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .45);
}
html:not(.js) .scratch__foil { display: none; }
.scratch.done .scratch__foil { opacity: 0; pointer-events: none; }
.scratch__btn {
  position: absolute; left: 50%; bottom: -14px; translate: -50% 0; opacity: 0; pointer-events: none;
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px; border: 1px solid currentColor; background: var(--fx-bg, #fff); cursor: pointer;
}
.scratch__btn:focus-visible { opacity: 1; pointer-events: auto; }
.scratch.done .scratch__btn { display: none; }
html.js section:not(.revealed) .count--gated { opacity: .25; filter: blur(3px); }
.count--gated { transition: opacity 1s, filter 1s; }
.count { perspective: 400px; }
.count b { display: block; font-variant-numeric: tabular-nums; }

/* music button + "now playing" toast */
.music {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 70;
  width: 48px; height: 48px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center;
  background: var(--fx-music-bg, #6e141b); border: 1.5px solid var(--fx-music-ring, #d8b36b);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  animation: fxRise .6s cubic-bezier(.22, 1, .36, 1);
}
.music::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px solid var(--fx-music-ring, #d8b36b);
  opacity: 0; transition: opacity .4s;
}
.music[aria-pressed="true"]::before { opacity: .7; animation: fxPulse 2.4s ease-out infinite; }
.music__bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.music__bars i { width: 3px; height: 4px; border-radius: 2px; background: var(--fx-music-ink, #ffe2a8); }
.music[aria-pressed="true"] .music__bars i { animation: fxEq .8s ease-in-out infinite alternate; }
.music[aria-pressed="true"] .music__bars i:nth-child(2) { animation-delay: .2s; }
.music[aria-pressed="true"] .music__bars i:nth-child(3) { animation-delay: .4s; }
.music[aria-pressed="true"] .music__bars i:nth-child(4) { animation-delay: .1s; }
.music__toast {
  position: fixed; left: 50%; top: calc(16px + env(safe-area-inset-top)); z-index: 70; translate: -50% 0;
  padding: 9px 18px; border-radius: 999px; background: rgba(20, 14, 10, .85); color: var(--fx-music-ink, #ffe7b4);
  font-size: 16px; font-style: italic; white-space: nowrap;
  animation: fxToast 3.4s ease forwards;
}
@keyframes fxEq { from { height: 4px; } to { height: 16px; } }
@keyframes fxPulse { 0% { box-shadow: 0 0 0 0 rgba(236, 138, 30, .5); } 100% { box-shadow: 0 0 0 22px rgba(236, 138, 30, 0); } }
@keyframes fxRise { from { opacity: 0; translate: 0 14px; } }
@keyframes fxToast { 0% { opacity: 0; translate: -50% -14px; } 12%, 80% { opacity: 1; translate: -50% 0; } 100% { opacity: 0; translate: -50% 0; } }

/* ?og: only the 1200x630 link-preview card is rendered */
.ogcard { display: none; }
html.og body { overflow: hidden; }
html.og body > :not(.ogcard) { display: none !important; }
html.og .ogcard { display: flex; width: 1200px; height: 630px; position: relative; overflow: hidden; }

/* background video loops: poster first, video fades in once playing */
.loop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
video.loop { opacity: 0; transition: opacity .8s ease; }
video.loop.playing { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
