/* @section: design-system */
:root {
  --fuchsia: #C9007A;
  --fuchsia-deep: #9B005B;
  --fuchsia-light: #E8409A;
  --gold: #C9A84C;
  --gold-light: #E8D08A;
  --gold-dark: #9A7B28;
  --cream: #FAF5EE;
  --cream-dark: #F0E6D6;
  --white: #FFFFFF;
  --dark: #1A0A12;
  --dark-soft: #2D1520;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-italic: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Montserrat', system-ui, -apple-system, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--dark);
  color: var(--cream);
  overflow-x: hidden;
}

/* ─────────────────────────────────────────
   ESCENA DEL SOBRE
───────────────────────────────────────── */
.env-scene {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #2D0A1F 0%, #0D0008 100%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.env-scene.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Partículas flotantes */
.env-bg-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  animation: floatParticle linear infinite;
}

@keyframes floatParticle {
  0% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(-10vh) scale(1.5); opacity: 0; }
}

/* Wrapper del sobre */
.env-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem;
}

.env-pretext {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--gold-light);
  letter-spacing: 0.05em;
  opacity: 0;
  animation: fadeDown 1s 0.5s ease forwards;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* SOBRE */
.envelope {
  position: relative;
  width: clamp(280px, 80vw, 420px);
  height: clamp(196px, 56vw, 294px);
  cursor: pointer;
  filter: drop-shadow(0 20px 60px rgba(201,0,122,0.4));
  transition: filter 0.3s ease;
  opacity: 0;
  animation: fadeUp 1s 0.8s ease forwards;
}

.envelope:hover {
  filter: drop-shadow(0 25px 80px rgba(201,0,122,0.6));
}

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

/* Cuerpo del sobre */
.env-body {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #8B0055 0%, var(--fuchsia) 50%, #A80068 100%);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.3);
}

/* Pliegues laterales */
.env-fold {
  position: absolute;
  top: 0; bottom: 0;
  width: 0; height: 0;
}

.env-fold--left {
  left: 0;
  border-style: solid;
  border-width: 0 0 clamp(98px,28vw,147px) clamp(140px,40vw,210px);
  border-color: transparent transparent rgba(0,0,0,0.12) transparent;
}

.env-fold--right {
  right: 0;
  border-style: solid;
  border-width: clamp(98px,28vw,147px) 0 0 clamp(140px,40vw,210px);
  border-color: transparent transparent transparent rgba(0,0,0,0.1);
}

.env-fold--bottom {
  bottom: 0;
  left: 0; right: 0;
  height: 0;
  border-style: solid;
  border-width: 0 clamp(140px,40vw,210px) clamp(98px,28vw,147px);
  border-color: transparent transparent rgba(255,255,255,0.07) transparent;
}

/* Sello médico */
.env-seal {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  z-index: 2;
}

.seal-ring {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-light) 0%, var(--gold) 60%, var(--gold-dark) 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 20px rgba(201,168,76,0.8), 0 0 40px rgba(201,168,76,0.4);
  border: 2px solid var(--gold-light);
  animation: sealPulse 2s ease-in-out infinite;
}

@keyframes sealPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(201,168,76,0.8), 0 0 40px rgba(201,168,76,0.4); }
  50% { box-shadow: 0 0 30px rgba(201,168,76,1), 0 0 60px rgba(201,168,76,0.6); }
}

.seal-cross {
  font-size: 1.8rem;
  color: var(--dark);
  font-weight: bold;
  text-shadow: none;
}

/* SOLAPA */
.env-flap {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 0;
  border-style: solid;
  border-width: clamp(98px,28vw,147px) clamp(140px,40vw,210px) 0;
  border-color: #B0006A transparent transparent;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  z-index: 3;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
}

.env-flap-inner {
  position: absolute;
  top: -clamp(98px,28vw,147px);
  left: -clamp(140px,40vw,210px);
  right: -clamp(140px,40vw,210px);
  height: clamp(98px,28vw,147px);
  background: linear-gradient(180deg, #C40080 0%, #9B005B 100%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.env-flap.open {
  transform: rotateX(-180deg);
}

/* TARJETA que sale del sobre */
.env-card {
  position: absolute;
  bottom: 0; left: 5%; right: 5%;
  height: 90%;
  background: linear-gradient(160deg, var(--cream) 0%, #FFF8F2 100%);
  border-radius: 4px 4px 0 0;
  z-index: 1;
  transform: translateY(0);
  transition: transform 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s;
  overflow: hidden;
}

.env-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--fuchsia), var(--gold), var(--fuchsia));
}

.env-card.rising {
  transform: translateY(-75%);
}

.env-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  height: 100%;
  text-align: center;
  gap: 0.5rem;
}

.env-card-pre {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 0.75rem;
  color: var(--fuchsia);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.env-card-cross {
  font-size: 1.4rem;
  color: var(--gold);
}

.env-card-name {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
}

.env-card-degree {
  font-size: 0.65rem;
  color: var(--fuchsia);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.env-card-line {
  width: 40px;
  height: 1px;
  background: var(--gold);
  margin: 0.25rem auto;
}

.env-card-sub {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 0.7rem;
  color: var(--dark-soft);
}

/* BOTÓN CTA */
.env-cta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, var(--fuchsia), var(--fuchsia-deep));
  border: 1px solid var(--fuchsia-light);
  border-radius: 50px;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(201,0,122,0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  opacity: 0;
  animation: fadeUp 1s 1.2s ease forwards;
}

.env-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px rgba(201,0,122,0.6);
}

.env-cta-icon { font-size: 1.1rem; }

/* ─────────────────────────────────────────
   MAIN INVITACIÓN
───────────────────────────────────────── */
.inv-main {
  opacity: 0;
  transition: opacity 1s ease;
}

.inv-main.visible {
  opacity: 1;
}

.inv-main[aria-hidden="true"] {
  display: none;
}

/* ─────────────────────────────────────────
   PARALLAX SECTIONS
───────────────────────────────────────── */
.parallax-sec {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  inset: -30% 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
  z-index: 0;
}

/* ─── HERO ─── */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(155,0,91,0.82) 0%, rgba(26,10,18,0.9) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1.5rem;
  gap: 1.2rem;
  max-width: 700px;
}

.hero-eyebrow {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--gold-light);
  letter-spacing: 0.05em;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--white);
}

.hero-title em {
  font-style: italic;
  color: var(--gold-light);
  display: block;
}

.hero-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 2vw, 1rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  font-weight: 300;
}

.hero-tagline {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  color: var(--gold-light);
}

/* FOTO FRAME */
.photo-frame {
  width: clamp(160px, 45vw, 240px);
  height: clamp(160px, 45vw, 240px);
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--gold);
  box-shadow: 0 0 0 8px rgba(201,168,76,0.25), 0 0 60px rgba(201,0,122,0.5);
  background: var(--dark-soft);
  flex-shrink: 0;
}

.photo-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem;
  text-align: center;
}

.photo-icon-wrap { font-size: 3rem; }

.photo-lbl {
  font-size: 0.65rem;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.photo-hint {
  font-size: 0.55rem;
  color: rgba(255,255,255,0.4);
  line-height: 1.4;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* ─── BARRA DORADA ─── */
.gold-bar {
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  flex-shrink: 0;
}

.gold-bar--center { margin: 0 auto; }

/* ─── GRATITUD ─── */
.gratitude-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(10,3,8,0.88) 0%, rgba(155,0,91,0.55) 100%);
  z-index: 1;
}

.gratitude-wrap {
  position: relative;
  z-index: 2;
  max-width: 780px;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
}

.big-quote {
  font-family: var(--font-serif);
  font-size: 6rem;
  line-height: 0.5;
  color: var(--gold);
  opacity: 0.4;
  font-style: normal;
  font-weight: 700;
}

.big-quote--close {
  align-self: flex-end;
}

.gratitude-text {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 300;
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.92);
  border: none;
  margin: 0;
}

.gratitude-text--god {
  color: var(--gold-light);
}

.quote-divider {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.gratitude-signature {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.05em;
}

/* ─── EVENTO ─── */
.event-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(155,0,91,0.88) 0%, rgba(10,3,8,0.9) 100%);
  z-index: 1;
}

.event-wrap {
  position: relative; z-index: 2;
  max-width: 900px;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  text-align: center;
  width: 100%;
}

.event-eyebrow {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: var(--gold-light);
  letter-spacing: 0.05em;
}

.event-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.event-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .event-cards { grid-template-columns: 1fr; max-width: 320px; }
}

.event-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 12px;
  padding: 2rem 1.2rem;
  backdrop-filter: blur(12px);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.event-card:hover {
  transform: translateY(-6px);
  border-color: var(--gold);
}

.ec-icon { font-size: 2rem; margin-bottom: 0.6rem; }

.ec-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.ec-value {
  font-family: var(--font-serif);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--white);
  line-height: 1.5;
  min-height: 2.5em;
  outline: none;
  cursor: text;
  border-bottom: 1px dashed rgba(201,168,76,0.3);
  padding: 0.3rem 0;
  transition: border-color 0.2s;
}

.ec-value:focus {
  border-color: var(--gold);
  color: var(--gold-light);
}

.edit-hint {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
  font-style: italic;
}

/* ─── MÉDICA / PILARES ─── */
.medical-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(26,10,18,0.92) 0%, rgba(155,0,91,0.7) 100%);
  z-index: 1;
}

.medical-wrap {
  position: relative; z-index: 2;
  max-width: 900px;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
  width: 100%;
}

.med-cross {
  font-size: 3.5rem;
  color: var(--gold);
  filter: drop-shadow(0 0 20px rgba(201,168,76,0.7));
  animation: crossGlow 3s ease-in-out infinite;
}

@keyframes crossGlow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(201,168,76,0.7)); }
  50% { filter: drop-shadow(0 0 40px rgba(201,168,76,1)); }
}

.med-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.med-title em {
  font-style: italic;
  color: var(--gold-light);
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  width: 100%;
}

@media (max-width: 640px) {
  .pillars { grid-template-columns: 1fr; max-width: 320px; }
}

.pillar {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: 12px;
  padding: 2rem 1.2rem;
  transition: transform 0.3s ease, background 0.3s ease;
}

.pillar:hover {
  transform: translateY(-6px);
  background: rgba(201,0,122,0.12);
}

.pillar-icon { font-size: 2.2rem; margin-bottom: 0.8rem; }

.pillar h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 0.6rem;
}

.pillar p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
}

/* ─── CIERRE ─── */
.closing-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(155,0,91,0.9) 0%, rgba(10,3,8,0.95) 100%);
  z-index: 1;
}

.closing-wrap {
  position: relative; z-index: 2;
  max-width: 680px;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.2rem;
}

.closing-flowers { font-size: 1.8rem; letter-spacing: 0.4em; }
.closing-flowers--bottom { margin-top: 1rem; }

.closing-name {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 6vw, 4rem);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.closing-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 300;
}

.closing-verse {
  font-family: var(--font-italic);
  font-style: italic;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: rgba(255,255,255,0.85);
  line-height: 1.8;
}

.verse-ref {
  font-size: 0.85rem;
  color: var(--gold-light);
  font-style: normal;
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0.05em;
  display: block;
  margin-top: 0.4rem;
}

/* ─────────────────────────────────────────
   BOTÓN MÚSICA
───────────────────────────────────────── */
.music-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 500;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(201,0,122,0.85);
  border: 2px solid var(--gold);
  color: var(--white);
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(201,0,122,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.music-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(201,0,122,0.8);
}

.music-btn.playing #musicIcon {
  animation: musicBounce 0.6s ease-in-out infinite alternate;
}

@keyframes musicBounce {
  from { transform: scale(1) rotate(-10deg); }
  to { transform: scale(1.2) rotate(10deg); }
}

/* ─────────────────────────────────────────
   CONFETTI
───────────────────────────────────────── */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* ─────────────────────────────────────────
   ANIMACIONES SCROLL (Intersection Observer)
───────────────────────────────────────── */
.animate-up, .animate-left, .animate-right, .animate-fade {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
  will-change: opacity, transform;
}

.animate-up    { transform: translateY(40px); }
.animate-left  { transform: translateX(-50px); }
.animate-right { transform: translateX(50px); }
.animate-fade  { transform: scale(0.95); }

.animate-up.in,
.animate-left.in,
.animate-right.in,
.animate-fade.in {
  opacity: 1;
  transform: none;
}

.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.45s; }
.delay-4 { transition-delay: 0.6s; }

/* ─────────────────────────────────────────
   ACCESSIBILITY
───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
