/* =========================================================
   SaucedoCode — Tema de temporada: Navidad progresiva 🎄
   Solo aplica cuando <html> tiene la clase .navidad (la pone navidad.js).
   --nv     intensidad general (0.15 el 16 nov → 1 el 24 dic)
   --nv-cap cantidad de nieve acumulada (0 → 1)
   ========================================================= */

html.navidad {
    --nv-ice: #BAE6FD;
    --nv-red: #EF4444;
    --nv-green: #22C55E;
    --nv-gold: #FCD34D;
}

/* ---------- Paleta por etapa ---------- */
html.navidad .blob-1 { background: #1E3A8A; }
html.navidad .blob-3 { background: #0EA5E9; opacity: calc(0.18 + var(--nv) * 0.12); }
html.navidad[data-theme="light"] .blob-3 { background: #BAE6FD; }

html.nv-adviento { --grad: linear-gradient(120deg, #5B6EF5, #38BDF8 55%, #E0F2FE); }
html.nv-adviento[data-theme="light"] { --grad: linear-gradient(120deg, #4B5BE0, #0EA5E9 60%, #38BDF8); }

html.nv-posadas { --grad: linear-gradient(120deg, #DC2626, #A855F7 50%, #FBBF24); }
html.nv-posadas .blob-2 { background: #B91C1C; opacity: 0.26; }

html.nv-navidad { --grad: linear-gradient(120deg, #DC2626, #F59E0B 50%, #16A34A); --color-accent: var(--nv-gold); }
html.nv-navidad .blob-2 { background: #B91C1C; opacity: 0.3; }
html.nv-navidad .blob-3 { background: #15803D; }

html.nv-deshielo { --grad: linear-gradient(120deg, #5B6EF5, #A855F7 50%, #FCD34D); }

/* Punto del logo: destello de hielo (o dorado en Navidad) */
html.navidad .logo-dot {
    background: none;
    -webkit-text-fill-color: var(--nv-ice);
    color: var(--nv-ice);
    text-shadow: 0 0 12px rgba(186, 230, 253, 0.9);
    animation: nv-twinkle 3.4s ease-in-out infinite;
}
html.nv-navidad .logo-dot, html.nv-posadas .logo-dot {
    -webkit-text-fill-color: var(--nv-gold);
    color: var(--nv-gold);
    text-shadow: 0 0 14px rgba(252, 211, 77, 0.9);
}

/* ---------- Nieve ---------- */
.nv-snow {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Nieve acumulada sobre tarjetas y footer (crece con --nv-cap) */
html.navidad .glass-card,
html.navidad .footer { position: relative; }
html.navidad .glass-card::after,
html.navidad .footer::after {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: calc(var(--nv-cap) * 16px);
    pointer-events: none;
    z-index: 2;
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 16' preserveAspectRatio='none'%3E%3Cpath d='M0 0H120V7C112 7 108 12 100 11C92 10 90 6 80 7C70 8 68 13 58 12C48 11 46 6 36 7C26 8 22 12 14 11C8 10 4 7 0 8Z' fill='white'/%3E%3C/svg%3E") repeat-x top / 160px 100%;
    filter: drop-shadow(0 2px 2px rgba(56, 120, 200, 0.25));
    opacity: 0.92;
}
html.navidad[data-theme="light"] .glass-card::after,
html.navidad[data-theme="light"] .footer::after {
    filter: drop-shadow(0 2px 3px rgba(56, 120, 200, 0.45));
}

/* ---------- Cuenta regresiva ---------- */
.nv-countdown {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    margin-top: 2.2rem;
    padding: 1.2rem 1.8rem 1rem;
    border-radius: var(--radius);
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 1s forwards;
}
.nv-cd-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.nv-cd-done .nv-cd-label {
    font-size: 1.5rem;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nv-cd-done .nv-cd-units { display: none; }
.nv-cd-units { display: flex; gap: 0.7rem; }
.nv-cd-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 66px;
    padding: 0.55rem 0.4rem 0.45rem;
    border-radius: var(--radius-sm);
    background: rgba(186, 230, 253, 0.06);
    border: 1px solid rgba(186, 230, 253, 0.16);
    overflow: hidden;
}
[data-theme="light"] .nv-cd-unit { background: rgba(14, 165, 233, 0.06); border-color: rgba(14, 165, 233, 0.2); }
.nv-cd-num {
    display: block;
    font-size: 1.9rem;
    font-weight: 600;
    line-height: 1.1;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nv-cd-num.tick { animation: nv-tick 0.45s cubic-bezier(.2, .8, .3, 1.2); }
.nv-cd-lbl { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.nv-snow-btn {
    font: inherit;
    font-size: 0.78rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}
.nv-snow-btn:hover { color: var(--text); border-color: var(--nv-ice); }
.nv-snow-btn[aria-pressed="false"] { opacity: 0.7; }

/* ---------- Series de luces ---------- */
.nv-lights {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -13px;
    height: 16px;
    display: flex;
    pointer-events: none;
}
.nv-bulb { position: relative; flex: 1; }
.nv-bulb::before {               /* cable */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -9px;
    height: 14px;
    border-bottom: 1.5px solid rgba(148, 163, 184, 0.45);
    border-radius: 0 0 50% 50%;
}
.nv-bulb::after {                /* foco */
    content: "";
    position: absolute;
    left: 50%;
    top: 4px;
    width: 7px;
    height: 11px;
    margin-left: -3.5px;
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    background: var(--c);
    box-shadow: 0 0 6px 1px var(--c), 0 0 14px var(--c);
    animation: nv-bulb 2.4s ease-in-out infinite;
    animation-delay: inherit;
}
.nv-bulb.c0 { --c: #7DD3FC; }
.nv-bulb.c1 { --c: #FCD34D; }
.nv-bulb.c2 { --c: #E0F2FE; }
.nv-bulb.c3 { --c: #A5B4FC; }
html.nv-posadas .nv-bulb.c0, html.nv-navidad .nv-bulb.c0 { --c: #EF4444; }
html.nv-posadas .nv-bulb.c2, html.nv-navidad .nv-bulb.c2 { --c: #22C55E; }
html.nv-posadas .nv-bulb.c3, html.nv-navidad .nv-bulb.c3 { --c: #60A5FA; }

/* ---------- Muñeco de nieve ---------- */
.nv-snowman {
    position: fixed;
    left: 14px;
    bottom: 8px;
    width: 78px;
    height: 112px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 900;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
    transform-origin: 50% 100%;
    animation: nv-rise 0.9s cubic-bezier(.2, .8, .3, 1.2) 1.4s backwards;
}
.nv-snowman svg { width: 100%; height: 100%; overflow: visible; }
.nv-snowman:hover { transform: scale(1.06); transition: transform 0.2s; }
.nv-snowman:focus-visible { outline: 2px solid var(--nv-ice); outline-offset: 4px; border-radius: 12px; }
.nv-snowman.jiggle { animation: nv-jiggle 0.5s ease-in-out; }
.nv-snowman .nv-new { transform-box: fill-box; transform-origin: 50% 100%; animation: nv-pop 0.8s cubic-bezier(.2, .8, .3, 1.4) 2.2s both; }
.nv-snowman.wave .nv-arm-r { transform-box: fill-box; transform-origin: 0% 100%; animation: nv-wave 1.2s ease-in-out infinite; }

/* ---------- Árbol de Navidad ---------- */
.nv-tree {
    position: fixed;
    right: 14px;
    bottom: 6px;
    width: 92px;
    height: 130px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 900;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
    transform-origin: 50% 100%;
    animation: nv-rise 0.9s cubic-bezier(.2, .8, .3, 1.2) 1.7s backwards;
}
.nv-tree svg { width: 100%; height: 100%; overflow: visible; }
.nv-tree:hover { transform: scale(1.06); transition: transform 0.2s; }
.nv-tree:focus-visible { outline: 2px solid var(--nv-gold); outline-offset: 4px; border-radius: 12px; }
.nv-tree .nv-new { transform-box: fill-box; transform-origin: 50% 50%; animation: nv-pop 0.8s cubic-bezier(.2, .8, .3, 1.4) 2.6s both; }
.nv-tl { fill: var(--c); animation: nv-tl 2s ease-in-out infinite; }
.nv-tl.c0 { --c: #FCD34D; } .nv-tl.c1 { --c: #EF4444; } .nv-tl.c2 { --c: #7DD3FC; } .nv-tl.c3 { --c: #F9A8D4; }
.nv-tree.party .nv-tl { animation: nv-tl 0.25s ease-in-out 6; }
.nv-tree.party { animation: nv-jiggle 0.5s ease-in-out; }
.nv-star-glow { transform-box: fill-box; transform-origin: center; animation: nv-glow 2.6s ease-in-out infinite; }
.nv-tree.shine .nv-star-glow { animation-duration: 1.2s; }

/* ---------- Santa y sus renos ---------- */
.nv-santa {
    position: fixed;
    left: 0;
    width: 300px;
    height: 91px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 950;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}
.nv-santa svg { width: 100%; height: 100%; overflow: visible; }
.nv-santa.rtl svg { transform: scaleX(-1); }
.nv-bob { animation: nv-bob 0.7s ease-in-out infinite alternate; }
.nv-rudolph { filter: drop-shadow(0 0 3px #EF4444) drop-shadow(0 0 6px #EF4444); animation: nv-twinkle 1s ease-in-out infinite; }
.nv-trail circle { fill: #FDE68A; animation: nv-twinkle 0.6s ease-in-out infinite; }
.nv-trail circle:nth-child(2n) { animation-delay: -0.3s; fill: #fff; }
.nv-gift {
    position: fixed;
    font-size: 28px;
    line-height: 1;
    pointer-events: none;
    z-index: 9998;
}

/* Bola de nieve y salpicadura */
.nv-ball {
    position: fixed;
    left: -9px;
    top: -9px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff, #DCE8F8 70%, #B8CBE6);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 9998;
}
.nv-splat {
    position: fixed;
    width: 90px;
    height: 90px;
    margin: -45px 0 0 -45px;
    pointer-events: none;
    z-index: 9998;
    background:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.95) 0 22%, transparent 23%),
        radial-gradient(circle at 22% 38%, rgba(255, 255, 255, 0.9) 0 9%, transparent 10%),
        radial-gradient(circle at 78% 30%, rgba(255, 255, 255, 0.9) 0 8%, transparent 9%),
        radial-gradient(circle at 70% 75%, rgba(255, 255, 255, 0.9) 0 10%, transparent 11%),
        radial-gradient(circle at 28% 72%, rgba(255, 255, 255, 0.85) 0 7%, transparent 8%),
        radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.8) 0 5%, transparent 6%);
    filter: drop-shadow(0 2px 4px rgba(56, 120, 200, 0.45));
    animation: nv-splat 2.4s ease-out forwards;
}

/* Toast */
.nv-toast {
    position: fixed;
    left: 50%;
    bottom: 32px;
    max-width: calc(100vw - 32px);
    transform: translateX(-50%) translateY(20px);
    padding: 0.7em 1.2em;
    border-radius: 14px;
    background: var(--surface-strong);
    border: 1px solid rgba(186, 230, 253, 0.4);
    color: var(--text);
    font-family: var(--font-display);
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    pointer-events: none;
}
.nv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Animaciones ---------- */
@keyframes nv-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes nv-tick { from { transform: translateY(-60%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes nv-bulb { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; box-shadow: 0 0 2px var(--c); } }
@keyframes nv-rise { from { transform: translateY(120%); } to { transform: translateY(0); } }
@keyframes nv-pop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes nv-jiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes nv-tl { 0%, 100% { opacity: 1; filter: drop-shadow(0 0 2px var(--c)); } 50% { opacity: 0.4; filter: none; } }
@keyframes nv-glow { 0%, 100% { opacity: 0.55; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes nv-bob { from { transform: translateY(-2px); } to { transform: translateY(3px); } }
@keyframes nv-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-22deg); } }
@keyframes nv-splat {
    0% { transform: scale(0.2); opacity: 1; }
    12% { transform: scale(1.1); }
    20% { transform: scale(1); }
    75% { opacity: 1; transform: translateY(14px); }
    100% { opacity: 0; transform: translateY(40px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .nv-snowman { width: 54px; height: 78px; left: 8px; }
    .nv-tree { width: 62px; height: 88px; right: 8px; }
    .nv-santa { width: 190px; height: 58px; }
    .nv-countdown { padding: 1rem 1rem 0.9rem; margin-top: 1.8rem; }
    .nv-cd-units { gap: 0.45rem; }
    .nv-cd-unit { min-width: 56px; }
    .nv-cd-num { font-size: 1.5rem; }
    .nv-lights { bottom: -12px; }
}

@media (prefers-reduced-motion: reduce) {
    html.navidad .logo-dot, .nv-bulb::after, .nv-snowman, .nv-snowman .nv-new, .nv-snowman.wave .nv-arm-r, .nv-countdown,
    .nv-tree, .nv-tree .nv-new, .nv-tl, .nv-star-glow { animation: none; }
    .nv-countdown { opacity: 1; }
}
