/* =========================================================
   XV Manuela Rodríguez Santamaría
   Landing 9:16 · sobre + lacre + carta
   Paleta cerrada: crema, blush, rosa, oro champagne, tinta.
   ========================================================= */

:root {
  --crema:  #F6EEE4;
  --blush:  #D9A5B3;
  --rosa:   #B06B7A;
  --oro:    #C4A46A;
  --oro-hondo: #8A6E31;   /* mismo oro, para texto chico sobre papel */
  --tinta:  #3D332E;

  --papel:      #FBF6EF;  /* hoja de la carta, un punto sobre la crema */
  --sobre-cara: #EFE3D5;
  --sobre-sola: #E7D8C7;

  --curva: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--crema);
  color: var(--tinta);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------------------------------------------------------
   MARCO 9:16
   En celular ocupa la pantalla completa. En escritorio se
   recorta a proporción vertical y queda centrado.
   --------------------------------------------------------- */
.marco {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: calc(100dvh * 9 / 16);
  overflow: hidden;
  background: var(--crema);
  container-type: inline-size;
  font-size: clamp(15px, 4.3cqw, 20px);
}

@media (min-width: 700px) {
  body { background: #EDE2D6; }
  .marco {
    border-radius: 18px;
    box-shadow: 0 24px 70px rgba(61, 51, 46, .18);
  }
}

/* Textura de papel, muy sutil, sobre todo el marco */
.marco::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("../assets/textura-papel.jpg?v=20260829095725");
  background-size: 300px 300px;
  mix-blend-mode: multiply;
}

/* ---------------------------------------------------------
   FLORALES · solo esquinas
   --------------------------------------------------------- */
.florales {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.floral {
  position: absolute;
  width: 42cqw;
  height: 42cqw;
  background: url("../assets/floral-esquina.png?v=20260829095725") no-repeat center / contain;
  opacity: .62;
}

.floral--si { top: 0;    left: 0;  }
.floral--sd { top: 0;    right: 0; transform: scaleX(-1); }
.floral--ii { bottom: 0; left: 0;  transform: scaleY(-1); }
.floral--id { bottom: 0; right: 0; transform: scale(-1); }

/* En la carta los florales se montan SOBRE la tarjeta: así enmarcan el papel
   en vez de quedar sueltos detrás. */
.florales--carta { z-index: 3; }
.florales--carta .floral { opacity: .46; width: 23cqw; height: 23cqw; }

/* =========================================================
   ESCENA 1 · EL SOBRE
   ========================================================= */
.escena {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.6em;
  padding: 2em 1.4em;
  transition: opacity .55s ease, transform .55s ease;
}

.susurro {
  margin: 0;
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.7em;
  line-height: 1;
  color: var(--rosa);
  transition: opacity .4s ease;
}

.pista {
  margin: 0;
  font-size: .82em;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--rosa);
  opacity: .78;
  animation: respirar 2.8s ease-in-out infinite;
  transition: opacity .35s ease;
}

@keyframes respirar {
  0%, 100% { opacity: .78; }
  50%      { opacity: .34; }
}

/* --------------------- el sobre ---------------------
   Las dos piezas (solapa y cuerpo) están recortadas de UNA sola foto de papel
   generada con Grok, por eso el papel y la luz calzan exactos. El sobre mide
   864x616 en origen; los porcentajes de abajo salen de ahí.
   ---------------------------------------------------- */
.sobre {
  position: relative;
  width: min(78cqw, 340px);
  aspect-ratio: 864 / 616;
  perspective: 1100px;
  filter: drop-shadow(0 14px 26px rgba(61, 51, 46, .16))
          drop-shadow(0 2px 4px rgba(61, 51, 46, .10));
}

/* Hoja que asoma al abrirse la solapa */
.sobre__hoja {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4%;
  height: 92%;
  border-radius: 2px;
  background:
    url("../assets/textura-papel.jpg?v=20260829095725") repeat,
    linear-gradient(180deg, #FBF6EF 0%, #F5ECDF 55%, #EADFCE 100%);
  background-size: 180px 180px, auto;
  background-blend-mode: multiply, normal;
  box-shadow:
    0 2px 5px rgba(61, 51, 46, .10),
    0 10px 20px rgba(61, 51, 46, .12);
  transform: translateY(0);
  transition: transform .9s var(--curva);
  z-index: 1;
}

/* Bolsillo del sobre: tapa la hoja por delante */
.sobre__cuerpo {
  position: absolute;
  left: 0;
  top: 40.6%;
  width: 100%;
  height: 59.4%;
  background: url("../assets/sobre-cuerpo.png?v=20260829095725") no-repeat center / 100% 100%;
  z-index: 3;
}

/* Solapa: gira sobre su borde superior */
.sobre__solapa {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 42.5%;
  background: url("../assets/sobre-solapa.png?v=20260829095725") no-repeat center / 100% 100%;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 1s var(--curva);
  z-index: 4;
}

/* --------------------- el lacre --------------------- */
.sello {
  position: absolute;
  left: 50%;
  top: 43%;
  width: 27%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 5;
  -webkit-tap-highlight-color: transparent;
  transition: transform .45s var(--curva), opacity .45s ease;
}

/* El pulso vive en las capas de adentro, nunca en el botón: si se moviera el
   botón, se movería el área que el invitado tiene que tocar. */
.sello__img,
.sello__xv {
  animation: latir 3.4s ease-in-out infinite;
}

@keyframes latir {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.045); }
}

.sello:focus-visible {
  outline: 2px solid var(--rosa);
  outline-offset: 8px;
  border-radius: 50%;
}

.sello__halo {
  position: absolute;
  inset: -14%;
  border-radius: 50%;
  border: 1px solid var(--oro);
  opacity: .3;
  animation: halo 3.4s ease-out infinite;
}

@keyframes halo {
  0%   { transform: scale(.9);  opacity: .32; }
  70%  { transform: scale(1.28); opacity: 0; }
  100% { transform: scale(1.28); opacity: 0; }
}

/* Lacre renderizado en Grok. Si el archivo existe, tapa la capa base. */
.sello__img {
  position: absolute;
  inset: -6%;
  background: url("../assets/lacre.png?v=20260829095725") no-repeat center / contain;
  filter: drop-shadow(0 3px 6px rgba(61, 51, 46, .30));
}

/* Va por encima de la cera, centrado en el disco liso del sello. */
.sello__xv {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 1.34em;
  letter-spacing: .12em;
  text-indent: .12em;              /* compensa el espaciado de la última letra */
  color: #6E5527;
  /* Relieve: sombra hundida arriba, luz abajo. Grabado, no impreso. */
  text-shadow:
    0 -1px 0 rgba(74, 57, 24, .38),
    0  1px 0 rgba(247, 233, 199, .60);
  pointer-events: none;
}

/* --------------------- apertura --------------------- */
body.abriendo .sello__img,
body.abriendo .sello__xv { animation: none; }

body.abriendo .sello {
  transform: translate(-50%, -50%) scale(1.1) rotate(-14deg) translateY(38%);
  opacity: 0;
  transition: transform .6s var(--curva), opacity .5s ease .1s;
}
body.abriendo .sello__halo { animation: none; opacity: 0; }
body.abriendo .sobre__solapa { transform: rotateX(-172deg); z-index: 1; }
body.abriendo .sobre__hoja   { transform: translateY(-52%); }
body.abriendo .pista,
body.abriendo .susurro       { opacity: 0; }

body.abierto .escena {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

/* =========================================================
   ESCENA 2 · LA CARTA
   ========================================================= */
.carta {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .7s ease .25s, visibility 0s linear .95s;
}

body.abierto .carta {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .7s ease .3s, visibility 0s;
}

/* Tarjeta de papel: el contenido ya no flota sobre el fondo, se apoya en algo. */
.carta__hoja {
  position: relative;
  z-index: 2;
  min-height: calc(100% - 1.7em);
  margin: .85em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.1em 1.5em 2.3em;
  background: var(--papel);
  border-radius: 2px;
  box-shadow:
    0 1px 2px rgba(61, 51, 46, .07),
    0 10px 26px rgba(61, 51, 46, .10),
    0 24px 60px rgba(61, 51, 46, .07);
}

/* Doble filete de oro: uno fino pegado al borde y otro más adentro, como
   en una tarjeta impresa de verdad. Van en ::before/::after para no gastar nodos. */
.carta__hoja::before,
.carta__hoja::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 1px;
}
.carta__hoja::before {
  inset: .5em;
  border: 1px solid rgba(196, 164, 106, .55);
}
.carta__hoja::after {
  inset: .78em;
  border: 1px solid rgba(196, 164, 106, .22);
}

/* Entrada escalonada de cada pieza de la carta */
body.abierto .carta__hoja > * {
  animation: subir .8s var(--curva) both;
}
body.abierto .titulo { animation-delay: .40s; }
body.abierto .nombre { animation-delay: .52s; }
body.abierto .filete { animation-delay: .62s; }
body.abierto .cuerpo { animation-delay: .72s; }
body.abierto .datos  { animation-delay: .84s; }
body.abierto .cierre { animation-delay: .96s; }
body.abierto .cta    { animation-delay: 1.06s; }

@keyframes subir {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.titulo {
  margin: 0;
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.95em;
  line-height: 1.16;
  letter-spacing: .005em;
  color: var(--rosa);
}

.nombre {
  margin: .55em 0 0;
  font-size: 1.06em;
  font-weight: 500;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--tinta);
}

/* Filete fino: dos hilos de oro y un rombo abierto al medio. Se probó una orla
   de filigrana generada con Grok y a tamaño real el rombo central se leía como
   una carita — esto es más sutil y no se deforma al reducirse. */
.filete {
  width: 9.5em;
  height: 1em;
  margin: .9em 0 1.15em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75em;
}
.filete i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--oro) 35%, var(--oro));
}
.filete i:last-child {
  background: linear-gradient(270deg, transparent, var(--oro) 35%, var(--oro));
}
.filete b {
  width: .4em;
  height: .4em;
  border: 1px solid var(--oro-hondo);
  transform: rotate(45deg);
}

.cuerpo {
  margin: 0;
  max-width: 19em;
  font-size: 1.08em;
  font-style: italic;
  font-weight: 300;
  line-height: 1.62;
  color: var(--tinta);
}

/* --------------------- datos --------------------- */
.datos {
  margin: 1.5em 0 0;
  width: 100%;
  max-width: 17.5em;
  display: grid;
  gap: .8em;
}

.dato {
  padding-bottom: .8em;
  border-bottom: 1px solid rgba(196, 164, 106, .38);
}
.dato:last-child { border-bottom: 0; padding-bottom: 0; }

/* Los rótulos iban en el oro champagne puro: sobre papel daba ~2:1 de contraste
   y se perdían. Mismo oro, tono más profundo, y algo menos de interletrado. */
.dato dt {
  font-size: .75em;
  font-weight: 500;
  letter-spacing: .24em;
  text-indent: .24em;
  text-transform: uppercase;
  color: var(--oro-hondo);
  margin-bottom: .5em;
}

.dato dd {
  margin: 0;
  font-size: 1.06em;
  line-height: 1.4;
  color: var(--tinta);
}

.dato__sub {
  display: block;
  font-size: .86em;
  font-style: italic;
  font-weight: 300;
  color: var(--rosa);
  margin-top: .18em;
}

.cierre {
  margin: 1.7em 0 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.32em;
  line-height: 1.35;
  letter-spacing: .015em;
  color: var(--rosa);
}

/* --------------------- CTA --------------------- */
.cta {
  position: relative;
  z-index: 4;              /* por encima de los florales, pase lo que pase */
  margin-top: 1.6em;
  display: inline-block;
  padding: .82em 1.75em;
  border: 1px solid var(--oro);
  border-radius: 999px;
  background: transparent;
  color: var(--rosa);
  font-size: .82em;
  letter-spacing: .26em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color .3s ease, color .3s ease, transform .3s ease;
}

.cta:hover,
.cta:focus-visible {
  background: var(--rosa);
  border-color: var(--rosa);
  color: var(--crema);
  transform: translateY(-1px);
}

/* --------------------- retrato (stills de Creativo) --------------------- */
.retrato {
  margin: 0 0 1.8em;
  width: min(58cqw, 230px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 999px 999px 6px 6px;   /* arco superior */
  box-shadow: 0 10px 30px rgba(61, 51, 46, .16);
  border: 1px solid rgba(196, 164, 106, .5);
}
.retrato img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* =========================================================
   MOVIMIENTO REDUCIDO
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .sello__img, .sello__xv, .sello__halo, .pista { animation: none !important; }
  .sobre__solapa, .sobre__hoja, .escena, .carta,
  body.abierto .carta__hoja > * {
    transition-duration: .01ms !important;
    animation: none !important;
  }
}

/* Pantallas muy bajas: aire más apretado para que la carta quepa */
@media (max-height: 640px) {
  .titulo { font-size: 2.75em; }
  .cierre { font-size: 1.5em; }
  .carta__hoja { padding: 2.3em 1.5em 2.6em; margin: .8em; min-height: calc(100% - 1.6em); }
  .datos { margin-top: 1.5em; }
}
