/* Christmas 2026, active only while assets/season.js says it's Christmas (until 26 Dec 2026)
   - Lights (Lichterkette) draped across the background of every page.
   - "Coming to the Mac App Store" announcement with a reindeer on the home pages.
   To take it all down: delete the christmas.css / christmas.js lines from every page's <head>,
   the <section class="xmas"> block from index.html and de/index.html, then this file and christmas.js. */

/* ---------- Lights in the background ---------- */

.xmas-lights {
  --lights-opacity: 0.62;
  position: absolute;
  inset: 0 0 auto 0;
  height: 540px;
  pointer-events: none;
  opacity: var(--lights-opacity);
  /* Fade out toward the bottom so the lights melt into the wallpaper. */
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
  mask-image: linear-gradient(180deg, #000 70%, transparent);
}
@media (prefers-color-scheme: light) {
  .xmas-lights { --lights-opacity: 0.55; }
}

.xmas-strand { position: absolute; inset: 0; }
.xmas-strand.is-far { opacity: 0.55; }

.xmas-strand svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.xmas-strand path { fill: none; stroke: rgb(28 44 32 / 0.55); stroke-width: 1.6; }
.xmas-strand.is-far path { stroke-width: 1.2; filter: blur(1px); }
@media (prefers-color-scheme: dark) {
  .xmas-strand path { stroke: rgb(150 170 160 / 0.22); }
}

/* Each light: a soft glow behind a small glass bulb hanging from the wire. */
.xmas-glow,
.xmas-bulb {
  position: absolute;
  left: var(--x);
  top: var(--y);
  animation: xmas-twinkle var(--d) ease-in-out var(--delay) infinite alternate;
  will-change: opacity;
}
.xmas-glow {
  width: calc(78px * var(--k));
  height: calc(78px * var(--k));
  border-radius: 50%;
  transform: translate(-50%, -32%);
  background: radial-gradient(circle,
    color-mix(in srgb, var(--c) 70%, transparent) 0%,
    color-mix(in srgb, var(--c) 26%, transparent) 32%,
    transparent 68%);
}
.xmas-bulb {
  width: calc(9px * var(--k));
  height: calc(14px * var(--k));
  transform-origin: 50% 0;
  transform: translate(-50%, 0) rotate(var(--a));
  border-radius: 45% 45% 50% 50% / 32% 32% 68% 68%;
  background: radial-gradient(circle at 50% 62%, #fff 0 14%, var(--c) 48%, color-mix(in srgb, var(--c) 72%, #000) 100%);
  box-shadow: 0 0 calc(8px * var(--k)) calc(1px * var(--k)) var(--c);
  filter: blur(1px);
  animation-name: xmas-bulb;
}
.xmas-bulb::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 55%;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 1px;
  background: #2b352c;
}
.xmas-strand.is-far .xmas-bulb { filter: blur(2.2px); }

@keyframes xmas-twinkle {
  from { opacity: 0.25; }
  to { opacity: 0.85; }
}
@keyframes xmas-bulb {
  from { opacity: 0.55; }
  to { opacity: 0.95; }
}

.xmas {
  width: min(760px, 100%);
  display: none; /* shown only during Christmas, see below and assets/season.js */
  justify-content: center;
  margin: -6px auto clamp(28px, 5vh, 48px);
}

html.is-christmas .xmas { display: flex; }

/* Room around the bubble for the reindeer's loop. */
.xmas-orbit {
  position: relative;
  width: 100%;
  padding: 58px 92px;
}

.xmas-bubble {
  position: relative;
  z-index: 1;
  overflow: hidden;
  padding: 30px 32px 26px;
  border-radius: 30px;
  text-align: center;
  background:
    radial-gradient(90% 120% at 0% 0%, rgb(255 59 48 / 0.24), transparent 55%),
    radial-gradient(90% 120% at 100% 100%, rgb(52 199 89 / 0.24), transparent 55%),
    linear-gradient(150deg, var(--glass-1), var(--glass-2));
}

/* A snow cap along the top edge. */
.xmas-bubble::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 18px;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='18' viewBox='0 0 64 18'%3E%3Cpath d='M0 0H64V7C58 15 50 15 46 9C42 14 34 15 30 9C26 13 18 14 14 8C10 13 3 13 0 9Z' fill='%23ffffff' fill-opacity='.92'/%3E%3C/svg%3E") repeat-x top left / 64px 18px;
}

.xmas-date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 6px 14px 6px 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, #ff3b30, #c8102e);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.45), 0 8px 18px -8px rgb(200 16 46 / 0.8);
  color: white;
  font-family: var(--font-rounded);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.xmas-date .icon { font-size: 15px; }

.xmas-bubble h2 {
  margin-top: 14px;
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}
.xmas-bubble p.xmas-sub {
  margin: 8px auto 0;
  max-width: 30em;
  font-size: 16px;
  color: var(--text-2);
  text-wrap: balance;
}

/* Gently falling snow inside the bubble (flakes are added by christmas.js). */
.xmas-snow { position: absolute; inset: 0; pointer-events: none; }
.xmas-snow i {
  position: absolute;
  top: -10px;
  left: var(--x0);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  opacity: 0.85;
  /* A faint outline keeps white flakes visible on the light-mode bubble too. */
  box-shadow: 0 0 0 0.6px rgb(110 130 190 / 0.45), 0 0 6px rgb(255 255 255 / 0.8);
  animation: xmas-fall var(--d) linear var(--delay) infinite;
}
@keyframes xmas-fall {
  to { transform: translate(var(--drift), 260px); }
}

/* ---------- The reindeer ---------- */

.reindeer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 88px;
  pointer-events: none;
  will-change: transform;
}
.reindeer.is-behind { z-index: 0; }
.reindeer svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.28));
  transition: transform 0.35s ease;
}
.reindeer.is-left svg { transform: scaleX(-1); }

.rd-leg { transform-box: view-box; animation: rd-gallop 0.46s ease-in-out infinite alternate; }
.rd-front { transform-origin: 87px 63px; }
.rd-back { transform-origin: 43px 63px; animation-direction: alternate-reverse; }
.rd-leg.far { animation-delay: -0.23s; }
@keyframes rd-gallop {
  from { transform: rotate(-18deg); }
  to { transform: rotate(16deg); }
}

.rd-glow { transform-box: fill-box; transform-origin: center; animation: rd-nose 1.5s ease-in-out infinite; }
@keyframes rd-nose {
  0%, 100% { opacity: 0.55; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* Sparkle trail */
.xmas-spark {
  position: absolute;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff 0 30%, rgb(255 214 120 / 0.9) 45%, transparent 70%);
  animation: xmas-spark 1.1s ease-out forwards;
}
@keyframes xmas-spark {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  to { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.2); }
}

@media (max-width: 760px) {
  .xmas { margin-top: -10px; }
  .xmas-orbit { padding: 50px 24px; }
  .xmas-bubble { padding: 28px 18px 22px; border-radius: 26px; }
  .reindeer { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .xmas-snow, .xmas-spark { display: none; }
  .rd-leg, .rd-glow { animation: none; }
  .xmas-glow, .xmas-bulb { animation: none; opacity: 0.8; }
}
