/* Christmas - Festive (Tint). Red and green take over the site's accents
   (the palette). An evergreen garland with a red bow at each swag and
   baubles that glint hangs from the header, and now and then a robin flies
   in, perches on it, hops and looks about, then flies off. A little gold
   glitter drifts down the page, holly and a bow sit on the logo, and where
   there's a margin, holly, berries and a gold bauble frame the bottom
   corners. */

/* ---- The garland ------------------------------------------------------- */
html[data-gimmick="christmas-festive"] [data-gimmick-anchor="header"]::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: calc(100% - 4px);
  height: 40px;
  background: url("garland.svg") repeat-x left top / 180px 40px;
  filter: drop-shadow(0 2px 1.5px rgb(0 0 0 / 0.2));
  pointer-events: none;
}
/* The baubles glint once the page has loaded, and not while the tab is
   hidden: the glints are in the drawing, so it's swapped in. */
/* Not under reduced motion: an SVG background doesn't always see that
   setting, so the still drawing stays. */
@media (prefers-reduced-motion: no-preference) {
  html[data-gimmick="christmas-festive"][data-gimmick-ready]:not([data-gimmick-paused]) [data-gimmick-anchor="header"]::after {
    background-image: url("garland-on.svg");
  }
}

/* ---- The robin ----------------------------------------------------------
   The header's own ::before, so it perches on the garland above anything
   under the header. Its visit - flying in, perching, hopping, looking about,
   flying off - is one 40s drawing, attached only once the page has loaded,
   so it starts from the top. The box is 300x150; the robin's feet land at
   (230, 128), which is put on the garland 24px past a bow (180px apart). */
html[data-gimmick="christmas-festive"][data-gimmick-ready]:not([data-gimmick-paused]) [data-gimmick-anchor="header"]::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: calc(180px * var(--cf-bow, 4) + 24px - 230px);
  top: calc(100% - 121px);
  width: 300px;
  height: 150px;
  background: url("robin-still.svg") left top / 300px 150px no-repeat;
  pointer-events: none;
}
/* The visit itself, not under reduced motion (an SVG background doesn't
   always see that setting): there the robin just perches. */
@media (prefers-reduced-motion: no-preference) {
  html[data-gimmick="christmas-festive"][data-gimmick-ready]:not([data-gimmick-paused]) [data-gimmick-anchor="header"]::before { background-image: url("robin.svg"); }
}
@media (max-width: 1099px) { html[data-gimmick="christmas-festive"] { --cf-bow: 2; } }
@media (max-width: 640px)  { html[data-gimmick="christmas-festive"] { --cf-bow: 1; } }

/* ---- Holly on the logo -------------------------------------------------- */
html[data-gimmick="christmas-festive"] [data-gimmick-anchor="logo"]::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: var(--gimmick-logo-x, -0.5em);
  top: var(--gimmick-logo-y, -0.4em);
  width: calc(1.6em * var(--gimmick-logo-size, 1));
  height: calc(1.12em * var(--gimmick-logo-size, 1));
  background: url("holly.svg") center / contain no-repeat;
  transform: rotate(-12deg);
  filter: drop-shadow(0 1px 1px rgb(0 0 0 / 0.25));
  pointer-events: none;
}

/* ---- Gold glitter ------------------------------------------------------- */
html[data-gimmick="christmas-festive"] .cf-glit {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 9px;
  background: url("glitter.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 2px rgb(240 190 60 / 0.8));
  animation: cf-fall var(--d, 26s) linear infinite, cf-twinkle 1.8s ease-in-out infinite alternate;
  animation-delay: var(--w, 0s), var(--w, 0s);
}
@keyframes cf-fall {
  from { translate: 0 0; rotate: 0deg; }
  to   { translate: var(--x, 30px) 112vh; rotate: 360deg; }
}
@keyframes cf-twinkle { from { opacity: 1; scale: 1; } to { opacity: 0.35; scale: 0.6; } }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(1) { --y: 47vh; left: 3.3%; --d: 30s; --w: -25.7s; --x: 48px; width: 8px; height: 8px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(2) { --y: 84vh; left: 8.8%; --d: 30s; --w: -14.3s; --x: -26px; width: 11px; height: 11px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(3) { --y: 43vh; left: 16.7%; --d: 23s; --w: -12.4s; --x: -58px; width: 11px; height: 11px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(4) { --y: 80vh; left: 27.8%; --d: 32s; --w: -23.6s; --x: -59px; width: 7px; height: 7px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(5) { --y: 39vh; left: 34.1%; --d: 23s; --w: -1.4s; --x: -35px; width: 7px; height: 7px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(6) { --y: 76vh; left: 41.0%; --d: 27s; --w: -11.9s; --x: -53px; width: 8px; height: 8px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(7) { --y: 35vh; left: 47.3%; --d: 29s; --w: -0.1s; --x: -49px; width: 9px; height: 9px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(8) { --y: 72vh; left: 53.0%; --d: 30s; --w: -29.9s; --x: -36px; width: 9px; height: 9px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(9) { --y: 31vh; left: 62.3%; --d: 30s; --w: -8.7s; --x: -56px; width: 7px; height: 7px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(10) { --y: 68vh; left: 67.3%; --d: 26s; --w: -10.0s; --x: -20px; width: 8px; height: 8px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(11) { --y: 27vh; left: 73.3%; --d: 22s; --w: -10.3s; --x: 46px; width: 7px; height: 7px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(12) { --y: 64vh; left: 82.5%; --d: 25s; --w: -19.5s; --x: 41px; width: 7px; height: 7px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(13) { --y: 23vh; left: 88.2%; --d: 22s; --w: -21.2s; --x: -28px; width: 8px; height: 8px; }
html[data-gimmick="christmas-festive"] .cf-glit:nth-child(14) { --y: 60vh; left: 97.7%; --d: 22s; --w: -1.3s; --x: 31px; width: 8px; height: 8px; }
@media (max-width: 640px) {
  html[data-gimmick="christmas-festive"] .cf-glit:nth-child(even) { display: none; }
}

/* ---- The corner pieces: the one drawing, mirrored for the right -------- */
html[data-gimmick="christmas-festive"] .cf-corner {
  position: absolute;
  bottom: 0;
  width: 150px;
  height: 112px;
  background: url("corner.svg") left bottom / contain no-repeat;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 0.2));
}
html[data-gimmick="christmas-festive"] .cf-l { left: 0; }
html[data-gimmick="christmas-festive"] .cf-r { right: 0; transform: scaleX(-1); }

/* Still: the robin perches, the baubles don't glint (both above) and the
   glitter rests where it is. */
@media (prefers-reduced-motion: reduce) {
  html[data-gimmick="christmas-festive"] .cf-glit { animation: none; translate: 0 var(--y, 40vh); }
}
