/* =========================================================
   Fiesta de Ally — Carta de Admisión a Hogwarts
   Design tokens: no hay match en la base de ui-ux-pro-max para
   temática fantástica/mágica (confirmado via búsqueda, 0 resultados
   en typography; color/style devolvieron paletas SaaS genéricas
   fuera de tema). Paleta y tipografía abajo construidas a mano con
   referencias de marca Hogwarts de dominio público (pergamino,
   carmesí, oro antiguo, esmeralda, tinta).
   Sombras: valores exactos del skill beautiful-shadows (MengTo/Skills).
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Pirata+One&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Nunito:wght@400;600;700;800&display=swap');

:root {
  /* --- Color: pergamino + Hogwarts --- */
  --color-parchment: #f6ecd1;
  --color-parchment-dark: #ead9ab;
  --color-parchment-darker: #ddc485;
  --color-ink: #2a2015;
  --color-ink-soft: #4a3c2a;
  --color-maroon: #7a1f2b;
  --color-maroon-dark: #591420;
  --color-maroon-soft: #a94656;
  --color-gold: #b8872b;
  --color-gold-light: #e6c878;
  --color-emerald: #28543e;
  --color-emerald-light: #3f7d5c;
  --color-navy: #141a33;
  --color-navy-deep: #0b0e1d;
  --color-blush: #d98fa3;

  /* --- Tipografía --- */
  --font-display: 'Cinzel Decorative', 'Georgia', serif;
  --font-accent: 'Pirata One', cursive;
  --font-body: 'EB Garamond', Georgia, serif;
  --font-ui: 'Nunito', system-ui, sans-serif;

  /* --- Sombras (beautiful-shadows skill, valores exactos) --- */
  --shadow-sm: 0px 2px 3px -1px rgba(0,0,0,0.1), 0px 1px 0px 0px rgba(25,28,33,0.02), 0px 0px 0px 1px rgba(25,28,33,0.08);
  --shadow-md: 0px 0px 0px 1px rgba(0,0,0,0.06), 0px 1px 1px -0.5px rgba(0,0,0,0.06), 0px 3px 3px -1.5px rgba(0,0,0,0.06), 0px 6px 6px -3px rgba(0,0,0,0.06), 0px 12px 12px -6px rgba(0,0,0,0.06), 0px 24px 24px -12px rgba(0,0,0,0.06);
  --shadow-lg: 0 2.8px 2.2px rgba(0,0,0,0.034), 0 6.7px 5.3px rgba(0,0,0,0.048), 0 12.5px 10px rgba(0,0,0,0.06), 0 22.3px 17.9px rgba(0,0,0,0.072), 0 41.8px 33.4px rgba(0,0,0,0.086), 0 100px 80px rgba(0,0,0,0.12);

  --radius-md: 14px;
  --radius-lg: 22px;
  --space-section: clamp(3rem, 8vw, 6rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--color-ink);
  background:
    radial-gradient(ellipse at top, #1c2444 0%, var(--color-navy-deep) 65%);
  background-attachment: fixed;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0 0 0.5rem; color: var(--color-maroon-dark); }
a { color: var(--color-maroon); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Estrellas de fondo (nocturno) ---------- */
.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff 100%, transparent),
    radial-gradient(1.5px 1.5px at 70% 65%, #fff 100%, transparent),
    radial-gradient(1px 1px at 45% 15%, #fff 100%, transparent),
    radial-gradient(1px 1px at 85% 40%, #fff 100%, transparent),
    radial-gradient(1.5px 1.5px at 60% 85%, #fff 100%, transparent),
    radial-gradient(1px 1px at 10% 70%, #fff 100%, transparent),
    radial-gradient(1.5px 1.5px at 35% 55%, #fff 100%, transparent),
    radial-gradient(1px 1px at 92% 85%, #fff 100%, transparent);
  opacity: 0.55;
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.7; } }

/* ---------- Envoltorio / Sobre inicial ---------- */
.envelope-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1c2444 0%, var(--color-navy-deep) 70%);
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
.envelope-screen.is-hidden {
  opacity: 0; visibility: hidden; pointer-events: none;
}

.envelope {
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2rem;
  font-family: var(--font-ui);
}

.envelope-card {
  width: min(78vw, 280px);
  aspect-ratio: 3 / 2;
  background: linear-gradient(155deg, var(--color-parchment) 0%, var(--color-parchment-dark) 100%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.35s ease;
}
.envelope:hover .envelope-card,
.envelope:focus-visible .envelope-card { transform: translateY(-4px) scale(1.02); }

.envelope-seal {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--color-maroon-soft), var(--color-maroon-dark) 70%);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-gold-light);
  font-size: 28px;
}

.envelope-label {
  color: var(--color-gold-light);
  font-family: var(--font-accent);
  font-size: 1.3rem;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.envelope-hint {
  color: #cdd3ea;
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ---------- Contenido principal (la carta) ---------- */
main {
  position: relative; z-index: 1;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
main.is-revealed { opacity: 1; transform: translateY(0); }

.sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(1.25rem, 5vw, 3rem);
}

.card {
  background: linear-gradient(170deg, var(--color-parchment) 0%, var(--color-parchment-dark) 100%);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.75rem, 6vw, 3.25rem);
  position: relative;
}

.crest {
  width: 86px; height: 86px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--color-gold-light), var(--color-gold) 70%);
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-maroon-dark);
  font-size: 2.6rem;
}

.kicker {
  text-align: center;
  font-family: var(--font-ui);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--color-emerald);
  margin-bottom: 0.35rem;
}

.hero-title {
  text-align: center;
  font-size: clamp(2rem, 7vw, 3.1rem);
  line-height: 1.15;
  color: var(--color-maroon-dark);
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.hero-sub {
  text-align: center;
  font-family: var(--font-accent);
  font-size: clamp(1.1rem, 3.5vw, 1.4rem);
  color: var(--color-emerald);
  margin-bottom: 1.75rem;
}

hr.divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
  margin: 1.75rem 0;
}
hr.divider.icon::after {
  content: '';
}

.divider-icon {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem;
  margin: 1.75rem 0;
  color: var(--color-gold);
}
.divider-icon::before, .divider-icon::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-gold));
}
.divider-icon::after { background: linear-gradient(90deg, var(--color-gold), transparent); }

.letter-body p {
  margin: 0 0 1.1rem;
  font-size: 1.1rem;
}
.letter-body .signoff {
  font-family: var(--font-accent);
  font-size: 1.3rem;
  color: var(--color-maroon);
  margin-top: 1.5rem;
}

/* ---------- Foto de Ally ---------- */
.portrait-wrap {
  display: flex; justify-content: center; margin: 1.5rem 0 2rem;
}
.portrait {
  position: relative;
  width: 168px; height: 168px;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(155deg, var(--color-gold-light), var(--color-gold));
  box-shadow: var(--shadow-lg);
}
.portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--color-parchment);
  display: block;
}
.portrait-badge {
  position: absolute;
  bottom: -6px; right: -6px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--color-maroon-dark);
  color: var(--color-gold-light);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
  font-size: 1.3rem;
  border: 2px solid var(--color-gold-light);
}

/* ---------- Detalles del evento ---------- */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.detail-card {
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.2rem;
  display: flex; gap: 0.85rem; align-items: flex-start;
}
.detail-icon {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--color-emerald);
  color: #f6ecd1;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.detail-title {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-emerald);
  margin: 0 0 0.2rem;
}
.detail-value {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--color-ink);
  font-size: 0.98rem;
}
.detail-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin-top: 0.35rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-maroon);
  text-decoration: none;
}
.detail-link:hover { text-decoration: underline; }

/* ---------- RSVP ---------- */
.rsvp-card {
  background: linear-gradient(170deg, #fffaf0 0%, var(--color-parchment) 100%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  border: 1px solid rgba(0,0,0,0.06);
}

.field { margin-bottom: 1.15rem; }
.field label {
  display: block;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--color-ink-soft);
  margin-bottom: 0.35rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1.5px solid var(--color-parchment-darker);
  background: #fffdf7;
  color: var(--color-ink);
  min-height: 44px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid var(--color-emerald-light);
  outline-offset: 1px;
  border-color: var(--color-emerald);
}

.radio-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.radio-pill {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-ui); font-weight: 700; font-size: 0.95rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 1.5px solid var(--color-parchment-darker);
  background: #fffdf7;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
}
.radio-pill:has(input:checked) {
  background: var(--color-emerald);
  border-color: var(--color-emerald);
  color: #fff;
}
.radio-pill input { width: 16px; height: 16px; margin: 0; }

.btn-submit {
  width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.05rem;
  padding: 0.95rem 1.5rem;
  min-height: 48px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-maroon), var(--color-maroon-dark));
  color: var(--color-gold-light);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-submit:focus-visible { outline: 3px solid var(--color-gold-light); outline-offset: 2px; }
.btn-submit:disabled { opacity: 0.65; cursor: progress; transform: none; }

.form-status {
  margin-top: 1rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  display: none;
}
.form-status.is-visible { display: block; }
.form-status.success { background: rgba(40,84,62,0.12); color: var(--color-emerald); }
.form-status.error { background: rgba(122,31,43,0.1); color: var(--color-maroon); }

footer {
  position: relative; z-index: 1;
  text-align: center;
  color: #cdd3ea;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 2rem 1rem 3rem;
}
footer a { color: var(--color-gold-light); }

/* ---------- Confeti nativo (sin depender de IDs de Lordicon sin verificar) ---------- */
.confetti-piece {
  position: fixed;
  top: -10px;
  z-index: 60;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

@media (min-width: 640px) {
  .hero-title { letter-spacing: 0.01em; }
}
