/* ==========================================================================
   IMFSL seasonal decorations: Christmas 2026 (every page)
   Loaded on every page while IMFSL_SEASONAL_CHRISTMAS is true in
   pages/includes/seasonal.php (header.php on PHP pages, loader.php on the
   static 404 and legal pages). Every rule is scoped to the seasonal logo
   classes, to body.seasonal-christmas or to elements that christmas.js
   creates, so nothing here affects the site once the switch is off. The
   motion runs by itself: there is no play/pause button.
   pages/assets/.htaccess caches images for months, so each url() below
   carries ?v=; bump it (and IMFSL_SEASONAL_VER) whenever an SVG changes.
   Stacking: header 1000 < ornaments 1001 < snow 1050 < drawer 1090/1100
             < floating buttons 1200 (see --z-* tokens in imfsl.css).
   ========================================================================== */

/* @logo-start  (loader.php inlines this block on the static pages so the
   swapped logo never renders at the wrong size; keep it self-contained) */
/* ---- Seasonal logo (Santa hat on the blue arrow) ----
   logo-christmas*.png covers logo.png's frame (298 px wide) plus 11 px above it
   for the hat, i.e. 180/169 of the standard logo height. The negative top
   margin cancels that extra height, so the arrow and wordmark sit exactly where
   img/logo.png draws them and the header layout does not move. --lh mirrors
   the standard logo heights in imfsl.css (.brand img). */
.brand img.brand-logo--seasonal{
  --lh:58px;
  /* Both sides fixed to the frame (298 x 180 logo px), so the box is exactly
     as wide as the standard logo whichever srcset size loads; object-fit:
     contain (from .brand img) keeps the artwork's own proportions. */
  width:calc(var(--lh) * 298 / 169);
  height:calc(var(--lh) * 180 / 169);
  max-width:none;
  margin-top:calc(var(--lh) * -11 / 169);
}
@media (max-width:1024px){.brand img.brand-logo--seasonal{--lh:52px;}}
@media (max-width:420px){.brand img.brand-logo--seasonal{--lh:44px;}}
.drawer-head .brand img.brand-logo--seasonal{--lh:48px;}
/* Footer: 120 px wide like the standard logo (imfsl.css .footer-brand img),
   on the same white plate the standard logo carries; the hat (top 11/180 of
   the frame) overhangs the plate onto the dark footer. */
.footer-brand img.footer-logo--seasonal{
  width:120px;height:calc(120px * 180 / 298);max-width:none;object-fit:contain;
  margin-top:calc(120px * -11 / 298);
  background:linear-gradient(to bottom,transparent calc(100% * 11 / 180),#fff calc(100% * 11 / 180));
}
/* @logo-end */

/* ---- Suspended ornaments: scroll away with the top of the homepage ----
   Each rope and its ornament form ONE pendulum: .xmas-orn__swing rotates about
   the rope's top attachment (its 0,0 corner); the rope and the ornament are
   placed inside it and never move relative to each other. christmas.js sets
   the attachment point (--x, --y: page top on wide screens, the lower edge of
   the warning strip on phones and tablets), sizes, angle and timing. */
.xmas-ornaments{
  position:absolute;top:0;left:0;right:0;height:var(--layer-h,0px);
  overflow:hidden;pointer-events:none;z-index:1001;
  /* The ropes pass behind the warning strip (ticker rows are masked out). */
  -webkit-mask-image:linear-gradient(to bottom,#000 var(--mask-a,0px),transparent var(--mask-a,0px),transparent var(--mask-b,0px),#000 var(--mask-b,0px));
          mask-image:linear-gradient(to bottom,#000 var(--mask-a,0px),transparent var(--mask-a,0px),transparent var(--mask-b,0px),#000 var(--mask-b,0px));
}
/* Once the header is stuck to the viewport, ornaments slide underneath it. */
.xmas-ornaments.is-under{z-index:998;}
.xmas-orn{position:absolute;top:var(--y,0px);left:var(--x,0px);width:0;height:0;}
.xmas-orn[hidden]{display:none;}
.xmas-orn__swing{
  position:absolute;left:0;top:0;width:0;height:0;transform-origin:0 0;
  transform:rotate(0deg);
  /* Half a period from one extreme to the other, alternating. The sine-shaped
     easing makes the ornament fastest through the centre and momentarily still
     at each extreme: angle = -A cos(pi t / half-period). */
  animation:xmas-swing var(--half,2s) cubic-bezier(.37,0,.63,1) var(--phase,0s) infinite alternate;
}
.xmas-orn__rope{
  position:absolute;left:-.5px;top:0;width:1px;height:var(--len,0px);
  background:linear-gradient(to bottom,rgba(226,198,138,.95),rgba(204,168,98,.95));
}
.xmas-orn__body{
  position:absolute;top:var(--len,0px);left:calc(var(--w,0px) / -2);
  width:var(--w,0px);height:var(--h,0px);
  background:no-repeat center/100% 100%;
  filter:drop-shadow(0 5px 7px rgba(3,12,24,.32));
}
.xmas-orn--gold    .xmas-orn__body{background-image:url("bauble-gold.svg?v=20261119");}
.xmas-orn--emerald .xmas-orn__body{background-image:url("bauble-emerald.svg?v=20261119");}
.xmas-orn--star    .xmas-orn__body{background-image:url("star-gold.svg?v=20261119");}

@keyframes xmas-swing{
  from{transform:rotate(calc(var(--sway,0deg) * -1));}
  to{transform:rotate(var(--sway,0deg));}
}

/* ---- Falling snow: one canvas over the visible viewport ----
   Sized to the largest viewport (mobile address bar hidden), so the canvas
   is not reallocated, and never leaves a gap, as the bar slides. */
.xmas-snow{
  position:fixed;top:0;left:0;width:100%;height:100vh;height:100lvh;
  pointer-events:none;z-index:1050;
}

/* ---- Held still only through the support handle (IMFSLSeasonal.pause()) ---- */
.xmas-paused .xmas-orn__swing{animation-play-state:paused;}

/* ---- Reduce motion: the swing keeps running (christmas.js passes a smaller
   angle and a slower period). imfsl.css shortens every animation to 0.001 ms
   on such devices; restore the ornaments' own timing. ---- */
@media (prefers-reduced-motion:reduce){
  .xmas-orn__swing{animation-duration:var(--half,2s) !important;animation-iteration-count:infinite !important;}
}

/* ---- Never print decorations; drop them in Windows high-contrast mode ---- */
@media print{.xmas-snow,.xmas-ornaments{display:none !important;}}
@media (forced-colors:active){.xmas-snow,.xmas-ornaments{display:none !important;}}
