/* ============================================================================
   Halloween overlay — everything here is scoped to html.hw, which
   assets/halloween.js only adds while the date is before Nov 1 00:00 local.
   After that the class never appears, every rule below stops matching and the
   site is its normal self again. Nothing in the base design was edited.

   All of it is decoration: aria-hidden, pointer-events:none, and it steps out
   of the way under prefers-reduced-motion.
   ========================================================================== */

/* ── bat cursor ─────────────────────────────────────────────────────────── */
/* only when a real pointer is present — never on touch, never reduced motion */
.hw.hw-bat-on, .hw.hw-bat-on a, .hw.hw-bat-on button,
.hw.hw-bat-on summary, .hw.hw-bat-on [role="slider"], .hw.hw-bat-on .deck {
  cursor: none;
}
/* typing needs a real caret, so the system cursor comes back over fields */
.hw.hw-bat-on input, .hw.hw-bat-on textarea, .hw.hw-bat-on select { cursor: auto; }

.hw-bat {
  position: fixed; left: 0; top: 0; z-index: 2147483000;
  width: 42px; height: 30px; margin: -15px 0 0 -21px;
  pointer-events: none; will-change: transform;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45));
}
.hw-bat .hw-wing { transform-origin: 50% 55%; animation: hwFlap .34s ease-in-out infinite; }
.hw-bat .hw-wing--r { animation-delay: -.17s; }
@keyframes hwFlap {
  0%, 100% { transform: scaleY(1) scaleX(1); }
  50%      { transform: scaleY(.42) scaleX(1.06); }
}
/* the little eyes catch the light */
.hw-bat .hw-eye { animation: hwBlink 4.5s steps(1, end) infinite; }
@keyframes hwBlink { 0%, 96% { opacity: 1; } 97%, 100% { opacity: 0; } }

/* ── spider webs ────────────────────────────────────────────────────────── */
/* pale strands so they read on the dark hero, with a shadow so they still
   read against the cream pages the fixed corner webs sit on */
.hw-web { position: fixed; z-index: 40; pointer-events: none; opacity: .95;
          filter: drop-shadow(0 1px 1.4px rgba(22, 17, 14, .75))
                  drop-shadow(0 0 1px rgba(22, 17, 14, .55)); }
.hw-web--tl { top: 0; left: 0; width: clamp(150px, 19vw, 300px); }
.hw-web--tr { top: 0; right: 0; width: clamp(150px, 19vw, 300px); transform: scaleX(-1); }

.hw-spider { position: fixed; top: 0; right: clamp(60px, 22vw, 340px); z-index: 95;
             pointer-events: none; animation: hwDrop 9s ease-in-out infinite; }
.hw-spider .hw-thread { stroke: rgba(250, 247, 242, .5); stroke-width: 1.2; }
@keyframes hwDrop {
  0%, 100% { transform: translateY(-26px); }
  50%      { transform: translateY(16px); }
}

/* ── jack-o'-lanterns (replacing the firefly dots) ──────────────────────── */
/* the dot itself becomes the carrier; its glow stays, the pumpkin sits on top */
.hw .svc-fly, .hw .hw-fly {
  background: transparent !important;
  box-shadow: 0 0 22px 9px rgba(242, 125, 34, .34) !important;
  width: auto !important; height: auto !important; border-radius: 0 !important;
}
.hw-pumpkin { display: block; width: var(--hw-size, 34px); height: auto;
              pointer-events: none; filter: drop-shadow(0 0 10px rgba(242,125,34,.5)); }
/* eyes and grin flicker like candlelight — each lantern on its own rhythm */
.hw-pumpkin .hw-glow { animation: hwFlicker var(--hw-flicker, 1.7s) ease-in-out infinite; }
@keyframes hwFlicker {
  0%, 100% { opacity: 1; }
  12%  { opacity: .55; }
  18%  { opacity: .95; }
  43%  { opacity: .38; }
  47%  { opacity: 1; }
  71%  { opacity: .62; }
  78%  { opacity: .98; }
}

/* ── graveyard: the supplied cemetery artwork, with the flat hills retired ─ */
.hw .svc-hill, .hw .tst-hill, .hw .tst-bush { display: none !important; }

.hw-yard { position: absolute; left: 0; right: 0; bottom: 0; height: min(52vh, 420px);
           pointer-events: none; z-index: 1; overflow: hidden; }
.hw-yard-art {
  position: absolute; inset: 0;
  background: url("halloween/cemetery.jpg") center bottom / cover no-repeat;
  /* the top edge dissolves so the night scene meets the cream page softly */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26%, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 26%, #000 100%);
}

/* zombies are placed individually, at their own depth and size */
.hw-zombie { position: absolute; width: clamp(54px, 7vw, 96px);
             transform-origin: 50% 100%;
             animation: hwRise var(--hw-rise, 7s) ease-in-out infinite;
             animation-delay: var(--hw-delay, 0s); }
.hw-zombie svg { width: 100%; height: auto; display: block;
                 filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .55)); }
@keyframes hwRise {
  0%, 10%   { transform: scale(var(--hw-s, 1)) translateY(58%); opacity: 0; }
  24%, 60%  { transform: scale(var(--hw-s, 1)) translateY(0);   opacity: 1; }
  80%, 100% { transform: scale(var(--hw-s, 1)) translateY(58%); opacity: 0; }
}
.hw-zombie .hw-z-head { animation: hwLurch 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes hwLurch { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(7deg); } }

/* ── reduced motion: keep the scene, drop the movement and the cursor ───── */
@media (prefers-reduced-motion: reduce) {
  .hw.hw-bat-on, .hw.hw-bat-on a, .hw.hw-bat-on button { cursor: auto; }
  .hw-bat { display: none; }
  .hw-spider, .hw-bat .hw-wing, .hw-pumpkin .hw-glow,
  .hw-zombie, .hw-zombie .hw-z-head { animation: none !important; }
  .hw-zombie { transform: scale(var(--hw-s, 1)); opacity: 1; }
}

/* phones: the corner webs shrink so they never crowd the logo or the menu */
@media (max-width: 700px) {
  .hw-web--tl, .hw-web--tr { width: 104px; opacity: .72; }
  .hw-spider { display: none; }
  .hw-yard { height: 34vh; }
}
