/* Shared component styles; each template sets the colour variables. */
:root {
  --w-ink: #2b2220;
  --w-accent: #7a1f33;
  --w-gold: #b8892e;
  --w-surface: #fffdf8;
  --w-line: rgba(0, 0, 0, .12);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html.lb-lock, html.lb-lock body { overflow: hidden; }
body { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--w-gold); outline-offset: 3px; }

/* text that still needs the couple's real details */
.ph { background: linear-gradient(transparent 62%, rgba(226, 185, 94, .35) 0); border-bottom: 1px dashed var(--w-gold); }

/* personalised greeting only shows when the link carries ?to= */
[data-guest-line] { display: none; }
.has-guest [data-guest-line] { display: block; }

/* reveal on scroll */
.js .rv { opacity: 0; transform: translateY(16px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
  transition-delay: calc(var(--i, 0) * 90ms); }
.js .rv.in { opacity: 1; transform: none; }

/* toast */
.w-toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); z-index: 120;
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 999px; background: rgba(28, 22, 22, .92); color: #fff;
  font: 500 15px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; text-align: center;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; }
.w-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* petals */
.w-petals { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 110; pointer-events: none; }

/* scratch card foil */
[data-scratch] { position: relative; overflow: hidden; }
.w-foil { position: absolute; top: 0; left: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; border-radius: inherit;
  transition: opacity .7s ease; }
.w-foil.gone { opacity: 0; pointer-events: none; }

/* lazy Google map */
[data-map] { position: relative; overflow: hidden; border-radius: 14px; background: rgba(0, 0, 0, .04); min-height: 210px;
  display: grid; place-items: center; }
[data-map] iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }
[data-map].loaded > button { display: none; }

/* add-to-calendar menu: opens upwards so cards with hidden overflow don't clip it */
details.cal { position: relative; }
details.cal > summary { list-style: none; }
details.cal > summary::-webkit-details-marker { display: none; }
.cal-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; min-width: 210px; padding: 6px; border-radius: 14px;
  background: #fff; box-shadow: 0 14px 34px rgba(0, 0, 0, .22); text-align: left; }
.cal-menu a { display: block; padding: 13px 14px; border-radius: 10px; color: var(--w-ink); font: 600 15px/1.2 system-ui, -apple-system, sans-serif;
  text-decoration: none; }
.cal-menu a + a { border-top: 1px solid var(--w-line); }

/* contacts */
[data-contacts] { list-style: none; margin: 0; padding: 0; }
[data-contacts] li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  padding: 12px 0; border-bottom: 1px solid var(--w-line); }
[data-contacts] .c-actions { display: flex; gap: 8px; }
[data-contacts] .c-btn { min-height: 40px; padding: 9px 14px; border-radius: 999px; border: 1px solid currentColor;
  font-size: 14px; line-height: 1.2; text-decoration: none; }
[data-contacts] .c-btn.is-placeholder { opacity: .55; border-style: dashed; }

/* photo viewer */
.lb { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; display: none; align-items: center; justify-content: center;
  background: rgba(12, 10, 10, .94); }
.lb.open { display: flex; }
.lb figure { margin: 0; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.lb img { max-width: 92vw; max-height: 78vh; object-fit: contain; border-radius: 6px; }
.lb figcaption { color: #eee; font: 400 15px/1.4 system-ui, sans-serif; text-align: center; }
.lb button { position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12);
  color: #fff; font-size: 30px; line-height: 1; }
.lb-close { top: calc(14px + env(safe-area-inset-top, 0px)); right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center;
  color: #bbb; font: 500 13px system-ui, sans-serif; letter-spacing: .08em; }

/* music button states */
[data-music] .m-on { display: none; }
[data-music].on .m-on { display: block; }
[data-music].on .m-off { display: none; }
[data-music].on .m-on rect { transform-box: fill-box; transform-origin: 50% 100%; animation: w-eq 1.1s ease-in-out infinite; }
[data-music].on .m-on rect:nth-child(2) { animation-delay: -.35s; }
[data-music].on .m-on rect:nth-child(3) { animation-delay: -.7s; }
@keyframes w-eq { 50% { transform: scaleY(.45); } }

/* flip cards */
[data-flip] { perspective: 1000px; }
[data-flip] .flip-inner { position: relative; width: 100%; height: 100%; transition: transform .7s cubic-bezier(.3, .7, .2, 1); transform-style: preserve-3d; }
[data-flip].flipped .flip-inner { transform: rotateY(180deg); }
[data-flip] .flip-face { position: absolute; top: 0; left: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
[data-flip] .flip-back { transform: rotateY(180deg); }

/* RSVP done state */
[data-rsvp-scope] .rsvp-thanks { display: none; }
[data-rsvp-scope].rsvp-done form[data-rsvp] { display: none; }
[data-rsvp-scope].rsvp-done .rsvp-thanks { display: block; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv { transform: none; transition: opacity .3s ease; transition-delay: 0s; }
  [data-flip] .flip-inner { transition: none; }
}
