/*
   Flourish – the celebratory reveal layer (words that ink in, the date that blooms,
   sparkles on ornaments, a soft petal shower). Triggered by .is-in (js/lib/motion.js).
   */

/* words ink in: blur → sharp, rising, one after another */
html.js .ink {
  display: inline-block; opacity: 0; filter: blur(7px); transform: translate3d(0, 0.5em, 0) scale(1.05);
  transition: opacity 0.9s var(--ease-out), filter 1.1s var(--ease-out), transform 1.15s var(--ease-out);
  transition-delay: calc(var(--k, 0) * 44ms);
}
html.js [data-ink].is-in .ink { opacity: 1; filter: none; transform: none; }

/* a wave of warm light passes through the words once they have settled */
html.js [data-ink="glow"].is-in .ink { animation: ink-glow 1.8s ease-out calc(var(--k, 0) * 80ms + 1.5s) both; }
@keyframes ink-glow {
  35% { text-shadow: 0 0 16px rgba(255, 214, 130, 0.95), 0 0 3px rgba(255, 236, 190, 0.9); color: #FFF2CC; }
}

/* eyebrows draw together from wide-set letters */
html.js .eyebrow[data-reveal].is-in { animation: eyebrow-in 1.7s var(--ease-out) both; }
@keyframes eyebrow-in { from { letter-spacing: 0.72em; opacity: 0; filter: blur(4px); } }

/* the date blooms: month and year slide in, the day lands with a flash of light and a burst of sparkles */
.hero__date { position: relative; }
html.js [data-reveal="date"] { opacity: 1; transform: none; }
html.js [data-reveal="date"]::before {
  content: ""; position: absolute; inset: -55% 6%; z-index: -1; pointer-events: none; opacity: 0;
  background: radial-gradient(closest-side, rgba(247, 205, 120, 0.42), rgba(247, 205, 120, 0.1) 55%, transparent);
  transition: opacity 2s var(--ease-out) 0.2s;
}
html.js [data-reveal="date"].is-in::before { opacity: 1; }
html.js [data-reveal="date"] .hero__month,
html.js [data-reveal="date"] .hero__year { opacity: 0; letter-spacing: 0.75em; transition: opacity 1.2s var(--ease-out) 0.55s, letter-spacing 1.7s var(--ease-out) 0.45s, translate 1.4s var(--ease-out) 0.45s; }
html.js [data-reveal="date"] .hero__month { translate: 44px 0; }
html.js [data-reveal="date"] .hero__year { translate: -44px 0; }
html.js [data-reveal="date"] .hero__day { opacity: 0; scale: 1.9; filter: blur(12px); transition: opacity 0.9s var(--ease-out) 0.15s, scale 1.5s cubic-bezier(0.2, 1.1, 0.3, 1) 0.15s, filter 1.2s var(--ease-out) 0.15s; }
html.js [data-reveal="date"].is-in .hero__month,
html.js [data-reveal="date"].is-in .hero__year { opacity: 1; letter-spacing: 0.3em; translate: 0 0; }
html.js [data-reveal="date"].is-in .hero__day { opacity: 1; scale: 1; filter: none; }
.spk {
  position: absolute; left: 50%; top: 50%; width: var(--s, 12px); height: var(--s, 12px); margin: calc(var(--s, 12px) / -2) 0 0 calc(var(--s, 12px) / -2);
  background: #FDEBB6; opacity: 0; pointer-events: none;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}
html.js [data-reveal="date"].is-in .spk { animation: spk 1.7s var(--ease-out) calc(0.7s + var(--j, 0) * 45ms) both; }
@keyframes spk {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(0.2); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(var(--r, -90px)) scale(1.1); }
}

/* ornaments: a star blinks on the centre of every divider as it finishes drawing */
.sec__divider, .venue__divider, .closing__divider, .hero__divider { position: relative; }
.sec__divider::after, .venue__divider::after, .closing__divider::after, .hero__divider::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #FFF6D6 0 14%, rgba(255, 226, 150, 0.65) 15% 34%, transparent 62%);
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
.sec__divider.is-in::after, .venue__divider.is-in::after, .closing__divider.is-in::after, .hero.is-revealed .hero__divider::after { animation: star-pop 2s var(--ease-out) 1.45s both; }
.hero.is-revealed .hero__divider::after { animation-delay: 2.9s; }
@keyframes star-pop {
  0% { opacity: 0; transform: scale(0.1) rotate(-60deg); }
  38% { opacity: 1; transform: scale(1.7) rotate(0deg); }
  100% { opacity: 0; transform: scale(0.7) rotate(60deg); }
}

/* portraits: the arch outline settles in and a warm light blooms behind the photo */
html.js .person__photo::before { opacity: 0; scale: 0.9; transition: opacity 1.4s var(--ease-out) 0.5s, scale 1.8s var(--ease-out) 0.4s; }
html.js .person.is-in .person__photo::before { opacity: 1; scale: 1; }
html.js .person__photo::after {
  content: ""; position: absolute; inset: -34px -30px -10px; z-index: -1; pointer-events: none; opacity: 0;
  border-radius: 999px 999px 24px 24px; background: radial-gradient(closest-side, rgba(238, 198, 112, 0.55), transparent);
}
html.js .person.is-in .person__photo::after { animation: bloom 2.8s ease-out 0.5s both; }
@keyframes bloom { 0% { opacity: 0; transform: scale(0.8); } 45% { opacity: 1; } 100% { opacity: 0.4; transform: scale(1.08); } }

/* petal shower */
.shower { position: absolute; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.shower__petal { position: absolute; top: 0; border-radius: 100% 0 100% 0; opacity: 0; box-shadow: 0 1px 4px rgba(60, 10, 10, 0.25); will-change: transform, opacity; }

@media (prefers-reduced-motion: reduce) {
  html.js .ink, html.js [data-reveal="date"] .hero__month, html.js [data-reveal="date"] .hero__year, html.js [data-reveal="date"] .hero__day,
  html.js .person__photo::before { opacity: 1; filter: none; transform: none; scale: 1; translate: 0 0; letter-spacing: inherit; transition: none; animation: none; }
  html.js [data-reveal="date"] .hero__month, html.js [data-reveal="date"] .hero__year { letter-spacing: 0.3em; }
  .spk, .shower, .sec__divider::after, .venue__divider::after, .closing__divider::after, .hero__divider::after { display: none; }
}

/* thrown leaves (click / tap) */
.leafburst { position: fixed; inset: 0; z-index: 90; overflow: hidden; pointer-events: none; }
.leafburst__p { position: absolute; display: block; margin: -8px 0 0 -4px; opacity: 0; will-change: transform, opacity; filter: drop-shadow(0 2px 3px rgba(20, 8, 8, 0.35)); }
@media (prefers-reduced-motion: reduce) { .leafburst { display: none; } }

/* the hero performs again, a little quicker, when you scroll back up to it */
html.js .hero.is-replay.is-revealed [data-hero] { transition-delay: calc(var(--hd, 0.5s) * 0.4); }
.hero.is-replay.is-revealed .hero__names .n:first-child .split__unit { --split-delay: 250ms; }
.hero.is-replay.is-revealed .hero__names .n:last-child .split__unit { --split-delay: 480ms; }
.hero.is-replay.is-revealed .hero__divider::after { animation-delay: 1.4s; }
