/* ==========================================================================
   TEMA DE TEMPORADA: NAVIDAD
   --------------------------------------------------------------------------
   Lo carga app/core/seasonal_themes.php despues de main.min.css cuando el
   <html> lleva la clase .season-xmas.

   Rojo navidad en lugar del naranja, verde pino en lugar del azul y noche
   azulada en oscuro. Nieve acumulada sobre la cabecera y una tira de luces
   que parpadean debajo. Los copos y el gorro de Papa Noel van en theme.js.
   ========================================================================== */

html.season-xmas {
    --histo-color: #E5383B;            /* rojo navidad */
    --rieta-color: #23B26D;            /* verde pino */
    --ink-color: #121A26;              /* noche de invierno */
    --xm-snow: #FFFFFF;
    --xm-gold: #FFD166;
}

html.season-xmas[data-bs-theme="light"] {
    --bs-body-color-rgb: 18, 26, 38;
}

html.season-xmas[data-bs-theme="dark"] {
    --bs-body-bg-rgb: 18, 26, 38;
}

/* --------------------------------------------------------------------------
   FONDO: nieve quieta de puntos
   -------------------------------------------------------------------------- */

html.season-xmas[data-bs-theme="dark"] body {
    background-image:
        radial-gradient(rgba(255, 255, 255, .22) 1.2px, transparent 1.8px),
        radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1.5px);
    background-size: 46px 46px, 19px 19px;
    background-position: 0 0, 9px 13px;
    background-attachment: fixed;
}

html.season-xmas[data-bs-theme="light"] body {
    background-image: radial-gradient(rgba(35, 178, 109, .14) 1px, transparent 1.5px);
    background-size: 18px 18px;
    background-attachment: fixed;
}

/* --------------------------------------------------------------------------
   CABECERA: nieve encima, luces debajo, sombra roja + verde
   -------------------------------------------------------------------------- */

html.season-xmas .custom-nav-shadow {
    box-shadow: 6px 6px 0 0 var(--histo-color), 12px 12px 0 0 var(--rieta-color);
}

/* Nieve acumulada: borde ondulado blanco con filete de tinta */
html.season-xmas .custom-nav-shadow::before {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    top: -9px;
    height: 16px;
    pointer-events: none;
    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 9 Q6 1 14 6 Q20 0 30 5 Q38 -1 47 6 Q55 2 62 7 Q70 0 80 5 Q88 1 96 6 Q104 0 112 5 Q117 3 120 7 L120 12 Q112 16 104 12 Q98 15 90 13 Q80 16 72 12 Q64 15 56 12 Q46 16 38 12 Q30 15 22 12 Q12 16 6 12 Q2 13 0 12Z' fill='%23FFFFFF' stroke='%23121A26' stroke-width='1.5' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

/* Tira de luces bajo la cabecera */
html.season-xmas .custom-nav-shadow::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -13px;
    height: 16px;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 70%, var(--histo-color) 0 4px, transparent 5px) 0 0 / 72px 16px repeat-x,
        radial-gradient(circle at 50% 70%, var(--xm-gold) 0 4px, transparent 5px) 24px 0 / 72px 16px repeat-x,
        radial-gradient(circle at 50% 70%, var(--rieta-color) 0 4px, transparent 5px) 48px 0 / 72px 16px repeat-x,
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 16'%3E%3Cpath d='M0 3 Q12 12 24 3' fill='none' stroke='%23121A26' stroke-width='1.4'/%3E%3C/svg%3E") 0 0 / 24px 16px repeat-x;
    animation: xm-blink 1.6s steps(1) infinite;
}

@keyframes xm-blink {
    50% { filter: brightness(.55) saturate(.7); }
}

/* Gorro de Papa Noel sobre el icono (lo inserta theme.js) */
html.season-xmas .navbar-brand {
    position: relative;
}

.xm-hat {
    position: absolute;
    top: -20px;
    left: -8px;
    width: 40px;
    height: 30px;
    transform: rotate(-16deg);
    pointer-events: none;
    filter: drop-shadow(2px 2px 0 var(--rieta-color));
}

/* --------------------------------------------------------------------------
   DETALLES
   -------------------------------------------------------------------------- */

html.season-xmas ::selection {
    background: var(--rieta-color);
    color: #FFFFFF;
}

html.season-xmas .skew-title {
    box-shadow: 6px 6px 0 0 var(--rieta-color), 10px 10px 0 0 var(--histo-color);
}

/* --------------------------------------------------------------------------
   COPOS (theme.js)
   -------------------------------------------------------------------------- */

.xm-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1019;
}

.xm-flake {
    position: absolute;
    top: -20px;
    color: #FFFFFF;
    font-size: var(--xm-size, 14px);
    line-height: 1;
    opacity: var(--xm-op, .85);
    text-shadow: 0 0 1px #121A26, 0 0 2px #121A26;
    animation: xm-fall var(--xm-dur, 12s) linear forwards;
    will-change: transform;
}

[data-bs-theme="light"] .xm-flake {
    color: #BFE3FF;
    text-shadow: 0 0 1px #121A26;
}

@keyframes xm-fall {
    0%   { transform: translate(0, 0) rotate(0); }
    50%  { transform: translate(var(--xm-drift, 30px), 55vh) rotate(180deg); }
    100% { transform: translate(0, calc(100vh + 40px)) rotate(360deg); }
}

@media (max-width: 767.98px) {
    html.season-xmas .custom-nav-shadow::after { left: 4px; right: 4px; }
}

@media (prefers-reduced-motion: reduce) {
    html.season-xmas .custom-nav-shadow::after { animation: none; }
    .xm-layer { display: none; }
}

@media print {
    .xm-layer, .xm-hat { display: none !important; }
}
