/* Plantilla "Botánica".
   Hojas en acuarela que enmarcan la portada, el inicio y el cierre; ramitas que separan las
   secciones; iconos dentro de medallas; tarjetas suaves para lo importante y hojas que caen
   despacio. Nombres en caligrafía, títulos en romana clásica.
   Los colores vienen de paleta-base.css (o de la paleta elegida):
     --rojo-intenso / --burgundy-dark   hojas, títulos y botones
     --gold                             ramitas finas y detalles
     --papel                            fondo
   Si la boda subió una imagen de fondo (clase .con-fondo en <html> y variable
   --fondo-imagen), esa imagen reemplaza a las hojas dibujadas. */

:root {
    /* Letras por tipo de texto. Cada boda puede cambiarlas (--fuente-*, ver lib/tipografias.js);
       si no elige una, vale la que aquí se indica. */
    --f-nombres: var(--fuente-nombres, 'Parisienne'), 'Brush Script MT', cursive;
    --f-invitado: var(--fuente-invitado, var(--fuente-nombres, 'Parisienne')), 'Brush Script MT', cursive;
    --f-titulos: var(--fuente-titulos, 'Marcellus'), Georgia, serif;
    --f-mensaje: var(--fuente-mensaje, var(--fuente-titulos, 'Marcellus')), Georgia, serif;
    --f-fecha: var(--fuente-fecha, var(--fuente-titulos, 'Marcellus')), Georgia, serif;
    --f-etiquetas: var(--fuente-etiquetas, var(--fuente-titulos, 'Marcellus')), Georgia, serif;
    --f-texto: var(--fuente-texto, 'Lato'), 'Helvetica Neue', Arial, sans-serif;
    --f-botones: var(--fuente-botones, var(--fuente-titulos, 'Marcellus')), Georgia, serif;

    /* Sobre: verde de la paleta con el sello en dorado */
    --sobre-color: var(--rojo-intenso);
    --sobre-color-base: var(--primario-medio);
    --sobre-solapa: var(--primario-claro);
    --sobre-escena: radial-gradient(ellipse at 50% 35%, var(--papel) 0%, var(--champagne) 70%, var(--champagne-medio) 100%);
}

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

/* Cualquier pantalla de teléfono: un texto muy largo (un enlace, un apellido compuesto) se
   parte en lugar de ensanchar la página, y nada provoca desplazamiento hacia los lados.
   Los nombres grandes, además, se reducen solos si no caben (encajarNombres en main.js). */
html, body { max-width: 100%; overflow-x: clip; }
body { overflow-wrap: break-word; }
img, svg, video, iframe { max-width: 100%; }
:where(p, h1, h2, h3, h4, li, label, button, a, select, input, textarea) { max-width: 100%; }

html { font-size: 100%; }
/* El texto general lleva su propio tamaño (cada tipo de texto tiene su escala) */
body { font-size: calc(1rem * var(--escala-texto, 1)); }

html, body {
    margin: 0;
    padding: 0;
    background: var(--papel);
    color: var(--texto-oscuro);
    font-family: var(--f-texto);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
}

/* Manchas de acuarela muy tenues a lo largo de toda la invitación */
body {
    background:
        radial-gradient(ellipse 70% 26rem at 12% 8rem, rgba(var(--primario-rgb), 0.10), transparent 70%),
        radial-gradient(ellipse 60% 24rem at 92% 52rem, rgba(var(--gold-rgb), 0.10), transparent 70%),
        radial-gradient(ellipse 65% 26rem at 8% 100rem, rgba(var(--primario-rgb), 0.08), transparent 70%),
        radial-gradient(ellipse 60% 24rem at 95% 150rem, rgba(var(--primario-rgb), 0.08), transparent 70%),
        radial-gradient(ellipse 65% 26rem at 10% 200rem, rgba(var(--gold-rgb), 0.09), transparent 70%),
        var(--papel);
}

/* ── Páginas con marco de hojas: portada, inicio y cierre ───── */
.bo-pagina {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    text-align: center;
}
.bo-pagina > *:not(.bo-marco) { position: relative; z-index: 1; max-width: 26rem; }

/* La portada ocupa la pantalla; el relleno deja libres las esquinas donde van las hojas */
.bo-portada {
    min-height: 100vh;
    min-height: 100svh;
    padding: 8.5rem 2.2rem 7.5rem;
}
.bo-inicio { padding: 9.5rem 2rem 1.5rem; }
.bo-cierre { padding: 2.5rem 2rem 9rem; }
/* En el inicio solo van las hojas de arriba; en el cierre, las de abajo */
.bo-inicio .bo-so, .bo-inicio .bo-se, .bo-cierre .bo-ne, .bo-cierre .bo-no { display: none; }

.bo-marco { position: absolute; inset: 0; pointer-events: none; }
.bo-esquina, .bo-rama { position: absolute; overflow: visible; max-width: none; }
.bo-esquina { width: min(56vw, 14.5rem); height: min(56vw, 14.5rem); animation: boMecer 9s ease-in-out infinite alternate; }
.bo-rama { width: min(24vw, 6rem); height: min(32vw, 8rem); }
.bo-ne { top: 0; right: 0; transform-origin: 100% 0; }
/* La de abajo es la misma, girada media vuelta sobre su centro */
.bo-so { bottom: 0; left: 0; rotate: 180deg; transform-origin: center; animation-delay: -4s; }
.bo-no { top: 0.4rem; left: 0.4rem; transform: scaleY(-1); }
.bo-se { bottom: 0.4rem; right: 0.4rem; transform: scaleX(-1); }
/* Las hojas se mecen apenas, como con brisa */
@keyframes boMecer {
    from { transform: rotate(-1.4deg); }
    to   { transform: rotate(1.6deg); }
}

.bo-tallo { fill: none; stroke: var(--burgundy-dark); stroke-width: 1.1; stroke-linecap: round; opacity: 0.55; }
.bo-hoja { fill: var(--rojo-intenso); }
.bo-hoja-oro { fill: var(--gold); }
.bo-tono-0 { opacity: 0.78; }
.bo-tono-1 { opacity: 0.56; }
.bo-tono-2 { opacity: 0.38; }
.bo-rama .bo-tallo { stroke: var(--gold-oscuro); }
.bo-flor { fill: var(--papel); stroke: var(--gold); stroke-width: 1.2; }
.bo-punto { fill: var(--gold); }

/* Imagen de fondo propia: reemplaza a las hojas dibujadas */
.con-fondo body { background: var(--papel) var(--fondo-imagen) center top / 100% auto repeat-y; }
.con-fondo .bo-marco, .con-fondo .bo-lluvia { display: none; }

/* ── Secciones ──────────────────────────────────────────────── */
.bo-seccion {
    position: relative;
    max-width: 30rem;
    margin: 0 auto;
    padding: 1.6rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}
.bo-bloque, .bo-encabezado {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
}

/* Ramita que separa las secciones */
.bo-divisor {
    display: block;
    width: min(62vw, 13.5rem);
    height: auto;
    aspect-ratio: 200 / 44;
    margin: 1.3rem auto;
    overflow: visible;
}
.bo-divisor .bo-tallo { stroke: var(--gold-oscuro); opacity: 0.7; }

/* Icono de la sección dentro de una medalla */
.bo-medalla {
    width: 4.4rem;
    height: 4.4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rojo-intenso);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(var(--gold-rgb), 0.7);
    box-shadow: 0 0 0 5px rgba(var(--gold-rgb), 0.12), 0 6px 16px rgba(var(--primario-oscuro-rgb), 0.10);
}
.bo-medalla .icono { width: 2.3rem; height: 2.3rem; stroke-width: 1.4; }
.bo-icono-suelto { width: 1.7rem; height: 1.7rem; color: var(--gold); }
.bo-pareja-iconos { display: flex; justify-content: center; gap: 1.4rem; color: var(--gold-oscuro); }
.bo-pareja-iconos .icono { width: 3.3rem; height: 3.3rem; }

/* Tarjeta para lo importante: lugar, confirmación */
.bo-tarjeta {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.6rem 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.66);
    border: 1px solid rgba(var(--gold-rgb), 0.55);
    border-radius: 1.4rem 1.4rem 1.4rem 1.4rem / 1.2rem;
    box-shadow: 0 10px 26px rgba(var(--primario-oscuro-rgb), 0.08);
}
.bo-tarjeta .bo-medalla { margin-top: -3.6rem; background: var(--papel); }
.bo-tarjeta:has(.bo-medalla) { margin-top: 2.2rem; }
.bo-tarjeta-clara { background: rgba(var(--gold-rgb), 0.07); box-shadow: none; }

/* ── Tipos de texto ─────────────────────────────────────────── */
.bo-nombres {
    font-family: var(--f-nombres);
    font-weight: 400;
    font-size: calc(clamp(2.6rem, 12vw, 3.6rem) * var(--escala-nombres, 1));
    line-height: 1.15;
    color: var(--rojo-intenso);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-wrap: balance;
}
/* Los nombres completos son largos: letra menor para que cada uno ocupe una o dos líneas */
.bo-nombres-completos { font-size: calc(clamp(2rem, 8.6vw, 2.8rem) * var(--escala-nombres, 1)); line-height: 1.2; }
.bo-nombres-pie { font-size: calc(clamp(1.9rem, 8vw, 2.5rem) * var(--escala-nombres, 1)); }
.bo-y { font-family: var(--f-titulos); font-size: 0.42em; color: var(--gold-oscuro); line-height: 1.6; }

.bo-etiqueta {
    font-family: var(--f-etiquetas);
    font-size: calc(0.74rem * var(--escala-etiquetas, 1));
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold-oscuro);
    margin: 0;
}
.bo-titulo {
    font-family: var(--f-titulos);
    font-weight: 400;
    font-size: calc(1.5rem * var(--escala-titulos, 1));
    line-height: 1.25;
    letter-spacing: 0.04em;
    color: var(--burgundy-dark);
    margin: 0;
    text-wrap: balance;
}
.bo-pregunta { font-size: calc(1.25rem * var(--escala-titulos, 1)); }
.bo-texto {
    font-size: calc(0.98rem * var(--escala-texto, 1));
    line-height: 1.7;
    color: var(--texto-oscuro);
    margin: 0;
    white-space: pre-line;
    text-wrap: pretty;
}
.bo-texto strong { font-weight: 700; color: var(--rojo-intenso); }
.bo-suave { color: var(--texto-suave); font-size: calc(0.88rem * var(--escala-texto, 1)); }
.bo-nota { color: var(--rojo-intenso); font-weight: 400; }
.bo-hora { font-family: var(--f-fecha); font-size: calc(1.05rem * var(--escala-fecha, 1)); letter-spacing: 0.08em; color: var(--texto-oscuro); margin: 0; }

.bo-invitado {
    font-family: var(--f-invitado);
    font-size: calc(2.3rem * var(--escala-invitado, 1));
    line-height: 1.2;
    color: var(--rojo-intenso);
    margin: 0;
}
.bo-mensaje {
    font-family: var(--f-mensaje);
    font-size: calc(1.08rem * var(--escala-mensaje, 1));
    line-height: 1.75;
    color: var(--texto-oscuro);
    margin: 0;
    white-space: pre-line;
    text-wrap: pretty;
}
.bo-mensaje-corto { font-size: calc(1rem * var(--escala-mensaje, 1)); color: var(--texto-suave); }
.bo-adorno { font-size: calc(1.3rem * var(--escala-texto, 1)); color: var(--gold); line-height: 1; }

.bo-enlace {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-family: var(--f-botones);
    font-size: calc(0.78rem * var(--escala-botones, 1));
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rojo-intenso);
    text-decoration: none;
    border: 1px solid rgba(var(--primario-rgb), 0.45);
    border-radius: 999px;
    padding: 0.6rem 1.15rem;
    transition: background 0.2s ease, color 0.2s ease;
}
.bo-enlace .icono { width: 1.05rem; height: 1.05rem; stroke-width: 2.2; }
.bo-enlace:hover, .bo-enlace:focus-visible { background: var(--rojo-intenso); color: var(--papel); }
/* Zona de toque amplia sin cambiar el aspecto del enlace */
.bo-enlace::after { content: ''; position: absolute; inset: -8px; }

/* ── Botones y campos ───────────────────────────────────────── */
.bo-boton {
    display: inline-block;
    font-family: var(--f-botones);
    font-size: calc(0.8rem * var(--escala-botones, 1));
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--papel);
    background: var(--rojo-intenso);
    border: 1px solid var(--rojo-intenso);
    border-radius: 999px;
    padding: 0.95rem 2rem;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(var(--primario-oscuro-rgb), 0.18);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.bo-boton:hover, .bo-boton:focus-visible { background: var(--burgundy-dark); border-color: var(--burgundy-dark); transform: translateY(-1px); }
.bo-boton:focus-visible, .bo-enlace:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--gold-oscuro);
    outline-offset: 3px;
}

.bo-acceso, .bo-confirmar {
    width: 100%;
    max-width: 18rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-top: 0.6rem;
}
.bo-acceso input, .bo-confirmar select {
    width: 100%;
    font-family: var(--f-texto);
    font-size: calc(1rem * var(--escala-texto, 1));
    text-align: center;
    color: var(--texto-oscuro);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(var(--primario-rgb), 0.35);
    border-radius: 999px;
    padding: 0.8rem 1rem;
}
.bo-acceso input::placeholder { color: var(--texto-suave); opacity: 0.85; }
.bo-error { min-height: 1.3em; margin: 0; font-size: calc(0.88rem * var(--escala-texto, 1)); font-weight: 400; color: var(--rojo-intenso); }

/* ── Fecha ──────────────────────────────────────────────────── */
.bo-fecha {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    width: 100%;
}
.bo-fecha-lado {
    flex: 1 1 0;
    min-width: 0;
    font-family: var(--f-fecha);
    /* Con tope según el ancho: en teléfonos pequeños "SÁBADO" no se parte aunque se agrande */
    font-size: min(calc(0.8rem * var(--escala-fecha, 1)), 4.4vw);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--texto-oscuro);
    border-top: 1px solid var(--gold);
    border-bottom: 1px solid var(--gold);
    padding: 0.55rem 0.2rem;
}
.bo-fecha-centro { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; }
.bo-fecha-mes { font-family: var(--f-fecha); font-size: calc(0.8rem * var(--escala-fecha, 1)); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-oscuro); }
.bo-fecha-dia { font-family: var(--f-fecha); font-size: calc(3.6rem * var(--escala-fecha, 1)); line-height: 1; color: var(--rojo-intenso); }

/* Cuenta regresiva: cuatro círculos */
.bo-cuenta { display: flex; justify-content: center; gap: clamp(0.4rem, 2.4vw, 0.9rem); width: 100%; }
.bo-cuenta > div {
    flex: 0 1 4.6rem;
    min-width: 0;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(var(--gold-rgb), 0.7);
    box-shadow: 0 6px 14px rgba(var(--primario-oscuro-rgb), 0.08);
}
.bo-cuenta-numero { font-family: var(--f-fecha); font-size: calc(clamp(1.15rem, 6vw, 1.6rem) * var(--escala-fecha, 1)); line-height: 1.1; color: var(--burgundy-dark); font-variant-numeric: tabular-nums; }
.bo-cuenta-nombre { font-family: var(--f-etiquetas); font-size: calc(clamp(0.6rem, 2.6vw, 0.66rem) * var(--escala-etiquetas, 1)); letter-spacing: 0.1em; text-transform: uppercase; color: var(--texto-suave); }
.countdown-finished {
    font-family: var(--f-nombres) !important;
    font-weight: 400 !important;
    font-size: calc(1.9rem * var(--escala-nombres, 1)) !important;
    margin: 0 !important;
}

/* ── Fotos ──────────────────────────────────────────────────── */
.bo-fotos {
    position: relative;
    width: min(100%, 17rem);
    aspect-ratio: 4 / 5;
    border-radius: 50% 50% 0.6rem 0.6rem / 32% 32% 0.6rem 0.6rem;
    overflow: hidden;
    border: 5px solid #fff;
    box-shadow: 0 0 0 1px rgba(var(--gold-rgb), 0.6), 0 10px 26px rgba(0, 0, 0, 0.12);
    background: var(--champagne);
}
.slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}
.slide.active { opacity: 1; animation: boAcercar 6s ease-out both; }
@keyframes boAcercar { from { transform: scale(1.08); } to { transform: scale(1); } }

/* ── Confirmación ───────────────────────────────────────────── */
.bo-limite { display: flex; flex-direction: column; gap: 0.2rem; margin-top: 0.4rem; }
.bo-limite span { font-variant-numeric: tabular-nums; }
.bo-confirmado .success-msg { font-family: var(--f-titulos); font-size: calc(1.15rem * var(--escala-titulos, 1)); color: var(--rojo-intenso); margin: 0 0 0.2rem; }
.bo-confirmado button { font-family: var(--f-texto); }

/* ── Medios para regalos ────────────────────────────────────── */
.gift-options { width: 100%; display: flex; flex-direction: column; gap: 0.8rem; margin-top: 0.2rem; }
.gift-card {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(var(--gold-rgb), 0.55);
    border-radius: 1.2rem;
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 8px 20px rgba(var(--primario-oscuro-rgb), 0.07);
}
.gift-icon { font-size: calc(1.6rem * var(--escala-texto, 1)); height: 2.3rem; display: flex; align-items: center; justify-content: center; }
.gift-title { font-family: var(--f-titulos); font-weight: 400; font-size: calc(1.1rem * var(--escala-titulos, 1)); color: var(--burgundy-dark); margin: 0; }
.gift-detail { font-size: calc(0.9rem * var(--escala-texto, 1)); line-height: 1.6; color: var(--texto-suave); margin: 0; white-space: pre-line; }
.gift-detail strong { font-weight: 700; color: var(--texto-oscuro); }
.gift-card .wallet-address {
    font-family: ui-monospace, Consolas, monospace;
    font-size: calc(0.74rem * var(--escala-texto, 1));
    word-break: break-all;
    color: var(--rojo-intenso);
    text-decoration: underline;
    cursor: pointer;
}
.gift-card .qr-container img { width: 5.6rem; height: 5.6rem; padding: 4px; background: #fff; border-radius: 0.5rem; border: 1px solid rgba(var(--gold-rgb), 0.4); }

/* ── Hojas que caen ─────────────────────────────────────────── */
.bo-lluvia { position: fixed; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.bo-lluvia i {
    position: absolute;
    top: -8%;
    width: 0.95rem;
    height: 0.5rem;
    border-radius: 0 100% 0 100%;
    background: var(--rojo-intenso);
    opacity: 0;
    animation: boCaer linear infinite;
}
.bo-lluvia i:nth-child(1) { left: 8%;  animation-duration: 17s; animation-delay: 0s; }
.bo-lluvia i:nth-child(2) { left: 24%; animation-duration: 22s; animation-delay: 5s;  background: var(--gold); scale: 0.8; }
.bo-lluvia i:nth-child(3) { left: 41%; animation-duration: 19s; animation-delay: 10s; scale: 1.15; }
.bo-lluvia i:nth-child(4) { left: 58%; animation-duration: 24s; animation-delay: 2s;  background: var(--primario-claro); }
.bo-lluvia i:nth-child(5) { left: 73%; animation-duration: 18s; animation-delay: 13s; background: var(--gold); scale: 0.7; }
.bo-lluvia i:nth-child(6) { left: 88%; animation-duration: 21s; animation-delay: 7s; }
.bo-lluvia i:nth-child(7) { left: 50%; animation-duration: 26s; animation-delay: 16s; scale: 0.9; }
@keyframes boCaer {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 0; }
    8%   { opacity: 0.34; }
    50%  { transform: translate(2.4rem, 55vh) rotate(160deg); }
    92%  { opacity: 0.3; }
    100% { transform: translate(-1.6rem, 112vh) rotate(330deg); opacity: 0; }
}

/* ── Transiciones de entrada ────────────────────────────────── */
.fade-out-login { animation: boSalir 0.5s ease forwards; }
.invitation-slide-in { animation: boEntrar 1s ease both; }
@keyframes boSalir { to { opacity: 0; } }
@keyframes boEntrar { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .fade-out-login, .invitation-slide-in { animation-duration: 0.01s; }
    .slide { transition: none; }
    .slide.active, .bo-esquina { animation: none; }
    .bo-lluvia { display: none; }
}
