/* #3133: Christmas decorations (lights, Santa's sleigh, snow). Shared file, no dependencies.
   Colours follow the site: brand red, gold, plus a green and an ice blue for the light string. */
:where(:root) {
  --xf-red: var(--brand, #df2531);
  --xf-gold: #f5b82e;
  --xf-green: #1fae6b;
  --xf-blue: #4aa3ff;
  --xf-top: var(--header-h, 84px);
}

/* ---------- light string across the top of the header ---------- */
.site-header > .container { position: relative; z-index: 1; }
.xmas-lights {
  position: absolute; top: 0; left: 0; right: 0;
  height: 30px;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 6px;
  /* the wire: one shallow sag per bulb */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='12'%3E%3Cpath d='M0 2 Q24 10 48 2' fill='none' stroke='%23222' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x 0 0 / 48px 12px;
}
.xl-bulb {
  position: relative;
  flex: 0 0 auto;
  width: 9px; height: 15px;
  margin-top: 6px;
  border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%;
  background: radial-gradient(circle at 38% 30%, #fff 0 12%, var(--c) 45%, color-mix(in srgb, var(--c) 65%, #000) 100%);
  box-shadow: 0 0 6px 1px var(--c);
  animation: xl-twinkle 2.6s ease-in-out infinite;
  transform-origin: 50% -4px;
}
.xl-bulb::before { /* socket */
  content: ""; position: absolute; left: 1.5px; top: -4px;
  width: 6px; height: 5px; border-radius: 1.5px; background: #2a2a2a;
}
.xl-bulb:nth-child(4n+1) { --c: var(--xf-red); }
.xl-bulb:nth-child(4n+2) { --c: var(--xf-green); animation-delay: -.65s; transform: rotate(8deg); }
.xl-bulb:nth-child(4n+3) { --c: var(--xf-blue); animation-delay: -1.3s; }
.xl-bulb:nth-child(4n)   { --c: var(--xf-gold); animation-delay: -1.95s; transform: rotate(-8deg); }
.xl-bulb:nth-child(3n)   { margin-top: 7px; }
@keyframes xl-twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}
/* only at the top of the page: hidden once the header turns sticky on scroll */
.site-header.is-solid .xmas-lights,
.site-top.is-stuck .site-header > .xmas-lights { display: none; }
@media (max-width: 767.98px) {
  .xl-bulb:nth-child(n+23) { display: none; }   /* fewer, wider-spaced bulbs on phones */
}

/* the snow button adds a fourth action: tighten the menu a little so the row still fits */
@media (min-width: 1200px) and (max-width: 1599.98px) {
  .site-header:has(#xmasSnowToggle) .main-nav .nav-link { padding-left: 8px !important; padding-right: 8px !important; }
  .site-header:has(#xmasSnowToggle) .main-nav .nav-link::after { left: 8px; right: 8px; }
  .site-header:has(#xmasSnowToggle) .header-actions { gap: 6px; }
  .site-header:has(#xmasSnowToggle) .header-actions .btn { padding-left: 16px; padding-right: 16px; }
}
@media (min-width: 1200px) and (max-width: 1399.98px) {
  .site-header:has(#xmasSnowToggle) .main-nav .nav-link { padding-left: 6px !important; padding-right: 6px !important; font-size: .86rem; }
  .site-header:has(#xmasSnowToggle) .main-nav .nav-link::after { left: 6px; right: 6px; }
  .site-header:has(#xmasSnowToggle) .header-actions .btn { padding-left: 14px; padding-right: 14px; }
}


/* ---------- Santa's sleigh: small, just below the menu, crosses from left to right ----------
   assets/img/xmas/santa-sleigh.webp is one row of 37 frames (240x118 each, 25 fps, 1.48 s seamless loop: source frames 20-57 without the duplicated frames, plus one blended frame at the join),
   loaded by xmas-fx.js after the page has finished loading. */
.xmas-santa {
  --xs-w: 170px;
  position: fixed;
  left: 0;
  top: calc(var(--xf-top) + 4px);
  z-index: 1037;              /* under the header (1040), the gift box and the pop-up */
  width: var(--xs-w);
  pointer-events: none;
  visibility: hidden;
  transform: translate3d(calc(-1 * var(--xs-w) - 90px), 0, 0);
  will-change: transform;
}
.xmas-santa.is-ready {
  visibility: visible;
  animation: xs-fly var(--xs-dur, 16s) linear 1 forwards;   /* one crossing per page load */
}
.xmas-santa.is-done { display: none; }
@keyframes xs-fly {
  0%   { transform: translate3d(calc(-1 * var(--xs-w) - 90px), 0, 0); }
  100% { transform: translate3d(calc(100vw + 20px), 0, 0); }
}
.xs-bob { animation: xs-bob 3.2s ease-in-out infinite; }   /* gentle glide; the art has its own motion */
@keyframes xs-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.xs-sprite {
  position: relative;
  display: block; width: 100%;
  padding: 0; border: 0; background: none;
  cursor: pointer;
  pointer-events: auto;
  transition: transform .3s ease;
}
.xs-sprite:focus { outline: none; }   /* mouse-only target (tabindex -1); the gift box is the keyboard route */
.xs-frames {
  display: block;
  width: 100%;
  aspect-ratio: 240 / 118;
  position: relative; z-index: 1;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .25));
  background: no-repeat 0 0 / 3700% 100%;
  animation: xs-frames 1.48s steps(37, jump-none) infinite;
}
@keyframes xs-frames { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.xmas-santa:hover, .xmas-santa:hover .xs-bob { animation-play-state: paused; }
.xs-sprite:hover { transform: scale(1.08); }

/* magic trail behind the sleigh: blinking stars and glitter that drift back and fade */
.xs-trail {
  position: absolute;
  right: 90%; bottom: -4%;
  width: 130px; height: 58px;
  pointer-events: none;
}
.xs-trail i { position: absolute; right: 0; display: block; opacity: 0; will-change: transform, opacity; }
.xs-star {
  width: 14px; height: 14px;
  background: radial-gradient(circle, #fff 0 16%, #ffe680 34%, #ffc21a 62%, #f59e0b 90%);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px #fff1b0) drop-shadow(0 0 2px #ffd24a);
  animation: xs-star 1.7s linear infinite;
}
.xs-star:nth-child(1) { top: 8%; animation-delay: -0s; width: 14px; height: 14px; }
.xs-star:nth-child(2) { top: 66%; animation-delay: -0.12s; width: 10px; height: 10px; }
.xs-star:nth-child(3) { top: 28%; animation-delay: -0.24s; width: 15px; height: 15px; }
.xs-star:nth-child(4) { top: 84%; animation-delay: -0.36s; width: 9px; height: 9px; }
.xs-star:nth-child(5) { top: 16%; animation-delay: -0.48s; width: 11px; height: 11px; }
.xs-star:nth-child(6) { top: 56%; animation-delay: -0.6s; width: 14px; height: 14px; }
.xs-star:nth-child(7) { top: 40%; animation-delay: -0.72s; width: 9px; height: 9px; }
.xs-star:nth-child(8) { top: 0%; animation-delay: -0.84s; width: 10px; height: 10px; }
.xs-star:nth-child(9) { top: 74%; animation-delay: -0.96s; width: 12px; height: 12px; }
.xs-star:nth-child(10) { top: 48%; animation-delay: -1.08s; width: 15px; height: 15px; }
.xs-star:nth-child(11) { top: 22%; animation-delay: -1.2s; width: 9px; height: 9px; }
.xs-star:nth-child(12) { top: 90%; animation-delay: -1.32s; width: 10px; height: 10px; }
.xs-star:nth-child(13) { top: 34%; animation-delay: -1.44s; width: 12px; height: 12px; }
.xs-star:nth-child(14) { top: 62%; animation-delay: -1.56s; width: 9px; height: 9px; }
@keyframes xs-star { /* drift back and sparkle: quick flashes, turning, fading out */
  0%   { opacity: 0;  transform: translateX(-2px) scale(.3) rotate(0deg); }
  8%   { opacity: 1;  transform: translateX(-10px) scale(1.25) rotate(20deg); }
  16%  { opacity: .25; transform: translateX(-20px) scale(.5) rotate(40deg); }
  26%  { opacity: 1;  transform: translateX(-32px) scale(1.15) rotate(65deg); }
  36%  { opacity: .3; transform: translateX(-44px) scale(.55) rotate(90deg); }
  48%  { opacity: 1;  transform: translateX(-58px) scale(1) rotate(120deg); }
  60%  { opacity: .35; transform: translateX(-72px) scale(.5) rotate(145deg); }
  72%  { opacity: .9; transform: translateX(-86px) scale(.8) rotate(170deg); }
  100% { opacity: 0;  transform: translateX(-120px) scale(.15) rotate(220deg); }
}
.xs-glit { /* fine glitter */
  width: 3px; height: 3px; border-radius: 50%;
  background: #fffbe6;
  box-shadow: 0 0 4px 1px #ffd24a;
  animation: xs-glit 1.3s ease-out infinite;
}
.xs-glit:nth-child(15) { top: 12%; animation-delay: -0s; }
.xs-glit:nth-child(16) { top: 70%; animation-delay: -0.15s; }
.xs-glit:nth-child(17) { top: 38%; animation-delay: -0.3s; }
.xs-glit:nth-child(18) { top: 86%; animation-delay: -0.45s; }
.xs-glit:nth-child(19) { top: 24%; animation-delay: -0.6s; }
.xs-glit:nth-child(20) { top: 58%; animation-delay: -0.75s; }
.xs-glit:nth-child(21) { top: 4%; animation-delay: -0.9s; }
.xs-glit:nth-child(22) { top: 46%; animation-delay: -1.05s; }
.xs-glit:nth-child(23) { top: 78%; animation-delay: -1.2s; }
.xs-glit:nth-child(24) { top: 30%; animation-delay: -1.35s; }
@keyframes xs-glit {
  0%   { opacity: 0; transform: translate(0, 0) scale(.5); }
  15%  { opacity: 1; transform: translate(-14px, -2px) scale(1.4); }
  30%  { opacity: .2; }
  45%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-96px, 6px) scale(.3); }
}

/* "Gift for you" flag trailing behind the sleigh */
.xs-flag {
  position: absolute;
  right: 100%; top: 2%;
  display: flex; align-items: center;
  margin-right: -6px;
  transform-origin: 100% 50%;
  animation: xs-flutter .9s ease-in-out infinite alternate;
}
.xs-flag__rope { order: 2; width: 16px; height: 2px; background: var(--xf-gold); border-radius: 2px; }
.xs-flag__cloth {
  order: 1;
  padding: 3px 9px 3px 10px;
  border: 1.5px solid var(--xf-gold);
  border-radius: 10px 4px 4px 10px;
  background: #fff;
  color: var(--xf-red);
  font: 800 11px/1.2 var(--font-head, 'Poppins', sans-serif);
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .22);
}
@keyframes xs-flutter { from { transform: rotate(-4deg) skewY(-2deg); } to { transform: rotate(3deg) skewY(2deg); } }

@media (max-width: 767.98px) {
  .xmas-santa { --xs-w: 128px; --xs-dur: 15s; top: calc(var(--xf-top) + 2px); }
  .xs-flag__cloth { font-size: 9.5px; padding: 2px 7px; }
  .xs-flag__rope { width: 10px; }
  .xs-trail { width: 84px; height: 42px; transform: scale(.8); transform-origin: 100% 50%; }
}

/* ---------- snow ---------- */
.xmas-snow {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1039;
}
.xmas-snow-btn { position: relative; }
/* below 992px the gift box hangs just left of the dark-mode toggle; the snow button sits
   between that toggle and the menu button, so move the box one button further left */
@media (max-width: 991.98px) {
  :root:has(#xmasSnowToggle) .pg-hang { right: calc(var(--pg-right-m, 76px) + 52px); }
}
@media (max-width: 575.98px) {
  .header-actions .xmas-snow-btn { width: 38px; height: 38px; }
  :root:has(#xmasSnowToggle) .pg-hang { right: calc(var(--pg-right-m, 76px) + 48px); }
}
.xmas-snow-btn.is-on { color: #fff; background: rgba(74, 163, 255, .28); border-color: rgba(160, 205, 255, .8); }
.site-header.is-solid .xmas-snow-btn.is-on,
body.has-light-top .xmas-snow-btn.is-on { color: #1f6fc4; background: #eaf4ff; border-color: #9cc8f5; }
.xmas-snow-btn::after { /* slash while off */
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 22px; height: 2px; border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(-45deg) scaleX(0);
  transition: transform .25s ease;
}
.xmas-snow-btn:not(.is-on)::after { transform: translate(-50%, -50%) rotate(-45deg) scaleX(1); }

/* ---------- gift box: a little snow on the lid ---------- */
.pg-gift__lid::after {
  content: ""; position: absolute; left: -3px; right: -3px; top: -5px; height: 9px;
  background: radial-gradient(circle at 10% 100%, #fff 5px, transparent 5.5px) 0 0 / 14px 9px repeat-x;
  border-radius: 6px 6px 0 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .15));
}

/* ---------- pause when the tab is hidden; respect reduced motion ---------- */
html.xmas-paused .xl-bulb,
html.xmas-paused .xmas-santa, html.xmas-paused .xmas-santa * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .xmas-santa { display: none; }
  .xl-bulb { animation: none; }
}

/* ---------- offer pop-up: blinking stars in the red header (decorative, behind the text) ---------- */
.pg-card__top { position: relative; isolation: isolate; overflow: hidden; }
.pg-card__top > * { position: relative; z-index: 1; }
.pg-card__top::before,
.pg-card__top::after {
  content: ""; position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  animation: pg-twinkle 2.2s ease-in-out infinite;
}
.pg-card__top::before {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E");
  background-size: 16px 16px, 10px 10px, 12px 12px, 8px 8px;
  background-position: 6% 16%, 95% 72%, 5% 90%, 82% 9%;
}
.pg-card__top::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E");
  background-size: 9px 9px, 14px 14px, 8px 8px, 12px 12px;
  background-position: 24% 5%, 97% 36%, 3% 52%, 93% 95%;
  animation-delay: -1.1s;
}
@keyframes pg-twinkle {
  0%, 100% { opacity: .15; transform: scale(.96); }
  50%      { opacity: 1;   transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .pg-card__top::before, .pg-card__top::after { animation: none; opacity: .6; } }

/* ---------- gift box: small stars blinking around it (decorative, not clickable) ---------- */
.pg-gift::before,
.pg-gift::after {
  content: ""; position: absolute; inset: -12px -16px -6px;
  z-index: 4;
  pointer-events: none;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 2px rgba(255, 220, 120, .9));
  animation: pg-gift-twinkle 1.8s ease-in-out infinite;
}
.pg-gift::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E");
  background-size: 9px 9px, 6px 6px, 7px 7px;
  background-position: 2% 30%, 98% 18%, 94% 78%;
}
.pg-gift::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffe680%27/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 20%27%3E%3Cpath d=%27M10 0l2.2 7.8L20 10l-7.8 2.2L10 20l-2.2-7.8L0 10l7.8-2.2z%27 fill=%27%23ffffff%27/%3E%3C/svg%3E");
  background-size: 6px 6px, 8px 8px, 6px 6px;
  background-position: 100% 50%, 4% 72%, 12% 6%;
  animation-delay: -.9s;
}
@keyframes pg-gift-twinkle {
  0%, 100% { opacity: .1; transform: scale(.92); }
  50%      { opacity: 1;  transform: scale(1); }
}
@media (max-width: 991.98px) { .pg-gift::before, .pg-gift::after { inset: -10px -12px -4px; } }
@media (prefers-reduced-motion: reduce) { .pg-gift::before, .pg-gift::after { animation: none; opacity: .7; } }
html.xmas-paused .pg-gift::before, html.xmas-paused .pg-gift::after { animation-play-state: paused; }

/* ---------- ICESSU site adapter ----------
   The header keeps the site's own colours (transparent over the hero, Midnight Orchid once
   .site-top turns .is-stuck on scroll; the kit rule above hides the lights then). The light string
   hangs along the top edge of the nav bar, under the utility bar. Neither the lights nor the nav row
   get a z-index: a stacking context on .mainnav__inner would trap the phone drawer (z 1045) under
   the menu backdrop (z 1040), which lives outside that row. */
.site-header:has(> .xmas-lights) > .container { z-index: auto; }
.site-header > .xmas-lights { z-index: auto; }
/* snow button: same as the site's dark-mode toggle (.theme-toggle), next to it in .mainnav__cta */
.mainnav__cta > .xmas-snow-btn {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; flex: 0 0 auto; padding: 0;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: #fff; font-size: 1.05rem; line-height: 1; cursor: pointer;
  transition: background-color var(--transition-fast, .15s), border-color var(--transition-fast, .15s), color var(--transition-fast, .15s);
}
.mainnav__cta > .xmas-snow-btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .45); }
.mainnav__cta > .xmas-snow-btn.is-on,
.site-top.is-stuck .mainnav__cta > .xmas-snow-btn.is-on {
  color: var(--color-accent, #BAB0C8);
  background: rgba(186, 176, 200, .18);
  border-color: rgba(215, 197, 216, .7);
}
.mainnav__cta > .xmas-snow-btn:focus-visible { outline: 2px solid var(--color-accent, #BAB0C8); outline-offset: 2px; }
/* below 1200px the header actions move into the drawer; keep only the snow button on the bar,
   just left of the menu button */
@media (max-width: 1199.98px) {
  .mainnav__cta:has(> .xmas-snow-btn) { display: flex; margin-left: auto; }
  .mainnav__cta:has(> .xmas-snow-btn) > :not(.xmas-snow-btn) { display: none; }
  .mainnav__cta > .xmas-snow-btn { width: 2.75rem; height: 2.75rem; }
  :root:has(#xmasSnowToggle) .pg-hang { right: calc(var(--pg-right-m, 72px) + 60px); }
}
