/* seasons.css — the looks of the homepage's seasonal versions (data.js `season` / `seasons`, README「季節版本」).
   kit.js writes the season on <html data-season="xmas"> while the <head> loads, so a season's look is there from the
   first frame; the normal version is data-season="normal" and has no block here.
   The banner offers three places for a season to use: .banner::before and .banner::after (two layers that can fall
   or drift over the drawing) and .season-deco (an empty strip along the banner's top edge, with its own ::before and
   ::after). Everything here is decoration: it never takes a click (pointer-events: none) and stops moving when the
   visitor asks for less motion. Pictures are addressed as url(../assets/season/…) so tools/stamp.mjs versions them. */

.season-deco { display: none; }

/* ---------- xmas: Christmas (12-01 → 12-31) ---------- */
/* snow on the banner's top edge, a string of lights under it, and light snow falling over the drawing */
[data-season="xmas"] .banner { position: relative; overflow: hidden; }
[data-season="xmas"] .season-deco {
  display: block; position: absolute; left: 0; right: 0; top: 0; height: 50px; z-index: 2; pointer-events: none;
  background:
    url(../assets/season/xmas-snowcap.svg?v=2b76d8075c) 0 0 / 220px 24px repeat-x,
    url(../assets/season/xmas-lights.svg?v=2b76d8075c) 18px 10px / 264px 36px repeat-x;
}
/* the bulbs glow softly, the two halves of the string taking turns (xmas-glow.svg holds the glow of one sag;
   ::after is the same picture moved on by one sag) */
[data-season="xmas"] .season-deco::before,
[data-season="xmas"] .season-deco::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: url(../assets/season/xmas-glow.svg?v=2b76d8075c) 18px 10px / 264px 44px repeat-x;
  animation: xmas-twinkle 3.2s ease-in-out infinite alternate;
}
[data-season="xmas"] .season-deco::after { background-position: 150px 10px; animation-delay: -3.2s; }
@keyframes xmas-twinkle { from { opacity: .12; } to { opacity: .85; } }

/* falling snow: two layers at two speeds. Every dot of a layer repeats each 220px (150px) down and the layer moves
   down by exactly that much, so the loop has no seam; only a transform moves, which the browser does cheaply. */
[data-season="xmas"] .banner::before,
[data-season="xmas"] .banner::after {
  content: ''; position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; will-change: transform;
  filter: drop-shadow(0 0 1px rgba(107, 77, 58, .5));
}
[data-season="xmas"] .banner::before {
  top: -220px; height: calc(100% + 220px);
  background:
    radial-gradient(circle 6px at 40px 34px, #fff 0 3px, rgba(255, 255, 255, 0) 4px) 0 0 / 260px 220px,
    radial-gradient(circle 6px at 150px 150px, #fff 0 2.6px, rgba(255, 255, 255, 0) 3.6px) 0 0 / 330px 220px,
    radial-gradient(circle 6px at 90px 96px, #fff 0 2.4px, rgba(255, 255, 255, 0) 3.4px) 0 0 / 190px 220px;
  animation: xmas-fall-a 20s linear infinite;
}
[data-season="xmas"] .banner::after {
  top: -150px; height: calc(100% + 150px); opacity: .85;
  background:
    radial-gradient(circle 5px at 70px 20px, #fff 0 1.9px, rgba(255, 255, 255, 0) 2.8px) 0 0 / 210px 150px,
    radial-gradient(circle 5px at 20px 100px, #fff 0 1.7px, rgba(255, 255, 255, 0) 2.6px) 0 0 / 290px 150px;
  animation: xmas-fall-b 17s linear infinite;
}
@keyframes xmas-fall-a { to { transform: translateY(220px); } }
@keyframes xmas-fall-b { to { transform: translateY(150px); } }

/* a holly sprig before the Christmas row's title */
[data-season="xmas"] #h-xmas::before {
  content: ''; display: inline-block; width: 38px; height: 17px; margin-right: 8px; vertical-align: -1px;
  background: url(../assets/season/xmas-holly.webp?v=2b76d8075c) center / contain no-repeat;
}

@media (max-width: 560px) {
  /* a smaller banner: a slimmer string of lights */
  [data-season="xmas"] .season-deco { background-size: 176px 19px, 211px 29px; background-position: 0 0, 12px 7px; }
  [data-season="xmas"] .season-deco::before { background-size: 211px 35px; background-position: 12px 7px; }
  [data-season="xmas"] .season-deco::after { background-size: 211px 35px; background-position: 117.5px 7px; }
}

/* less motion asked for: the snow and the lights stay still (kit.css's rule does not reach ::before / ::after) */
@media (prefers-reduced-motion: reduce) {
  [data-season] .banner::before, [data-season] .banner::after,
  [data-season] .season-deco::before, [data-season] .season-deco::after { animation: none !important; }
}
