/* ===== CHRISTMAS =====
   Seasonal dressing for the paper theme, loaded only while
   params.season = 'christmas' in hugo.toml. Still ink on paper: the same
   thin line, plus three spot colours used sparingly, like a two-pass
   print on a card. Take it down by clearing that one param. */

.season-christmas {
  --berry: #b5412f;
  --pine: #3f7d4e;
  --gold: #d9a441;
}

.season-christmas ::selection {
  background: var(--berry);
  color: var(--paper);
}

/* Snow falls behind the page, so the paper has to be see-through.
   The html element still paints the paper colour. */
.season-christmas body {
  background-color: transparent;
}

/* --- String lights along the top edge --- */

.xmas-lights {
  position: relative;
  flex: 0 0 auto;
  height: 38px;
  background: center top / 320px 38px repeat-x url("/images/christmas/lights-wire.svg");
}

.xmas-lights::before,
.xmas-lights::after {
  content: "";
  position: absolute;
  inset: 0;
  background: center top / 320px 38px repeat-x url("/images/christmas/lights-a.svg");
  animation: xmas-twinkle 3.6s ease-in-out infinite alternate;
}

.xmas-lights::after {
  background-image: url("/images/christmas/lights-b.svg");
  animation-delay: -3.6s;
}

@keyframes xmas-twinkle {
  0%, 30% { opacity: 1; }
  70%, 100% { opacity: 0.1; }
}

.season-christmas .site-top {
  padding-top: 16px;
}

.season-christmas .site-nav a.is-active {
  border-bottom-color: var(--berry);
}

/* --- The cube, wrapped --- */

.season-christmas .logo-cube {
  overflow: visible;
}

.season-christmas .wordmark .logo-ribbon {
  stroke-width: 3;
}

/* --- Snow --- */

.xmas-snow {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.xmas-snow i {
  position: absolute;
  top: -32px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  background: center / contain no-repeat url("/images/christmas/flake-1.svg");
  animation:
    xmas-fall var(--t) linear var(--d) infinite,
    xmas-sway calc(var(--t) / 4) ease-in-out var(--d) infinite alternate;
  will-change: translate, transform;
}

.xmas-snow i:nth-child(3n + 2) { background-image: url("/images/christmas/flake-2.svg"); }
.xmas-snow i:nth-child(3n) { background-image: url("/images/christmas/flake-3.svg"); }

.xmas-snow i:nth-child(1)  { --x: 4%;  --s: 18px; --t: 26s; --d: -3s; }
.xmas-snow i:nth-child(2)  { --x: 11%; --s: 12px; --t: 34s; --d: -19s; }
.xmas-snow i:nth-child(3)  { --x: 18%; --s: 10px; --t: 30s; --d: -11s; }
.xmas-snow i:nth-child(4)  { --x: 25%; --s: 22px; --t: 38s; --d: -27s; }
.xmas-snow i:nth-child(5)  { --x: 33%; --s: 11px; --t: 28s; --d: -7s; }
.xmas-snow i:nth-child(6)  { --x: 40%; --s: 9px;  --t: 36s; --d: -23s; }
.xmas-snow i:nth-child(7)  { --x: 48%; --s: 16px; --t: 32s; --d: -15s; }
.xmas-snow i:nth-child(8)  { --x: 56%; --s: 12px; --t: 27s; --d: -21s; }
.xmas-snow i:nth-child(9)  { --x: 63%; --s: 10px; --t: 40s; --d: -5s; }
.xmas-snow i:nth-child(10) { --x: 70%; --s: 20px; --t: 33s; --d: -29s; }
.xmas-snow i:nth-child(11) { --x: 77%; --s: 11px; --t: 29s; --d: -13s; }
.xmas-snow i:nth-child(12) { --x: 84%; --s: 9px;  --t: 37s; --d: -9s; }
.xmas-snow i:nth-child(13) { --x: 91%; --s: 17px; --t: 31s; --d: -25s; }
.xmas-snow i:nth-child(14) { --x: 97%; --s: 12px; --t: 35s; --d: -17s; }

@keyframes xmas-fall {
  from { translate: 0 -4vh; rotate: 0deg; }
  to { translate: 0 108vh; rotate: 150deg; }
}

@keyframes xmas-sway {
  from { transform: translateX(-14px); }
  to { transform: translateX(14px); }
}

/* --- Holly in place of the wavy rule --- */

.season-christmas .reader-content hr {
  height: 30px;
  background: center / 160px 30px no-repeat url("/images/christmas/holly-rule.svg");
}

/* --- Footer: a small winter scene --- */

.season-christmas .site-footer::before {
  display: none;
}

.xmas-scene {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
  color: var(--ink);
}

[data-xmas-countdown]:not(:empty)::after {
  content: " ";
}

/* --- Stillness and print --- */

@media (prefers-reduced-motion: reduce) {
  .xmas-lights::before,
  .xmas-lights::after {
    animation: none;
  }

  .xmas-snow {
    display: none;
  }
}

@media print {
  .xmas-lights, .xmas-snow, .xmas-scene {
    display: none !important;
  }
}
