/* Block designs (resources/views/disenos/bloques.blade.php): "Esencial" is the
   base; other looks override it under body.estilo-{slug}. Colors come from the
   palette (--fondo, --superficie, --texto, --acento; --sobre-acento is the
   readable text color on the accent and --acento-texto the accent as text on
   the background, or the text color when they'd blend), fonts from the chosen pair
   (--fuente-titulo, --fuente-cuerpo). */

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--fondo);
    color: var(--texto);
    font: 400 1rem/1.7 var(--fuente-cuerpo);
    -webkit-font-smoothing: antialiased;
}

h1, h2 {
    font-family: var(--fuente-titulo);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 0.75rem;
}

h2 { font-size: clamp(1.9rem, 6vw, 2.6rem); }

p { margin: 0 0 1rem; }

img { max-width: 100%; display: block; }

a { color: var(--acento); }

.tenue { opacity: 0.7; font-size: 0.9375rem; }

.etiqueta {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--acento);
    margin-bottom: 0.5rem;
}

/* Portada */
.portada {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem;
    background-color: var(--fondo);
    background-size: cover;
    /* Faces are usually in the upper part: on wide screens a portrait photo loses its bottom, not the heads.
       The cover's own focal point, when set, comes inline (BloquesInvitacion::enfoqueDePortada). */
    background-position: center 25%;
    position: relative;
}

.portada.con-foto { color: #fff; }

.portada.con-foto::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgb(0 0 0 / 0.25), rgb(0 0 0 / 0.55));
}

.portada-contenido { position: relative; max-width: 40rem; }

.portada h1 { font-size: clamp(3rem, 13vw, 5.5rem); font-weight: 500; }

.portada-frase {
    font-family: var(--fuente-titulo);
    font-style: italic;
    font-size: clamp(1.25rem, 4.5vw, 1.6rem);
    margin-bottom: 0.75rem;
}

.portada-fecha {
    font-size: 0.8125rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin-top: 1rem;
}

.portada:not(.con-foto) .portada-fecha,
.portada:not(.con-foto) .portada-frase { color: var(--acento); }

/* "Portada fija" (the cover's option): the photo stays put while the rest of
   the invitation, one opaque layer (.tras-portada), slides over it. Sticky,
   not background-attachment: fixed, which iPhones ignore. */
.portada.portada-fija {
    position: sticky;
    top: 0;
    z-index: 0;
}

.tras-portada {
    position: relative;
    z-index: 1;
    background: var(--fondo);
    box-shadow: 0 -12px 32px rgb(0 0 0 / 0.25);
}

/* And it darkens as it gets covered, where the browser ties animations to
   scrolling (Chrome, Edge, recent Safari); elsewhere it just stays as is. */
@supports (animation-timeline: view()) {
    main.con-portada-fija { timeline-scope: --cubre-portada; }

    .tras-portada { view-timeline: --cubre-portada block; }

    .portada-fija::after {
        content: '';
        position: absolute;
        inset: 0;
        background: #000;
        opacity: 0;
        pointer-events: none;
        animation: oscurecer-portada linear both;
        animation-timeline: --cubre-portada;
        animation-range: entry 0% entry 100%;
    }

    @keyframes oscurecer-portada {
        to { opacity: 0.6; }
    }
}

/* Blocks */
.bloque {
    max-width: 44rem;
    margin: 0 auto;
    padding: 4.5rem 1.5rem;
    text-align: center;
}

.bloque + .bloque { border-top: 1px solid color-mix(in srgb, var(--texto) 12%, transparent); }

.tarjeta {
    background: var(--superficie);
    border-radius: 1rem;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.05);
}

.foto-bloque {
    border-radius: 1rem;
    margin: 0 auto 2rem;
    max-height: 32rem;
    object-fit: cover;
}

.personalizado .foto-bloque { margin: 2rem auto 0; }

.lugares { display: grid; gap: 1.25rem; }

.lugares h2 { font-size: 1.9rem; margin-bottom: 0.25rem; }

.lugares .hora { color: var(--acento); font-weight: 600; margin-bottom: 0.5rem; }

.lugares .lugar { font-weight: 600; margin-bottom: 0.25rem; }

.lugares .boton { margin-top: 0.75rem; }

/* Countdown */
.cuenta-numeros {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    max-width: 28rem;
    margin: 1.5rem auto 0;
}

.cuenta-numeros div {
    background: var(--superficie);
    border-radius: 0.75rem;
    padding: 1rem 0.25rem;
}

.cuenta-numeros span {
    display: block;
    font-family: var(--fuente-titulo);
    font-size: clamp(2rem, 8vw, 2.75rem);
    line-height: 1;
    color: var(--acento);
}

.cuenta-numeros small { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.12em; }

/* Itinerary */
.itinerario ol {
    list-style: none;
    margin: 1.5rem auto 0;
    padding: 0;
    max-width: 26rem;
    text-align: left;
}

.itinerario li {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--texto) 12%, transparent);
}

.itinerario .hora { color: var(--acento); font-weight: 600; }

.itinerario .actividad { display: flex; align-items: center; gap: 0.6rem; }

.itinerario .icono { flex: none; width: 1.4rem; height: 1.4rem; color: var(--acento); }

/* Gifts */
.botones {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.transferencia { margin-top: 1.5rem; }

.transferencia p:last-child { margin: 0; }

/* Gallery: grid (square crops), carousel (one large photo at a time) or collage (each photo in its own shape). */
.galeria-rejilla { margin-top: 1.5rem; }

.galeria-rejilla img {
    width: 100%;
    border-radius: 0.5rem;
}

.galeria-cuadricula {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.5rem;
}

.galeria-cuadricula img,
.galeria-carrusel img {
    aspect-ratio: 1;
    object-fit: cover;
}

.galeria-collage { columns: 2; column-gap: 0.5rem; }

.galeria-collage a { break-inside: avoid; margin-bottom: 0.5rem; }

.galeria-collage img { height: auto; }

.galeria-carrusel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.galeria-carrusel::-webkit-scrollbar { display: none; }

.galeria-carrusel a { flex: 0 0 100%; scroll-snap-align: center; }

.galeria-carrusel img { aspect-ratio: 4 / 3; }

.carrusel-controles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.carrusel-boton {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid color-mix(in srgb, var(--texto) 25%, transparent);
    border-radius: 50%;
    background: none;
    color: var(--texto);
    font: 1.5rem/1 system-ui, sans-serif;
    cursor: pointer;
}

.carrusel-puntos { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; }

.carrusel-punto {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--texto) 25%, transparent);
    cursor: pointer;
}

.carrusel-punto[aria-current="true"] { background: var(--acento); }

/* Hotels */
.hospedajes-rejilla {
    display: grid;
    /* Cards keep a card's size: one or two hotels don't stretch across the page. */
    grid-template-columns: repeat(auto-fit, minmax(14rem, 18rem));
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.hospedaje { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.hospedaje > a { display: block; cursor: zoom-in; }

.hospedaje img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }

.hospedaje-texto { padding: 1.25rem 1.25rem 1.5rem; display: flex; flex-direction: column; align-items: center; flex: 1; }

.hospedaje-nombre { font-family: var(--fuente-titulo); font-size: 1.35rem; font-weight: 600; line-height: 1.25; margin-bottom: 0.75rem; }

.hospedaje .tenue { margin-bottom: 0.75rem; }

/* Buttons line up at the bottom of cards of different heights. */
.hospedaje .boton { margin-top: auto; }

/* Photo viewer (invitacion.js): full screen, tap/pinch/wheel to zoom. */
.galeria-rejilla a { display: block; cursor: zoom-in; }

.visor-abierto { overflow: hidden; }

.visor {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(0 0 0 / 0.92);
    color: #fff;
    overflow: hidden;
}

.visor::backdrop { background: rgb(0 0 0 / 0.6); }

.visor-lienzo {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 0.5rem;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.visor-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transform-origin: center;
    will-change: transform;
    -webkit-user-drag: none;
}

.visor-img.animando { transition: transform 0.2s ease; }

.visor.con-zoom .visor-img { cursor: grab; }

.visor-boton {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 0.14);
    color: #fff;
    font: 400 1.75rem/1 system-ui, sans-serif;
    cursor: pointer;
}

.visor-boton:hover { background: rgb(255 255 255 / 0.26); }

.visor-boton[hidden] { display: none; }

.visor-cerrar { top: 0.75rem; right: 0.75rem; }

.visor-anterior,
.visor-siguiente { top: 50%; transform: translateY(-50%); }

.visor-anterior { left: 0.75rem; }

.visor-siguiente { right: 0.75rem; }

.visor.con-zoom .visor-anterior,
.visor.con-zoom .visor-siguiente { display: none; }

.visor-cuenta {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    font: 500 0.875rem/1 system-ui, sans-serif;
    opacity: 0.8;
}

/* Buttons */
.boton {
    display: inline-block;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    border: 1px solid var(--acento);
    background: var(--acento);
    color: var(--sobre-acento, #fff);
    font: 600 0.875rem/1 var(--fuente-cuerpo);
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
}

.boton:disabled { opacity: 0.5; cursor: not-allowed; }

.boton-claro { background: transparent; color: var(--acento-texto, var(--acento)); border-color: var(--acento-texto, var(--acento)); }

.enlace {
    background: none;
    border: 0;
    color: var(--acento-texto, var(--acento));
    text-decoration: underline;
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

/* RSVP: one step visible at a time, picked by data-estado on the section. */
.confirmacion .pases { color: var(--acento); font-weight: 600; }

.confirmacion .paso { display: none; }

.confirmacion[data-estado="pendiente"] [data-paso="pendiente"],
.confirmacion[data-estado="respuesta"] [data-paso="respuesta"],
.confirmacion[data-estado="confirmado"] [data-paso="confirmado"],
.confirmacion[data-estado="rechazado"] [data-paso="rechazado"],
.confirmacion[data-estado="vista-previa"] [data-paso="vista-previa"] { display: block; }

.confirmacion textarea {
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    display: block;
    padding: 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid color-mix(in srgb, var(--texto) 25%, transparent);
    background: var(--superficie);
    color: var(--texto);
    font: inherit;
}

/* The pass QR (invitacion.js qrSvg): white card with the photos' radius;
   --qr-radio rounds its finder squares (fraction of their side) per estilo. */
body { --qr-radio: 0.3; }

.qr {
    display: block;
    width: fit-content;
    padding: 1.25rem;
    background: #fff;
    border-radius: 1rem;
    margin: 0.5rem auto 1rem;
}

.qr svg { display: block; }

.error { color: #b42318; font-size: 0.9375rem; }

.pie {
    text-align: center;
    padding: 2.5rem 1.5rem;
    font-size: 0.75rem;
    opacity: 0.6;
}

@media (min-width: 720px) {
    /* Photo and text side by side; without a photo the text stays centered like any block. */
    .historia.con-foto { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; text-align: left; max-width: 60rem; }
    .historia .foto-bloque { margin: 0; }
    /* Side by side, capped and centered: one or two places don't stretch nor sit to one side.
       Flex, not grid: the separator before the block (a full-width item) would open empty columns. */
    .lugares { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; max-width: 60rem; }
    .lugares > .tarjeta { flex: 1 1 16rem; max-width: 22rem; }
    .hospedajes { max-width: 60rem; }
    /* Collage: three columns on a wider block, so the photos keep their size. */
    .galeria.con-collage { max-width: 60rem; }
    .galeria-collage { columns: 3; }

    /* Blocks laid out as a grid: the separator drawn before them (estilo or
       sep-*) would land in the first cell; it takes a whole row, centered,
       and the grid's gap stands in for its bottom margin. */
    .lugares::before { flex-basis: 100%; }

    .historia.con-foto::before,
    .lugares::before {
        grid-column: 1 / -1;
        justify-self: center;
        text-align: center;
    }

    .estilo-romantico .historia.con-foto::before,
    body.separador-propio .historia.con-foto::before { margin-bottom: 0 !important; }

    .estilo-romantico .lugares::before,
    body.separador-propio .lugares::before { margin-bottom: 1.25rem !important; }
}

/* ---------- Moderno: clean sans titles, square shapes, strong contrast ---------- */
.estilo-moderno h1,
.estilo-moderno h2 {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.estilo-moderno h2 { font-size: clamp(1.4rem, 5vw, 1.9rem); }

.estilo-moderno .portada h1 { font-size: clamp(2.4rem, 10vw, 4.5rem); letter-spacing: 0.06em; }

.estilo-moderno .portada-frase { font-style: normal; text-transform: uppercase; letter-spacing: 0.3em; font-size: 0.8125rem; }

.estilo-moderno { --qr-radio: 0.08; }

.estilo-moderno .qr,
.estilo-moderno .tarjeta,
.estilo-moderno .cuenta-numeros div,
.estilo-moderno .foto-bloque,
.estilo-moderno .galeria-rejilla img,
.estilo-moderno .hospedaje,
.estilo-moderno .boton,
.estilo-moderno .confirmacion textarea { border-radius: 0; }

.estilo-moderno .tarjeta { box-shadow: none; border: 1px solid color-mix(in srgb, var(--texto) 15%, transparent); }

.estilo-moderno .boton { text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.75rem; }

.estilo-moderno .bloque + .bloque { border-top-width: 2px; }

/* ---------- Script title font (any style): uppercase and letter-spacing break the
   joined letters, and most come in one weight, so a synthetic bold changes the face ---------- */
body.titulo-cursiva h1,
body.titulo-cursiva h2,
body.titulo-cursiva .portada h1,
body.titulo-cursiva .portada-frase {
    text-transform: none;
    letter-spacing: normal;
    font-synthesis: none;
}

body.titulo-cursiva .portada-frase { font-size: clamp(1.25rem, 4.5vw, 1.6rem); }

/* Moderno sizes its titles for uppercase sans; a script reads small there, so it takes Romántico's. */
body.titulo-cursiva.estilo-moderno h2 { font-size: clamp(2.4rem, 8vw, 3.2rem); }

body.titulo-cursiva.estilo-moderno .portada h1 { font-size: clamp(3.4rem, 15vw, 6.5rem); }

/* ---------- Romántico: script titles, soft shapes, ornaments ---------- */
.estilo-romantico h1,
.estilo-romantico h2 { font-weight: 400; }

.estilo-romantico h2 { font-size: clamp(2.4rem, 8vw, 3.2rem); }

.estilo-romantico .portada h1 { font-size: clamp(3.4rem, 15vw, 6.5rem); }

.estilo-romantico .bloque + .bloque { border-top: 0; }

.estilo-romantico .bloque + .bloque::before {
    content: '❦';
    display: block;
    margin: -2rem auto 2.5rem;
    color: var(--acento);
    font-size: 1.5rem;
    opacity: 0.7;
}

.estilo-romantico { --qr-radio: 0.42; }

.estilo-romantico .qr,
.estilo-romantico .tarjeta,
.estilo-romantico .cuenta-numeros div { border-radius: 2rem; }

.estilo-romantico .foto-bloque { border-radius: 50% 50% 1rem 1rem / 30% 30% 1rem 1rem; }

.estilo-romantico .etiqueta { letter-spacing: 0.3em; }

/* Handmade paper, so Romántico reads as a printed invitation even with Esencial's fonts:
   sparse specks, a coarse grain and long fibers, drawn as SVG noise (no image files), in a
   warm low-alpha tint that sits on any of its (light) palettes. The layer that covers a
   fixed cover carries it too. */
body.estilo-romantico,
.estilo-romantico .tras-portada {
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.2 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='4' seed='1' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0 0.26 0 0 0 0.13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='500' height='500'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.008 0.25' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0 0.26 0 0 0 0.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* The sheet's edges, a little darker. Fixed, over everything, never in the way of a tap.
   As tall as the screen with the address bar hidden (lvh), not inset: 0: phones resize a
   fixed layer only after the scroll ends, so its bottom edge flashed where the bar was. */
body.estilo-romantico::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100lvh;
    z-index: 50;
    pointer-events: none;
    box-shadow: inset 0 0 120px rgb(110 80 50 / 0.22);
}

/* Cards printed on the paper: a fine accent line just inside the edge, and a soft shadow. */
.estilo-romantico .tarjeta {
    box-shadow: 0 1px 2px rgb(80 60 40 / 0.08), 0 6px 18px rgb(80 60 40 / 0.07);
    outline: 1px solid color-mix(in srgb, var(--acento) 35%, transparent);
    outline-offset: -8px;
}

/* ---------- Separators chosen by the owner (tema.separador) ----------
   body.separador-propio drops the estilo's own, then sep-{clave} draws one.
   "auto" adds neither class and keeps the estilo's. */
body.separador-propio .bloque + .bloque { border-top: 0; }

body.separador-propio .bloque + .bloque::before { content: none; }

body.sep-linea .bloque + .bloque { border-top: 1px solid color-mix(in srgb, var(--texto) 18%, transparent); }

body.sep-ornamento .bloque + .bloque::before,
body.sep-punto .bloque + .bloque::before,
body.sep-onda .bloque + .bloque::before,
body.sep-tema .bloque + .bloque::before {
    content: '';
    display: block;
    margin: -2rem auto 2.5rem;
}

body.sep-ornamento .bloque + .bloque::before {
    content: '❦';
    color: var(--acento);
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.7;
}

body.sep-punto .bloque + .bloque::before {
    width: 10rem;
    height: 7px;
    background:
        radial-gradient(circle, var(--acento) 3px, transparent 3.5px) center / 7px 7px no-repeat,
        linear-gradient(to right, transparent, color-mix(in srgb, var(--acento) 60%, transparent) 30% 42%, transparent 42% 58%, color-mix(in srgb, var(--acento) 60%, transparent) 58% 70%, transparent) center / 100% 1px no-repeat;
}

body.sep-onda .bloque + .bloque::before {
    width: 9rem;
    height: 12px;
    background: var(--acento);
    opacity: 0.75;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M0 6q7.5-6 15 0t15 0 15 0 15 0 15 0 15 0 15 0 15 0' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M0 6q7.5-6 15 0t15 0 15 0 15 0 15 0 15 0 15 0 15 0' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

body.sep-tema .bloque + .bloque::before {
    width: 1.9rem;
    height: 1.9rem;
    background: var(--acento);
    opacity: 0.8;
    -webkit-mask: var(--sep-icono) center / contain no-repeat;
    mask: var(--sep-icono) center / contain no-repeat;
}
