:root {
  --cream: #faf8f5;
  --paper: #f5f0e8;
  --gold: #c9a962;
  --gold-dark: #a68b4a;
  --text: #2c2416;
  --text-muted: #5c5344;
  --shadow: rgba(44, 36, 22, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  background: url("images/background.png") center center / cover no-repeat fixed;
}

body {
  font-family: "Montserrat", sans-serif;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Dramatic Zoom Effect (SpongeBob style) === */
/* Duration set via JS to match audio length */
.zoom-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 10;
  --zoom-duration: 37s; /* fallback, overwritten by JS from audio duration */
}

.zoom-container.playing .start-btn {
  opacity: 0;
  pointer-events: none;
}

.start-btn {
  position: absolute;
  inset: 0;
  z-index: 15;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.5s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.8),
    0 2px 8px rgba(0, 0, 0, 0.6);
}

.envelope-trigger {
  position: relative;
  z-index: 1;
  cursor: pointer;
  transition: transform 0.2s;
}

.envelope-trigger:hover {
  transform: scale(1.05);
}

.envelope-trigger lottie-player {
  width: 220px;
  height: 220px;
  display: block;
}

.start-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    transparent 30%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
}

.start-btn:hover {
  color: white;
}

.start-btn span {
  position: relative;
  z-index: 1;
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50px;
  backdrop-filter: blur(4px);
}

.invitation-card {
  width: 520px;
  padding: 0;
  overflow: hidden;
  z-index: 1;
  visibility: hidden;
  background: linear-gradient(145deg, #fffef9 0%, var(--paper) 100%);
  box-shadow:
    0 0 0 1px var(--gold) inset,
    0 25px 60px var(--shadow),
    0 0 120px rgba(201, 169, 98, 0.2);
  border-radius: 2px;
  animation: dramaticZoom var(--zoom-duration) cubic-bezier(0.7, 0, 0.3, 1)
    forwards;
  transform-origin: center center;
  animation-play-state: paused;
  will-change: transform;
  backface-visibility: hidden;
}

.zoom-container.playing .invitation-card {
  animation-play-state: paused;
}

.zoom-container.zoom-animating .invitation-card {
  animation-play-state: running;
  visibility: visible;
}

@keyframes dramaticZoom {
  0% {
    transform: scale(0.08);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes dramaticZoomMobile {
  0% {
    transform: scale(0.08);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.card-inner {
  opacity: 1;
}

.card-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 2rem 2.5rem;
  text-align: center;
}

.card-intro {
  font-size: 0.85rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin: 0 0 0.5rem;
}

.card-names {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  font-style: italic;
  color: var(--gold-dark);
  margin: 0.5rem 0;
}

.card-stack h1.card-names {
  margin: 0 0 1rem;
}

.card-photo-wrap {
  width: 100%;
  max-width: 320px;
  margin: 0.75rem auto;
  overflow: hidden;
  border-radius: 150px 150px 0 0;
}

.card-photo {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 4.2;
  object-fit: cover;
  object-position: center top;
  display: block;
  vertical-align: middle;
}

.card-details {
  margin: 1rem 0 0;
  text-align: center;
}

.card-when,
.card-where {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.card-when {
  margin-bottom: 0.35rem;
}

.card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 0.25rem;
}

.card-rsvp-link {
  display: inline-block;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dark);
  text-decoration: none;
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.2em;
  transition: color 0.2s;
}

.zoom-container.fading {
  animation: fadeOut 0.8s ease-out forwards;
}

@keyframes fadeInText {
  to {
    opacity: 1;
  }
}

.card-rsvp-link:hover {
  color: var(--gold);
}

/* === Main Content (after zoom) === */
.content {
  position: relative;
  min-height: 100vh;
  padding: 4rem 1.5rem 3rem;
  opacity: 0;
  /* showContent delay set via JS to match zoom-duration + 0.5s */
}

@keyframes showContent {
  to {
    opacity: 1;
  }
}

.rsvp-section {
  max-width: 420px;
  margin: 0 auto;
  padding: 2.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 40px var(--shadow);
}

.rsvp-section h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.rsvp-intro {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.rsvp-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.rsvp-form input[type="text"],
.rsvp-form input[type="number"],
.rsvp-form textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.rsvp-form input:focus,
.rsvp-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.attendance-options {
  margin-bottom: 1.25rem;
}

.radio-option {
  display: flex;
  align-items: center;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
  border: 2px solid #e8e4dc;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.radio-option:hover {
  border-color: var(--gold);
  background: rgba(201, 169, 98, 0.05);
}

.radio-option input {
  margin-right: 0.75rem;
  accent-color: var(--gold);
}

.radio-option input:checked + .radio-label {
  font-weight: 500;
}

.radio-option:has(input:checked) {
  border-color: var(--gold);
  background: rgba(201, 169, 98, 0.08);
}

.submit-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  margin-top: 0.5rem;
  background: var(--gold);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.submit-btn:hover {
  background: var(--gold-dark);
}

/* Zoom controls: mute + skip */
.zoom-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 25;
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--gold);
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    opacity 0.3s,
    background 0.2s;
}

.control-btn:hover,
.control-btn:focus {
  background: rgba(255, 255, 255, 1);
  outline: none;
}

.mute-btn {
  padding: 0.5rem 0.75rem;
  font-size: 1.1rem;
}

/* Lottie animations */
.lottie-decor {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
}

.lottie-decor lottie-player {
  display: block;
}

.lottie-hearts {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lottie-hearts lottie-player {
  width: 100%;
  max-width: 400px;
  height: auto;
}

.lottie-section {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
}

.lottie-section lottie-player {
  width: 120px;
  height: 120px;
}

/* === Responsive: Smartphones === */
@media (max-width: 640px) {
  .zoom-container {
    padding: 2rem 1rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
  }

  .invitation-card {
    width: 100%;
    max-width: 100%;
    margin: 0;
    animation-name: dramaticZoomMobile;
  }

  .zoom-container.zoom-animating .invitation-card {
    animation-name: dramaticZoomMobile;
  }

  .card-stack {
    padding: 1.5rem 1.25rem 2rem;
  }

  .card-names {
    font-size: 1.5rem;
  }

  .card-intro {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
  }

  .card-photo-wrap {
    max-width: 100%;
    margin-bottom: 1.25rem;
  }

  .card-rsvp-link {
    font-size: 0.85rem;
  }

  .start-btn {
    font-size: 0.95rem;
  }

  .start-btn span {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  .envelope-trigger lottie-player {
    width: 160px;
    height: 160px;
  }

  .content {
    padding: 2rem 1rem 2rem;
  }

  .rsvp-section {
    padding: 1.5rem 1.25rem;
    margin: 0 1rem;
  }

  .rsvp-section h2 {
    font-size: 1.5rem;
  }
}
