/* The Halloween theme (halloween.js). Every rule here hangs off body.halloween
   or the layer that file builds, so with the theme off none of it applies.

   Nothing in here touches a colour that carries meaning -- lines, trains,
   incidents, traffic, the board's figures -- and nothing sits over a card:
   the map layer is inside #mapwrap, below the top bar, the panel, the
   presentation card and the band. */

:root{
  --hw-rind:#f0701a; --hw-rind-mid:#e2620f; --hw-rind-dark:#c9530b; --hw-rib:#9c3e08;
  --hw-flame:#ffcf3f; --hw-stem:#5f6d2c;
  --hw-silk:rgba(226,232,244,.5); --hw-sheet:#eef2fb; --hw-eyes:#1a2232;
  --hw-orange:#ff8f2e;
}

/* The wordmark's .com (or .work) in pumpkin rather than the airport cyan. */
body.halloween .brand h1 span{color:var(--hw-orange)}

/* ---------- jack-o'-lantern (header and map) ---------- */
.hw-jack{display:block; width:100%; height:auto; overflow:visible}
.hw-stem{fill:var(--hw-stem)}
.hw-rind ellipse{stroke:var(--hw-rib); stroke-width:.9}
.hw-rind ellipse:nth-child(1),.hw-rind ellipse:nth-child(2){fill:var(--hw-rind-dark)}
.hw-rind ellipse:nth-child(3),.hw-rind ellipse:nth-child(4){fill:var(--hw-rind-mid)}
.hw-rind ellipse:nth-child(5){fill:var(--hw-rind)}
.hw-face{fill:var(--hw-flame)}
/* A candle, not a strobe: a handful of uneven dips over several seconds. */
@keyframes hw-candle{
  0%,100%{opacity:1} 9%{opacity:.82} 12%{opacity:.97} 31%{opacity:.88}
  47%{opacity:1} 63%{opacity:.78} 67%{opacity:.95} 84%{opacity:.86}
}

/* ---------- greeting in the top bar ----------
   Takes only the bar's spare width (flex-basis 0) so it can never wrap the bar
   onto another row; the container query drops the words, then everything, as
   that spare width shrinks. */
.hw-hello{flex:1 1 0; min-width:0; align-self:center; overflow:hidden; container-type:inline-size;
  display:flex; justify-content:center; pointer-events:none}
.hw-hello-in{display:inline-flex; align-items:center; gap:.55em; white-space:nowrap;
  color:var(--hw-orange); font-weight:700; font-size:var(--fs); letter-spacing:.03em}
.hw-hello .hw-jack{width:1.55em}
.hw-hello .hw-face{animation:hw-candle 5.2s steps(1) infinite}
.hw-hello .hw-jack:last-child .hw-face{animation-delay:-2.3s}
@container (max-width:13.5em){
  .hw-hello b,.hw-hello .hw-jack:last-child{display:none}
}
@container (max-width:2em){.hw-hello-in{visibility:hidden}}
body.tv .hw-hello-in{font-size:var(--fs-lg)}

/* ---------- the map layer ---------- */
/* Above the map (Leaflet's own panes stop at 400 inside their container, and
   Google's sit in a stacking context of their own at 0), below every card:
   #mapwrap is a stacking context beneath the bar and the cards, so z-index
   here never reaches them. Leaflet's corner controls (1000) stay on top. */
.hw-layer{position:absolute; inset:0; z-index:500; overflow:hidden; pointer-events:none;
  --t:0px; --l:0px; --rr:0px; --bb:0px; --s:120px; --p:48px; --d0:30px; --d1:110px; --k0:.27}
.hw-layer *{pointer-events:none}

/* Cobwebs in the clear area's two top corners, strung from the edge of the
   board to the panel or card beside them. */
.hw-web{position:absolute; top:var(--t); width:var(--s); height:var(--s); transition:opacity .6s var(--ease)}
.hw-web svg{display:block; width:100%; height:100%; overflow:visible}
.hw-web-l{left:var(--l)}
.hw-web-r{right:var(--rr); transform:scaleX(-1)}
.hw-spokes,.hw-rings{fill:none; stroke:var(--hw-silk); stroke-linecap:round}
.hw-spokes{stroke-width:.75}
.hw-rings{stroke-width:.5; opacity:.85}
.hw-narrow .hw-web-l{display:none}

/* The spider, hanging from the right-hand web's rim: it bobs, now and then
   lets itself down, and climbs back. The silk is scaled rather than resized,
   and the spider moved rather than repositioned, so both stay on the GPU. */
.hw-spider{position:absolute; top:calc(var(--t) + var(--s) * .6); right:calc(var(--rr) + var(--s) * .52);
  width:0; height:0; transition:opacity .6s var(--ease)}
.hw-silk{position:absolute; left:-.5px; top:0; width:1px; height:var(--d1); background:var(--hw-silk);
  transform-origin:top; transform:scaleY(var(--k0)); animation:hw-silk 26s ease-in-out infinite}
.hw-crawler{position:absolute; left:calc(var(--s) * -.11); top:calc(var(--s) * -.035); width:calc(var(--s) * .22);
  transform:translateY(var(--d0)); animation:hw-crawl 26s ease-in-out infinite}
.hw-crawler svg{display:block; width:100%; height:auto; overflow:visible;
  filter:drop-shadow(0 0 1.5px rgba(235,240,255,.55))}
.hw-legs{fill:none; stroke:#151a24; stroke-width:1.15; stroke-linecap:round}
.hw-body{fill:#151a24}
.hw-eye{fill:var(--hw-orange)}
@keyframes hw-crawl{
  0%,30%,74%,100%{transform:translateY(var(--d0))}
  8%{transform:translateY(calc(var(--d0) + 3px))} 16%{transform:translateY(calc(var(--d0) - 2px))}
  42%,56%{transform:translateY(var(--d1))}
  49%{transform:translateY(calc(var(--d1) + 4px))}
}
@keyframes hw-silk{
  0%,30%,74%,100%{transform:scaleY(var(--k0))}
  8%{transform:scaleY(calc(var(--k0) * 1.03))} 16%{transform:scaleY(calc(var(--k0) * .98))}
  42%,56%{transform:scaleY(1)}
  49%{transform:scaleY(1.04)}
}
.hw-low .hw-spider{display:none}

/* The region and backup slides are about the roads' traffic colours, which
   reach right into the corners there: the webs and the spider step aside. */
body[data-stage="traffic"] .hw-web,body[data-stage="traffic"] .hw-spider,
body[data-stage="hotspot"] .hw-web,body[data-stage="hotspot"] .hw-spider{opacity:0}

/* Three jack-o'-lanterns sitting on the band at the right of the clear area. */
.hw-patch{position:absolute; right:calc(var(--rr) + var(--p) * .25); bottom:var(--bb);
  display:flex; align-items:flex-end}
.hw-p{position:relative; display:block}
.hw-p1{width:var(--p); z-index:1}
.hw-p2{width:calc(var(--p) * .74); margin-right:calc(var(--p) * -.12)}
.hw-p3{width:calc(var(--p) * .6); margin-left:calc(var(--p) * -.1)}
/* Candlelight on the ground around them. Its own element, faded by opacity,
   so the flicker is a compositor job rather than a repaint. */
.hw-p::before{content:""; position:absolute; left:-35%; right:-35%; top:5%; bottom:-30%; z-index:-1;
  border-radius:50%; background:radial-gradient(closest-side, rgba(255,150,40,.32), rgba(255,120,30,0));
  animation:hw-candle 4.6s steps(1) infinite}
.hw-p .hw-face{animation:hw-candle 4.6s steps(1) infinite}
.hw-p2::before,.hw-p2 .hw-face{animation-delay:-1.7s}
.hw-p3::before,.hw-p3 .hw-face{animation-delay:-3.1s}

/* Bats and the ghost: placed and flown by halloween.js. */
.hw-bat{position:absolute; left:0; top:0}
.hw-bat svg{display:block; width:100%; height:auto; overflow:visible; fill:#120d1c;
  filter:drop-shadow(0 0 1.5px rgba(205,190,255,.6))}
.hw-wings{transform-box:view-box; transform-origin:24px 9px; animation:hw-flap .24s ease-in-out infinite alternate}
@keyframes hw-flap{from{transform:scaleY(1)} to{transform:scaleY(-.35)}}
.hw-ghost{position:absolute; opacity:0}
.hw-ghost svg{display:block; width:100%; height:auto; fill:var(--hw-eyes)}
.hw-ghost .hw-sheet{fill:var(--hw-sheet)}

/* Holding still: no flicker, no bob. Bats and the ghost never start. */
@media (prefers-reduced-motion:reduce){
  .hw-hello .hw-face,.hw-p .hw-face,.hw-p::before,.hw-silk,.hw-crawler{animation:none}
}

/* ---------- the switch in Presentation settings ---------- */
.ps-hw legend{color:var(--hw-orange)}
.ps-hw .ps-opt input:checked + .sw{background:rgba(255,143,46,.34); border-color:var(--hw-orange)}
.ps-hw .ps-opt input:checked + .sw::after{background:var(--hw-orange)}
