/* ============================================================
   03-PORTADA.css — PORTADA / SOBRE DE BIENVENIDA
   ============================================================
   Pantalla inicial: el sobre con la carta que dice "Están
   invitados a la boda de...". Al hacer clic en el botón
   "Abrir invitación", se desliza hacia arriba.

   Las flores decorativas de la portada están en este archivo
   (no en 02-fondo.css) porque son específicas de la portada.
   ============================================================ */

body.locked { overflow: hidden; }

.cover {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at top, #f4f7fb 0%, #d6e0ee 55%, #b9c8de 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem 1.5rem;
  transition: opacity 0.9s ease, transform 0.9s ease;
}

/* Las flores decorativas de la portada (cover__floral--side-left/--side-right)
   las maneja 02-fondo.css con sus reglas genéricas. */

.cover.is-open {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

/* SOBRE — contenedor que flota */
.envelope {
  position: relative;
  width: min(440px, 92vw);
  height: 340px;
  animation: floatCard 5s ease-in-out infinite;

  /* Textura granulada reutilizable (ruido SVG en escala de grises).
     Se mezcla con soft-light sobre los degradados del sobre. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Pared trasera del sobre */
.envelope__base {
  position: absolute;
  inset: 0;
  background:
    var(--grain),
    linear-gradient(180deg, #9fb2cd 0%, #7e93b3 100%);
  background-size: 180px 180px, auto;
  background-blend-mode: soft-light, normal;
  border-radius: 6px;
  z-index: 0;
  box-shadow:
    0 18px 40px rgba(70,90,125,0.28),
    0 4px 10px rgba(70,90,125,0.16);
}

/* Solapa trasera (triángulo decorativo) */
.envelope__back-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 55%;
  background:
    var(--grain),
    linear-gradient(135deg, #d3dded 0%, #b1c2db 100%);
  background-size: 180px 180px, auto;
  background-blend-mode: soft-light, normal;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  z-index: 1;
  box-shadow: inset 0 -8px 14px rgba(70,90,125,0.10);
}

/* Filo decorativo interior de la solapa (liner) */
.envelope__back-flap::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(135deg, #eef3f9 0%, #cdd9ea 100%);
  transform: scale(0.965);
  transform-origin: top center;
  opacity: 0.7;
}

/* CARTA — sale del sobre */
.letter {
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 82%;
  background:
    repeating-linear-gradient(45deg, transparent 0, transparent 3px, rgba(70,90,125,0.014) 3px, rgba(70,90,125,0.014) 4px),
    repeating-linear-gradient(-45deg, transparent 0, transparent 3px, rgba(70,90,125,0.014) 3px, rgba(70,90,125,0.014) 4px),
    linear-gradient(180deg, #ffffff 0%, #f3f6fb 100%);
  border-radius: 14px;
  padding: 2.2rem 1.6rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.4rem;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.8) inset,
    0 10px 28px rgba(70,90,125,0.14);
  z-index: 2;
  transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
}

.letter__text {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--accent);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

/* Bolsillo frontal del sobre con V */
.envelope__pocket {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 72%;
  background:
    var(--grain),
    linear-gradient(115deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 48%),
    linear-gradient(180deg, #c3d0e3 0%, #93a8c4 100%);
  background-size: 180px 180px, auto, auto;
  background-blend-mode: soft-light, normal, normal;
  clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%);
  z-index: 3;
  box-shadow:
    0 16px 34px rgba(70,90,125,0.26),
    inset 0 2px 6px rgba(255,255,255,0.25);
  display: flex;
  justify-content: center;
}

/* Sutil sombra del pliegue en V del bolsillo */
.envelope__pocket::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 50% 48%, 100% 0, 50% 6%);
  background: linear-gradient(180deg, rgba(70,90,125,0.16), rgba(70,90,125,0));
}

/* Sello de cera dorado */
.envelope__seal {
  position: absolute;
  top: 28%;
  width: 62px;
  height: 62px;
  /* Borde orgánico, no un círculo perfecto */
  border-radius: 47% 53% 51% 49% / 50% 47% 53% 50%;
  background:
    var(--grain),
    radial-gradient(circle at 38% 30%, #e3c485 0%, #c79f54 36%, #a9803c 66%, #7c5a26 100%);
  background-size: 90px 90px, auto;
  background-blend-mode: soft-light, normal;
  color: #5a4119;            /* color del emblema grabado */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  box-shadow:
    inset 0 2px 3px rgba(255,248,230,0.45),   /* brillo superior de la cera */
    inset 0 -5px 9px rgba(74,48,18,0.55),      /* profundidad inferior */
    0 6px 12px rgba(60,40,15,0.42),            /* sombra proyectada */
    0 1px 2px rgba(0,0,0,0.25);
}

/* Anillo grabado interior (presión del sello sobre la cera) */
.envelope__seal::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1.5px rgba(90,65,25,0.5),
    inset 0 1px 2px rgba(255,248,230,0.3),
    inset 0 -2px 3px rgba(74,48,18,0.45);
}

/* Pequeño rebose irregular de cera alrededor del sello */
.envelope__seal::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50% 46% 52% 48% / 48% 52% 47% 53%;
  background: radial-gradient(circle at 40% 35%, rgba(201,159,84,0.45), rgba(124,90,38,0));
  z-index: -1;
  filter: blur(1.5px);
}

/* Emblema grabado en relieve */
.envelope__seal svg {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 1px 0.5px rgba(255,248,230,0.35));
}

/* Animación al hacer clic en abrir */
.envelope.is-pulling .letter {
  transform: translateY(-24px);
}

/* Botón de abrir invitación */
.cover__btn {
  min-width: auto;
  padding: 0.75rem 1.8rem;
  border-radius: 999px;
  background: var(--accent);
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.04em;
}
.cover__btn:hover { background: var(--ink); }

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
