/* ============================================================
   Seasonal look on the home page (season.js adds these while the
   season runs). Decorations sit behind the content and ignore the
   pointer. The only things touched on the page itself are the gold
   card edges and the hat on the logo; layout stays as it is.

   The look grows week by week; season.js sets data-season-level:
   1 snow · 2 gold edges and a warmer glow · 3 garland, lights off ·
   4 lights on · 5 hat and more snow · 6 gifts along the bottom.
   ============================================================ */
#page-home {
  --season-gold: #e6c068;
  --season-edge: rgba(230, 192, 104, 0.42);
  --season-flake: #ffffff;
}
#page-home.light {
  --season-gold: #8f6a12;
  --season-edge: rgba(176, 130, 30, 0.5);
  --season-flake: #8fb1cd;
}

.season-layer, .season-garland { position: absolute; z-index: -1; pointer-events: none; }

/* A warm glow from the top, fir green from the corners */
.season-layer {
  position: fixed; inset: 0; overflow: hidden;
  background:
    radial-gradient(80vmax 42vmax at 50% -8%, rgba(230, 192, 104, 0.24), transparent 70%),
    radial-gradient(60vmax 55vmax at 100% 100%, rgba(40, 130, 82, 0.26), transparent 70%),
    radial-gradient(55vmax 50vmax at 0% 100%, rgba(190, 50, 45, 0.16), transparent 70%);
}
body.light .season-layer {
  background:
    radial-gradient(80vmax 42vmax at 50% -8%, rgba(214, 160, 50, 0.22), transparent 70%),
    radial-gradient(60vmax 55vmax at 100% 100%, rgba(40, 130, 82, 0.18), transparent 70%),
    radial-gradient(55vmax 50vmax at 0% 100%, rgba(190, 50, 45, 0.11), transparent 70%);
}

/* From the second week the glow is warmer */
body:not([data-season-level="1"]) > .season-layer {
  background:
    radial-gradient(80vmax 42vmax at 50% -8%, rgba(230, 192, 104, 0.34), transparent 70%),
    radial-gradient(60vmax 55vmax at 100% 100%, rgba(40, 130, 82, 0.32), transparent 70%),
    radial-gradient(55vmax 50vmax at 0% 100%, rgba(190, 50, 45, 0.24), transparent 70%);
}
body.light:not([data-season-level="1"]) > .season-layer {
  background:
    radial-gradient(80vmax 42vmax at 50% -8%, rgba(214, 160, 50, 0.3), transparent 70%),
    radial-gradient(60vmax 55vmax at 100% 100%, rgba(40, 130, 82, 0.24), transparent 70%),
    radial-gradient(55vmax 50vmax at 0% 100%, rgba(190, 50, 45, 0.16), transparent 70%);
}

/* Falling snow: season.js scatters small flakes, each with its own size, speed, side
   wind, sway and start. Every flake is a tiny element of its own, so the browser only
   moves a few small pieces instead of repainting or blending whole-screen layers.
   Only translate and transform animate, which needs no repaint of the page. */
.season-flake {
  position: absolute; top: -30px; left: var(--x); width: var(--size); height: var(--size);
  border-radius: 50%; opacity: var(--alpha);
  background: radial-gradient(circle, var(--season-flake) 0 30%, transparent 70%);
  animation: season-fall var(--fall) linear var(--start) infinite, season-sway var(--sway-time) ease-in-out var(--start) infinite alternate;
  will-change: transform, translate;
}
/* Some are real six-armed flakes, turning slowly as they sway */
.season-flake--star {
  border-radius: 0; background: var(--season-flake);
  -webkit-mask: url("/assets/img/season-flake.svg") center / contain no-repeat;
  mask: url("/assets/img/season-flake.svg") center / contain no-repeat;
}
@keyframes season-fall { to { translate: var(--wind) calc(100vh + 60px); } }
@keyframes season-sway {
  from { transform: translateX(calc(-1 * var(--sway))) rotate(0deg); }
  to { transform: translateX(var(--sway)) rotate(var(--turn)); }
}
/* Snow stays on the page but stands still */
@media (prefers-reduced-motion: reduce) {
  .season-flake { top: var(--y); animation: none; will-change: auto; }
}

/* A fir garland along the very top; it scrolls away with the page. Its bulbs are
   dark until the lights go on: two overlays, every other bulb each, that take turns
   glowing. Only their opacity animates. */
.season-garland {
  --garland-at: center -10px; --garland-size: 480px 70px;
  top: 0; left: 0; right: 0; height: 60px;
  background: url("/assets/img/season-garland.svg") repeat-x var(--garland-at) / var(--garland-size);
}
.season-lights {
  position: absolute; inset: 0;
  background: url("/assets/img/season-lights-a.svg") repeat-x var(--garland-at) / var(--garland-size);
  animation: season-twinkle 2.6s ease-in-out infinite alternate;
}
.season-lights + .season-lights { background-image: url("/assets/img/season-lights-b.svg"); animation-delay: -2.6s; }
@keyframes season-twinkle { from { opacity: 1; } to { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .season-lights { animation: none; } }
@media (max-width: 600px) { .season-garland { --garland-at: center -6px; --garland-size: 316px 46px; height: 40px; } }

/* Gifts and a candle in the bottom corners, in the last days before Christmas.
   season.js draws each pile at random, so the two corners never match. */
.season-gifts { position: absolute; bottom: 0; left: 14px; width: 340px; height: 170px; overflow: visible; }
.season-gifts + .season-gifts { left: auto; right: 14px; transform: scaleX(-1); }
@media (max-width: 1200px) { .season-gifts { width: 240px; height: 120px; } }
@media (max-width: 900px) { .season-gifts { display: none; } }

/* A hat on the logo */
:is([data-season-level="5"], [data-season-level="6"]) .logo-wrap { position: relative; overflow: visible; }
.season-hat {
  position: absolute; top: -33%; left: -18%; width: 68%; aspect-ratio: 64 / 56;
  background: url("/assets/img/season-hat.svg") no-repeat center / contain;
  transform: rotate(-14deg);
  pointer-events: none;
}

/* Gold card edges */
#page-home.season-on:not([data-season-level="1"]) .card.glass,
#page-home.season-on:not([data-season-level="1"]) .home-nav.glass { border-color: var(--season-edge); }

/* The switch mirrors the account button: same size, other corner */
#page-home .season-toggle { position: absolute; left: 0; right: auto; padding: 0; cursor: pointer; }
#page-home .season-toggle .material-icons-outlined { font-size: 1.25rem; }
#page-home .season-toggle[aria-pressed="true"] { color: var(--season-gold); }
#page-home .season-toggle[aria-pressed="false"] { color: var(--muted); }
#page-home .season-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The greeting takes no room in the header, so the page never shifts for it */
.season-greeting {
  position: absolute; top: 50%; left: 56px; height: 44px; transform: translateY(-50%);
  display: flex; align-items: center;
  margin: 0; color: var(--season-gold); font-size: 0.95rem; font-weight: 600; white-space: nowrap;
}
/* Beside a centred logo there's no room for it on smaller screens */
@media (max-width: 900px) { .season-greeting { display: none; } }

@media print { .season-layer, .season-garland, .season-hat, .season-toggle, .season-greeting { display: none; } }
