/* ==========================================================================
   JD MAGAZINE + TV — Décoration de Noël (saisonnière)
   Chargé UNIQUEMENT quand la décoration est active (voir layouts/jdmag +
   SiteSetting::christmasActive()). Aucun impact hors période.
   Règles : purement décoratif, pointer-events:none partout, jamais sur les
   images d'articles / vidéos / couvertures, sous les publicités latérales
   (z-index 30) et sous l'en-tête collant (z-index 50).
   Visuels : public/images/christmas/ (régénérables :
   node resources/christmas/generate-svg.mjs).
   ========================================================================== */

.jd-xmas-decor,
.jd-xmas-decor * {
    pointer-events: none;
    user-select: none;
}

/* Largeur disponible dans chaque marge (colonne centrale = 85rem). */
:root {
    --jd-xmas-gutter: calc((100vw - 85rem) / 2 - 0.75rem);
    --jd-xmas-w: min(300px, var(--jd-xmas-gutter));
}

/* ── 1. Marges latérales (ordinateur) ─────────────────────────────────── */
.jd-xmas-side,
.jd-xmas-gifts {
    display: none;
}

@media (min-width: 1500px) {
    .jd-xmas-side {
        display: block;
        position: fixed;
        /* Accroché tout en haut de l'écran, par-dessus les marges (vides)
           de la barre bleue et de l'en-tête. */
        top: 0;
        bottom: 0;
        width: var(--jd-xmas-w);
        /* Au-dessus de l'en-tête collant (50) — qui n'occupe que la colonne
           centrale de 85rem — mais sous les publicités latérales (relevées
           à 60 ci-dessous). */
        z-index: 55;
        overflow: hidden;
        background-image: var(--jd-xmas-img);
        background-repeat: no-repeat;
        background-position: top center;
        background-size: contain;
    }
    .jd-xmas-side--left  { left: 0; }
    .jd-xmas-side--right { right: 0; }

    .jd-xmas-gifts {
        display: block;
        position: fixed;
        bottom: 0;
        width: var(--jd-xmas-w);
        aspect-ratio: 300 / 180;
        z-index: 21;
        background-repeat: no-repeat;
        background-position: bottom center;
        background-size: contain;
    }
    .jd-xmas-gifts--left  { left: 0;  background-image: url("../images/christmas/gifts-left.svg?v=2"); }
    .jd-xmas-gifts--right { right: 0; background-image: url("../images/christmas/gifts-right.svg?v=2"); }
}

/* Publicités latérales toujours au premier plan, devant le décor (seul leur
   ordre d'empilement change ; contenu, taille et position intacts). Elles
   restent collées sous l'en-tête, donc ne le recouvrent jamais. */
.jd-xmas .side-ad-col {
    z-index: 60;
}

/* Grands écrans de bureau peu larges (1500–1700px) : marges étroites,
   on allège en cachant les cadeaux pour ne garder que les suspensions. */
@media (min-width: 1500px) and (max-width: 1699px) {
    .jd-xmas-gifts { display: none; }
}

/* ── Neige très légère, limitée aux marges ────────────────────────────── */
.jd-xmas-flake {
    position: absolute;
    top: -24px;
    left: var(--x, 50%);
    width: var(--s, 12px);
    height: var(--s, 12px);
    background: url("../images/christmas/snowflake.svg?v=2") center / contain no-repeat;
    opacity: 0.75;
    will-change: transform;
    animation: jd-xmas-fall var(--d, 16s) linear var(--delay, 0s) infinite;
}

@keyframes jd-xmas-fall {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
    50%  { transform: translate3d(14px, 50vh, 0) rotate(120deg); }
    100% { transform: translate3d(-6px, 105vh, 0) rotate(240deg); }
}

/* ── 2. Petits coins supérieurs (tablette & smartphone) ───────────────── */
/* Placés dans la barre bleue (site-shell-top), entre son fond et son
   contenu : les boutons « Nos offres » / compteur restent toujours devant. */
.jd-xmas-corner {
    position: absolute;
    top: 0;
    width: 60px;
    height: 60px;
    pointer-events: none;
    background: url("../images/christmas/corner.svg?v=2") top left / contain no-repeat;
}
.jd-xmas-corner--left  { left: 0; }
.jd-xmas-corner--right { right: 0; transform: scaleX(-1); }

@media (max-width: 767px) {
    .jd-xmas-corner { width: 44px; height: 44px; }
}
@media (min-width: 1500px) {
    .jd-xmas-corner { display: none; }
}

/* ── 3. Habillage discret des sections ────────────────────────────────── */

/* En-tête : guirlande lumineuse accrochée à la jonction barre bleue / en-tête
   blanc, sur toute la largeur de l'écran ; les ampoules pendent dans la
   marge haute de la ligne du logo (sans chevaucher logo, recherche, menu). */
.jd-xmas-sections .jdmag-sticky-chrome > header {
    position: relative;
}
.jd-xmas-sections .jdmag-sticky-chrome > header::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -1px;
    height: 18px;
    z-index: 2;
    background: url("../images/christmas/garland.svg?v=2") repeat-x 0 0 / auto 18px;
    pointer-events: none;
}
@media (min-width: 768px) {
    .jd-xmas-sections .jdmag-sticky-chrome > header::before {
        height: 20px;
        background-size: auto 20px;
    }
}

/* Logo : petite étoile dorée à l'extérieur, en haut à droite (le logo
   lui-même n'est pas modifié). */
.jd-xmas-sections .jdmag-header-logo > div::after {
    content: "";
    position: absolute;
    top: -8px;
    right: -16px;
    width: 20px;
    height: 20px;
    background: url("../images/christmas/logo-star.svg?v=2") center / contain no-repeat;
    pointer-events: none;
}
@media (min-width: 768px) {
    .jd-xmas-sections .jdmag-header-logo > div::after {
        top: -10px;
        right: -20px;
        width: 26px;
        height: 26px;
    }
}

/* Haut de page : guirlande fil d'or sur le bord supérieur de la barre
   bleue (dans sa marge haute, sans toucher aux boutons). */
.jd-xmas-sections .jdmag-topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 16px;
    z-index: 1;
    background: url("../images/christmas/garland-dark.svg?v=2") repeat-x 0 0 / auto 16px;
    pointer-events: none;
}

/* Titres de rubriques (À la une, JD WebTV, Magazine à la une,
   Photothèque…) : brin de houx posé sur le coin de la pastille. */
.jd-xmas-sections .jd-section-title > h2 {
    position: relative;
}
.jd-xmas-sections .jd-section-title > h2::before {
    content: "";
    position: absolute;
    left: -14px;
    top: -13px;
    width: 40px;
    height: 27px;
    background: url("../images/christmas/holly.svg?v=2") center / contain no-repeat;
    pointer-events: none;
}

/* Pied de page : guirlande fil d'or sur le bord supérieur. */
.jd-xmas-sections .jdmag-site-footer {
    position: relative;
}
.jd-xmas-sections .jdmag-site-footer::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 20px;
    background: url("../images/christmas/garland-dark.svg?v=2") repeat-x 0 0 / auto 20px;
    pointer-events: none;
}

/* ── Accessibilité : pas d'animation si l'utilisateur les limite ──────── */
@media (prefers-reduced-motion: reduce) {
    .jd-xmas-flake { display: none; }
}

@media print {
    .jd-xmas-decor { display: none !important; }
}
