/* Christmas theme (keeps the site's usual colours): only loaded while the date check in layouts/site.blade.php is true.
   Everything here is decoration: clicks pass straight through it and screen readers skip it. */

.home-title { text-shadow: 0 0 1.2rem rgba(255, 63, 216, 0.5), 0 0 2.6rem rgba(111, 211, 255, 0.28); }

.xmas-strip { margin: 0; padding: 0.45rem 1rem; background: linear-gradient(90deg, #7d0d27, #c2163a 50%, #7d0d27); color: #fff; font-family: var(--font-button); font-size: 0.95rem; font-weight: 500; text-align: center; }

/* Fairy lights hanging from the bottom edge of the header (so they stay in view as the page scrolls).
   One layer is the wire with the bulbs unlit; the other three each light two bulbs in six and fade at their own speed. */
.xmas-lights { position: absolute; top: 100%; left: 0; right: 0; height: 48px; pointer-events: none; background: url('../img/christmas/lights-wire.svg') 0 0 / 240px 48px repeat-x; }
.xmas-lights i { position: absolute; inset: 0; background: 0 0 / 240px 48px repeat-x; animation: xmas-twinkle 2.6s ease-in-out infinite; }
.xmas-lights i:nth-child(1) { background-image: url('../img/christmas/lights-a.svg'); }
.xmas-lights i:nth-child(2) { background-image: url('../img/christmas/lights-b.svg'); animation-duration: 3.7s; animation-delay: -1.3s; }
.xmas-lights i:nth-child(3) { background-image: url('../img/christmas/lights-c.svg'); animation-duration: 3.1s; animation-delay: -2.2s; }
/* The phone menu drops down from the same edge: lights off while it is open. */
.site-header:has(.site-nav.is-open) .xmas-lights { display: none; }

/* Falling snow, in front of the page but under the header. Each flake's place, size and speed are set in the page (partials/christmas.blade.php). */
.xmas-snow, .xmas-flight { position: fixed; inset: 0; z-index: 9; overflow: hidden; pointer-events: none; }
/* Far-off snow: one sheet of fine dots sliding down by exactly its own repeat, so the loop has no join. */
.xmas-snow::before {
    content: ''; position: absolute; inset: -420px 0 0; opacity: 0.55; animation: xmas-drift 26s linear infinite;
    background-image:
        radial-gradient(circle at 34px 52px, #fff 0 1.1px, transparent 2.2px), radial-gradient(circle at 148px 18px, #fff 0 0.9px, transparent 2px),
        radial-gradient(circle at 262px 96px, #fff 0 1.3px, transparent 2.4px), radial-gradient(circle at 372px 168px, #fff 0 0.9px, transparent 2px),
        radial-gradient(circle at 92px 214px, #fff 0 1.2px, transparent 2.3px), radial-gradient(circle at 206px 286px, #fff 0 0.9px, transparent 2px),
        radial-gradient(circle at 318px 342px, #fff 0 1.2px, transparent 2.3px), radial-gradient(circle at 24px 384px, #fff 0 1px, transparent 2.1px);
    background-size: 420px 420px;
}
.xmas-snow i { position: absolute; top: -2.5rem; left: var(--x); width: var(--size); height: var(--size); opacity: var(--fade); animation: xmas-fall var(--fall) linear var(--wait) infinite; }
.xmas-snow i::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #fff 30%, rgba(255, 255, 255, 0) 72%); animation: xmas-sway var(--swing) ease-in-out var(--wait) infinite alternate; }
.xmas-snow i.xmas-crystal::before { border-radius: 0; background: url('../img/christmas/snowflake.svg') center / contain no-repeat; animation-name: xmas-sway-spin; }

/* Santa's sleigh: crosses the screen from left to right, climbing then dipping, then waits off screen before the next pass. */
.xmas-sleigh { position: absolute; top: max(13.5rem, 24vh); left: 0; width: clamp(15rem, 32vw, 28rem); transform: translateX(-110%); animation: xmas-fly-across 44s linear 2s infinite; }
.xmas-sleigh-arc { animation: xmas-fly-arc 44s linear 2s infinite; }
.xmas-sleigh-art { display: block; width: 100%; height: auto; overflow: visible; animation: xmas-bob 1.7s ease-in-out infinite alternate; }
.xmas-trail use { animation: xmas-sparkle 0.9s ease-in-out infinite alternate; }
.xmas-trail use:nth-child(2n) { animation-delay: -0.45s; }
.xmas-trail use:nth-child(3n) { animation-duration: 1.3s; }
.xmas-nose { animation: xmas-sparkle 1.1s ease-in-out infinite alternate; }

@keyframes xmas-twinkle {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.12; }
}
@keyframes xmas-fall {
    to { transform: translateY(calc(100vh + 5rem)); }
}
@keyframes xmas-drift {
    to { transform: translateY(420px); }
}
@keyframes xmas-sway {
    from { transform: translateX(calc(var(--sway) * -1)); }
    to   { transform: translateX(var(--sway)); }
}
@keyframes xmas-sway-spin {
    from { transform: translateX(calc(var(--sway) * -1)) rotate(0deg); }
    to   { transform: translateX(var(--sway)) rotate(160deg); }
}
/* The pass takes the first third of the 44 seconds; the rest is the wait. */
@keyframes xmas-fly-across {
    0%        { transform: translateX(-110%); }
    34%, 100% { transform: translateX(calc(100vw + 2rem)); }
}
@keyframes xmas-fly-arc {
    0%        { transform: translateY(34vh) rotate(-15deg); animation-timing-function: cubic-bezier(0.2, 0.6, 0.5, 1); }
    19%       { transform: translateY(0) rotate(-2deg); animation-timing-function: cubic-bezier(0.5, 0, 0.8, 0.5); }
    34%, 100% { transform: translateY(9vh) rotate(7deg); }
}
@keyframes xmas-bob {
    from { transform: translateY(-0.3rem); }
    to   { transform: translateY(0.3rem); }
}
@keyframes xmas-sparkle {
    from { opacity: 1; }
    to   { opacity: 0.25; }
}

@media (max-width: 48rem) {
    .xmas-lights, .xmas-lights i { height: 36px; background-size: 180px 36px; }
    .xmas-snow i:nth-child(2n) { display: none; }
}
/* For anyone who has asked their device for less movement: no snow, no sleigh, lights on but still. */
@media (prefers-reduced-motion: reduce) {
    .xmas-snow, .xmas-flight { display: none; }
    .xmas-lights i { animation: none; }
}
@media print {
    .xmas-strip, .xmas-lights, .xmas-snow, .xmas-flight { display: none; }
}
