:root {
  --sand-1: #f9f2df;
  --sand-2: #f2dec3;
  --coral: #ef6f51;
  --teal: #2a7f8d;
  --ink: #152228;
  --gold: #f4c262;
  --shell: #fff8ea;
  --rose: #d87d6f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 20%, rgba(244, 194, 98, 0.35), transparent 40%),
    radial-gradient(circle at 80% 10%, rgba(42, 127, 141, 0.22), transparent 38%),
    linear-gradient(145deg, var(--sand-1), var(--sand-2));
  overflow-x: hidden;
}

.page {
  position: relative;
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2.5rem 0 3.25rem;
}

.sparkle-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 234, 0.95), rgba(244, 194, 98, 0.2));
  opacity: 0;
  animation: sparklePulse var(--sparkle-duration, 5s) ease-in-out infinite;
  animation-delay: var(--sparkle-delay, 0s);
}

.hero {
  text-align: center;
  position: relative;
  z-index: 2;
  animation: riseIn 0.9s ease-out;
}

.eyebrow {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--coral);
  text-transform: uppercase;
}

h1 {
  margin: 0.5rem 0 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.hero-copy {
  width: min(40rem, 80vw);
  margin: 0.85rem auto 0;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: rgba(21, 34, 40, 0.82);
}

.gallery-shell {
  position: relative;
  margin-top: 2.5rem;
  height: min(70vh, 650px);
  min-height: 420px;
  background:
    radial-gradient(circle at top right, rgba(216, 125, 111, 0.18), transparent 30%),
    linear-gradient(160deg, rgba(255, 248, 234, 0.76), rgba(239, 111, 81, 0.12));
  border: 2px solid rgba(21, 34, 40, 0.15);
  border-radius: 2rem;
  box-shadow: 0 18px 30px rgba(21, 34, 40, 0.14);
  overflow: hidden;
}

.gallery-shell::after {
  content: "";
  position: absolute;
  inset: 1rem;
  border: 1px solid rgba(244, 194, 98, 0.45);
  border-radius: 1.35rem;
  pointer-events: none;
}

.photo-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: auto;
  z-index: 0;
  filter: saturate(1.05);
}

.backdrop-photo {
  position: absolute;
  border-radius: 1rem;
  border: 2px solid rgba(255, 248, 234, 0.55);
  background: rgba(255, 248, 234, 0.4);
  box-shadow: 0 10px 24px rgba(21, 34, 40, 0.2);
  opacity: 0.16;
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg)) translateY(0) scale(1);
  transition: transform 0.55s ease, opacity 0.55s ease, box-shadow 0.55s ease;
  pointer-events: none;
  animation: floatMemory var(--float-duration, 7s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
}

.backdrop-photo.foreground {
  opacity: 0.98;
  transform: translate(-50%, -50%) rotate(0deg) translateY(-14px) scale(1.45);
  box-shadow: 0 24px 46px rgba(21, 34, 40, 0.4);
  border-color: rgba(255, 248, 234, 0.95);
  z-index: 3;
  pointer-events: auto;
}

.backdrop-photo.video-tile {
  opacity: 0.75;
  z-index: 2;
  pointer-events: auto;
}

.backdrop-photo.dismissed {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
}

.backdrop-photo img,
.backdrop-photo video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.9rem;
}

.play-video-button {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 700;
  color: var(--shell);
  background: rgba(21, 34, 40, 0.78);
  box-shadow: 0 10px 18px rgba(21, 34, 40, 0.25);
  cursor: pointer;
}

.play-video-button.always-visible {
  bottom: 0.75rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
}

.play-video-button:hover {
  background: rgba(21, 34, 40, 0.9);
}

.intro-panel,
.finale-card {
  position: absolute;
  inset: 2rem;
  display: grid;
  place-items: center;
  text-align: center;
  border-radius: 1.6rem;
  z-index: 5;
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.intro-panel {
  background: linear-gradient(180deg, rgba(255, 248, 234, 0.88), rgba(255, 248, 234, 0.18));
  backdrop-filter: blur(8px);
}

.intro-script {
  margin: 0;
  font-family: "Georgia", serif;
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--rose);
  letter-spacing: 0.04em;
}

.intro-panel h2,
.finale-card h2 {
  margin: 0.35rem 0 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 0.96;
}

.intro-note,
.finale-copy {
  width: min(34rem, 84vw);
  margin: 1rem auto 0;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: rgba(21, 34, 40, 0.82);
}

.finale-card {
  background:
    radial-gradient(circle at top, rgba(244, 194, 98, 0.35), transparent 38%),
    linear-gradient(180deg, rgba(255, 248, 234, 0.95), rgba(242, 222, 195, 0.94));
  box-shadow: 0 28px 55px rgba(21, 34, 40, 0.22);
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  pointer-events: none;
}

.finale-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  color: var(--coral);
  font-weight: 700;
}

.replay-card-button {
  margin-top: 1.5rem;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.35rem;
  font: inherit;
  font-weight: 700;
  background: var(--ink);
  color: var(--shell);
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(21, 34, 40, 0.2);
}

.replay-card-button:hover {
  background: #0d171b;
}

.status {
  margin: 1rem 0 0;
  text-align: center;
  font-weight: 500;
  position: relative;
  z-index: 2;
}

.page[data-phase="intro"] .photo-backdrop {
  opacity: 0.28;
  filter: blur(3px) saturate(0.95);
}

.page[data-phase="intro"] .hero {
  opacity: 0.32;
}

.page[data-phase="intro"] .intro-panel {
  opacity: 1;
  transform: translateY(0);
}

.page[data-phase="memories"] .intro-panel,
.page[data-phase="finale"] .intro-panel {
  opacity: 0;
  transform: translateY(-18px);
  pointer-events: none;
}

.page[data-phase="memories"] .photo-backdrop,
.page[data-phase="finale"] .photo-backdrop {
  opacity: 1;
  filter: blur(0) saturate(1.05);
}

.page[data-phase="memories"] .hero,
.page[data-phase="finale"] .hero {
  opacity: 1;
}

.page[data-phase="finale"] .finale-card {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.video-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.video-modal[hidden] {
  display: none;
}

.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 34, 40, 0.75);
  backdrop-filter: blur(6px);
}

.video-modal-panel {
  position: relative;
  width: min(88vw, 960px);
  max-height: 88vh;
  padding: 3.25rem 1rem 1rem;
  border-radius: 1.5rem;
  background: rgba(255, 248, 234, 0.96);
  box-shadow: 0 24px 60px rgba(21, 34, 40, 0.35);
  z-index: 1;
}

.modal-video-player {
  display: block;
  width: 100%;
  max-height: 72vh;
  border-radius: 1rem;
  background: #000;
}

.video-modal-close {
  position: absolute;
  right: 1rem;
  top: 0.9rem;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-weight: 700;
  color: var(--shell);
  background: rgba(21, 34, 40, 0.85);
  cursor: pointer;
}

.video-modal-close:hover {
  background: rgba(21, 34, 40, 1);
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparklePulse {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.7);
  }
  40% {
    opacity: 0.95;
    transform: scale(1.15);
  }
}

@keyframes floatMemory {
  0%,
  100% {
    transform: translate(-50%, -50%) rotate(var(--tilt, 0deg)) translateY(0) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) rotate(calc(var(--tilt, 0deg) * 0.55)) translateY(-10px) scale(1.02);
  }
}

@media (max-width: 760px) {
  .page {
    padding-top: 1.5rem;
  }

  .gallery-shell {
    margin-top: 1.8rem;
    min-height: 380px;
  }

  .backdrop-photo.foreground {
    transform: translate(-50%, -50%) rotate(0deg) scale(1.25);
  }

  .intro-panel,
  .finale-card {
    inset: 1.1rem;
  }

  .hero-copy,
  .intro-note,
  .finale-copy {
    width: min(92vw, 32rem);
  }

  .video-modal-panel {
    width: min(94vw, 960px);
    padding-top: 3rem;
  }
}
