/* Halloween season overlay (2026-10-07).
 *
 * Loaded LAST by base.html, and only while the `season-halloween` feature
 * flag is on; base.html also stamps data-season="halloween" on <html>.
 * Two things only: the brand accent (buttons, pills, highlights) goes
 * pumpkin, and a small easter-egg layer -- cobwebs, a spider, bats,
 * pumpkins. Backgrounds, surfaces and the /packs worlds are NOT touched
 * (Andrew 2026-10-07: "just button changes ... small easter egg stuff"),
 * nor are odds-tier, pack-tier, success/error colours or the cashier.
 * Turning the season off is the flag; no other stylesheet knows this file.
 */

:root[data-season="halloween"] {
    /* Brand accent: lime -> pumpkin. Every lime in the public CSS reads
       var(--accent-2) / var(--accent-2-rgb), so this is the whole swap. */
    --accent-2: #FF7A1A;
    --accent-2-rgb: 255, 122, 26;
    --accent-2-soft: #FF9A3C;
    --lime-win: #FF9A3C;
    --focus-ring: #FF7A1A;

    --hw-orange: #FF7A1A;
    --hw-orange-rgb: 255, 122, 26;
}

/* ── Decoration layer (partials/season_halloween.html) ─────────────────── */

.hw-sky {
    position: absolute;      /* page coordinates: scrolls away with the top of the page */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;           /* grown by the partial's script to min(1500px, page height),
                                so a short page never gains extra scroll */
    overflow: hidden;        /* bats leaving the right edge must not widen the page */
    pointer-events: none;
    z-index: 999;
}

.hw-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;            /* above page content, below the top bar (1000) */
    overflow: hidden;
}

/* Corner cobwebs, placed INSIDE each card by the partial's script, so they
   scroll with it. The cards they go in are all position:relative with
   overflow:hidden and rounded corners, which clips each web to the corner. */
.hw-cw {
    position: absolute;
    aspect-ratio: 1;         /* width (and so size) is set per web by the script */
    z-index: 4;              /* over the card art; pointer-events off, so taps pass through */
    pointer-events: none;
    color: rgb(245, 238, 255);   /* per-strand opacity lives on the SVG paths */
    filter: drop-shadow(0 0 0.6px rgba(0, 0, 0, 0.55));
}
.hw-cw svg { display: block; width: 100%; height: 100%; overflow: visible; }
/* Corner placement: the drawing is anchored top-left and mirrored into place. */
.hw-cw--tl { top: 0; left: 0; }
.hw-cw--tr { top: 0; right: 0; transform: scaleX(-1); }
.hw-cw--bl { bottom: 0; left: 0; transform: scaleY(-1); }
.hw-cw--br { bottom: 0; right: 0; transform: scale(-1, -1); }

/* The spider hangs from the right-hand web of the first pack tile in a row. */
.hw-spider {
    position: absolute;
    top: 0;
    right: 14%;
    width: 16px;
    z-index: 5;
    pointer-events: none;
    color: rgba(20, 10, 28, 0.95);
    transform-origin: 50% 0;
    animation: hw-dangle 7s ease-in-out infinite;
}
.hw-spider-thread {
    display: block;
    width: 1px;
    height: 96px;
    margin: 0 auto;
    background: rgba(235, 220, 255, 0.45);
}
.hw-spider .hw-spider-thread { height: 44px; }
.potd-card > .hw-spider .hw-spider-thread { height: 26px; }
.potd-card > .hw-spider { width: 13px; }
.hw-spider svg {
    display: block;
    width: 18px;
    height: 18px;
    filter: drop-shadow(0 0 4px rgba(var(--hw-orange-rgb), 0.5));
}
@keyframes hw-dangle {
    0%, 100% { transform: translateY(-34px) rotate(0deg); }
    45%      { transform: translateY(0) rotate(2deg); }
    60%      { transform: translateY(-6px) rotate(-2deg); }
}

.hw-bat {
    position: absolute;
    top: 0;
    left: 0;
    width: 34px;
    color: rgba(18, 8, 26, 0.92);
    filter: drop-shadow(0 0 6px rgba(var(--hw-orange-rgb), 0.35));
    offset-rotate: 0deg;
    opacity: 0;
    animation: hw-fly 19s linear infinite;
}
.hw-bat svg { display: block; width: 100%; animation: hw-flap 0.32s ease-in-out infinite alternate; transform-origin: 50% 60%; }
.hw-bat--1 { top: 110px; animation-delay: 1.5s; }
.hw-bat--2 { top: 170px; width: 24px; animation-delay: 8s; animation-duration: 23s; }
.hw-bat--3 { top: 140px; width: 28px; animation-delay: 14s; animation-duration: 21s; }
.hw-bat--4 { top: 420px; width: 30px; animation-delay: 4s;  animation-duration: 20s; }
.hw-bat--5 { top: 610px; width: 22px; animation-delay: 11s; animation-duration: 25s; }
.hw-bat--6 { top: 800px; width: 32px; animation-delay: 17s; animation-duration: 18s; }
.hw-bat--7 { top: 1010px; width: 26px; animation-delay: 6s; animation-duration: 22s; }
.hw-bat--8 { top: 1260px; width: 28px; animation-delay: 13s; animation-duration: 24s; }
/* Some fly right-to-left. */
.hw-bat--back { animation-name: hw-fly-back; }
@keyframes hw-fly {
    0%   { transform: translate(-60px, 0); opacity: 0; }
    3%   { opacity: 1; }
    25%  { transform: translate(28vw, -30px); }
    50%  { transform: translate(55vw, 20px); }
    75%  { transform: translate(80vw, -18px); }
    97%  { opacity: 1; }
    100% { transform: translate(calc(100vw + 60px), 6px); opacity: 0; }
}
@keyframes hw-fly-back {
    0%   { transform: translate(calc(100vw + 60px), 0); opacity: 0; }
    3%   { opacity: 1; }
    25%  { transform: translate(72vw, 24px); }
    50%  { transform: translate(45vw, -16px); }
    75%  { transform: translate(20vw, 14px); }
    97%  { opacity: 1; }
    100% { transform: translate(-60px, -4px); opacity: 0; }
}
@keyframes hw-flap {
    from { transform: scaleY(1); }
    to   { transform: scaleY(0.45); }
}


/* Jack-o'-lantern peeking up from the bottom-right corner every ~24s. */
.hw-pumpkin {
    position: absolute;
    width: 64px;
}
.hw-pumpkin svg { display: block; width: 100%; overflow: visible; }
.hw-pumpkin--peek {
    right: 28px;
    bottom: -60px;
    animation: hw-peek 24s ease-in-out infinite 4s;
}
@keyframes hw-peek {
    0%, 70%, 100% { transform: translateY(0) rotate(0deg); }
    76%           { transform: translateY(-46px) rotate(-6deg); }
    84%           { transform: translateY(-46px) rotate(5deg); }
    90%           { transform: translateY(0) rotate(0deg); }
}

/* The jack-o'-lantern glow: a warm drop-shadow that flickers like a candle. */
.hw-pumpkin svg, .hw-hpk svg, .hw-stage-pk svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    animation: hw-candle 2.6s steps(1) infinite;
}
@keyframes hw-candle {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 150, 40, 0.75)); }
    31%      { filter: drop-shadow(0 0 3px rgba(255, 150, 40, 0.45)); }
    34%      { filter: drop-shadow(0 0 6px rgba(255, 170, 60, 0.85)); }
    72%      { filter: drop-shadow(0 0 4px rgba(255, 150, 40, 0.6)); }
}

/* Homepage headings: a pumpkin right after the words (the heading is a flex
   row with a 10px gap, so pull it back in a little). */
.hw-hpk {
    display: inline-block;
    width: 1.35em;
    margin-left: -2px;
    align-self: center;
    transform: rotate(-8deg) translateY(-1px);
    transform-origin: 50% 80%;
}

/* /packs stage layers (inserted into #pcRoot by the partial's script). */
.hw-stage {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;              /* over the world and pack, under the EV/odds pills (5) */
    overflow: hidden;
}
.hw-stage--back { z-index: auto; }

.hw-stage-pk {
    position: absolute;
    bottom: 14px;
    width: 58px;
}
.hw-stage-pk--l { left: 5%; transform: rotate(-6deg); }
.hw-stage-pk--r { right: 6%; width: 44px; transform: rotate(7deg); }

.hw-ghost {
    position: absolute;
    left: 18%;
    bottom: 12%;
    width: 64px;
    opacity: 0;
    filter: blur(0.3px) drop-shadow(0 0 14px rgba(244, 240, 255, 0.55));
    animation: hw-ghost 17s ease-in-out infinite 3s;
}
.hw-ghost svg { display: block; width: 100%; }
@keyframes hw-ghost {
    0%, 62%, 100% { opacity: 0; transform: translate(0, 40px) scale(0.9); }
    68%           { opacity: 0.55; transform: translate(14vw, -40px) scale(1); }
    80%           { opacity: 0.45; transform: translate(34vw, -110px) scale(1.04) rotate(-4deg); }
    90%           { opacity: 0; transform: translate(52vw, -170px) scale(1.06) rotate(3deg); }
}

/* Phones: one bat, no peeking pumpkin -- iPhone Safari has frozen on
   this site before under decode/DOM load, so keep the overlay cheap there. */
@media (max-width: 720px) {
    .hw-pumpkin--peek { display: none; }   /* the bottom edge is the app's tab bar */
    .hw-stage-pk { width: 40px; bottom: 10px; }
    .hw-stage-pk--r { width: 32px; }
    .hw-ghost { width: 46px; }
    .hw-bat--2, .hw-bat--5, .hw-bat--8 { display: none; }   /* 5 of 8 on phones */
}

@media (prefers-reduced-motion: reduce) {
    .hw-bat { display: none; }
    .hw-spider, .hw-pumpkin--peek, .hw-pumpkin svg, .hw-hpk svg, .hw-stage-pk svg { animation: none; }
    .hw-ghost { display: none; }
    .hw-spider { transform: none; }
}
