/* ============================================================
   Seasonal touches on the homepage (season_lib.php).

   Loaded only while a season is on. Everything here is scoped to
   body.has-season, and each season adds a `.season-<key>` block
   at the bottom. A season changes four things and nothing else:
     - the decoration along the top of the hero (.season-deco)
     - the greeting chip above the hero badge (.season-chip)
     - a few falling particles in the hero (.season-fall)
     - the tint of the hero band and of the promo band
   Only transform and opacity are animated, and every animation
   stops under prefers-reduced-motion (md_files/DESIGN.md).
   ============================================================ */

.has-season {
    --season-a: #0ea5e9;                 /* main accent */
    --season-b: #2563eb;                 /* second accent */
    --season-chip-bg: rgba(255,255,255,.86);
    --season-chip-ink: #0f172a;
    --season-promo: linear-gradient(135deg, #0f172a, #1e3a8a);
}

/* ---- Decoration along the top of the hero ----------------------
   Transparent pictures (images/season/<key>.webp), pinned to the top
   edge and as wide as the band. */
.home-modern.hm-refresh.has-season .season-deco {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: clamp(190px, 33.4vw, 640px);
    background-repeat: no-repeat;
    background-position: top center;
    background-size: max(100%, 1180px) auto;
    pointer-events: none;
    animation: seasonDecoIn 900ms var(--lq-ease-out, ease-out) backwards;
}
@keyframes seasonDecoIn { from { opacity: 0; transform: translateY(-18px); } }

/* Room for the decoration above the hero copy. */
.home-modern.hm-refresh.has-season .lq-hero { padding-top: clamp(96px, 9.5vw, 150px); }

/* The hero copy and the print deck stay above the decoration. */
.home-modern.hm-refresh.has-season .lq-hero { position: relative; z-index: 1; }

/* ---- Greeting chip --------------------------------------------- */
.home-modern.hm-refresh.has-season .season-chip {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 14px;
    padding: 7px 16px 7px 12px;
    border-radius: 999px;
    background: var(--season-chip-bg);
    color: var(--season-chip-ink);
    border: 1px solid color-mix(in srgb, var(--season-a) 38%, transparent);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--season-a) 18%, transparent);
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
    font-family: var(--lq-font-display, inherit);
    font-weight: 700; font-size: .92rem; letter-spacing: -.01em;
}
.home-modern.hm-refresh.has-season .season-chip span { font-size: 1.05rem; line-height: 1; }
/* The chip sits on its own line; the V5 badge follows under it. */
.home-modern.hm-refresh.has-season .season-chip + .v5-badge { display: flex; width: fit-content; }

/* ---- Falling particles ----------------------------------------- */
.home-modern.hm-refresh.has-season .season-fall {
    position: absolute; inset: 0;
    overflow: hidden; pointer-events: none;
}
.has-season .season-fall i {
    position: absolute; top: -24px;
    left: calc(var(--x) * 1%);
    width: var(--s); height: var(--s);
    opacity: 0;
    animation: seasonFall var(--d) linear var(--w) infinite;
    will-change: transform, opacity;
}
@keyframes seasonFall {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
    8%   { opacity: var(--o, .9); }
    80%  { opacity: var(--o, .9); }
    100% { transform: translate3d(var(--drift), 720px, 0) rotate(var(--spin, 0deg)); opacity: 0; }
}
/* Sixteen particles, spread by hand so they never line up. */
.has-season .season-fall i:nth-child(1)  { --x: 3;  --s: 8px;  --d: 15s; --w: -2s;  --drift: 30px; }
.has-season .season-fall i:nth-child(2)  { --x: 9;  --s: 5px;  --d: 19s; --w: -9s;  --drift: -22px; }
.has-season .season-fall i:nth-child(3)  { --x: 16; --s: 10px; --d: 13s; --w: -5s;  --drift: 40px; }
.has-season .season-fall i:nth-child(4)  { --x: 23; --s: 6px;  --d: 21s; --w: -14s; --drift: -30px; }
.has-season .season-fall i:nth-child(5)  { --x: 29; --s: 7px;  --d: 16s; --w: -1s;  --drift: 18px; }
.has-season .season-fall i:nth-child(6)  { --x: 36; --s: 9px;  --d: 18s; --w: -11s; --drift: -36px; }
.has-season .season-fall i:nth-child(7)  { --x: 43; --s: 5px;  --d: 22s; --w: -7s;  --drift: 26px; }
.has-season .season-fall i:nth-child(8)  { --x: 50; --s: 8px;  --d: 14s; --w: -3s;  --drift: -18px; }
.has-season .season-fall i:nth-child(9)  { --x: 57; --s: 6px;  --d: 20s; --w: -16s; --drift: 34px; }
.has-season .season-fall i:nth-child(10) { --x: 63; --s: 10px; --d: 15s; --w: -8s;  --drift: -28px; }
.has-season .season-fall i:nth-child(11) { --x: 70; --s: 5px;  --d: 23s; --w: -12s; --drift: 20px; }
.has-season .season-fall i:nth-child(12) { --x: 76; --s: 8px;  --d: 17s; --w: -4s;  --drift: -40px; }
.has-season .season-fall i:nth-child(13) { --x: 82; --s: 6px;  --d: 19s; --w: -15s; --drift: 24px; }
.has-season .season-fall i:nth-child(14) { --x: 88; --s: 9px;  --d: 14s; --w: -6s;  --drift: -20px; }
.has-season .season-fall i:nth-child(15) { --x: 93; --s: 5px;  --d: 21s; --w: -10s; --drift: 32px; }
.has-season .season-fall i:nth-child(16) { --x: 97; --s: 7px;  --d: 16s; --w: -13s; --drift: -26px; }

@media (max-width: 640px) {
    /* Half the particles on a phone. */
    .has-season .season-fall i:nth-child(even) { display: none; }
    .home-modern.hm-refresh.has-season .season-deco { background-size: 920px auto; height: 310px; }
    .home-modern.hm-refresh.has-season .lq-hero { padding-top: 104px; }
}
@media (prefers-reduced-motion: reduce) {
    .has-season .season-fall { display: none; }
    .home-modern.hm-refresh.has-season .season-deco { animation: none; }
}

/* ---- Tints ------------------------------------------------------ */
.home-modern.hm-refresh.has-season .hm-hero-band {
    background:
        radial-gradient(55% 65% at 88% 8%, color-mix(in srgb, var(--season-a) 15%, transparent), transparent 62%),
        radial-gradient(45% 55% at 4% 0%, color-mix(in srgb, var(--season-b) 13%, transparent), transparent 60%),
        linear-gradient(180deg, #fbfcff 0%, #ffffff 100%);
}
.home-modern.has-season .promo-band { background: var(--season-promo); }

/* ============================================================
   The seasons
   ============================================================ */

/* Christmas: pine green and berry red, soft snow. */
.season-christmas {
    --season-a: #dc2626;
    --season-b: #16a34a;
    --season-promo: linear-gradient(135deg, #0b3d2c 0%, #14532d 45%, #7f1d1d 100%);
}
.season-christmas .season-fall i {
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(148,163,184,.42), 0 2px 6px rgba(100,116,139,.28);
}

/* New Year: gold and blue confetti. */
.season-newyear {
    --season-a: #d97706;
    --season-b: #2563eb;
    --season-promo: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #92400e 100%);
}
.season-newyear .season-fall i {
    width: calc(var(--s) * .7); height: calc(var(--s) * 1.5);
    border-radius: 2px;
    background: #f59e0b;
    --spin: 540deg;
}
.season-newyear .season-fall i:nth-child(3n)   { background: #2563eb; --spin: -420deg; }
.season-newyear .season-fall i:nth-child(3n+1) { background: #fbbf24; }
.season-newyear .season-fall i:nth-child(4n)   { background: #94a3b8; }

/* Chinese New Year: red and gold, plum petals. */
.season-cny {
    --season-a: #dc2626;
    --season-b: #f59e0b;
    --season-promo: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 60%, #92400e 100%);
}
.season-cny .season-fall i {
    width: calc(var(--s) * 1.2); height: var(--s);
    border-radius: 80% 10% 80% 10%;
    background: #f9a8d4;
    --spin: 260deg; --o: .85;
}
.season-cny .season-fall i:nth-child(3n) { background: #fb7185; }

/* Eid al-Fitr: emerald and gold, slow gold sparks. */
.season-eid {
    --season-a: #059669;
    --season-b: #d97706;
    --season-promo: linear-gradient(135deg, #022c22 0%, #065f46 60%, #92400e 100%);
}
.season-eid .season-fall i {
    width: calc(var(--s) * .9); height: calc(var(--s) * .9);
    background: #f59e0b;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    --spin: 180deg; --o: .8;
}
.season-eid .season-fall i:nth-child(even) { background: #fcd34d; }
