/* =========================================================
   XV AÑOS ANELIZ — CINDERELLA
   Las páginas 1–7 son imágenes terminadas.
   CSS solo controla apertura, botones y contador.
========================================================= */

:root {
  --blue: #173f73;
  --royal: #2858ad;
  --gold: #d6ad55;
  --white: #ffffff;
}

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

html {
  scroll-behavior: smooth;
  background: #173d86;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Montserrat', sans-serif;
  background: #173d86;
}

button, a {
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   APERTURA
========================================================= */

.opening-screen {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  background: url("../assets/fondo_cenicienta_apertura.jpg") center / cover no-repeat;
}

.opening-screen::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255,255,255,.82);
  box-shadow: inset 0 0 0 1px rgba(145,164,182,.25), 0 0 45px rgba(255,255,255,.22);
  pointer-events: none;
  z-index: 20;
}

.opening-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.48), transparent 34%),
    linear-gradient(to bottom, rgba(255,255,255,.04), rgba(55,112,145,.28));
  z-index: -1;
}

.magic-dust {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.95) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(255,255,255,.72) 0 1px, transparent 1.7px);
  background-size: 150px 170px, 210px 230px;
  background-position: 10px 30px, 80px 110px;
  animation: drift 18s linear infinite;
  opacity: .68;
}

@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-60px); }
}

.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.star {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px 3px rgba(255,255,255,.7);
  animation: twinkle 3.4s infinite ease-in-out;
}

.star::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  color: #fff;
  font-size: 12px;
}

.star-1 { top: 15%; left: 12%; }
.star-2 { top: 24%; right: 18%; animation-delay: 1s; }
.star-3 { top: 52%; left: 15%; animation-delay: .5s; }
.star-4 { top: 70%; right: 14%; animation-delay: 1.7s; }
.star-5 { top: 39%; right: 28%; animation-delay: 2s; }
.star-6 { top: 76%; left: 31%; animation-delay: .8s; }
.star-7 { top: 18%; left: 43%; animation-delay: 2.4s; }
.star-8 { top: 59%; right: 38%; animation-delay: 1.4s; }

@keyframes twinkle {
  0%,100% { opacity: .22; transform: scale(.65); }
  50% { opacity: 1; transform: scale(1.45); }
}

.fairytale-envelope {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(430px, 78vw);
  height: min(300px, 55vw);
  transform: translate(-50%, -50%);
  perspective: 1200px;
  z-index: 8;
}

.envelope-shadow {
  position: absolute;
  inset: 12px -10px -18px;
  border-radius: 12px;
  background: rgba(42,82,104,.18);
  filter: blur(18px);
  transform: translateY(10px);
}

.envelope-back {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, #f9fdff, #d9edf8 48%, #f8fcff);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 20px 55px rgba(49,92,120,.18), inset 0 1px 0 rgba(255,255,255,.95);
  overflow: hidden;
}

.envelope-back::before,
.envelope-back::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: .78;
}

.envelope-back::before {
  left: 0;
  border-width: 0 0 155px 215px;
  border-color: transparent transparent #eaf7fd transparent;
}

.envelope-back::after {
  right: 0;
  border-width: 0 215px 155px 0;
  border-color: transparent transparent #dff1fa transparent;
}

.envelope-pocket {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 58%;
  z-index: 5;
  background: linear-gradient(155deg, rgba(255,255,255,.96), rgba(219,239,248,.95));
  clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%);
}

.envelope-flap {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 61%;
  z-index: 7;
  transform-origin: top center;
  background: linear-gradient(155deg, #fff, #e5f5fc 52%, #cde8f5);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 5px rgba(49,92,120,.08));
  transition: transform 1.05s cubic-bezier(.2,.75,.2,1);
  backface-visibility: hidden;
}

.invitation-card {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 78%; height: 82%;
  transform: translateX(-50%);
  z-index: 4;
  padding: 10px;
  border-radius: 7px;
  background: linear-gradient(145deg, #fff, #f2faff 65%, #e9f6fd);
  border: 1px solid rgba(199,209,220,.9);
  box-shadow: 0 10px 30px rgba(49,92,120,.12);
  transition: transform 1.05s cubic-bezier(.2,.75,.2,1), opacity .7s ease;
}

.card-border {
  height: 100%;
  border: 1px solid rgba(145,164,182,.35);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card-eyebrow {
  color: #5b8eaf;
  font-size: 8px;
  letter-spacing: .42em;
  margin-left: .42em;
}

.card-crown { margin-top: 8px; color: var(--gold); font-size: 17px; }

.card-name {
  margin-top: 2px;
  font-family: 'Parisienne', cursive;
  font-size: clamp(43px, 9vw, 65px);
  font-weight: 400;
  line-height: .9;
  color: #315c78;
}

.card-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 70%;
  margin: 13px 0 8px;
}

.card-divider span {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #91a4b6);
}

.card-divider span:last-child {
  background: linear-gradient(90deg, #91a4b6, transparent);
}

.card-divider b { color: #91a4b6; font-size: 8px; }

.card-date {
  color: #315c78;
  font-family: 'Cormorant Garamond', serif;
  font-size: 15px;
  letter-spacing: .24em;
}

.card-message {
  margin-top: 11px;
  color: #7890a0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 11px;
  font-style: italic;
}

.envelope-seal {
  position: absolute;
  left: 50%; top: 57%;
  width: 66px; height: 66px;
  transform: translate(-50%, -50%);
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.95);
  padding: 0;
  cursor: pointer;
  appearance: none;
  background: radial-gradient(circle at 32% 25%, #f5fdff 0 7%, #c8efff 22%, #8cc9e6 54%, #5e98b7 100%);
  box-shadow:
    0 0 0 5px rgba(255,255,255,.28),
    0 0 0 9px rgba(145,212,245,.20),
    0 7px 22px rgba(49,92,120,.30),
    inset 0 2px 0 rgba(255,255,255,.95);
  color: #fff;
  font-family: 'Parisienne', cursive;
  font-size: 35px;
  animation: sealAttention 1.8s ease-in-out infinite;
}

@keyframes sealAttention {
  0%,100% { transform: translate(-50%,-50%) scale(1); }
  50% { transform: translate(-50%,-50%) scale(1.09); }
}

.envelope-seal:hover { transform: translate(-50%,-50%) scale(1.1); }
.envelope-seal span { transform: translateY(-2px); }

.seal-sparkle {
  position: absolute;
  top: -12px; right: -9px;
  color: #fff;
  font-family: serif;
  font-size: 14px;
  font-style: normal;
  text-shadow: 0 0 9px #fff;
  animation: sparkleAroundSeal 1.5s ease-in-out infinite;
}

@keyframes sparkleAroundSeal {
  0%,100% { opacity: .35; transform: scale(.75); }
  50% { opacity: 1; transform: scale(1.35); }
}

.opening-caption {
  position: absolute;
  left: 50%;
  top: calc(46% + min(190px, 35vw));
  transform: translateX(-50%);
  z-index: 10;
  width: min(92%, 600px);
  text-align: center;
}

.opening-subtitle {
  color: rgba(255,255,255,.96);
  font-size: 10px;
  letter-spacing: .34em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(49,92,120,.25);
}

.opening-divider {
  width: 150px;
  height: 1px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, #fff, transparent);
}

.opening-hint {
  margin-top: 16px;
  color: rgba(255,255,255,.95);
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  font-style: italic;
  text-shadow: 0 2px 10px rgba(49,92,120,.28);
  animation: hintPulse 2.2s ease-in-out infinite;
}

@keyframes hintPulse {
  0%,100% { opacity: .62; }
  50% { opacity: 1; }
}

.opening-screen.opening-closing .envelope-flap { transform: rotateX(-180deg); }
.opening-screen.opening-closing .invitation-card {
  transform: translateX(-50%) translateY(-92%);
  opacity: 1;
}
.opening-screen.opening-closing .envelope-seal {
  animation: none;
  transform: translate(-50%,-50%) scale(.1) rotate(30deg);
  opacity: 0;
  pointer-events: none;
}
.opening-screen.opening-closing .opening-caption {
  opacity: 0;
  transition: opacity .45s ease;
}

/* =========================================================
   INVITACIÓN: IMÁGENES TERMINADAS
========================================================= */

.invitation {
  display: none;
  width: 100%;
  background: #173d86;
}

.invitation.visible { display: block; }

.page {
  position: relative;
  width: 100%;
  max-width: 941px;
  margin: 0 auto;
  line-height: 0;
  overflow: hidden;
}

.page img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

/* =========================================================
   CONTADOR
   Se coloca dentro del rectángulo vacío ya dibujado
   en la imagen 4.
========================================================= */

.countdown-overlay {
  position: absolute;
  left: 50%;
  top: 80.7%;
  transform: translate(-50%, -50%);
  width: 61%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  align-items: center;
  line-height: 1;
}

.countdown-item {
  text-align: center;
  color: var(--blue);
}

.countdown-item strong {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(26px, 4vw, 42px);
  font-weight: 600;
  line-height: 1;
}

.countdown-item span {
  display: block;
  margin-top: 5px;
  font-size: clamp(7px, 1.1vw, 10px);
  letter-spacing: .13em;
  text-transform: uppercase;
}

/* =========================================================
   BOTONES
   Se apoyan sobre los espacios vacíos de las imágenes.
========================================================= */

.overlay-button {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, 48%);
  min-height: 40px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(214,173,85,.78);
  border-radius: 999px;
  color: #174b7e;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(9px, 1.25vw, 12px);
  font-weight: 600;
  letter-spacing: .05em;
  background: linear-gradient(135deg,
    rgba(255,255,255,.96),
    rgba(220,241,252,.94),
    rgba(255,250,235,.90));
  box-shadow:
    0 12px 32px rgba(15,51,105,.22),
    0 0 0 4px rgba(255,255,255,.16),
    inset 0 1px 0 #fff;
  transition: transform .25s ease, box-shadow .25s ease;
  line-height: 1;
}

.overlay-button::before {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: inherit;
  border: 1px solid rgba(214,173,85,.35);
  pointer-events: none;
}

.overlay-button:hover {
  transform: translateX(-50%) translateY(-3px);
  box-shadow:
    0 16px 38px rgba(15,51,105,.28),
    0 0 0 6px rgba(255,255,255,.22),
    0 0 28px rgba(148,212,245,.42);
}

.button-icon {
  position: relative;
  z-index: 1;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  background: radial-gradient(circle at 32% 25%, #fff, #b9ddf7 45%, #4d82c8 100%);
  border: 2px solid rgba(255,255,255,.94);
}

.overlay-button > span:nth-child(2) {
  position: relative;
  z-index: 1;
  flex: 1;
  text-align: center;
}

.button-arrow {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--royal);
  background: rgba(255,255,255,.62);
  border: 1px solid rgba(214,173,85,.38);
}

.location-button { top: 81.2%; }
.rsvp-button { top: 83.8%; }

/* =========================================================
   MÚSICA
========================================================= */

.music-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.75);
  background: linear-gradient(145deg, rgba(255,255,255,.78), rgba(105,184,223,.88));
  backdrop-filter: blur(12px);
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 23px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(.8);
  box-shadow: 0 10px 28px rgba(49,92,120,.18);
  transition: .3s ease;
}

.music-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.music-button.playing { animation: musicPulse 1.8s infinite; }

@keyframes musicPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,.5), 0 10px 28px rgba(49,92,120,.18); }
  50% { box-shadow: 0 0 0 10px rgba(255,255,255,0), 0 10px 28px rgba(49,92,120,.18); }
}

/* =========================================================
   DESTELLOS DE APERTURA
========================================================= */

.magic-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  z-index: 40;
  pointer-events: none;
}

.magic-burst::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 18px; height: 18px;
  transform: translate(-50%,-50%) scale(.15);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 5px rgba(255,255,255,.98),
              0 0 30px 12px rgba(191,231,255,.95),
              0 0 65px 22px rgba(105,184,223,.58);
  opacity: 0;
}

.magic-burst::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 42px; height: 42px;
  transform: translate(-50%,-50%) scale(.15);
  border: 2px solid rgba(255,255,255,.95);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255,255,255,.9),
              0 0 35px rgba(148,212,245,.75);
  opacity: 0;
}

.magic-burst-active::before { animation: magicCore 1.15s ease-out forwards; }
.magic-burst-active::after { animation: magicRing 1.35s ease-out forwards; }

.magic-burst span {
  position: absolute;
  left: 0; top: 0;
  color: #fff;
  font-family: Georgia, serif;
  line-height: 1;
  opacity: 0;
  transform: rotate(var(--angle)) translateX(0) scale(.15);
  text-shadow: 0 0 5px #fff, 0 0 12px #fff, 0 0 24px rgba(91,142,175,.95);
}

.magic-burst-active span {
  animation: magicSpark var(--duration) cubic-bezier(.12,.72,.18,1) forwards;
  animation-delay: var(--delay);
}

@keyframes magicCore {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.15); }
  15% { opacity: 1; transform: translate(-50%,-50%) scale(1.8); }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(4.2); }
}

@keyframes magicRing {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.15); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%,-50%) scale(7.5); }
}

@keyframes magicSpark {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(0) scale(.15);
  }
  12% {
    opacity: 1;
    transform: rotate(var(--angle)) translateX(calc(var(--distance) * .12)) scale(1.25);
  }
  35% {
    opacity: 1;
    transform: rotate(var(--angle)) translateX(calc(var(--distance) * .48)) scale(1);
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateX(var(--distance)) scale(.45);
  }
}

/* =========================================================
   CELULAR
========================================================= */

@media (max-width: 600px) {
  .fairytale-envelope {
    width: min(360px, 88vw);
    height: 250px;
    top: 43%;
  }

  .opening-caption {
    top: calc(43% + 160px);
  }

  .invitation-card { width: 80%; height: 82%; }
  .card-name { font-size: 48px; }

  .envelope-seal {
    width: 52px;
    height: 52px;
    font-size: 28px;
  }

  .countdown-overlay {
    top: 80.7%;
    width: 60%;
    gap: 4px;
  }

  .countdown-item strong {
    font-size: clamp(20px, 6vw, 30px);
  }

  .countdown-item span {
    margin-top: 3px;
    font-size: 7px;
  }

  .overlay-button {
    width: 48%;
    min-height: 38px;
    padding: 5px 8px;
    gap: 5px;
    font-size: 8px;
    letter-spacing: .04em;
  }

  .button-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
    font-size: 11px;
  }

  .button-arrow {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
    font-size: 10px;
  }

  .location-button { top: 81.2%; }
  .rsvp-button { top: 83.8%; }

  .music-button {
    width: 44px;
    height: 44px;
    right: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
