:root {
  color-scheme: dark;
  --paper: #fffaf3;
  --gold: #ffd68a;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  color: var(--paper);
  font-family: "DM Sans", system-ui, sans-serif;
  background: #10072f;
}

.scene {
  position: fixed;
  inset: -3%;
  background:
    linear-gradient(180deg, rgba(12, 5, 40, .18), rgba(13, 6, 43, .63)),
    url("hero-floral.png") center/cover no-repeat;
  animation: breathe 18s ease-in-out infinite alternate;
}

.veil {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(101, 69, 176, .08), rgba(10, 4, 35, .34) 55%, rgba(7, 3, 29, .72)),
    linear-gradient(100deg, rgba(11, 5, 40, .32), transparent 45%, rgba(11, 5, 40, .28));
  backdrop-filter: blur(1px);
}

.deck {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100svh;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(28px, 7vw, 92px) clamp(20px, 8vw, 120px);
  opacity: 0;
  visibility: hidden;
  transform: scale(1.025);
  transition: opacity 1.25s ease, transform 1.5s ease, visibility 1.25s;
}

.slide.active {
  z-index: 2;
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.slide.leaving {
  z-index: 1;
  opacity: 0;
  visibility: visible;
  transform: scale(.985);
}

.content {
  width: min(980px, 100%);
  text-align: center;
  text-shadow: 0 4px 26px rgba(9, 2, 33, .74);
}

.content-narrow { width: min(800px, 100%); }

h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(3.2rem, 9.2vw, 7.4rem);
  font-weight: 600;
  line-height: .96;
  letter-spacing: -.045em;
  text-wrap: balance;
}

h1 > span { display: block; }

.accent {
  margin-top: .08em;
  color: transparent;
  background: linear-gradient(100deg, #ffc0d9, #ffdd97 50%, #d9caff);
  background-clip: text;
  -webkit-background-clip: text;
  font-style: italic;
}

.prose,
blockquote {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(2rem, 5.1vw, 4.5rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.025em;
  text-wrap: balance;
}

blockquote { color: #fff4ed; font-style: italic; }

.quote-mark {
  display: block;
  height: .55em;
  margin-bottom: .12em;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: clamp(5rem, 12vw, 10rem);
  line-height: .7;
  opacity: 0;
  transform: translateY(-10px);
}

.active .quote-mark { animation: reveal-line 1.1s .15s ease forwards; }
.closing { font-size: clamp(1.8rem, 4.5vw, 4rem); }

.final-flourish {
  display: block;
  margin-top: clamp(24px, 4vw, 42px);
  color: var(--gold);
  font-size: clamp(1.9rem, 4vw, 3rem);
  opacity: 0;
  transform: scale(.65) rotate(-25deg);
}

.active .final-flourish { animation: bloom 1.2s 3.1s cubic-bezier(.2,.8,.2,1) forwards; }

.word {
  display: inline-block;
  margin-right: .22em;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(20px);
}

.active .word {
  animation: word-in .85s cubic-bezier(.2,.78,.25,1) forwards;
  animation-delay: calc(.35s + var(--word-index) * 105ms);
}

#flower-rain {
  position: fixed;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.flower {
  position: absolute;
  top: -10vh;
  left: var(--x);
  color: var(--color);
  font-family: Georgia, serif;
  font-size: var(--size);
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 213, 160, .35);
  opacity: 0;
  will-change: transform, opacity;
  animation: flower-fall var(--duration) var(--delay) linear forwards;
}

.progress {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
}

.progress span {
  width: 22px;
  height: 2px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255,255,255,.3);
  transition: width .5s ease, background .5s ease;
}

.progress span.active { width: 44px; background: var(--gold); }

@keyframes word-in {
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@keyframes reveal-line {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bloom {
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes flower-fall {
  0% { opacity: 0; transform: translate3d(0, -8vh, 0) rotate(0deg); }
  12% { opacity: var(--opacity); }
  74% { opacity: calc(var(--opacity) * .82); }
  100% { opacity: 0; transform: translate3d(var(--drift), 116vh, 0) rotate(var(--spin)); }
}

@keyframes breathe {
  from { transform: scale(1.01); }
  to { transform: scale(1.075); }
}

@media (max-width: 600px) {
  .slide { padding: 30px 22px 58px; }
  h1 { font-size: clamp(3rem, 15vw, 5.2rem); }
  .prose, blockquote { font-size: clamp(1.75rem, 8vw, 3rem); line-height: 1.28; }
  .closing { font-size: clamp(1.62rem, 7.2vw, 2.7rem); }
  .scene { background-position: 52% center; }
}

@media (prefers-reduced-motion: reduce) {
  .scene { animation: none; }
  .flower { display: none; }
  .slide { transition-duration: .01ms; }
  .active .word, .active .quote-mark, .active .final-flourish {
    animation-duration: .01ms;
    animation-delay: 0ms;
  }
}
