/*
 * Temporada navideña: pop-up de promoción, nieve, guirnalda de luces y
 * accesos a la promoción. Todo vive en este archivo y en navidad.js;
 * para retirar la temporada basta con quitar sus etiquetas de index.html.
 *
 * Rendimiento: todas las animaciones son solo de transform u opacity
 * (las hace la GPU, sin repintar la página). Nada de canvas por cuadro,
 * backdrop-filter, ni sombras o fondos animados.
 */

:root {
    --xmas-red: #B3122E;
    --xmas-red-deep: #6E0A1B;
    --xmas-gold: #E3CE93;
}

/* ---------- Nieve (copos de CSS) ---------- */
.xmas-snow {
    position: fixed;
    inset: 0;
    z-index: 38;               /* debajo del navbar (40) y del WhatsApp (45) */
    overflow: hidden;
    pointer-events: none;
    contain: strict;
}
html.xmas-open body > .xmas-snow--page { display: none; }   /* con el pop-up abierto, solo nieva dentro */

.xmas-flake {
    position: absolute;
    top: -12px;
    left: var(--x);
    width: var(--s);
    height: var(--s);
    border-radius: 50%;
    background: radial-gradient(circle, #fff 45%, rgba(255, 255, 255, 0) 72%);
    opacity: var(--o);
    will-change: transform;
    animation: xmas-fall var(--t) linear var(--d) infinite;
}
.xmas-snow--page .xmas-flake {   /* sobre fondo claro: un halo azul grisáceo para que se vea */
    background: radial-gradient(circle, #fff 38%, rgba(125, 150, 180, .55) 58%, rgba(125, 150, 180, 0) 74%);
}
@keyframes xmas-fall {
    0%   { transform: translate3d(0, 0, 0); }
    25%  { transform: translate3d(var(--w), 27vh, 0); }
    50%  { transform: translate3d(0, 54vh, 0); }
    75%  { transform: translate3d(calc(var(--w) * -1), 81vh, 0); }
    100% { transform: translate3d(0, 108vh, 0); }
}

/* ---------- Guirnalda de luces bajo el navbar ---------- */
.xmas-lights {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 22px;
    overflow: hidden;
    pointer-events: none;
    contain: strict;
    /* El cable: una curva cada 48px; navidad.js cuelga una bombilla en el centro de cada una. */
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12'%3E%3Cpath d='M0 1Q24 13 48 1' fill='none' stroke='%231C1A16' stroke-opacity='.4'/%3E%3C/svg%3E") 0 0 / 48px 12px repeat-x;
}
.xmas-bulb {
    position: absolute;
    top: 7px;
    margin-left: -3.5px;
    width: 7px;
    height: 10px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--c);
    box-shadow: 0 0 6px 1px var(--c);     /* fija: solo se anima la opacidad */
    animation: xmas-twinkle 2.4s ease-in-out var(--d, 0s) infinite;
}
.xmas-bulb::before {          /* casquillo */
    content: '';
    position: absolute;
    left: 1.5px;
    top: -3px;
    width: 4px;
    height: 3px;
    border-radius: 1px;
    background: #8A7A55;
}
@keyframes xmas-twinkle {
    0%, 100% { opacity: 1; }
    50%      { opacity: .3; }
}

/* ---------- Etiqueta navideña en el hero ---------- */
.xmas-chip {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1rem;
    padding: .4rem .9rem .4rem .45rem;
    border: 1px solid rgba(179, 18, 46, .25);
    border-radius: 999px;
    background: rgba(255, 255, 255, .92);
    color: var(--xmas-red-deep);
    font-size: .8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .3s, background-color .3s, transform .3s;
}
.xmas-chip:hover { border-color: var(--xmas-red); background: #fff; }
.xmas-chip:active { transform: scale(.97); }
.xmas-chip__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--xmas-red);
    color: #fff;
}
.xmas-chip svg { width: .9rem; height: .9rem; }

/* ---------- Botón flotante para reabrir la promoción ---------- */
.xmas-fab {
    position: fixed;
    left: 1.25rem;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    z-index: 45;
    display: flex;
    align-items: center;
    gap: .55rem;
    height: 3.5rem;
    padding: 0 1.1rem 0 .45rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--xmas-red), var(--xmas-red-deep));
    color: #fff;
    font: 500 .875rem/1 'Jost', system-ui, sans-serif;
    box-shadow: 0 10px 25px -8px rgba(110, 10, 27, .55);
    cursor: pointer;
    transition: transform .4s cubic-bezier(.32, .72, 0, 1);
}
.xmas-fab:hover { transform: translateY(-2px); }
.xmas-fab:active { transform: scale(.96); }
.xmas-fab__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
}
.xmas-fab svg { width: 1.25rem; height: 1.25rem; }
@media (max-width: 639px) {
    .xmas-fab { padding: 0; width: 3.5rem; justify-content: center; }
    .xmas-fab__label { display: none; }
    .xmas-fab__icon { background: none; }
}

/* ---------- Pop-up de promoción ---------- */
.xmas-dialog {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    overflow: hidden;
    outline: none;
}
.xmas-dialog::backdrop { background: transparent; }
.xmas-dialog[open] { display: block; }

/* Sin fondo: la página se ve tal cual detrás; el velo solo recibe el clic para cerrar. */
.xmas-dialog__veil {
    position: absolute;
    inset: 0;
    background: transparent;
}
.xmas-dialog .xmas-snow { position: absolute; z-index: 0; }

.xmas-dialog__scroll {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: max(3.5rem, env(safe-area-inset-top)) 16px max(1.5rem, env(safe-area-inset-bottom));
    overflow-x: hidden;        /* los rayos y el halo salen del adorno: que no generen scroll lateral */
    overflow-y: auto;
}
.xmas-dialog__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 34rem;
    text-align: center;
    animation: xmas-pop .6s cubic-bezier(.32, .72, 0, 1) both;
}

/* Halo de luz cálida detrás del título y la bola: aclara la página para que todo se lea. Estático. */
.xmas-dialog__halo {
    position: absolute;
    left: 50%;
    top: 52%;
    z-index: -1;
    width: 195%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(255, 251, 240, .98) 0%, rgba(255, 250, 238, .97) 60%, rgba(255, 246, 226, .8) 76%, rgba(255, 244, 220, 0) 100%);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.xmas-dialog__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .32em;
    text-transform: uppercase;
    color: var(--xmas-red);
}
.xmas-dialog__eyebrow::before,
.xmas-dialog__eyebrow::after {
    content: '';
    width: 1.75rem;
    height: 1px;
    background: currentColor;
    opacity: .6;
}
.xmas-dialog__title {
    margin: .5rem 0 1rem;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2rem, 1.2rem + 3.6vw, 3.4rem);
    line-height: 1.05;
    /* Dorado oscuro: sobre el halo claro el dorado pálido no se leía. */
    background: linear-gradient(180deg, #C9A227 0%, #A6831A 45%, #6E5208 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .9)) drop-shadow(0 6px 14px rgba(166, 131, 26, .25));
}

.xmas-dialog__figure {
    position: relative;
    width: min(100%, 32rem, calc(100dvh - 12.5rem));
    min-width: 17rem;
    aspect-ratio: 1;
    margin: 0;
    isolation: isolate;        /* el aura (z-index -1) queda detrás de la bola, no detrás de la página */
}

/* La bola: cuelga de su argolla y se balancea apenas. */
.xmas-ornament {
    position: relative;
    width: 100%;
    height: 100%;
    transform-origin: 50% 1%;
    isolation: isolate;
    animation: xmas-sway 6s ease-in-out infinite;
}
.xmas-ornament img {
    display: block;
    width: 100%;
    height: 100%;
    /* Borde de luz dorada + sombra suave. Fija: no se anima (el filtro se pinta una sola vez). */
    filter: drop-shadow(0 0 10px rgba(255, 214, 120, .85)) drop-shadow(0 18px 28px rgba(110, 60, 10, .28));
}
@keyframes xmas-sway {
    0%, 100% { transform: rotate(-1.6deg); }
    50%      { transform: rotate(1.6deg); }
}

/* Luz detrás de la bola: resplandor que respira, rayos que giran y destellos. */
.xmas-aura {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
/* Todas las capas se centran en el centro del vidrio de la bola: 50 % / 60 % del adorno. */
.xmas-aura__fill,
.xmas-aura__glow,
.xmas-aura__rays {
    position: absolute;
    left: 50%;
    top: 60%;
    aspect-ratio: 1;
    border-radius: 50%;
    translate: -50% -50%;
}
/* Luz sólida dentro del vidrio: la bola es semitransparente y dejaba ver la página. */
.xmas-aura__fill {
    width: 92%;
    background: radial-gradient(closest-side, #FFFDF7 60%, #FFF4D6 100%);
}
.xmas-aura__glow {
    width: 128%;
    background: radial-gradient(closest-side, rgba(255, 223, 140, .9) 62%, rgba(255, 210, 110, .4) 80%, rgba(255, 210, 110, 0) 100%);
    animation: xmas-breathe 4s ease-in-out infinite;
}
.xmas-aura__rays {
    width: 185%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 196, 80, .38) 0deg 4deg, rgba(255, 196, 80, 0) 4deg 15deg);
    -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
    mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
    animation: xmas-spin 50s linear infinite;
}
.xmas-spark {
    position: absolute;
    width: var(--s);
    height: var(--s);
    margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
    background: radial-gradient(closest-side, #fff 0%, #FFE7A3 40%, rgba(255, 231, 163, 0) 100%);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    animation: xmas-sparkle 2.6s ease-in-out var(--d) infinite;
}
@keyframes xmas-breathe {
    0%, 100% { opacity: .75; transform: scale(.97); }
    50%      { opacity: 1;   transform: scale(1.04); }
}
@keyframes xmas-spin { to { transform: rotate(1turn); } }
@keyframes xmas-sparkle {
    0%, 100% { opacity: 0; transform: scale(.3) rotate(0); }
    50%      { opacity: 1; transform: scale(1) rotate(45deg); }
}
/* Hueco blanco del adorno: entre el 49 % y el 76 % de la altura. */
.xmas-dialog__cta-wrap {
    position: absolute;
    left: 50%;
    top: 64%;
    transform: translate(-50%, -50%);
    isolation: isolate;
}

/*
 * Botón con borde arcoíris (versión CSS del componente rainbow-borders-button).
 * El arcoíris es un gradiente cónico que GIRA (transform) dentro de un marco
 * recortado, en vez de mover background-position, que repintaba cada cuadro.
 */
.rainbow-border {
    position: relative;
    display: inline-flex;
    padding: 2px;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    isolation: isolate;
    transition: transform .2s ease;
}
.rainbow-border::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: -1;
    width: 300%;
    aspect-ratio: 1;
    background: conic-gradient(#fb0094, #0000ff, #00ff00, #ffff00, #ff0000, #fb0094);
    transform: translate(-50%, -50%);
    animation: rainbow-spin 4s linear infinite;
}
.rainbow-border__glow {        /* resplandor fijo, sin animación */
    position: absolute;
    inset: -6px;
    z-index: -1;
    border-radius: 18px;
    background: linear-gradient(45deg, #fb0094, #0000ff, #00ff00, #ffff00, #ff0000);
    filter: blur(14px);
    opacity: .55;
}
.rainbow-border__inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    min-width: 9rem;
    height: 2.9rem;
    padding: 0 1.4rem;
    border-radius: 12px;
    background: #000;
    color: #fff;
    font: 600 clamp(.85rem, .78rem + .3vw, 1rem)/1 'Jost', system-ui, sans-serif;
    letter-spacing: .02em;
    white-space: nowrap;
}
.rainbow-border:hover { transform: translateY(-1px); }
.rainbow-border:active { transform: scale(.97); }
.rainbow-border:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.rainbow-border svg { width: 1.1rem; height: 1.1rem; }
@keyframes rainbow-spin {
    to { transform: translate(-50%, -50%) rotate(1turn); }
}

.xmas-dialog__note {
    margin-top: .9rem;
    font-size: .8125rem;
    font-weight: 500;
    color: #524B42;
}

/* Junto al lado derecho de la bola, en el hueco vacío sobre el aro (el aro pasa por x≈79 % a esa altura). */
.xmas-dialog__close {
    position: absolute;
    left: 92%;
    top: 17%;
    translate: -50% -50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid #E7E1D5;
    border-radius: 999px;
    background: #fff;
    color: #1C1A16;
    box-shadow: 0 6px 18px -6px rgba(28, 26, 22, .35);
    cursor: pointer;
    transition: background-color .25s, transform .25s;
}
.xmas-dialog__close:hover { background: #FBF6E9; transform: rotate(90deg); }
.xmas-dialog__close:focus-visible { outline: 2px solid #A6831A; outline-offset: 2px; }
.xmas-dialog__close svg { width: 1.25rem; height: 1.25rem; }

.xmas-dialog.is-closing .xmas-dialog__panel { animation: xmas-out .25s ease both; }

html.xmas-open { overflow: hidden; }

@keyframes xmas-fade { from { opacity: 0; } }
@keyframes xmas-pop  { from { opacity: 0; transform: translateY(18px) scale(.94); } }
@keyframes xmas-out  { to   { opacity: 0; transform: scale(.98); } }

@media (prefers-reduced-motion: reduce) {
    .xmas-snow { display: none; }
    .xmas-bulb, .rainbow-border::before, .xmas-dialog__panel,
    .xmas-ornament, .xmas-aura__glow, .xmas-aura__rays { animation: none !important; }
    .xmas-spark { animation: none !important; opacity: .8; }
}

@media print {
    .xmas-snow, .xmas-lights, .xmas-fab, .xmas-chip, .xmas-dialog { display: none !important; }
}
