/* Christmas decorations. Everything is scoped to html.xmas, which layouts/_partials/xmas.html
   sets until the date in params.xmasUntil. Delete this file with that partial when Christmas is over. */

/* Light string hanging from the navbar */
html.xmas .site-nav::before,
html.xmas .site-nav::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  pointer-events: none;
  background-repeat: repeat-x;
  background-position: center top;
}
html.xmas .site-nav::before {
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='24'%3E%3Cpath d='M0 3 Q15 10 30 3 T60 3 T90 3 T120 3' fill='none' stroke='%2355606e' stroke-width='1.2'/%3E%3Crect x='13' y='6' width='4' height='3.5' rx='1' fill='%2355606e'/%3E%3Cellipse cx='15' cy='14.5' rx='4.2' ry='5.6' fill='%23d72e21'/%3E%3Cellipse cx='13.6' cy='12.6' rx='1.1' ry='1.8' fill='%23fff' fill-opacity='.45'/%3E%3Crect x='43' y='6' width='4' height='3.5' rx='1' fill='%2355606e'/%3E%3Cellipse cx='45' cy='14.5' rx='4.2' ry='5.6' fill='%23eed11c'/%3E%3Cellipse cx='43.6' cy='12.6' rx='1.1' ry='1.8' fill='%23fff' fill-opacity='.45'/%3E%3Crect x='73' y='6' width='4' height='3.5' rx='1' fill='%2355606e'/%3E%3Cellipse cx='75' cy='14.5' rx='4.2' ry='5.6' fill='%232e9e4f'/%3E%3Cellipse cx='73.6' cy='12.6' rx='1.1' ry='1.8' fill='%23fff' fill-opacity='.45'/%3E%3Crect x='103' y='6' width='4' height='3.5' rx='1' fill='%2355606e'/%3E%3Cellipse cx='105' cy='14.5' rx='4.2' ry='5.6' fill='%233f6ebd'/%3E%3Cellipse cx='103.6' cy='12.6' rx='1.1' ry='1.8' fill='%23fff' fill-opacity='.45'/%3E%3C/svg%3E");
}
html.xmas .site-nav::after {
  height: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30'%3E%3Cdefs%3E%3CradialGradient id='g'%3E%3Cstop offset='0' stop-color='%23fff8d6' stop-opacity='.32'/%3E%3Cstop offset='.45' stop-color='%23ffe680' stop-opacity='.2'/%3E%3Cstop offset='1' stop-color='%23ffe680' stop-opacity='0'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='15' cy='14.5' r='13' fill='url%28%23g%29'/%3E%3C/svg%3E");
  background-position: calc(50% - 30px) top;
  animation: xmas-twinkle 2.4s steps(1) infinite;
}
@keyframes xmas-twinkle {
  50% {
    background-position: 50% top;
  }
}

/* Snow in the hero and the page headers */
html.xmas .hero,
html.xmas .page-header {
  position: relative;
  overflow: hidden;
}
html.xmas .hero > .container,
html.xmas .page-header > .container {
  position: relative;
  z-index: 1;
}
html.xmas .hero::before,
html.xmas .page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Ccircle cx='20' cy='30' r='1.6' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='95' cy='12' r='1.2' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='160' cy='70' r='1.8' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='60' cy='110' r='1.3' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='130' cy='150' r='1.6' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='25' cy='175' r='1.2' fill='%237fa3d8' fill-opacity='.55'/%3E%3Ccircle cx='185' cy='190' r='1.4' fill='%237fa3d8' fill-opacity='.55'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Ccircle cx='40' cy='60' r='2.6' fill='%237fa3d8' fill-opacity='.4'/%3E%3Ccircle cx='210' cy='30' r='2.2' fill='%237fa3d8' fill-opacity='.4'/%3E%3Ccircle cx='140' cy='170' r='2.8' fill='%237fa3d8' fill-opacity='.4'/%3E%3Ccircle cx='270' cy='230' r='2.3' fill='%237fa3d8' fill-opacity='.4'/%3E%3Ccircle cx='70' cy='260' r='2.5' fill='%237fa3d8' fill-opacity='.4'/%3E%3C/svg%3E");
  animation: xmas-snow 14s linear infinite;
}
html.xmas[data-bs-theme="dark"] .hero::before,
html.xmas[data-bs-theme="dark"] .page-header::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Ccircle cx='20' cy='30' r='1.6' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='95' cy='12' r='1.2' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='160' cy='70' r='1.8' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='60' cy='110' r='1.3' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='130' cy='150' r='1.6' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='25' cy='175' r='1.2' fill='%23ffffff' fill-opacity='.6'/%3E%3Ccircle cx='185' cy='190' r='1.4' fill='%23ffffff' fill-opacity='.6'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Ccircle cx='40' cy='60' r='2.6' fill='%23ffffff' fill-opacity='.45'/%3E%3Ccircle cx='210' cy='30' r='2.2' fill='%23ffffff' fill-opacity='.45'/%3E%3Ccircle cx='140' cy='170' r='2.8' fill='%23ffffff' fill-opacity='.45'/%3E%3Ccircle cx='270' cy='230' r='2.3' fill='%23ffffff' fill-opacity='.45'/%3E%3Ccircle cx='70' cy='260' r='2.5' fill='%23ffffff' fill-opacity='.45'/%3E%3C/svg%3E");
}
@keyframes xmas-snow {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 0 200px, 0 300px;
  }
}

/* Greeting on the home page */
.xmas-greeting {
  display: none;
}
html.xmas .xmas-greeting {
  display: block;
}
.xmas-pill {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 50rem;
  font-weight: 600;
  background-color: rgba(215, 46, 33, 0.12);
  color: #b3261b;
}
[data-bs-theme="dark"] .xmas-pill {
  background-color: rgba(215, 46, 33, 0.25);
  color: #ffb4ab;
}

/* Dark mode only while the decorations are on: hide the theme switcher (xmas.html forces the dark theme) */
html.xmas .site-nav .dropdown {
  display: none;
}

/* Snow that has settled: drifts along the bottom of the hero and page headers */
html.xmas .hero::after,
html.xmas .page-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='30' preserveAspectRatio='none' viewBox='0 0 600 30'%3E%3Cpath d='M0 30 V18 C50 18 100 8 180 8 C260 8 300 22 380 22 C460 22 540 18 600 18 V30 Z' fill='%23fff' fill-opacity='.55'/%3E%3Cpath d='M0 30 V24 C60 24 120 16 220 16 C320 16 380 26 460 26 C520 26 560 24 600 24 V30 Z' fill='%23fff'/%3E%3C/svg%3E") repeat-x center bottom / 600px 100%;
}
html.xmas .page-header::after {
  height: 16px;
}

/* Snow caps on the buttons, card and photo in the hero */
html.xmas .hero .btn-lg,
html.xmas .hero .col-lg-6:has(> .hero-photo) {
  position: relative;
}
html.xmas .hero .btn-lg::before,
html.xmas .hero .card::before,
html.xmas .hero .col-lg-6:has(> .hero-photo)::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 10px;
  right: 10px;
  height: 22px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 11 C0 5 8 1 20 3 C35 -1 55 2 78 1 C105 -1 135 3 162 1 C182 -1 201 4 197 11 C196 15 190 15 188 12 C172 13 163 12 153 12 C152 19 143 19 142 12 C112 13 74 12 54 12 C53 17 45 17 44 12 C32 13 18 13 11 12 C9 15 4 15 3 11 Z' fill='%23fff'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  z-index: 2;
}
html.xmas .hero .btn-lg::before {
  top: -8px;
  left: 18px;
  right: 18px;
  height: 18px;
}
html.xmas .hero .col-lg-6:has(> .hero-photo)::before {
  left: calc(var(--bs-gutter-x) * 0.5 + 14px);
  right: calc(var(--bs-gutter-x) * 0.5 + 14px);
}

@media (prefers-reduced-motion: reduce) {
  html.xmas .site-nav::after,
  html.xmas .hero::before,
  html.xmas .page-header::before {
    animation: none;
  }
}
