:root {
  --intro-bg: #f7f2ea;
  --intro-bg-2: #efe4d5;
  --envelope-back: #f3e7d9;
  --envelope-front: #ead9c8;
  --envelope-flap: #f0e2d4;
  --seal-bg: #b68e63;
  --seal-text: #fff9f2;
  --intro-text: #7a5e3f;
  --intro-title: #8d6a43;
  --intro-shadow: 0 20px 40px rgba(89, 59, 29, 0.12);
  --intro-card-shadow: 0 20px 32px rgba(102, 76, 45, 0.14);
}

h2,
body {
  font-family: 'Caveat', serif;
  color: #675238;
}

h1 {
  font-family: 'Great Vibes', cursive;
  color: #ba4920;
}

html {
  scroll-behavior: smooth;
}

#mainContent {
  height: 100dvh;
}

@supports not (height: 100dvh) {
  #mainContent {
    height: 100vh;
  }
}

.hero-map-bg {
  background-image: url('../assets/mapa-claro.jpg');
}

.map-embed {
  border: 0;
  filter: sepia(0.82) hue-rotate(340deg) saturate(0.82) brightness(0.96);
}

.rsvp-form-embed {
  display: block;
  width: 100%;
  max-width: 100vw;
  border: 0;
}

.music-player {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
}

.music-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #ba4920;
  transition: transform 0.28s ease;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: grid;
  place-items: center;
  position: relative;
  padding: 0;
}

.music-toggle:hover {
  transform: scale(1.06);
}

.music-toggle svg {
  position: absolute;
}

.music-player audio {
  display: none;
}

body.intro-active {
  overflow: hidden;
}

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.7), transparent 42%),
    radial-gradient(circle at 80% 12%, rgba(255, 255, 255, 0.45), transparent 40%),
    linear-gradient(155deg, var(--intro-bg), var(--intro-bg-2));
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.intro-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-shell {
  width: min(92vw, 420px);
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  position: relative;
  animation: introFadeUp 900ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.intro-kicker {
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--intro-title);
  margin-bottom: 0.6rem;
  opacity: 0.8;
}

.intro-title {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  color: #9e6f4a;
  line-height: 1;
  margin-bottom: 0.9rem;
}

.intro-subtitle {
  color: var(--intro-text);
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.envelope-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  position: relative;
  width: min(84vw, 320px);
  outline: none;
  border-radius: 14px;
  animation: envelopeFloat 3.6s ease-in-out infinite;
}

.envelope-button:focus-visible {
  box-shadow: 0 0 0 4px rgba(182, 142, 99, 0.25);
}

.envelope-button.is-opening,
.envelope-button.is-opened {
  animation: none;
  cursor: default;
}

.envelope {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3.4;
  filter: drop-shadow(var(--intro-shadow));
  transform-style: preserve-3d;
  perspective: 900px;
  overflow: hidden;
}

.envelope-button.is-opening .envelope,
.envelope-button.is-opened .envelope {
  overflow: visible;
}

.envelope-back,
.envelope-front,
.envelope-flap,
.envelope-letter {
  position: absolute;
  left: 0;
  width: 100%;
  border-radius: 14px;
}

.envelope-back {
  bottom: 0;
  height: 78%;
  background: linear-gradient(160deg, #f8ede1, var(--envelope-back));
  border: 1px solid rgba(182, 142, 99, 0.16);
}

.envelope-front {
  bottom: 0;
  height: 78%;
  background: var(--envelope-front);
  border: 1px solid rgba(182, 142, 99, 0.22);
  overflow: hidden;
  z-index: 3;
}

.envelope-front::before,
.envelope-front::after {
  content: "";
  position: absolute;
  top: 0;
  width: 52%;
  height: 100%;
  background: linear-gradient(155deg, #f0dfcc, #e7d2be);
}

.envelope-front::before {
  left: -2%;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.envelope-front::after {
  right: -2%;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.envelope-letter {
  bottom: 10%;
  left: 8%;
  width: 84%;
  height: 78%;
  background: linear-gradient(180deg, #fffdf9 0%, #fcf6ee 100%);
  border: 1px solid rgba(173, 135, 92, 0.22);
  box-shadow: var(--intro-card-shadow);
  z-index: 2;
  padding: 1.2rem 1rem 1rem;
  text-align: center;
  transform: translateY(30%) scale(0.98);
  transform-origin: bottom center;
  transition: transform 1.85s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 1.1s ease;
  opacity: 0.95;
}

.letter-head {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(1.4rem, 5.5vw, 2rem);
  color: #a56f45;
  line-height: 1;
  margin-bottom: 0.45rem;
}

.letter-date {
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.66rem;
  color: #9f7b55;
  margin-bottom: 0.55rem;
}

.letter-message {
  font-family: 'Playfair Display', serif;
  font-size: 0.88rem;
  color: #7b6247;
  line-height: 1.35;
}

.envelope-flap {
  top: 21%;
  height: 56%;
  background: linear-gradient(160deg, #f8ede1, var(--envelope-flap));
  clip-path: polygon(0 0, 100% 0, 50% 94%);
  border: 1px solid rgba(182, 142, 99, 0.18);
  transform-origin: top center;
  transform: rotateX(0deg);
  z-index: 5;
  transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.2, 1);
  backface-visibility: hidden;
}

.envelope-seal {
  position: absolute;
  left: 50%;
  top: 68%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #cfac82, var(--seal-bg));
  color: var(--seal-text);
  display: grid;
  place-items: center;
  font-family: 'Playfair Display', serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  box-shadow: 0 8px 18px rgba(102, 67, 34, 0.2);
  z-index: 6;
  transition: transform 500ms ease, opacity 420ms ease;
}

.envelope-button:hover .envelope-seal {
  transform: translate(-50%, -50%) scale(1.04);
}

.envelope-button.is-opening .envelope-seal,
.envelope-button.is-opened .envelope-seal {
  opacity: 0;
  transform: translate(-50%, -62%) scale(0.88);
}

.envelope-button.is-opening .envelope-flap,
.envelope-button.is-opened .envelope-flap {
  transform: rotateX(-176deg);
}

.envelope-button.is-opening .envelope-letter,
.envelope-button.is-opened .envelope-letter {
  transform: translateY(-55%) scale(1.02) rotate(-0.6deg);
  opacity: 1;
}

.intro-hint {
  margin-top: 1rem;
  color: #8b6d4d;
  font-family: 'Playfair Display', serif;
  font-size: 0.84rem;
  opacity: 0.9;
  transition: opacity 280ms ease;
}

.intro-hint.is-hidden {
  opacity: 0;
}

.intro-cta {
  margin-top: 1.15rem;
  border: 1px solid rgba(168, 126, 83, 0.42);
  background: rgba(255, 252, 247, 0.85);
  color: #8e6a45;
  padding: 0.72rem 1.4rem;
  border-radius: 999px;
  font-family: 'Playfair Display', serif;
  font-size: 0.93rem;
  letter-spacing: 0.03em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 420ms ease, transform 420ms ease, background 220ms ease;
}

.intro-cta.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.intro-cta:hover {
  background: rgba(255, 255, 255, 0.98);
}

.intro-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.intro-sparkles span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 12px rgba(250, 233, 192, 0.9);
  animation: sparkle 5.5s ease-in-out infinite;
}

.intro-sparkles span:nth-child(1) { top: 18%; left: 18%; animation-delay: 0.2s; }
.intro-sparkles span:nth-child(2) { top: 24%; right: 20%; animation-delay: 1.3s; }
.intro-sparkles span:nth-child(3) { bottom: 24%; left: 24%; animation-delay: 2.2s; }
.intro-sparkles span:nth-child(4) { bottom: 18%; right: 22%; animation-delay: 0.9s; }
.intro-sparkles span:nth-child(5) { top: 48%; left: 9%; animation-delay: 3s; }
.intro-sparkles span:nth-child(6) { top: 52%; right: 10%; animation-delay: 2.6s; }

@keyframes introFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes envelopeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes sparkle {
  0%, 100% { opacity: 0.18; transform: translateY(0) scale(0.85); }
  50% { opacity: 0.75; transform: translateY(-8px) scale(1); }
}

.scroll-cue {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translate(-50%, 10px);
  z-index: 1200;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 420ms ease, transform 420ms ease;
}

.scroll-cue.is-visible {
  opacity: 0.86;
  transform: translate(-50%, 0);
}

.scroll-cue-icon {
  width: 30px;
  height: 28px;
  position: relative;
}

.scroll-cue-icon span {
  position: absolute;
  left: 50%;
  width: 10px;
  height: 10px;
  border-right: 1.5px solid rgba(103, 82, 56, 0.62);
  border-bottom: 1.5px solid rgba(103, 82, 56, 0.62);
  transform: translateX(-50%) rotate(45deg);
  animation: cueChevron 1.8s ease-in-out infinite;
}

.scroll-cue-icon span:nth-child(1) {
  top: 0;
  opacity: 0.25;
  animation-delay: 0s;
}

.scroll-cue-icon span:nth-child(2) {
  top: 7px;
  opacity: 0.55;
  animation-delay: 0.15s;
}

.scroll-cue-icon span:nth-child(3) {
  top: 14px;
  opacity: 0.85;
  animation-delay: 0.3s;
}

.scroll-cue p {
  margin: 0;
  font-family: 'Playfair Display', serif;
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: rgba(103, 82, 56, 0.7);
}

@keyframes cueChevron {
  0%, 100% { transform: translate(-50%, 0) rotate(45deg); opacity: 0.15; }
  50% { transform: translate(-50%, 4px) rotate(45deg); opacity: 0.95; }
}

@media (prefers-reduced-motion: reduce) {
  .intro-shell,
  .envelope-button,
  .intro-sparkles span,
  .scroll-cue-icon span {
    animation: none !important;
  }

  .envelope-flap,
  .envelope-letter,
  .envelope-seal,
  .intro-overlay,
  .intro-hint,
  .intro-cta,
  .scroll-cue {
    transition-duration: 0.01ms !important;
  }
}
