/* Karla & Christopher — styles
   Palette from Karla's 🤍 💛 🎀: cotton paper, soft gold, blush, plum ink.
   Type: Bodoni Moda (engraved-invitation display) + Figtree (large, open
   lowercase that older eyes read easily; plain zeros).
   Written for older phones: no `inset`, no flex `gap`, fallbacks before clamp()/env(). */

:root {
  --rosa: #F7EFE5;          /* page: warm cream with a trace of blush */
  --rosa-hondo: #EADDD1;    /* hairlines */
  --algodon: #FFFCFA;       /* card paper */
  --sobre: #FAF4EE;         /* envelope paper */
  --tinta: #3B2531;         /* text, primary button — 11.7:1 on rosa */
  --tinta-suave: #66505B;   /* secondary text — 6.1:1 on rosa */
  --oro: #B08D4F;           /* lines only, never text */
  --oro-oscuro: #7C5E25;    /* gold text — 5.0:1 on rosa */
  --vino: #A3172F;          /* the one accent red: envelope liner, seal, roses, focus ring */
  --error: #8E1A2B;

  /* Elevation: three levels, all tinted plum (never black) */
  --sombra-papel: 0 1px 2px rgba(59, 37, 49, .06), 0 14px 34px -14px rgba(59, 37, 49, .22); /* paper on the table */
  --sombra-flotante: 0 14px 32px -12px rgba(59, 37, 49, .5);                                 /* floating RSVP */
  --sombra-dialogo: 0 30px 60px -20px rgba(59, 37, 49, .45);                                 /* panels on desktop */

  /* Corner radii: paper, controls, pills */
  --radio-papel: 2px;
  --radio-control: 6px;
  --radio-pastilla: 999px;

  --f-display: 'Bodoni Moda', 'Bodoni 72', Didot, Georgia, serif;
  --f-texto: 'Figtree', -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Motion: "felt, not noticed" */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --d-micro: 120ms;
  --d-corta: 220ms;
  --d-media: 320ms;

  --lazo-largo: 426;        /* stroke length of the lazo path, for the draw-on */
  --medida: 36rem;

  /* Type scale: six steps (the couple's names have their own display size) */
  --t-1: 2.1rem;        /* 34px: section and step titles */
  --t-2: 1.75rem;       /* 28px: date, reply question, family name */
  --t-3: 1.375rem;      /* 22px: times, lead lines, labels */
  --t-body: 1.1875rem;  /* 19px: body and buttons */
  --t-small: 1.0625rem; /* 17px: notes and hints */
  --t-fine: .9375rem;   /* 15px: second language under buttons, small labels, credit */

  /* Spacing scale: every gap on the page is one of these */
  --esp-xs: .5rem;  /* 8px */
  --esp-s: 1rem;    /* 16px */
  --esp-m: 1.5rem;  /* 24px: heading to its content, between items */
  --esp-l: 2.5rem;  /* 40px: between related blocks */
  --esp-xl: 4rem;   /* 64px: between sections */

  color-scheme: only light;

  /* Papel picado, cut in wine-red paper: lines the envelope */
  --forro: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='%23F7EFE5' fill-opacity='.82'%3E%3Cpath d='M24 14c2 4 2 6 0 10-2-4-2-6 0-10zM24 34c-2-4-2-6 0-10 2 4 2 6 0 10zM14 24c4-2 6-2 10 0-4 2-6 2-10 0zM34 24c-4 2-6 2-10 0 4-2 6-2 10 0z'/%3E%3Ccircle cx='24' cy='24' r='1.6'/%3E%3Cpath d='M0 -3l3 3-3 3-3-3zM48 -3l3 3-3 3-3-3zM0 45l3 3-3 3-3-3zM48 45l3 3-3 3-3-3z'/%3E%3Ccircle cx='0' cy='24' r='1.2'/%3E%3Ccircle cx='48' cy='24' r='1.2'/%3E%3Ccircle cx='24' cy='0' r='1.2'/%3E%3Ccircle cx='24' cy='48' r='1.2'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--rosa);
}
html.sin-scroll, html.sin-scroll body { overflow: hidden; }

body {
  margin: 0;
  font-family: var(--f-texto);
  font-size: 1.1875rem; /* 19px, and it follows the phone's text-size setting */
  line-height: 1.6;
  color: var(--tinta);
  background: var(--rosa);
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 48em) { body { font-size: 1.25rem; } }

::selection { background: var(--rosa-hondo); }

a { color: var(--tinta); text-underline-offset: .18em; }

:focus { outline: 3px solid var(--vino); outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }  /* dropped by browsers without :focus-visible */
[tabindex="-1"]:focus { outline: none; }

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

.saltar {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--tinta); color: var(--algodon); padding: .75rem 1.25rem;
  border-radius: var(--radio-pastilla); font-weight: 700; text-decoration: none;
}
.saltar:focus { top: 1rem; }

#app { transition: opacity 180ms var(--ease-in); }
#app.cambiando { opacity: 0; }
#app:focus { outline: none; }

/* ---------- Lazo: the figure-eight cord placed over the couple ---------- */

.lazo { display: block; overflow: visible; height: auto; }
.lazo-hilo {
  fill: none;
  stroke: var(--oro);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.lazo-hilo--fino { stroke: var(--oro-oscuro); stroke-width: 1; opacity: .5; }

@keyframes trazar { to { stroke-dashoffset: 0; } }
@keyframes subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes respirar { 50% { opacity: .55; } }

/* ---------- Header ---------- */

.cabecera {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 0;
  padding-top: max(1rem, env(safe-area-inset-top));
}

.idioma {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  padding: 0 1.15rem;
  font-family: var(--f-texto);
  font-size: var(--t-small);
  font-weight: 700;
  color: var(--tinta);
  background: var(--algodon);
  border: 2px solid var(--tinta);
  border-radius: var(--radio-pastilla);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.idioma:active { transform: scale(.98); }

/* ---------- Hero: the invitation card ---------- */

.hero {
  max-width: var(--medida);
  margin: 0 auto;
  padding: var(--esp-m) 1.25rem 0;
  text-align: center;
}

.tarjeta {
  background: var(--algodon);
  box-shadow: var(--sombra-papel);
  border-radius: var(--radio-papel);
  padding: var(--esp-xs);
}
/* Double gold rule, like a letterpress card */
.tarjeta-marco {
  border: 1px solid rgba(176, 141, 79, .55);
  outline: 1px solid rgba(176, 141, 79, .35);
  outline-offset: -6px;
  padding: var(--esp-l) var(--esp-m);
}

.para { margin: 0 0 1.75rem; }
.para-etiqueta { display: block; font-size: var(--t-fine); color: var(--tinta-suave); }
.para-familia {
  display: block;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-2);
  line-height: 1.2;
}

.anuncio {
  margin: 0 0 1rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: var(--t-3);
  line-height: 1.25;
  color: var(--oro-oscuro);
}

.nombres {
  margin: 0;
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 500;
  font-size: 2.9rem;
  font-size: clamp(2.2rem, 12vw, 4.5rem); /* min scales with text size; stays inside the card at 125% */
  line-height: 1;
  letter-spacing: -.01em;
}
.nombre { display: block; }
.lazo--nombres { width: 7.75rem; margin: .32em auto .3em; }

.invita { margin: 1.75rem auto 0; max-width: 24rem; }
.invita--pie { margin-top: 1.25rem; color: var(--tinta-suave); }

.fecha {
  margin: 1.5rem 0 0;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-2);
  line-height: 1.2;
}
.ciudad { margin: .25rem 0 0; color: var(--tinta-suave); }

/* The reply slip: on the invitation itself, below a fine "tear here" line */
.talon {
  margin: var(--esp-xs) 0 0;
  padding: var(--esp-m) var(--esp-s) var(--esp-l);  /* 40px at the bottom: room for the corner flowers */
  border-top: 1px dashed rgba(176, 141, 79, .65);
}
.talon .acciones { max-width: 22rem; margin: 0 auto; }
.talon .respuesta-nota { max-width: 20rem; margin-left: auto; margin-right: auto; }
.respuesta-titulo {
  margin: 0 0 1.25rem;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-2);
  line-height: 1.2;
}
.respuesta-titulo--hecha {
  font-family: var(--f-texto);
  font-weight: 700;
  font-size: var(--t-body);
  line-height: 1.5;
}
.respuesta-nota { margin: 1rem 0 0; font-size: var(--t-small); color: var(--tinta-suave); }
.acciones > * + * { margin-top: .75rem; }



/* ---------- Buttons ---------- */

.btn {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.5rem;   /* 56px: easy for any thumb */
  padding: .75rem 1.5rem;
  font-family: var(--f-texto);
  font-size: var(--t-body);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  border: 2px solid var(--tinta);
  border-radius: var(--radio-pastilla);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--d-micro) var(--ease-out), background-color var(--d-corta) var(--ease-out);
}
.btn:active { transform: scale(.98); }
.btn--primario { background: var(--tinta); color: var(--algodon); }
.btn--secundario { background: transparent; color: var(--tinta); }
@media (hover: hover) {
  .btn--primario:hover { background: #2B1A23; }
  .btn--secundario:hover { background: rgba(59, 37, 49, .06); }
}
.btn[disabled] { opacity: .65; cursor: default; transform: none; }
.btn--compacto {
  display: inline-flex;
  width: auto;
  min-height: 3rem;
  margin-top: .85rem;
  padding: .5rem 1.25rem;
  font-size: var(--t-small);
}

.enlace-btn {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  padding: 0 .75rem;
  font-family: var(--f-texto);
  font-size: var(--t-small);
  font-weight: 700;
  color: var(--tinta);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: .2em;
  cursor: pointer;
}
.respuesta-nota .enlace-btn { padding: 0; font-weight: 400; color: var(--tinta-suave); }

/* ---------- Details ---------- */

.detalles { max-width: var(--medida); margin: 0 auto; padding: 0 1.25rem; }
.seccion { padding-top: var(--esp-xl); }
.seccion-titulo {
  margin: 0 0 var(--esp-m);
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-1);
  line-height: 1.15;
}

/* Ceremony then reception: a short timeline, so a gold rule ties them */
.evento { margin: 0 0 var(--esp-m); padding-left: var(--esp-s); border-left: 2px solid var(--oro); }
.evento:last-child { margin-bottom: 0; }
.evento p { margin: 0; }
.evento-titulo { margin: 0; font-size: var(--t-body); font-weight: 700; }
/* Times must be read at a glance: bold sans, no hairlines */
.evento-hora { margin: .1rem 0; font-family: var(--f-texto); font-weight: 700; font-size: var(--t-3); line-height: 1.3; }
.evento-lugar { font-weight: 600; }
.evento-dir { color: var(--tinta-suave); }

.prosa p { margin: 0 0 1em; max-width: 34em; }
.prosa p:last-child { margin-bottom: 0; }
.prosa--nota { margin-top: 1.5rem; color: var(--tinta-suave); }

.padrinos { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rosa-hondo); }
.padrinos li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rosa-hondo);
}
.padrino-rol { margin-right: 1rem; font-family: var(--f-display); font-style: italic; font-size: var(--t-3); }
.padrino-quien { font-weight: 600; }

.pregunta { border-bottom: 1px solid var(--rosa-hondo); }
.pregunta:first-of-type { border-top: 1px solid var(--rosa-hondo); }
.pregunta summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.5rem;
  padding: .9rem 0;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.pregunta summary::-webkit-details-marker { display: none; }
.pregunta summary::after {
  content: '+';
  flex: none;
  margin-left: 1rem;
  font-family: var(--f-display);
  font-size: 1.9rem;
  line-height: 1;
  color: var(--oro-oscuro);
  transition: transform var(--d-corta) var(--ease-out);
}
.pregunta[open] summary::after { transform: rotate(45deg); }
.pregunta-resp { padding: 0 0 1rem; }
.pregunta-resp p { margin: 0 0 .75em; }
.pregunta[open] .pregunta-resp { animation: aparecer var(--d-corta) var(--ease-out); }

/* ---------- Footer ---------- */

.pie { max-width: var(--medida); margin: var(--esp-xl) auto 0; padding: 0 1.25rem 3rem; text-align: center; }
.con-barra .pie { padding-bottom: 8rem; } /* room above the RSVP bar */
.lazo--pie { width: 4.5rem; margin: 0 auto 1rem; }
.firma { margin: 0; color: var(--tinta-suave); }
.firma-nombres { font-family: var(--f-display); font-style: italic; font-size: var(--t-2); color: var(--tinta); }
.contacto { margin: 1.75rem 0 0; }
.tel { display: inline-block; padding: .5rem; font-size: var(--t-3); font-weight: 700; }

/* ---------- RSVP bar: appears once the reply card scrolls away ---------- */

.barra-rsvp {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: .75rem 1rem;
  padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
  background: rgba(247, 239, 229, .97);
  border-top: 1px solid var(--rosa-hondo);
  transform: translateY(110%);
  opacity: 0;
  transition: transform var(--d-media) var(--ease-out), opacity var(--d-media) var(--ease-out);
}
.barra-rsvp.visible { transform: none; opacity: 1; }
.barra-rsvp:not(.visible) { pointer-events: none; }
.barra-rsvp .btn { max-width: 30rem; margin: 0 auto; }

/* ---------- Intro: the page's one orchestrated moment ---------- */

.intro-espera .hero, .intro-espera .detalles, .intro-espera .pie { opacity: 0; }

.intro .hero .tarjeta { animation: aparecer 500ms var(--ease-out) both; }
.intro .hero .para,
.intro .hero .anuncio,
.intro .hero .nombre,
.intro .hero .invita,
.intro .hero .fecha,
.intro .hero .ciudad { animation: subir 600ms var(--ease-out) both; }
.intro .hero .para { animation-delay: 150ms; }
.intro .hero .anuncio { animation-delay: 230ms; }
.intro .hero .nombre--uno { animation-delay: 300ms; }
.intro .hero .lazo--nombres .lazo-hilo {
  stroke-dasharray: var(--lazo-largo);
  stroke-dashoffset: var(--lazo-largo);
  animation: trazar 1000ms var(--ease-inout) 420ms forwards;
}
.intro .hero .nombre--dos { animation-delay: 560ms; }
.intro .hero .invita { animation-delay: 820ms; }
.intro .hero .fecha { animation-delay: 900ms; }
.intro .hero .ciudad { animation-delay: 960ms; }
/* Buttons only fade in place: nothing slides under a thumb */
.intro .hero .talon,
.intro .hero .hero-foto,
.intro .hero .tarjeta-accion,
.intro .detalles,
.intro .pie { animation: aparecer 450ms var(--ease-out) 1100ms both; }

/* ---------- El Sobre: the envelope ---------- */

.sobre-escena {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--rosa);
  transition: opacity 340ms var(--ease-in);
}
.sobre-escena[hidden] { display: none; }
.sobre-escena.saliendo { opacity: 0; }

.sobre-arriba {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem 0;
  padding-top: max(1rem, env(safe-area-inset-top));
}
.sobre-centro {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7rem 1.25rem 2rem; /* headroom for the card to rise into */
}

.sobre {
  position: relative;
  width: 86vw;
  max-width: 24rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-perspective: 1400px;
  perspective: 1400px;
}
.sobre::before { content: ''; display: block; padding-top: 70%; } /* envelope proportions */
.sobre > span { position: absolute; } /* absolute already makes them block-level; no display here, or it would beat .sobre-bolsa's flex */

.sobre-fondo {
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;
  border-radius: var(--radio-papel);
  background-color: var(--vino);
  background-image: var(--forro);
  background-size: 32px 32px;
  box-shadow: var(--sombra-papel);
}

.sobre-carta {
  top: 5%; right: 6%; bottom: 8%; left: 6%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 9%;
  background: var(--algodon);
  border-radius: var(--radio-papel);
  box-shadow: 0 1px 3px rgba(59, 37, 49, .15);
  transition: transform 720ms var(--ease-out) 620ms;
}
.lazo--carta { width: 34%; }
.sobre-carta-nombres {
  margin-top: .35rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.15;
  text-align: center;
}

/* Front pocket, with faint folds running from the bottom corners */
.sobre-bolsa {
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 1rem 6%;
  border-radius: var(--radio-papel);
  background:
    linear-gradient(to bottom right, transparent 49.6%, rgba(59, 37, 49, .07) 50%, transparent 50.4%) left bottom / 50% 50% no-repeat,
    linear-gradient(to bottom left, transparent 49.6%, rgba(59, 37, 49, .07) 50%, transparent 50.4%) right bottom / 50% 50% no-repeat,
    var(--sobre);
  -webkit-clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%);
  clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%);
}
.sobre-destino { text-align: center; }
.sobre-para { display: block; font-size: var(--t-fine); color: var(--tinta-suave); }
.sobre-familia {
  display: block;
  font-family: var(--f-display);
  font-size: var(--t-3);
  font-weight: 500;
  line-height: 1.2;
  animation: aparecer 400ms var(--ease-out) both;
}
.sobre-espera {
  display: block;
  width: 8rem;
  height: 2px;
  margin: .9rem auto .55rem;
  background: var(--oro);
  animation: respirar 1.4s ease-in-out infinite;
}

/* Flap: paper outside, papel picado inside */
.sobre-solapa {
  top: 0; right: 0; left: 0;
  height: 52%;
  z-index: 4;
  -webkit-transform-origin: 50% 0;
  transform-origin: 50% 0;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  transition: transform 660ms var(--ease-inout) 140ms, z-index 0s linear 460ms;
}
.solapa-cara {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.solapa-cara--papel {
  background: linear-gradient(to bottom, #FBF4F1, #F3E4DF);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.solapa-cara--forro {
  -webkit-transform: rotateX(180deg);
  transform: rotateX(180deg);
  background-color: var(--vino);
  background-image: var(--forro);
  background-size: 32px 32px;
  -webkit-clip-path: polygon(0 100%, 100% 100%, 50% 0);
  clip-path: polygon(0 100%, 100% 100%, 50% 0);
}

/* Wax seal */
.sobre-sello {
  left: 50%; top: 52%;
  width: 17%;
  z-index: 5;
  border-radius: 50% 47% 52% 49% / 49% 52% 47% 51%;
  background: radial-gradient(circle at 35% 30%, #C23A52, var(--vino) 55%, #6E0B1D);
  box-shadow: 0 2px 5px rgba(59, 37, 49, .28), inset 0 0 0 3px rgba(255, 255, 255, .1);
  transform: translate(-50%, -50%);
  transition: opacity 220ms var(--ease-in), transform 220ms var(--ease-in);
}
.sobre-sello::before { content: ''; display: block; padding-top: 100%; }
.sello-iniciales {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.2rem;
  letter-spacing: -.06em;
  color: rgba(255, 252, 250, .9);
}
.sobre.esperando .sobre-sello { animation: respirar 1.2s ease-in-out infinite; }

.btn--abrir { width: auto; min-width: 16rem; margin-top: 2.5rem; }

/* Arrival (page load) */
.llegando .sobre { animation: subir 700ms var(--ease-out) both; }
.llegando .btn--abrir { animation: aparecer 500ms var(--ease-out) 350ms both; }

/* Opening (on tap): seal lifts, flap turns, card rises, scene fades */
.abriendo .sobre-sello { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
.abriendo .sobre-solapa { z-index: 1; -webkit-transform: rotateX(180deg); transform: rotateX(180deg); }
.abriendo .sobre-carta { transform: translateY(-58%); }
.abriendo .btn--abrir { opacity: 0; transition: opacity 200ms var(--ease-in); }

/* ---------- RSVP panel ---------- */

.panel-fondo {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(59, 37, 49, .4);
  opacity: 0;
  transition: opacity var(--d-corta) var(--ease-out);
}
.panel-fondo[hidden] { display: none; }
.panel-fondo.abierto { opacity: 1; }

.panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--rosa);
  transform: translateY(24px);
  transition: transform var(--d-media) var(--ease-out);
}
.abierto .panel { transform: none; }
@media (min-width: 40em) {
  .panel-fondo { align-items: center; padding: 2rem; }
  .panel { max-width: 34rem; height: auto; max-height: 92vh; border-radius: var(--radio-control); box-shadow: var(--sombra-dialogo); }
}

.panel-barra {
  display: flex;
  align-items: center;
  flex: none;
  padding: .5rem .5rem;
  padding-top: max(.5rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--rosa-hondo);
}
.panel-espacio { flex: 1; }
.idioma--panel { min-height: 44px; margin-right: .25rem; font-size: var(--t-small); }

.panel-paso { flex: none; margin: 1.25rem 1.5rem 0; font-size: var(--t-fine); color: var(--tinta-suave); }
.panel-paso:empty { display: none; }

.panel-cuerpo {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: .25rem 1.5rem 2rem;
  padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  transition: opacity 120ms var(--ease-in);
}
.panel-cuerpo.saliendo { opacity: 0; }
.panel-cuerpo.entrando { animation: entrar-adelante 280ms var(--ease-out) both; }
.panel-cuerpo.entrando-atras { animation: entrar-atras 280ms var(--ease-out) both; }
@keyframes entrar-adelante { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes entrar-atras { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.paso-titulo {
  margin: .5rem 0 .75rem;
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--t-1);
  line-height: 1.15;
}
.paso-saludo { margin: 1rem 0 0; font-weight: 700; color: var(--oro-oscuro); }
.paso-pista { margin: 0 0 1.5rem; color: var(--tinta-suave); }
.paso-acciones { margin-top: 2rem; }
.paso-acciones > * + * { margin-top: .75rem; }
.paso-error {
  margin: 1.25rem 0 0;
  padding: .75rem 1rem;
  font-weight: 700;
  color: var(--error);
  background: rgba(163, 23, 47, .07);
  border-left: 3px solid var(--vino);
}
.paso-ayuda { margin: 1.5rem 0 0; color: var(--tinta-suave); }
.paso-ayuda a { font-weight: 700; white-space: nowrap; }
.paso-form .btn { margin-top: 1.5rem; }

/* Fields */
.campo-etiqueta { display: block; margin: 0 0 .4rem; font-weight: 700; }
.campo-etiqueta--sub { margin-top: 1rem; }
.campo {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-height: 3.5rem;
  padding: .6rem .9rem;
  font-family: var(--f-texto);
  font-size: var(--t-body); /* above 16px, so iPhones don't zoom in */
  color: var(--tinta);
  background: var(--algodon);
  border: 2px solid var(--tinta-suave);
  border-radius: var(--radio-control);
}
.campo:focus { border-color: var(--tinta); }
.campo[aria-invalid="true"] { border-color: var(--error); }
.campo--codigo { font-size: var(--t-2); letter-spacing: .22em; text-align: center; text-transform: uppercase; }
.campo--texto { min-height: 8rem; line-height: 1.5; resize: vertical; }
.campo--select {
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='10' viewBox='0 0 16 10'%3E%3Cpath d='M1.5 1.5 8 8l6.5-6.5' fill='none' stroke='%233B2531' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.personas { border-top: 1px solid var(--rosa-hondo); }
.persona { padding: 1.25rem 0; border-bottom: 1px solid var(--rosa-hondo); }

.casilla {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  margin-top: .75rem;
  cursor: pointer;
}
.casilla input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.casilla-caja {
  position: relative;
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-right: .75rem;
  background: var(--algodon);
  border: 2px solid var(--tinta-suave);
  border-radius: var(--radio-control);
  transition: background-color var(--d-micro) var(--ease-out);
}
.casilla input:checked + .casilla-caja { background: var(--tinta); border-color: var(--tinta); }
.casilla input:checked + .casilla-caja::after {
  content: '';
  position: absolute;
  left: .5rem; top: .18rem;
  width: .45rem; height: .9rem;
  border: solid var(--algodon);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.casilla input:focus + .casilla-caja { outline: 3px solid var(--vino); outline-offset: 2px; }

/* Guest counter */
.contador { display: flex; align-items: center; justify-content: center; margin: 1.75rem 0 0; }
.contador-btn {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 4rem;
  height: 4rem;
  padding: 0;
  font-family: var(--f-texto);
  font-size: 2.1rem;
  line-height: 1;
  color: var(--tinta);
  background: var(--algodon);
  border: 2px solid var(--tinta);
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.contador-btn:active { transform: scale(.96); }
.contador-btn[disabled] { opacity: .3; cursor: default; transform: none; }
.contador-valor { min-width: 7rem; margin: 0 1.25rem; text-align: center; }
.contador-num {
  display: block;
  font-family: var(--f-texto); /* a number that must be read at a glance: no hairlines */
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: lining-nums;
}
.contador-num.pulso { animation: pulso 200ms var(--ease-out); }
@keyframes pulso { 50% { transform: scale(1.08); } }
.contador-unidad { display: block; color: var(--tinta-suave); }

/* Review */
.resumen-total { margin: 0 0 1rem; font-size: var(--t-3); font-weight: 700; }
.resumen-lista { margin: 0 0 1rem; padding: 0; list-style: none; border-top: 1px solid var(--rosa-hondo); }
.resumen-lista li { padding: .75rem 0; border-bottom: 1px solid var(--rosa-hondo); }
.resumen-nombre { display: block; font-weight: 600; }
.resumen-dato { display: block; font-size: var(--t-small); color: var(--tinta-suave); }
.resumen p { margin: 0 0 .75rem; }
.resumen-mensaje span { font-weight: 700; }

/* Thank-you: the lazo ties itself */
.gracias { padding-top: 2.5rem; text-align: center; }
.lazo--gracias { width: 8.5rem; margin: 0 auto 1.25rem; }
.cargando { padding: 2rem 0; }
.lazo--cargando { width: 6rem; margin: 0 auto; animation: respirar 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: no-preference) {
  .gracias .lazo-hilo { stroke-dasharray: var(--lazo-largo); stroke-dashoffset: var(--lazo-largo); }
  .gracias.dibujar .lazo-hilo { animation: trazar 1100ms var(--ease-inout) 120ms forwards; }
}

/* ---------- Demo mode bar (only while no Sheet is connected) ---------- */

.demo-aviso { margin: 0; padding: .5rem 1rem; font-size: var(--t-fine); line-height: 1.35; text-align: center; color: var(--algodon); background: var(--tinta); }
.demo-aviso a { color: var(--algodon); }
.demo-aviso[hidden] { display: none; }
.demo { padding: 1rem 1rem 1.5rem; font-size: var(--t-fine); line-height: 1.4; color: var(--algodon); background: var(--tinta); }
.demo[hidden] { display: none; }
.es-demo.con-barra .demo { padding-bottom: 7rem; }
.es-demo.con-barra .pie { padding-bottom: 3rem; }
.demo-fila { display: flex; flex-wrap: wrap; align-items: center; }
.demo-fila > * { margin: .2rem .45rem .2rem 0; }
.demo button {
  min-height: 2.25rem;
  padding: .2rem .75rem;
  font: inherit;
  font-size: .9rem;
  color: var(--algodon);
  background: transparent;
  border: 1px solid rgba(255, 252, 250, .55);
  border-radius: var(--radio-pastilla);
  cursor: pointer;
}
.demo button[aria-pressed="true"] { color: var(--tinta); background: var(--algodon); }

/* ---------- Reduced motion: crossfades only ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
  }
  .sobre-escena, .panel-fondo, #app { transition-duration: 200ms !important; }
  .panel { transform: none !important; }
  .barra-rsvp { transform: none; transition-property: opacity !important; transition-duration: 200ms !important; }
  .sobre-espera, .lazo--cargando { animation: respirar 1.6s ease-in-out infinite !important; }
}

/* ---------- Bilingual RSVP buttons ---------- */

.btn { flex-direction: column; }
.btn-texto { display: block; }
.btn-traduccion {
  display: block;
  margin-top: .1rem;
  font-size: var(--t-fine); /* 15px: still easy to read, clearly secondary */
  font-weight: 400;
  opacity: .82;
}

/* ---------- Azahar (orange blossom): fine line, never louder than the type ---------- */

:root { --salvia: #93A383; --salvia-oscura: #6F8160; }
.azahar { display: block; overflow: visible; height: auto; pointer-events: none; }
.az-tallo { fill: none; stroke: var(--salvia-oscura); stroke-width: 1.1; stroke-linecap: round; }
.az-hoja { fill: rgba(147, 163, 131, .3); stroke: var(--salvia-oscura); stroke-width: .8; }
.az-nervio { fill: none; stroke: var(--salvia-oscura); stroke-width: .55; opacity: .7; }
.az-petalo { fill: var(--algodon); stroke: var(--oro); stroke-width: .8; }
.az-boton { fill: #FBF3EE; stroke: var(--oro); stroke-width: .8; }
.az-centro { fill: #EBCFC8; stroke: var(--oro); stroke-width: .5; }
.az-estambre { stroke: var(--oro); stroke-width: .5; }
.az-polen { fill: var(--oro-oscuro); }

/* Two sprigs laid across opposite corners of the invitation card */
.tarjeta { position: relative; }
.azahar--arriba, .azahar--abajo { position: absolute; z-index: 1; width: 6.5rem; }
.azahar--arriba { top: -.55rem; left: -.55rem; }
.azahar--abajo { bottom: -.55rem; right: -.55rem; transform: rotate(180deg); }
@media (min-width: 40em) {
  .azahar--arriba, .azahar--abajo { width: 8.5rem; }
  .azahar--arriba { top: -.8rem; left: -.8rem; }
  .azahar--abajo { bottom: -.8rem; right: -.8rem; }
}
.intro .hero .azahar { animation: aparecer 900ms var(--ease-out) 1000ms both; }

/* ---------- Engagement photos, printed ---------- */

.galeria { max-width: 64rem; margin: var(--esp-xl) auto 0; padding: 0 1.25rem; }
.galeria-cabeza { max-width: var(--medida); margin: 0 auto var(--esp-l); text-align: center; }
.azahar--galeria { width: 5.5rem; margin: 0 auto .1rem; transform: rotate(-10deg); }
.galeria-titulo { margin-bottom: var(--esp-s); } /* same style as every section title */
.galeria-texto { max-width: 30rem; margin: 0 auto; color: var(--tinta-suave); }
.galeria-texto p { margin: 0 0 .75em; }
.galeria-texto p:last-child { margin-bottom: 0; }

.foto { margin: 0 0 var(--esp-m); }
.foto-boton {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  font: inherit;
  text-align: inherit;
  background: none;
  border: 0;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.foto-boton:focus { outline: none; }
.foto-boton:focus .foto-papel { outline: 3px solid var(--vino); outline-offset: 3px; }
.foto-boton:focus:not(:focus-visible) .foto-papel { outline: none; }

/* A print: photo on cotton paper with an even white border */
.foto-papel { display: block; padding: .45rem; background: var(--algodon); box-shadow: var(--sombra-papel); }
.foto-imagen { position: relative; display: block; overflow: hidden; padding-top: 133.333%; background: #EFE3DE; }
.foto--ancha .foto-imagen { padding-top: 125%; } /* a slightly wider crop for the big prints */
.foto-imagen img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

.fotos-par { display: flex; align-items: flex-start; margin: 0 0 var(--esp-m); }
.galeria-hilo > :last-child { margin-bottom: 0; }
.fotos-par .foto { flex: 1 1 0; min-width: 0; margin: 0; }
.fotos-par .foto + .foto { margin-left: var(--esp-s); margin-top: var(--esp-l); } /* the second print lies a little lower */


@media (min-width: 48em) {
  .foto, .fotos-par { margin-bottom: var(--esp-l); }
  .foto--ancha { width: 74%; }
  .foto--derecha { margin-left: auto; }
  .foto--centro { width: 58%; margin-left: auto; margin-right: auto; }
  .foto--centrada { margin-left: auto; margin-right: auto; } /* same size, centered */
  .fotos-par .foto + .foto { margin-left: var(--esp-m); margin-top: var(--esp-xl); }
  .foto-papel { padding: .6rem; }
}

/* Revelado: each print develops once, as a warm paper wash lifts off it.
   Opacity only (no filter), so it runs on the compositor like the rustle. */
.revelar .foto-imagen img { opacity: .3; transition: opacity 1.2s var(--ease-out); }
.revelar .foto-imagen::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: radial-gradient(ellipse at 50% 45%, #F7EBDC 0%, #E9D6BF 100%);
  opacity: .9;
  pointer-events: none;
  transition: opacity 1.6s var(--ease-out);
}
.revelar .revelada .foto-imagen img { opacity: 1; }
.revelar .revelada .foto-imagen::after { opacity: 0; }

/* ---------- Photo viewer ---------- */

.visor {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  color: var(--algodon);
  background: #22151C;
  opacity: 0;
  transition: opacity var(--d-corta) var(--ease-out);
}
.visor[hidden] { display: none; }
.visor.abierto { opacity: 1; }
.visor-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  padding: .6rem 1rem;
  padding-top: max(.6rem, env(safe-area-inset-top));
}
.visor-cuenta { margin: 0; font-size: var(--t-small); opacity: .85; }
.visor-cerrar, .visor-btn {
  -webkit-appearance: none;
  appearance: none;
  min-height: 48px;
  padding: 0 1.25rem;
  font-family: var(--f-texto);
  font-size: var(--t-small);
  font-weight: 700;
  color: var(--algodon);
  background: transparent;
  border: 2px solid rgba(255, 252, 250, .7);
  border-radius: var(--radio-pastilla);
  cursor: pointer;
  touch-action: manipulation;
}
.visor-btn { min-width: 9rem; min-height: 3.25rem; }
.visor-cerrar:focus, .visor-btn:focus { outline: 3px solid #F0BCC4; outline-offset: 3px; }
.visor-figura {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  margin: 0;
  padding: 0 1rem;
}
#visor-img {
  max-width: 100%;
  max-height: calc(100vh - 12.5rem);
  border: .4rem solid var(--algodon);
  transition: opacity 160ms var(--ease-out);
}
#visor-img.cambiando { opacity: 0; }
.visor-leyenda {
  min-height: 1.75rem;
  margin-top: .8rem;
  font-family: var(--f-display);
  font-style: italic;
  font-size: var(--t-3);
  color: #EAD9B5;
}
.visor-nav {
  display: flex;
  justify-content: space-between;
  flex: none;
  padding: .75rem 1rem;
  padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
}

.visor-btn .btn-texto { display: inline; }

/* ---------- "Lugar, horarios y detalles" ---------- */

.tarjeta-accion { margin: 1.75rem 0 0; }
.btn--info { max-width: 20rem; margin: 0 auto; background: var(--algodon); }
.btn-detalle { display: block; margin-top: .1rem; font-size: var(--t-fine); font-weight: 400; opacity: .82; }

.info-fecha { margin: 0 0 var(--esp-m); font-family: var(--f-display); font-size: var(--t-2); line-height: 1.25; }
.info-ciudad { display: block; font-family: var(--f-texto); font-size: var(--t-small); color: var(--tinta-suave); }
.info-eventos .btn--compacto { display: flex; width: 100%; min-height: 3.25rem; }
.info-subtitulo { margin: 2.25rem 0 1rem; font-family: var(--f-display); font-weight: 500; font-size: var(--t-2); line-height: 1.2; }
.info-limite { margin: 1.5rem 0 0; }

/* Short phones (iPhone SE/8 size): a tighter card, so "Lugar y horarios"
   is on the first screen after the envelope opens, above the RSVP bar. */
@media (max-width: 30em) and (max-height: 46em) {
  .cabecera { padding-top: .6rem; }
  .hero { padding-top: .6rem; }
  .tarjeta { padding: var(--esp-xs); }
  .tarjeta-marco { padding: var(--esp-m) var(--esp-s); }
  .para { margin-bottom: .9rem; }
  .para-familia { font-size: var(--t-3); }
  .anuncio { margin-bottom: .6rem; }
  .nombres { font-size: 2.45rem; }
  .lazo--nombres { width: 6.25rem; margin: .2em auto .18em; }
  .invita { margin-top: 1rem; }
  .fecha { margin-top: .9rem; font-size: var(--t-3); }
  .tarjeta-accion { margin-top: 1rem; }
  .azahar--arriba, .azahar--abajo { width: 5.5rem; }
}

/* ---------- Credit (Will / Webnomous): quiet on purpose, close to the page color ---------- */

.pie-codigo { margin: var(--esp-s) 0 0; }
.pie-codigo .enlace-btn { font-weight: 400; color: var(--tinta-suave); }
.creditos { margin: var(--esp-l) auto 0; font-size: var(--t-fine); line-height: 1.5; color: #C4B1A3; }
.creditos p { margin: 0; }
.creditos-nota { font-family: var(--f-display); font-style: italic; font-size: var(--t-fine); }
.creditos-firma { white-space: nowrap; }
.creditos-por { display: flex; align-items: center; justify-content: center; margin: .5rem 0 .15rem; } /* margins trimmed by the link's taller hit area, so the line sits where it did */
.creditos-marca {
  display: inline-flex;
  align-items: center;
  margin-left: .15rem;
  min-height: 2.75rem; /* 44px tap target, same as every other control */
  padding: 0 .35rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radio-control);
  transition: color var(--d-corta) var(--ease-out);
}
.creditos-marca:hover, .creditos-marca:focus { color: var(--tinta-suave); }
.creditos-logo { width: 1.35rem; height: auto; margin-right: .45rem; }
.creditos-legal { font-size: var(--t-fine); }

/* ---------- Rustle: prints sway a little as the page scrolls ----------
   A scroll-driven animation (no JavaScript). Chrome runs transform animations
   like this on the compositor thread, so a slow phone busy decoding photos
   doesn't stutter. Browsers without support show still prints; reduced
   motion gets none. It's tied to scroll position: stop scrolling and the
   prints are still, so nothing moves under a finger about to tap. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .galeria .foto-boton {
      animation: susurro ease-in-out both;
      animation-timeline: view();          /* after the shorthand, which would reset it */
      animation-range: cover 0% cover 100%;
    }
    /* neighbours sway the other way, so they don't move in step */
    .fotos-par .foto + .foto .foto-boton,
    .galeria-hilo > .foto:nth-child(even) .foto-boton { animation-name: susurro-b; }
  }
}
/* Five gentle sways while a print crosses the screen (about one every 250px of scrolling).
   Tilt alternates between neighbours; the sideways drift is the same for both,
   so the two prints of a pair never bump into each other. */
@keyframes susurro {
  0%   { transform: translate(-3px, 14px) rotate(-2deg); }
  18%  { transform: translate(2px, 8px) rotate(1.4deg); }
  36%  { transform: translate(-2px, 3px) rotate(-1.1deg); }
  54%  { transform: translate(3px, -2px) rotate(1.2deg); }
  72%  { transform: translate(-2px, -7px) rotate(-.9deg); }
  100% { transform: translate(2px, -13px) rotate(1deg); }
}
@keyframes susurro-b {
  0%   { transform: translate(-3px, 12px) rotate(1.8deg); }
  18%  { transform: translate(2px, 7px) rotate(-1.3deg); }
  36%  { transform: translate(-2px, 2px) rotate(1.2deg); }
  54%  { transform: translate(3px, -3px) rotate(-1.1deg); }
  72%  { transform: translate(-2px, -8px) rotate(1deg); }
  100% { transform: translate(2px, -12px) rotate(-.9deg); }
}

/* Red rose: one per flower cluster, never on its own */
.rs-fondo { fill: #B0142E; stroke: #6E0B1D; stroke-width: .8; }
.rs-copa { fill: #CC2A44; }
.rs-pliegue { fill: none; stroke: #6E0B1D; stroke-width: .9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Desktop: a portrait beside the invitation; RSVP floats ---------- */

.hero-foto { display: none; margin: 0; }
@media (min-width: 64em) {
  .cabecera { max-width: 64rem; }
  /* One 64rem container: the card, the sections below and the photos share a left edge;
     the portrait, the language button and the floating RSVP share a right edge. */
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 34rem) minmax(0, 24rem);
    justify-content: space-between;
    align-items: start;
    max-width: 64rem;
  }
  .detalles { max-width: 64rem; }
  .detalles > .seccion { max-width: var(--medida); }
  .hero-foto { display: block; margin-top: var(--esp-xl); transform: rotate(1.4deg); }
  .hero-foto .foto-papel { padding: .6rem; }

  /* The RSVP bar becomes a floating button; the empty strip never blocks clicks */
  .barra-rsvp {
    background: transparent;
    border-top: 0;
    pointer-events: none;
    padding-bottom: var(--esp-m);
    /* % padding resolves against the viewport minus its scrollbar (100vw would include it) */
    padding-right: max(1.25rem, calc((100% - 64rem) / 2 + 1.25rem));
  }
  .barra-rsvp.visible .btn { pointer-events: auto; }
  .barra-rsvp .btn { max-width: 22rem; margin: 0 0 0 auto; box-shadow: var(--sombra-flotante); }
}

/* Large prints never taller than the screen on laptops */
@media (min-width: 48em) {
  .foto--ancha { width: 74%; width: min(74%, 64vh); }
  .foto--centro { width: 58%; width: min(58%, 60vh); }
}
