/* ── HALLOWEEN THEME ──
   Seasonal overlay. Everything is scoped under `html.halloween`, which an
   inline <head> script adds only from Oct 1 (Guam) until Halloween is over in
   the whole USA: Nov 1 00:00 in American Samoa = Nov 1 11:00 UTC. Outside
   that window this file is inert and the site looks exactly as normal; open
   pages revert by themselves at the end time (nav.js). Repeats every year.
   To retire it: delete this file, its <link> tags and the inline script. */

html.halloween {
  --yellow: #FF7A1A;      /* pumpkin orange (was IKEA yellow) */
  --blue: #7B2CBF;        /* witchy purple */
  --dark-blue: #2B1240;   /* midnight purple */
  --off-white: #FBF4EC;
  --light-gray: #EFE3D6;
  --hw-orange: #FF7A1A;
  --hw-purple: #2B1240;
  --hw-green: #7ED957;
}

/* Top bar → seasonal banner (text swapped in by nav.js) */
html.halloween .top-bar {
  background: var(--hw-purple);
  background-image: radial-gradient(circle at 12% 50%, rgba(255,122,26,.25), transparent 40%),
                    radial-gradient(circle at 88% 50%, rgba(126,217,87,.18), transparent 40%);
}
html.halloween .top-bar a {
  color: var(--hw-orange);
  text-decoration: none;
}
html.halloween .top-bar a:hover,
html.halloween .top-bar a:focus-visible { text-decoration: underline; }

/* Candy-corn stripe under the sticky nav */
html.halloween #site-chrome > nav,
html.halloween body > nav:first-of-type {
  border-bottom: 4px solid transparent;
  border-image: linear-gradient(90deg,
    #FFF6E5 0 33.3%, var(--hw-orange) 33.3% 66.6%, #FFC300 66.6% 100%) 1;
}

/* Footer goes full midnight */
html.halloween footer { background: var(--hw-purple); }

/* Flying bats (injected by nav.js; decorative only).
   Three nested layers so the motions combine: .hw-bat crosses the screen,
   .hw-bat-bob swoops up and down, and the wing paths flap. Per-bat height,
   size, speed and delay come from CSS variables set in nav.js. */
.hw-bats {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 250;
}
.hw-bat {
  position: absolute;
  left: 0;
  top: var(--y, 30%);
  animation: hw-cross var(--dur, 18s) linear var(--delay, 0s) infinite;
  will-change: transform;
}
.hw-bat.hw-rtl { animation-name: hw-cross-rtl; }
.hw-bat-bob {
  animation: hw-bob var(--bob, 2.6s) ease-in-out infinite alternate;
}
.hw-bat svg {
  display: block;
  width: var(--size, 44px);
  height: auto;
  fill: #1B0B26;
  opacity: .85;
  filter: drop-shadow(0 2px 3px rgba(43, 18, 64, .25));
}
.hw-rtl svg { transform: scaleX(-1); }
.hw-wing {
  transform-box: fill-box;
  animation: hw-flap var(--flap, .22s) ease-in-out infinite alternate;
}
.hw-wing-l { transform-origin: right 40%; }
.hw-wing-r { transform-origin: left 40%; }
@keyframes hw-cross {
  from { transform: translateX(-12vw); }
  to   { transform: translateX(112vw); }
}
@keyframes hw-cross-rtl {
  from { transform: translateX(112vw); }
  to   { transform: translateX(-12vw); }
}
@keyframes hw-bob {
  from { transform: translateY(-28px); }
  to   { transform: translateY(28px); }
}
@keyframes hw-flap {
  from { transform: scaleY(1); }
  to   { transform: scaleY(.25); }
}

/* Spider dangling from the banner (desktop only) */
html.halloween .top-bar { position: relative; }
html.halloween .top-bar::after {
  content: '🕷️';
  position: absolute;
  left: 50%;
  top: 100%;
  font-size: 18px;
  line-height: 1;
  padding-top: 26px;
  background: linear-gradient(rgba(255,255,255,.55), rgba(255,255,255,.55)) center top / 1px 26px no-repeat;
  transform-origin: top center;
  animation: hw-dangle 4s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 301;
}
@keyframes hw-dangle {
  from { transform: translateY(-8px) rotate(-4deg); }
  to   { transform: translateY(6px) rotate(4deg); }
}

@media (max-width: 768px) {
  .hw-bat svg { width: calc(var(--size, 44px) * .7); }
  .hw-long { display: none; }
  html.halloween .top-bar::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html.halloween .top-bar::after { animation: none; }
  .hw-bats { display: none; }
}
