/*
 * Christmas, shown December 1st through 31st (see `holiday_on` in
 * vzdv-site/src/main.rs).
 */

/* Frost-blue links. */
[data-bs-theme="dark"] {
  --bs-link-color: #a9d8f2;
  --bs-link-color-rgb: 169, 216, 242;
  --bs-link-hover-color: #d6eefb;
  --bs-link-hover-color-rgb: 214, 238, 251;
}

.navbar {
  --bs-navbar-hover-color: #d6eefb;
  /* room for the bulbs to hang clear of the page's first heading */
  margin-bottom: calc(1rem + 12px) !important;
}

/* The homepage banner on a snowy afternoon. */
picture:has(> #banner-img) {
  display: block;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(180deg, #5f7198 0%, #8797b8 55%, #b6c2d8 100%);
}

#banner-img {
  filter: saturate(0.55) contrast(1.05) brightness(1.1);
  mix-blend-mode: multiply;
}

/* Two depths of snowfall. Each layer is one tile taller than the banner
   and falls exactly one tile, so the loop has no seam. */
picture:has(> #banner-img)::before,
picture:has(> #banner-img)::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

picture:has(> #banner-img)::before {
  inset: -240px -20px 0;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240' fill='white'><circle cx='78' cy='36' r='1.3' opacity='0.78'/><circle cx='229' cy='166' r='0.9' opacity='0.52'/><circle cx='198' cy='51' r='0.9' opacity='0.46'/><circle cx='123' cy='166' r='1.3' opacity='0.73'/><circle cx='45' cy='114' r='1.2' opacity='0.74'/><circle cx='10' cy='5' r='1.2' opacity='0.55'/><circle cx='119' cy='92' r='0.9' opacity='0.48'/><circle cx='151' cy='219' r='1.3' opacity='0.52'/><circle cx='53' cy='183' r='1.0' opacity='0.60'/><circle cx='197' cy='104' r='0.8' opacity='0.54'/><circle cx='10' cy='70' r='1.0' opacity='0.70'/><circle cx='97' cy='212' r='1.0' opacity='0.56'/><circle cx='183' cy='187' r='1.4' opacity='0.63'/><circle cx='141' cy='49' r='1.3' opacity='0.67'/><circle cx='2' cy='203' r='0.8' opacity='0.59'/></svg>");
  animation:
    christmas-snow-far 36s linear infinite,
    christmas-snow-sway 11s ease-in-out infinite alternate;
}

picture:has(> #banner-img)::after {
  inset: -360px -20px 0;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='360' height='360' fill='white'><circle cx='163' cy='202' r='2.5' opacity='0.90'/><circle cx='330' cy='73' r='2.3' opacity='0.82'/><circle cx='326' cy='238' r='3.0' opacity='0.88'/><circle cx='164' cy='9' r='2.4' opacity='0.86'/><circle cx='46' cy='156' r='2.7' opacity='0.89'/><circle cx='22' cy='343' r='2.9' opacity='0.83'/><circle cx='240' cy='122' r='2.8' opacity='0.88'/><circle cx='129' cy='98' r='2.8' opacity='0.91'/><circle cx='269' cy='331' r='2.8' opacity='0.93'/></svg>");
  animation:
    christmas-snow-near 21s linear infinite,
    christmas-snow-sway 7s -3s ease-in-out infinite alternate;
}

@keyframes christmas-snow-far {
  to { translate: 0 240px; }
}

@keyframes christmas-snow-near {
  to { translate: 0 360px; }
}

@keyframes christmas-snow-sway {
  from { transform: translateX(-12px); }
  to { transform: translateX(12px); }
}

/* The navbar's own pseudo-elements hold the bulbs, so the snow and the
   wire hang off its container. The container isn't positioned, so they
   still span the full width of the navbar. */
.navbar > [class^="container"]::before,
.navbar > [class^="container"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}

/* Snow lying along the top of the navbar. On pages without the banner
   this sits above the top of the page, out of sight. */
.navbar > [class^="container"]::after {
  bottom: 100%;
  height: 14px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='620' height='14'><defs><linearGradient id='g' x2='0' y2='1'><stop offset='0' stop-color='white'/><stop offset='1' stop-color='%23d5e0ee'/></linearGradient></defs><path d='M0 14V8C22 4 48 4 82 7S136 11 176 7 240 2 292 6 352 10 402 6 470 3 512 6 566 10 596 9 612 8 620 8V14Z' fill='url(%23g)'/></svg>") repeat-x center bottom;
}

/* A strand of lights under the navbar on every page. The wire is pinned
   every 100px and sags between. */
.navbar > [class^="container"]::before {
  top: 100%;
  height: 10px;
  background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='10'><path d='M0 1.5Q50 9.5 100 1.5T200 1.5' fill='none' stroke='%2355695e' stroke-width='1.2'/></svg>") repeat-x center top;
}

/* The bulbs, in two sets that take turns dimming: red and green, then
   gold and blue. */
.navbar::before,
.navbar::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 32px;
  background-repeat: repeat-x;
  background-position: center top;
  pointer-events: none;
  z-index: 1;
  animation: christmas-twinkle 7s ease-in-out infinite;
}

.navbar::before {
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='32'><defs><radialGradient id='r'><stop offset='0' stop-color='%23ff5a4f' stop-opacity='.6'/><stop offset='.45' stop-color='%23ff5a4f' stop-opacity='.22'/><stop offset='1' stop-color='%23ff5a4f' stop-opacity='0'/></radialGradient><radialGradient id='g'><stop offset='0' stop-color='%2345d483' stop-opacity='.6'/><stop offset='.45' stop-color='%2345d483' stop-opacity='.22'/><stop offset='1' stop-color='%2345d483' stop-opacity='0'/></radialGradient></defs><g transform='rotate(7 25 4.5)'><circle cx='25' cy='15' r='15' fill='url(%23r)'/><rect x='22.6' y='4' width='4.8' height='4.4' rx='.9' fill='%2333473c'/><path d='M21.8 8C19.4 12 20.6 19.6 25 21.4 29.4 19.6 30.6 12 28.2 8Z' fill='%23ff5a4f'/><ellipse cx='23.4' cy='12.6' rx='1.1' ry='2.3' fill='white' opacity='.6'/></g><g transform='rotate(-6 125 4.5)'><circle cx='125' cy='15' r='15' fill='url(%23g)'/><rect x='122.6' y='4' width='4.8' height='4.4' rx='.9' fill='%2333473c'/><path d='M121.8 8C119.4 12 120.6 19.6 125 21.4 129.4 19.6 130.6 12 128.2 8Z' fill='%2345d483'/><ellipse cx='123.4' cy='12.6' rx='1.1' ry='2.3' fill='white' opacity='.6'/></g></svg>");
}

.navbar::after {
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='32'><defs><radialGradient id='y'><stop offset='0' stop-color='%23ffc94a' stop-opacity='.6'/><stop offset='.45' stop-color='%23ffc94a' stop-opacity='.22'/><stop offset='1' stop-color='%23ffc94a' stop-opacity='0'/></radialGradient><radialGradient id='b'><stop offset='0' stop-color='%2358a8ff' stop-opacity='.6'/><stop offset='.45' stop-color='%2358a8ff' stop-opacity='.22'/><stop offset='1' stop-color='%2358a8ff' stop-opacity='0'/></radialGradient></defs><g transform='rotate(-8 75 4.5)'><circle cx='75' cy='15' r='15' fill='url(%23y)'/><rect x='72.6' y='4' width='4.8' height='4.4' rx='.9' fill='%2333473c'/><path d='M71.8 8C69.4 12 70.6 19.6 75 21.4 79.4 19.6 80.6 12 78.2 8Z' fill='%23ffc94a'/><ellipse cx='73.4' cy='12.6' rx='1.1' ry='2.3' fill='white' opacity='.6'/></g><g transform='rotate(5 175 4.5)'><circle cx='175' cy='15' r='15' fill='url(%23b)'/><rect x='172.6' y='4' width='4.8' height='4.4' rx='.9' fill='%2333473c'/><path d='M171.8 8C169.4 12 170.6 19.6 175 21.4 179.4 19.6 180.6 12 178.2 8Z' fill='%2358a8ff'/><ellipse cx='173.4' cy='12.6' rx='1.1' ry='2.3' fill='white' opacity='.6'/></g></svg>");
  animation-delay: -3.5s;
}

@keyframes christmas-twinkle {
  0%, 38% { opacity: 1; }
  50%, 88% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Activity trophies become snowflakes in gold, silver and bronze. */
.bi-trophy-fill[class*="rank-"] {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
}

.bi-trophy-fill[class*="rank-"]::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><g fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><g id='a'><path d='M12 1.6V22.4'/><path d='M8.9 3.6 12 6.6 15.1 3.6M8.9 20.4 12 17.4 15.1 20.4'/></g><use href='%23a' transform='rotate(60 12 12)'/><use href='%23a' transform='rotate(120 12 12)'/></g></svg>") center / contain no-repeat;
}

@media (prefers-reduced-motion: reduce) {
  picture:has(> #banner-img)::before,
  picture:has(> #banner-img)::after,
  .navbar::before,
  .navbar::after {
    animation: none;
  }
}
