@font-face { font-family: 'Gelasio'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/gelasio-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Gelasio'; font-weight: 400; font-style: italic; font-display: swap; src: url('../fonts/gelasio-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Gelasio'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/gelasio-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF; }
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/inter-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+1E00-1EFF; }

:root {
    --rojo: #A6192E;
    --rojo-vivo: #C8102E;
    --tinta: #2D2926;
    --gris: #57534E;
    --fondo: #F1F1F0;
    --noche: #2A1B20;
    --noche-2: #1A1014;
    --crema: #F4ECE1;
    --oro: #D9AE5B;
    --serif: 'Gelasio', Georgia, 'Times New Roman', serif;
    --sans: 'Inter', Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    min-height: 100svh;
    background:
        radial-gradient(120% 70% at 50% 0%, #4A2630 0%, rgba(74, 38, 48, 0) 60%),
        linear-gradient(180deg, var(--noche) 0%, var(--noche-2) 100%);
    background-attachment: fixed;
    color: var(--crema);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--oro); outline-offset: 3px; border-radius: 4px; }

.nieve { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* Cabecera */
.cabecera {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    padding: max(18px, env(safe-area-inset-top)) clamp(18px, 4vw, 40px) 0;
}
.cabecera__logo { height: 16px; width: auto; opacity: .92; }
.cabecera__acciones { display: flex; align-items: center; gap: 10px; }
.musica {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    border: 1px solid rgba(244, 236, 225, .22); background: transparent; border-radius: 999px;
    padding: 6px 12px 6px 9px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: rgba(244, 236, 225, .75); transition: background .2s, color .2s, border-color .2s;
}
.musica svg { width: 16px; height: 16px; }
.musica .musica__on { display: none; }
.musica[aria-pressed="true"] { color: var(--noche); background: var(--oro); border-color: var(--oro); }
.musica[aria-pressed="true"] .musica__on { display: block; }
.musica[aria-pressed="true"] .musica__off { display: none; }
.musica.invita { animation: invitar 2.4s ease-in-out 3s 4; }
@keyframes invitar { 0%, 100% { border-color: rgba(244, 236, 225, .22); } 50% { border-color: var(--oro); color: #fff; } }
.idioma { display: flex; gap: 2px; border: 1px solid rgba(244, 236, 225, .22); border-radius: 999px; padding: 3px; }
.idioma button {
    border: 0; background: transparent; cursor: pointer;
    font-size: 11px; font-weight: 600; letter-spacing: .08em;
    padding: 5px 10px; border-radius: 999px; color: rgba(244, 236, 225, .6);
    transition: background .2s, color .2s;
}
.idioma button[aria-pressed="true"] { background: var(--crema); color: var(--noche); }

/* Escena */
.escena {
    position: relative; z-index: 1;
    min-height: calc(100svh - 56px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: clamp(8px, 2.2svh, 26px);
    padding: clamp(10px, 2svh, 24px) clamp(14px, 4vw, 40px) max(20px, env(safe-area-inset-bottom));
}
.portada { text-align: center; }
.cuarenta { display: block; height: clamp(86px, 17svh, 168px); width: auto; margin: 0 auto 6px; overflow: visible; }
.cuarenta__trazo, .cuarenta__leyenda path {
    fill: var(--crema); fill-opacity: 0;
    stroke: var(--crema); stroke-width: 1.6; stroke-dasharray: 1; stroke-dashoffset: 1;
    vector-effect: non-scaling-stroke;
}
.cuarenta__leyenda path { stroke: none; fill-opacity: 0; }
.cuarenta__leyenda:not(.activa) { display: none; }
.listo .cuarenta__trazo { animation: dibujar 1.6s cubic-bezier(.6, 0, .3, 1) forwards, rellenar .8s 1.2s ease forwards; }
.listo #cero { animation-delay: .25s, 1.4s; }
.listo .cuarenta__leyenda path { animation: rellenar .8s 1.5s ease forwards; }
@keyframes dibujar { to { stroke-dashoffset: 0; } }
@keyframes rellenar { to { fill-opacity: 1; stroke-opacity: 0; } }

.titulo {
    font-family: var(--serif); font-weight: 400;
    font-size: clamp(26px, 4.4vw, 46px); line-height: 1.1; letter-spacing: -.01em;
    margin: 0; color: #fff;
    opacity: 0; transform: translateY(8px);
}
.indicacion {
    margin: 10px auto 0; max-width: 34em;
    font-size: clamp(13px, 1.5vw, 15px); line-height: 1.5; color: rgba(244, 236, 225, .68);
    opacity: 0; transform: translateY(8px);
}
.listo .titulo { animation: aparecer .8s .6s ease forwards; }
.listo .indicacion { animation: aparecer .8s .8s ease forwards; }
@keyframes aparecer { to { opacity: 1; transform: none; } }

/* Guirnalda */
.guirnalda {
    width: min(100%, 940px, max(300px, calc((100svh - 400px) * var(--proporcion, 2.2))));
    opacity: 0;
}
.listo .guirnalda { animation: aparecer .9s 1s ease forwards; }
.guirnalda__svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.cable { fill: none; stroke: #6B5258; stroke-width: 2; stroke-linecap: round; }
.foco { cursor: pointer; outline: none; }
.foco__zona { fill: transparent; }
.foco__casquillo { fill: #5C4A4F; }
.foco__vidrio { fill: rgba(255, 255, 255, .07); stroke: rgba(255, 255, 255, .2); stroke-width: 1; transition: fill .35s, stroke .35s; }
.foco__brillo { fill: #fff; opacity: .18; }
.foco__halo { opacity: 0; transition: opacity .5s; }
.foco__cuerpo { transform-box: fill-box; transform-origin: 50% 0; }
.foco.encendido .foco__vidrio { fill: var(--color); stroke: var(--color); }
.foco.encendido .foco__halo { opacity: 1; }
.foco.encendido .foco__cuerpo { animation: prender .5s ease-out; }
.foco:focus-visible .foco__vidrio { stroke: var(--oro); stroke-width: 2.5; }
@keyframes prender { 0% { transform: rotate(0); } 35% { transform: rotate(9deg); } 70% { transform: rotate(-5deg); } 100% { transform: rotate(0); } }
.completa .foco.encendido .foco__halo { animation: titilar 2.4s ease-in-out infinite; animation-delay: var(--retraso); }
@keyframes titilar { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Estado */
.estado { width: min(100%, 620px); text-align: center; opacity: 0; }
.listo .estado { animation: aparecer .9s 1.2s ease forwards; }
.deseo { min-height: 1.5em; margin: 0 0 14px; font-family: var(--serif); font-style: italic; font-size: clamp(17px, 2.2vw, 22px); color: #fff; }
.deseo__num { font-family: var(--sans); font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--oro); margin-right: 10px; vertical-align: 2px; }
.deseo.cambia .deseo__texto { animation: aparecer .5s ease both; }
.estado__fila { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.contador { display: flex; align-items: center; gap: 10px; font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(244, 236, 225, .7); }
.contador__barra { width: 120px; height: 2px; background: rgba(244, 236, 225, .15); border-radius: 2px; overflow: hidden; }
.contador__relleno { display: block; height: 100%; width: 0; background: var(--oro); transition: width .3s ease; }
.enlace {
    border: 0; background: none; padding: 6px 2px; cursor: pointer;
    font-size: 12px; letter-spacing: .04em; color: rgba(244, 236, 225, .7);
    text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(244, 236, 225, .3);
}
.enlace:hover { color: #fff; }
.completa .enlace[data-accion="todas"] { visibility: hidden; }

/* Final: esfera */
.final { position: fixed; inset: 0; z-index: 10; }
.final[hidden] { display: none; }
.final__velo { position: absolute; inset: 0; background: rgba(20, 10, 14, .72); opacity: 0; transition: opacity 1.2s ease; backdrop-filter: blur(2px); }
.final.velado .final__velo { opacity: 1; }
.esfera {
    position: absolute; padding: 0; border: 0; background: none; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.esfera:focus-visible { outline-offset: 8px; border-radius: 50%; }
.esfera__mecedor { display: block; width: 100%; height: 100%; transform-origin: 50% 0; }
.esfera__mecedor svg { display: block; width: 100%; height: 100%; overflow: visible; }
.final.colgada .esfera__mecedor { animation: mecer 4.5s ease-in-out infinite; }
@keyframes mecer { 0%, 100% { transform: rotate(2.2deg); } 50% { transform: rotate(-2.2deg); } }
.esfera__cuatro, .esfera__cero {
    fill: url(#g-oro); fill-opacity: 0;
    stroke: #E9C987; stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: 1;
}
.final.colgada .esfera__cuatro, .final.colgada .esfera__cero { animation: dibujar 1.3s .1s cubic-bezier(.6, 0, .3, 1) forwards, rellenar .8s 1.1s ease forwards; }
.final.colgada .esfera__cero { animation-delay: .4s, 1.4s; }
.esfera:hover .esfera__mecedor svg { filter: drop-shadow(0 0 24px rgba(229, 56, 79, .35)); }
.final__pista {
    position: absolute; left: 0; right: 0; bottom: max(8svh, 40px); margin: 0; text-align: center;
    font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: rgba(244, 236, 225, .75);
    opacity: 0; transition: opacity .8s ease .4s;
}
.final.colgada .final__pista { opacity: 1; animation: respirar 2.6s ease-in-out 1.2s infinite; }
@keyframes respirar { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* Mensaje */
.mensaje {
    position: fixed; inset: 0; z-index: 20; overflow-y: auto;
    display: grid; place-items: center; padding: 20px;
    background: var(--rojo);
    background-image: radial-gradient(90% 70% at 50% 10%, #B92036 0%, var(--rojo) 55%, #7E1222 100%);
}
.mensaje[hidden] { display: none; }
.mensaje__tarjeta {
    position: relative; width: min(100%, 560px);
    background: var(--fondo); color: var(--tinta);
    padding: clamp(40px, 7vw, 64px) clamp(24px, 6vw, 60px) clamp(32px, 5vw, 48px);
    text-align: center;
    box-shadow: 0 30px 80px rgba(40, 0, 10, .35);
}
.mensaje__tarjeta::before {
    content: ''; position: absolute; inset: 10px; border: 1px solid rgba(166, 25, 46, .25); pointer-events: none;
}
.mensaje__cerrar {
    position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; display: grid; place-items: center;
    border: 0; background: none; color: var(--gris); cursor: pointer; border-radius: 50%; z-index: 1;
}
.mensaje__cerrar:hover { background: rgba(45, 41, 38, .06); color: var(--tinta); }
.mensaje__cerrar svg { width: 20px; height: 20px; }
.mensaje__logo { display: block; width: min(100%, 300px); height: auto; margin: 0 auto 30px; }
.mensaje__logo path { fill: var(--rojo); }
.mensaje__logo .leyenda-otra { display: none; }
.mensaje__antetitulo { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gris); }
.mensaje__titulo { margin: 0 0 20px; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 6vw, 48px); line-height: 1.05; color: var(--rojo); }
.mensaje__texto { margin: 0 auto 14px; max-width: 30em; font-size: 16px; line-height: 1.65; color: var(--tinta); }
.mensaje__firma { margin: 26px 0 30px; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--rojo); }
.boton {
    display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
    border: 1px solid var(--rojo); background: transparent; color: var(--rojo);
    padding: 11px 20px; border-radius: 999px; font-size: 13px; font-weight: 500;
    transition: background .2s, color .2s;
}
.boton:hover { background: var(--rojo); color: #fff; }
.boton svg { width: 16px; height: 16px; }
.compartir { margin: 0 0 22px; padding-top: 22px; border-top: 1px solid rgba(166, 25, 46, .15); }
.compartir__titulo { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gris); }
.compartir__botones { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.compartir__boton {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer; text-decoration: none;
    border: 1px solid rgba(166, 25, 46, .35); background: transparent; color: var(--rojo);
    padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
    transition: background .2s, color .2s, border-color .2s;
}
.compartir__boton[hidden] { display: none; }
.compartir__boton:hover { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.compartir__boton--wa { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.compartir__boton--wa:hover { background: #8A1426; }
.compartir__boton svg { width: 18px; height: 18px; flex: none; }
.compartir__aviso { min-height: 1.2em; margin: 10px 0 0; font-size: 12px; color: var(--gris); }
.enlace--oscuro { display: inline-flex; align-items: center; gap: 6px; color: var(--gris); text-decoration-color: rgba(87, 83, 78, .35); font-size: 13px; }
.enlace--oscuro:hover { color: var(--rojo); }
.enlace--oscuro svg { width: 15px; height: 15px; }
@media (max-width: 420px) {
    .compartir__boton { padding: 9px 12px; }
}
.mensaje .aparece { opacity: 0; transform: translateY(10px); }
.mensaje.abierto .aparece { animation: aparecer .8s ease forwards; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .final.colgada .esfera__mecedor { animation: none; }
}

@media (max-width: 420px) {
    .musica { padding: 7px; }
    .musica span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
