/* ==========================================================================
   Thème de fête : chargé uniquement pendant Halloween et Noël
   (cf. App\Twig\SeasonalThemeExtension et components/_seasonal.html.twig).
   Classe season-halloween ou season-noel sur <body>.
   ========================================================================== */

/* Les décorations débordent du menu (araignée, guirlande) : il passe
   au-dessus du contenu */
.season-halloween #mainNav,
.season-noel #mainNav {
    z-index: 1020;
}

/* Ciel du menu : flocons (créés par seasonal.js) */
.season-sky {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

/* Décorations du logo */
.season-pumpkin,
.season-hat {
    position: absolute;
    pointer-events: none;
}

/* ==========================================================================
   Halloween
   ========================================================================== */
.season-halloween #mainNav {
    box-shadow: 0 2px 14px rgba(140, 60, 200, .35);
}

/* Liseré du site public seulement : celui des zones protégées reste un repère */
.season-halloween #mainNav:not(.main-nav--member, .main-nav--admin) {
    --main-nav-accent: #ff7518;
}

.season-halloween .wbf-title > span::first-letter {
    color: #ff7518;
}

/* Citrouille posée au sol, sous l'aile droite */
.season-pumpkin {
    right: -4%;
    bottom: -14%;
    width: 22%;
    filter: drop-shadow(0 0 4px rgba(255, 140, 30, .55));
}

.season-pumpkin-face {
    animation: seasonCandle 3.2s infinite;
}

@keyframes seasonCandle {
    0%, 100% { opacity: 1; }
    8% { opacity: .55; }
    11% { opacity: .95; }
    47% { opacity: .8; }
    52% { opacity: 1; }
    74% { opacity: .65; }
    78% { opacity: 1; }
}

/* Toile dans le coin haut droit du menu */
.season-web {
    position: absolute;
    top: 0;
    right: 0;
    width: 86px;
    height: 86px;
    pointer-events: none;
    fill: none;
    stroke: rgba(235, 235, 245, .42);
    stroke-width: .7;
}

/* Araignée suspendue à son fil : elle remonte quand on la touche */
.season-spider {
    position: absolute;
    top: 0;
    right: 4px;
    width: 30px;
    height: 116px; /* l'araignée pend sous le menu */
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    z-index: 2;
    pointer-events: none; /* seul le corps est cliquable, pas le fil */
    transform-origin: 50% 0;
    animation: seasonSpiderSwing 5s ease-in-out infinite;
    transition: height 1.2s cubic-bezier(.5, 0, .3, 1);
}

.season-spider::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 20px;
    left: 50%;
    width: 1px;
    background: rgba(235, 235, 245, .55);
}

.season-spider svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 30px;
    pointer-events: auto;
}

.season-spider.is-climbing {
    height: 30px;
    transition-duration: .5s;
}

.season-spider:focus-visible {
    outline: 2px solid #ff7518;
    outline-offset: 2px;
}

@keyframes seasonSpiderSwing {
    0%, 100% { transform: rotate(4deg); }
    50% { transform: rotate(-4deg); }
}

/* Fantôme flottant à travers la fenêtre (calque .season-screen) */
.season-ghost {
    position: absolute;
    left: 0;
    width: 60px;
    height: 72px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    pointer-events: auto;
    animation: seasonCross var(--cross-duration, 12s) linear forwards;
}

.season-ghost svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px rgba(190, 205, 255, .85));
    animation: seasonFloat 2.2s ease-in-out infinite alternate;
    transition: opacity .6s ease-out, transform .6s ease-out;
}

/* Effrayé par le clic : il s'évanouit en s'élevant */
.season-ghost.is-scared {
    pointer-events: none;
}

.season-ghost.is-scared svg {
    opacity: 0;
    transform: translateY(-40px) scale(1.3);
    animation: none;
}

@keyframes seasonFloat {
    0% { transform: translateY(-14px) rotate(-6deg); opacity: .95; }
    100% { transform: translateY(14px) rotate(4deg); opacity: .7; }
}

/* ==========================================================================
   Noël
   ========================================================================== */
.season-noel #mainNav:not(.main-nav--member, .main-nav--admin) {
    --main-nav-accent: #1f7a45;
}

/* Bonnet posé sur la verrière : il suit l'avion au survol */
.season-hat {
    left: 50%;
    top: -11%;
    width: 15%;
    transform: translateX(-42%) rotate(-8deg);
}

/* Guirlande lumineuse sous le menu : 4 couleurs qui clignotent en décalé */
.season-garland {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -7px;
    height: 8px;
    pointer-events: none;
}

.season-garland i {
    position: absolute;
    inset: 0;
    --bulb: #ff3b3b;
    background: radial-gradient(circle 3px at 50% 50%, var(--bulb) 0 2.5px, transparent 3px) 0 0 / 88px 8px repeat-x;
    filter: drop-shadow(0 0 3px var(--bulb));
    animation: seasonBlink 2.4s ease-in-out infinite;
}

.season-garland i:nth-child(2) { --bulb: #ffd23b; background-position-x: 22px; animation-delay: -.6s; }
.season-garland i:nth-child(3) { --bulb: #3bff7a; background-position-x: 44px; animation-delay: -1.2s; }
.season-garland i:nth-child(4) { --bulb: #3bb4ff; background-position-x: 66px; animation-delay: -1.8s; }

@keyframes seasonBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

/* Flocons qui tombent dans le menu */
.season-flake {
    position: absolute;
    top: -6px;
    border-radius: 50%;
    background: #fff;
    opacity: .8;
    animation: seasonSnow var(--fall-duration, 6s) linear infinite;
}

@keyframes seasonSnow {
    to { transform: translate(var(--drift, 10px), 90px); }
}

/* Traîneau du père Noël, à travers la fenêtre : un clic fait tinter les grelots */
.season-sleigh {
    position: absolute;
    left: 0;
    width: 168px;
    height: 42px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    pointer-events: auto;
    animation: seasonCross var(--cross-duration, 14s) linear forwards;
}

.season-sleigh svg {
    display: block;
    width: 100%;
    height: 100%;
    /* halo clair : visible sur le menu sombre comme sur les pages claires */
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, .9));
    animation: seasonBob 1.8s ease-in-out infinite alternate;
}

@keyframes seasonBob {
    from { transform: translateY(6px) rotate(1deg); }
    to { transform: translateY(-8px) rotate(-3deg); }
}

/* ==========================================================================
   Commun
   ========================================================================== */

/* Calque fixe sur toute la fenêtre, pour le traîneau et le fantôme :
   au-dessus du contenu, sous les fenêtres modales ; seuls les passants
   sont cliquables */
.season-screen {
    position: fixed;
    inset: 0;
    z-index: 1040;
    overflow: hidden;
    pointer-events: none;
}

/* Traversée de la fenêtre ou du menu, de droite à gauche */
@keyframes seasonCross {
    from { transform: translateX(calc(100vw + 20px)); }
    to { transform: translateX(-140px); }
}

@media (max-width: 991.98px) {
    .season-web {
        width: 56px;
        height: 56px;
    }

    .season-spider {
        right: 64px;
        height: 88px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .season-pumpkin-face,
    .season-spider,
    .season-garland i {
        animation: none;
    }

    .season-sky {
        display: none;
    }
}
