* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #f3dfd0; overflow: hidden; overscroll-behavior: none; }
body { display: flex; justify-content: center; align-items: center; }

/* Stage keeps the 903:1700 story aspect; all sizes use cqw so it scales on any phone */
#stage {
  position: relative;
  container-type: inline-size;
  width: min(100vw, calc(100dvh * 903 / 1700));
  height: 100vh; height: 100dvh;
  overflow: hidden;
  background: linear-gradient(160deg, #fdf1e8, #f9e6d8 60%, #fbeee3);
  color: #1a1210;
  user-select: none; -webkit-user-select: none;
  cursor: pointer;
}
.leaves {
  position: absolute; inset: 0; opacity: .55;
  background: url(img/leaves.svg) center / cover no-repeat;
}

.scene { position: absolute; inset: 0; top: max(0px, calc((100dvh - 188.3cqw) / 2)); }
.fx {
  position: absolute;
  opacity: 0;
  transform: translateY(3cqw) scale(.96);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}
.fx.show { opacity: 1; transform: none; }
.fx.gone { opacity: 0; transform: translateY(-2cqw); transition-duration: .6s; }

h1, h2 {
  font-family: "Texturina", Georgia, serif;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.1;
  white-space: nowrap;
}
.script {
  font-family: "Parisienne", cursive;
  color: #b84a5b;
  font-weight: 500;
  white-space: nowrap;
}

/* pieces: svg box is 662x505 units; 0.115cqw per unit */
.half { width: 76.1cqw; height: 58.1cqw; overflow: visible; }
.p1 { left: 0.9cqw; top: 6.4cqw; }
.p2 { left: 20.9cqw; top: 54cqw; }

.txt { text-align: center; }
.txt h2 { font-size: 3.8cqw; margin: 1.6cqw 0; white-space: normal; text-wrap: balance; }
.txt .script { font-size: 5.2cqw; }
.txt .script.small { font-size: 4.6cqw; white-space: normal; }
.t1 { left: 52cqw; width: 44cqw; top: 18cqw; }
.t2 { left: 4cqw; width: 50cqw; top: 68cqw; }

.match { left: 0; right: 0; top: 116cqw; text-align: center; font-size: 7.4cqw; }

.heart { width: 70.8cqw; height: 54cqw; left: 14.4cqw; top: 127cqw; }
.heart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.heart .hl { transform: translateX(-4cqw); transition: transform 1s ease .3s; }
.heart .hr { transform: translateX(4cqw); transition: transform 1s ease .3s; }
.heart.show .hl, .heart.show .hr { transform: none; }

/* scene 2 */
#s2 h1 { left: 0; right: 0; top: 19cqw; text-align: center; font-size: 9.5cqw; }
#s2 .date { left: 0; right: 0; top: 43cqw; text-align: center; font-size: 12cqw; }
#s2 .wed { left: 0; right: 0; top: 77cqw; text-align: center; font-size: 5.8cqw; }
#s2 .names { left: 0; right: 0; top: 98cqw; text-align: center; font-size: 11.5cqw; }

#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.12); }
#bar i { display: block; height: 100%; width: 0; background: #b84a5b; }

@media (prefers-reduced-motion: reduce) {
  .fx, .heart .hl, .heart .hr { transition-duration: .01s; }
}

/* static preview (no animation): ?scene=1 or ?scene=2 */
html[data-scene] .fx { opacity: 1; transform: none; }
html[data-scene="1"] #s2, html[data-scene="2"] #s1 { display: none; }
