/* Halloween. A seasonal layer over /style.css, which stays untouched.
   It only applies while /core/season.js sets <html data-season="halloween">; see docs/SEASONS.md. */
:root[data-season="halloween"] {
  --paper:#f7f1e6; --ink:#24192e; --muted:#6d6075; --line:#e2d5c3; --surface:#fcf8f0; --surface-hover:#f1e5d3; --card-art:#efe3cf; --card-shadow:#e6d3b6; --button-hover:#43305a; --focus:#c2560a; --accent-ink:#24192e; --lime:#ff8a1f; --pumpkin:#ff8a1f; --pumpkin-rib:#c9600c; --stem:#5c7a2e; --moon:#fbe3bd; --moon-glow:#fbe3bd00; --haze:#f4dcc1; --spooky:#24192e; --web:#24192e;
  &[data-theme="dark"] { --paper:#16121c; --ink:#f3ebde; --muted:#b4a7c2; --line:#382d46; --surface:#201929; --surface-hover:#2d2339; --card-art:#291f35; --card-shadow:#0c0812; --button-hover:#e8d8c2; --focus:#ff9a3c; --moon:#f4e7c8; --moon-glow:#f4e7c833; --haze:#2b1d3d; --spooky:#0b0710; --web:#f3ebde; }

  & body { background:radial-gradient(1400px 520px at 50% -140px,var(--haze),transparent 75%) no-repeat,var(--paper); }
  & .button.lime:hover { background:#ffad5c; }
  & dialog::backdrop { background:#120b1a99; }

  /* Cobwebs in the top corners sit behind everything and scroll away with the page. */
  & body::before,& body::after { content:''; position:absolute; top:0; z-index:-1; width:clamp(110px,16vw,210px); aspect-ratio:1; background:var(--web); opacity:.18; pointer-events:none; -webkit-mask:url(web.svg) no-repeat 0 0/100%; mask:url(web.svg) no-repeat 0 0/100%; }
  & body::before { left:0; }
  & body::after { right:0; transform:scaleX(-1); width:clamp(80px,11vw,150px); }

  /* A witch hat perched on the logo. */
  & .wordmark { position:relative; }
  & .wordmark::before { content:''; position:absolute; left:11px; top:-15px; width:25px; height:21px; transform:rotate(16deg); background:linear-gradient(to top,var(--ink) 0 26%,var(--pumpkin) 26% 38%,var(--ink) 38%); -webkit-mask:url(hat.svg) no-repeat center/contain; mask:url(hat.svg) no-repeat center/contain; pointer-events:none; }

  /* The home hero: a rising moon, a flight of bats and a spider letting itself down. */
  & .hero { position:relative; background:radial-gradient(circle 128px at calc(100% - 140px) 40%,var(--moon) 0 98%,transparent 100%),radial-gradient(circle 210px at calc(100% - 140px) 40%,var(--moon-glow),transparent 100%); }
  & .hero::before { content:''; position:absolute; right:clamp(190px,22vw,330px); top:22px; width:clamp(150px,18vw,250px); aspect-ratio:2; background:var(--spooky); -webkit-mask:url(bats.svg) no-repeat center/contain; mask:url(bats.svg) no-repeat center/contain; pointer-events:none; animation:halloween-flutter 7s ease-in-out infinite; }
  & .hero::after { content:''; position:absolute; top:0; left:clamp(300px,46%,640px); width:24px; height:78px; background:var(--ink); -webkit-mask:url(spider.svg) no-repeat top/contain; mask:url(spider.svg) no-repeat top/contain; transform-origin:top center; pointer-events:none; animation:halloween-dangle 5s ease-in-out infinite; }
  &[data-theme="dark"] .highlight { box-shadow:0 0 28px #ff8a1f55; }

  /* The stamp becomes a carved pumpkin, keeping its sticker outline. */
  & .hero-stamp { position:relative; width:182px; height:160px; border-radius:48% 48% 44% 44% / 54% 54% 46% 46%; background:radial-gradient(ellipse 15% 50% at 50% 50%,transparent 93%,var(--pumpkin-rib) 95% 98%,transparent 100%),radial-gradient(ellipse 36% 50% at 50% 50%,transparent 95%,var(--pumpkin-rib) 96.5% 98.5%,transparent 100%),radial-gradient(ellipse at 42% 35%,#ffb15e,var(--pumpkin) 55%,#e9700c); transform:rotate(9deg); gap:4px; }
  & .hero-stamp::before { content:''; position:absolute; top:-19px; left:calc(50% - 7px); width:14px; height:24px; border:2px solid var(--ink); border-radius:4px 7px 2px 2px; background:var(--stem); transform:rotate(-10deg); z-index:-1; }
  & .hero-stamp span { width:58px; height:33px; font-size:0; background:var(--accent-ink); -webkit-mask:url(face.svg) no-repeat center/contain; mask:url(face.svg) no-repeat center/contain; }

  /* Game cards glow faintly like lanterns. */
  & .game-card:hover { box-shadow:0 8px 0 var(--card-shadow),0 10px 30px #ff8a1f26; }

  /* The player frame trades its green for a midnight purple; the games inside keep their own art. */
  & .player { --focus:#ff9a3c; background:#17111f; border-color:#3e2f50; }
  & .player:fullscreen,& .player.is-expanded { background:#17111f; }
  & .player-toolbar { background:#241a31; }
  & .player-category { border-color:#6b4a82; }
  & .player-actions .button { border-color:#53406a; background:#2e2340; }
  & .player-actions .button:hover { background:#41315a; }

  @media (prefers-reduced-motion:reduce) { & .hero::before,& .hero::after { animation:none; } }
  @media (max-width:700px) {
    & .hero { background:radial-gradient(circle 66px at calc(100% - 62px) 42%,var(--moon) 0 98%,transparent 100%),radial-gradient(circle 110px at calc(100% - 62px) 42%,var(--moon-glow),transparent 100%); }
    & .hero::before { right:110px; top:6px; width:120px; }
    & .hero::after { left:auto; right:34%; height:56px; width:18px; }
    & .hero-stamp { width:104px; height:92px; }
    & .hero-stamp::before { top:-13px; left:calc(50% - 5px); width:10px; height:16px; }
    & .hero-stamp span { width:34px; height:19px; }
    & .wordmark::before { left:9px; top:-13px; width:21px; height:18px; }
  }
  @media (max-width:500px) {
    & .hero { background:none; }
    & .hero::before { right:4%; top:8px; width:96px; }
    & .hero::after { right:18%; }
  }
}

@keyframes halloween-flutter { 0%,100% { transform:translate(0,0) rotate(0); } 30% { transform:translate(-14px,-8px) rotate(-3deg); } 65% { transform:translate(10px,5px) rotate(2deg); } }
@keyframes halloween-dangle { 0%,100% { transform:rotate(3deg) scaleY(1); } 50% { transform:rotate(-3deg) scaleY(1.22); } }
