/* Festive season layer (Christmas 2026), used with /assets/js/festive.js. Every rule is scoped to
   html.festive, which the script sets only during the season, so the page is unchanged without it. */

/* Falling snow: above the content, below the nav (z 100), never catches clicks */
html.festive .festive-snow {
  /* stops 2 px short of the bottom edge: iPhone Safari paints its bottom bar solid behind elements pinned there */
  position: fixed; left: 0; top: 0; width: 100%; height: calc(100% - 2px); z-index: 60; pointer-events: none;
}
html.festive .festive-snow[hidden] { display: none; }

/* Fairy lights across the full top of the page (fixed, so they stay while you scroll).
   On desktop the announcement bar and the nav pill move down 12 px to make room. */
html.festive .festive-garland {
  position: fixed; left: 0; top: 0; width: 100%; height: 20px; z-index: 101; pointer-events: none; overflow: visible;
  transition: opacity 0.2s ease;
}
html.festive .festive-garland svg { display: block; overflow: visible; }
html.festive .festive-wire { fill: none; stroke: #b9b2a6; stroke-width: 0.8; opacity: 0.7; }
html.festive .festive-fairy {
  fill: #ffc85a; filter: drop-shadow(0 0 4px rgba(255, 170, 40, 0.95));
  animation: festive-shimmer 3s ease-in-out infinite;
}
@keyframes festive-shimmer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (min-width: 769px) {
  html.festive .announcement-bar { padding-top: 26px; }
  html.festive .navbar { top: 60px; }
}
@media (max-width: 768px) {
  /* Phones: the snow stops 72 px above the bottom edge and fades out, so nothing pinned sits by Safari's
     bottom toolbar (iPhone Safari paints that bar solid white behind elements pinned to the bottom). */
  html.festive .festive-snow {
    height: calc(100% - 72px);
    -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent);
    mask-image: linear-gradient(to bottom, #000 80%, transparent);
  }
  html.festive .festive-garland { top: 48px; }       /* hangs from the bottom of the phone nav bar */
  html.festive .navbar.m-open ~ .festive-garland { opacity: 0; }
}

/* Snow cap along the top edge of each card */
html.festive .festive-snowcap {
  position: absolute; left: 0; right: 0; top: 0; height: 34px; z-index: 5; pointer-events: none;
  filter: drop-shadow(0 2px 2.5px rgba(80, 104, 140, 0.22));
}
html.festive .festive-snowcap { overflow: hidden; }   /* clipped to the card's own top corners */
html.festive .festive-snowcap svg { display: block; fill: #ffffff; overflow: visible; }
html.festive .festive-cap-sheen { fill: none; stroke: rgba(255, 255, 255, 0.9); stroke-width: 2; }

/* Hanging baubles and holly in a top corner of each card */
html.festive .festive-baubles,
html.festive .festive-holly { position: absolute; top: 0; z-index: 6; pointer-events: none; }
html.festive .festive-baubles { width: 120px; height: 120px; }
html.festive .festive-holly { width: 92px; height: 62px; top: 10px; }
html.festive .festive-right { right: 28px; }
html.festive .festive-left { left: 28px; }
html.festive .festive-baubles svg,
html.festive .festive-holly svg { display: block; width: 100%; height: 100%; overflow: visible; }
html.festive .festive-sprig { fill: none; stroke: #2f6b45; stroke-width: 4; stroke-linecap: round; }
html.festive .festive-swing line { stroke: #b39a62; stroke-width: 1.2; }
html.festive .festive-shine { fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 2; stroke-linecap: round; }
html.festive .festive-swing {
  transform-box: view-box; transform-origin: 50% 0; animation: festive-swing 5s ease-in-out infinite; animation-delay: var(--d);
}
html.festive .festive-swing:nth-of-type(1) { transform-origin: 30px 8px; }
html.festive .festive-swing:nth-of-type(2) { transform-origin: 62px 7px; }
html.festive .festive-swing:nth-of-type(3) { transform-origin: 92px 10px; }
@keyframes festive-swing {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

/* Santa's sleigh crossing the sky now and then */
html.festive .festive-sleigh {
  position: fixed; left: 0; top: 18vh; z-index: 55; width: 190px; height: 56px; pointer-events: none;
  transform: translateX(-240px); opacity: 0;
}
html.festive .festive-sleigh svg { display: block; width: 100%; height: 100%; overflow: visible; }
html.festive .festive-sleigh.is-flying { animation: festive-fly 17s linear 1 forwards; }
html.festive .festive-sleigh.is-flying svg { animation: festive-bob 1.6s ease-in-out infinite; }
html.festive .festive-deer { fill: #7a5a42; }
html.festive .festive-antler { fill: none; stroke: #7a5a42; stroke-width: 1.6; stroke-linecap: round; }
html.festive .festive-rein { fill: none; stroke: #8f7a5a; stroke-width: 1; }
html.festive .festive-runner { fill: none; stroke: #c9a24a; stroke-width: 3; stroke-linecap: round; }
@keyframes festive-fly {
  0% { transform: translateX(-240px) translateY(30px) rotate(-4deg); opacity: 0; }
  6% { opacity: 1; }
  50% { transform: translateX(calc(50vw - 95px)) translateY(-10px) rotate(-2deg); }
  94% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 60px)) translateY(-40px) rotate(-6deg); opacity: 0; }
}
@keyframes festive-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* A little snow resting on the card buttons */
html.festive .festive-btn-snow { position: relative; }
html.festive .festive-btn-snow::before {
  content: ''; position: absolute; left: 12%; right: 12%; top: -7px; height: 12px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 10' preserveAspectRatio='none'%3E%3Cpath d='M2 9C2 4 6 2 10 3c2-2 6-3 9-1 3-2 8-2 11 0 3-2 7-2 10 0 3-2 7-3 11-1 3-1 7-1 9 1 3-2 8-2 11 0 3-1 7-1 9 1 4 0 8 2 8 6Z' fill='%23fff'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  filter: drop-shadow(0 1px 1px rgba(80, 104, 140, 0.25));
}

/* Tree-top stars twinkle */
html.festive .festive-star { transform-box: fill-box; transform-origin: center; animation: festive-star 2.8s ease-in-out infinite; }
@keyframes festive-star { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: 0.75; } }

/* Winter scene above the home page's about text */
html.festive .festive-scene {
  /* white and above the fixed home cards, like the about section under it */
  position: relative; z-index: 10; width: 100%; margin: 0; padding: 64px 12px 0; box-sizing: border-box;
  background: #ffffff; text-align: center; pointer-events: none;
}
html.festive .festive-scene svg { max-width: 1100px; margin: 0 auto; }
html.festive .festive-greeting {
  margin: 0 0 4px; font-size: 13px; line-height: 1.4; letter-spacing: 0.02em; color: #6e6e73;
}
html.festive .festive-scene svg { display: block; width: 100%; height: auto; max-height: 120px; }
html.festive .festive-hill { fill: #ffffff; filter: drop-shadow(0 -1px 1.5px rgba(90, 110, 140, 0.18)); }
html.festive .festive-hill-back { fill: #eef3f8; }
html.festive .festive-snowball { fill: #ffffff; stroke: #c9d5e3; stroke-width: 1.2; }

/* Dark pages (the Attention Test): a night version of the scene; nothing moves during the test */
html.festive body.at-dark .festive-scene { background: transparent; }
html.festive body.at-dark .festive-greeting { color: #a1a1a6; }
html.festive body.at-dark .festive-hill { fill: #2c2c2e; filter: none; }
html.festive body.at-dark .festive-hill-back { fill: #1c1c1e; }
html.festive body.at-dark .festive-snowball { fill: #f5f5f7; stroke: #3a3a3c; }
html.festive body.at-dark .festive-wire { stroke: #6e6e73; }
html.festive body.at-testing .festive-sleigh,
html.festive body.at-testing .festive-garland,
html.festive body.at-testing .festive-scene { display: none; }

/* A small snowflake before the announcement */
html.festive .festive-flake-icon { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
html.festive .festive-flake-icon svg { display: block; width: 100%; height: 100%; fill: none; stroke: #5b8fd6; stroke-width: 2; stroke-linecap: round; }

@media (max-width: 768px) {
  html.festive .festive-snowcap { height: 20px; }
  html.festive .festive-snowcap svg { transform: scaleY(0.55); transform-origin: top; }
  html.festive .festive-baubles { width: 84px; height: 84px; }
  html.festive .festive-holly { width: 70px; height: 48px; top: 8px; }
  html.festive .festive-right { right: 16px; }
  html.festive .festive-left { left: 16px; }
  html.festive .festive-scene { padding: 40px 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html.festive .festive-fairy,
  html.festive .festive-swing,
  html.festive .festive-star { animation: none; }
}
