/* Kalomori in December (build 142, season.py), made like halloween.css. Loaded only while it's the season, after app.css.
   Only things a redesign wouldn't change: the art layer behind the page (_christmas.html, its own classes, over the
   haze), Kal's costume, text selection, the presents that peek from the edges (christmas.js), and Home's
   Holiday music category. No layout or components of the site are touched; like October, the see-through surfaces
   are solid while the art is on, so what you can press stands out from the snow and lights. */

html[data-season="christmas"]:not([data-season-calm]) {
  --surface-1: #19172a; --surface-2: #201d33; --surface-3: #2a2741;
  --glass: rgba(16, 14, 28, .94); --card-bg: #15131f;
  --line: rgba(214, 214, 255, .16); --line-2: rgba(214, 214, 255, .3);
}
:where(html[data-season="christmas"]:not([data-season-calm])) input,
:where(html[data-season="christmas"]:not([data-season-calm])) select,
:where(html[data-season="christmas"]:not([data-season-calm])) textarea { background-color: #19172a; }
:where(html[data-season="christmas"]:not([data-season-calm])) .searchbar { background: #1c1a2d; }
:where(html[data-season="christmas"]:not([data-season-calm])) .searchbar:focus-within { background: #232038; }
html[data-season="christmas"]:not([data-season-calm]) .site-banner { background: linear-gradient(rgba(143, 211, 255, .1), rgba(143, 211, 255, .1)) #100e1a; }
html[data-season="christmas"]:not([data-season-calm]) .site-banner.warn { background: linear-gradient(rgba(255, 211, 138, .1), rgba(255, 211, 138, .1)) #100e1a; }
html[data-season="christmas"]:not([data-season-calm]) .site-banner.good { background: linear-gradient(rgba(143, 240, 196, .09), rgba(143, 240, 196, .09)) #100e1a; }
html[data-season="christmas"]:not([data-season-calm]) .site-banner.plex-nag { background: linear-gradient(135deg, rgba(229, 160, 13, .16), rgba(167, 123, 255, .1)) #100e1a; }
html[data-season="christmas"]:not([data-season-calm]) .site-banner.app-ad { background: linear-gradient(120deg, rgba(167, 123, 255, .2), rgba(255, 107, 125, .1)) #100e1a; }
html[data-season="christmas"]:not([data-season-calm]) .tabs { background: #0b0a13; }

/* --- The art layer ----------------------------------------------------------------------------- */
.xm { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
/* Build 146: where there's a sidebar, the decorations stay beside it (the village showed through its foot) */
/* Build 176 (owner: "the side is cut off" on the sign-in page): only where the sidebar really is; pages without it
   (welcome, sign in, forgot password) get the decorations across the whole width */
@media (min-width: 1024px) { html:has(aside.rail) .xm { left: calc(var(--rail) + env(safe-area-inset-left, 0px)); } }
html[data-season-calm] .xm { display: none; }
[data-season="christmas"] .haze .o2 { background: radial-gradient(circle, #ff4d6a 0%, #ff4d6a44 32%, transparent 70%); opacity: .13; }   /* a warm red glow */
[data-season="christmas"] .haze .o3 { background: radial-gradient(circle, #3fd69a 0%, #3fd69a33 32%, transparent 70%); opacity: .1; }    /* and a pine-green one */

/* A faint aurora (northern lights) high up, drifting very slowly */
.xm-aurora { position: absolute; left: -20%; width: 140%; top: -8vh; height: 34vh; opacity: .1; filter: blur(28px);
  background: linear-gradient(100deg, transparent 8%, #3fd69a 26%, #8fd3ff 44%, transparent 58%, #b48cff 74%, transparent 90%);
  border-radius: 0 0 50% 50% / 0 0 100% 100%; animation: xm-aurora 70s ease-in-out infinite alternate; }
.xm-aurora.a2 { top: -4vh; height: 22vh; opacity: .07; animation-duration: 95s; animation-direction: alternate-reverse;
  background: linear-gradient(80deg, transparent 20%, #8fd3ff 40%, #3fd69a 55%, transparent 72%); }
@keyframes xm-aurora { from { transform: translateX(-6%) skewX(-6deg); } to { transform: translateX(8%) skewX(5deg); } }

/* String of lights along the top: each bulb glows softly in turn, slowly (no blinking) */
/* Build 171 (owner: "christmas lights are cut off"): like the village (build 169), the string keeps its shape and grows
   with the width, so the bulbs aren't cropped off its bottom on wide screens. */
.xm-lights { position: absolute; top: 0; left: 0; width: 100%; height: auto; aspect-ratio: 1440 / 44; min-height: 2.75rem; opacity: .75; }
.xm-bulb ellipse { animation: xm-twinkle 8s ease-in-out infinite; }
.xm-bulb.b2 ellipse { animation-delay: -2s; } .xm-bulb.b3 ellipse { animation-delay: -4s; } .xm-bulb.b4 ellipse { animation-delay: -6s; }
@keyframes xm-twinkle { 0%, 100% { opacity: .55; filter: none; } 50% { opacity: 1; filter: drop-shadow(0 0 3px currentColor) brightness(1.15); } }
.xm-bulb.b1 { color: #ff6b7d; } .xm-bulb.b2 { color: #ffd38a; } .xm-bulb.b3 { color: #7be3a8; } .xm-bulb.b4 { color: #8fd3ff; }

/* Light snow: few flakes, far apart, falling slowly with a little sway */
.xm-snow i { position: absolute; top: -2vh; width: 5px; height: 5px; border-radius: 50%; background: #eef0ff; opacity: 0;
  box-shadow: 0 0 6px 1px rgba(220, 228, 255, .35); animation: xm-fall 26s linear infinite; }
.xm-snow .s1 { left: 4%; } .xm-snow .s2 { left: 11%; animation-delay: -9s; animation-duration: 31s; width: 3px; height: 3px; }
.xm-snow .s3 { left: 18%; animation-delay: -17s; } .xm-snow .s4 { left: 26%; animation-delay: -4s; animation-duration: 34s; width: 4px; height: 4px; }
.xm-snow .s5 { left: 33%; animation-delay: -21s; animation-duration: 29s; } .xm-snow .s6 { left: 41%; animation-delay: -12s; width: 3px; height: 3px; }
.xm-snow .s7 { left: 48%; animation-delay: -2s; animation-duration: 33s; } .xm-snow .s8 { left: 56%; animation-delay: -15s; width: 4px; height: 4px; }
.xm-snow .s9 { left: 63%; animation-delay: -24s; animation-duration: 30s; } .xm-snow .s10 { left: 70%; animation-delay: -7s; width: 3px; height: 3px; }
.xm-snow .s11 { left: 77%; animation-delay: -19s; animation-duration: 35s; } .xm-snow .s12 { left: 84%; animation-delay: -11s; width: 4px; height: 4px; }
.xm-snow .s13 { left: 91%; animation-delay: -1s; animation-duration: 28s; } .xm-snow .s14 { left: 97%; animation-delay: -22s; width: 3px; height: 3px; }
.xm-snow .s15 { left: 8%; animation-delay: -27s; animation-duration: 38s; width: 6px; height: 6px; filter: blur(1px); }
.xm-snow .s16 { left: 60%; animation-delay: -33s; animation-duration: 40s; width: 6px; height: 6px; filter: blur(1px); }
@keyframes xm-fall { 0% { transform: translate(0, 0); opacity: 0; } 6% { opacity: .55; } 25% { transform: translate(1.4rem, 26vh); }
  50% { transform: translate(-.6rem, 52vh); } 75% { transform: translate(1rem, 78vh); opacity: .45; } 100% { transform: translate(0, 104vh); opacity: 0; } }

/* Far off near the top, now and then: a sleigh crossing (about every 90 s, 2+ min on phones) */
.xm-sleigh-fly { position: absolute; left: 0; top: 0; width: 7.5rem; height: 1.9rem; opacity: 0; animation: xm-sleigh 100s linear infinite 20s; }
.xm-sleigh-bob { display: block; width: 100%; height: 100%; animation: xm-bob 3s ease-in-out infinite alternate; }
@keyframes xm-bob { from { transform: translateY(-.3rem) rotate(-1deg); } to { transform: translateY(.3rem) rotate(1deg); } }
.xm-sleigh { display: block; width: 100%; height: 100%; overflow: visible; fill: #1c1830; stroke: #3c3560; stroke-width: .5; }
.xm-nose { fill: #ff4d6a; stroke: none; filter: drop-shadow(0 0 2px #ff4d6a); }
/* build 168: flies left to right, the reindeer leading (the picture faces right; it used to be flipped and fly the
   other way, which put the reindeer behind the sleigh) */
@keyframes xm-sleigh { 0% { transform: translate(-12vw, 12vh); opacity: 0; } 1% { opacity: .7; }
  7% { transform: translate(50vw, 7vh) rotate(-3deg); } 14% { transform: translate(106vw, 11vh); opacity: .7; }
  14.5%, 100% { transform: translate(106vw, 11vh); opacity: 0; } }

/* The village on the horizon */
/* Build 169 (owner: "the winter backdrop is cut off on my computer"): the village keeps its shape and grows with the
   width (aspect-ratio), so on wide screens nothing is cropped off its top any more; narrower screens still crop the sides. */
.xm-town { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: auto; aspect-ratio: 1440 / 180;
  min-height: clamp(6.5rem, 18vh, 11.5rem); opacity: .62; }
.xm-window { animation: xm-window 7s ease-in-out infinite alternate; filter: drop-shadow(0 0 4px rgba(255, 180, 90, .55)); }
.xm-window.w2 { animation-delay: -3s; }
@keyframes xm-window { 0% { opacity: .7; } 50% { opacity: .95; } 100% { opacity: .8; } }
.xm-smoke circle { transform-box: fill-box; transform-origin: center; opacity: 0; animation: xm-smoke 9s ease-out infinite; }
.xm-smoke circle:nth-child(2) { animation-delay: -3s; } .xm-smoke circle:nth-child(3) { animation-delay: -6s; }
@keyframes xm-smoke { 0% { transform: translate(0, 12px) scale(.5); opacity: 0; } 20% { opacity: .18; } 100% { transform: translate(10px, -26px) scale(1.6); opacity: 0; } }
.xm-tree-lights circle { animation: xm-twinkle 6s ease-in-out infinite; }
.xm-tree-lights .t1 { color: #ff6b7d; fill: #ff6b7d; } .xm-tree-lights .t2 { color: #ffd38a; fill: #ffd38a; animation-delay: -1.5s; }
.xm-tree-lights .t3 { color: #8fd3ff; fill: #8fd3ff; animation-delay: -3s; } .xm-tree-lights .t4 { color: #7be3a8; fill: #7be3a8; animation-delay: -4.5s; }
.xm-star { filter: drop-shadow(0 0 5px rgba(255, 227, 163, .8)); animation: xm-star 5s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes xm-star { from { opacity: .8; transform: scale(.94); } to { opacity: 1; transform: scale(1.06); } }
.xm-lamp { filter: drop-shadow(0 0 6px rgba(255, 211, 138, .8)); }
.xm-wave { transform-box: fill-box; transform-origin: 0 100%; animation: xm-wave 14s ease-in-out infinite; }
@keyframes xm-wave { 0%, 84%, 100% { transform: rotate(0); } 87% { transform: rotate(-14deg); } 90% { transform: rotate(6deg); } 93% { transform: rotate(-12deg); } 96% { transform: rotate(0); } }

/* Phones and tablets. Build 145 (owner: "a little hard to notice on iPad/mobile"): as many flakes as on computers and
   bigger, brighter lights that hang just below the top bar (they were behind it on phones), a stronger aurora, a
   taller and brighter village that sits above the tab bar, and the sleigh as often as on computers. Still slow. */
@media (hover: none), (max-width: 1023px) {
  /* build 148 (owner: "smaller and less often and slightly slower", then "clogging up the screen on my mobile
     devices… fix only mobile, don't touch pc"): phones/tablets only, 7 of the 16 flakes, small and dim, ~35% slower */
  .xm-snow i { width: 3px; height: 3px; box-shadow: 0 0 4px 1px rgba(220, 228, 255, .3); animation-name: xm-fall-m; }
  .xm-snow i:nth-child(odd) { animation-duration: 38s !important; } .xm-snow i:nth-child(even) { animation-duration: 44s !important; }
  .xm-snow .s6, .xm-snow .s10 { width: 2px; height: 2px; }
  .xm-snow .s15 { width: 4px; height: 4px; }
  .xm-snow :is(.s2, .s4, .s5, .s8, .s9, .s11, .s12, .s14, .s16) { display: none; }
  .xm-aurora { opacity: .2; height: 40vh; } .xm-aurora.a2 { opacity: .12; }
  .xm-sleigh-fly { width: 6.5rem; height: 1.65rem; }
  .xm-sleigh { fill: #2a2448; stroke: #5a4f8a; }
  .xm-lights { min-height: 2.6rem; top: var(--top-h, var(--glass-top, 0px)); opacity: .95; }
  .xm-bulb ellipse { animation-name: xm-twinkle-m; }
  .xm-town { opacity: .85; min-height: clamp(7.5rem, 21vh, 12.5rem); }
  [data-season="christmas"] .haze .o2 { opacity: .2; } [data-season="christmas"] .haze .o3 { opacity: .16; }
}
@media (max-width: 700px) {
  .xm-town { bottom: calc(var(--tabbar, 3.6rem) + env(safe-area-inset-bottom)); }
}
@keyframes xm-fall-m { 0% { transform: translate(0, 0); opacity: 0; } 6% { opacity: .65; } 25% { transform: translate(1.2rem, 26vh); }
  50% { transform: translate(-.6rem, 52vh); } 75% { transform: translate(1rem, 78vh); opacity: .5; } 100% { transform: translate(0, 104vh); opacity: 0; } }
@keyframes xm-twinkle-m { 0%, 100% { opacity: .75; filter: none; } 50% { opacity: 1; filter: drop-shadow(0 0 4px currentColor) brightness(1.25); } }

/* Build 156: text that sits right on the page (the footer, page hints) gets a dark backing while the village and
   snow are behind it, so it never runs over the cabin, snowman or lights */
html[data-season="christmas"]:not([data-season-calm]) .site-foot { width: fit-content; max-width: 100%; margin: 1.5rem auto 0;
  padding: .45rem .9rem; border-radius: 999px; background: rgba(10, 8, 16, .88); border: 1px solid rgba(214, 214, 255, .1); color: var(--muted); }
html[data-season="christmas"]:not([data-season-calm]) .page > .hint, html[data-season="christmas"]:not([data-season-calm]) .ga > .hint {
  text-shadow: 0 1px 2px #07050d, 0 0 12px #07050d, 0 0 4px #07050d; }

/* A quiet countdown under the version (rail on computers, footer on phones) */
.season-note { color: #ffb3bd; opacity: .8; font-size: .78rem; white-space: nowrap; }
/* build 146: placed by app.css */

/* --- Kal dresses up: a Santa hat (instead of the party hat) and a striped scarf ------------------ */
.kal .kal-santa, .kal .kal-scarf { display: inline; }
.kal .kal-hat { display: none; }

::selection { background: rgba(255, 107, 125, .4); }

/* --- The secret: a present that peeks from the edge of the screen (christmas.js) ----------------- */
.xm-gift { position: fixed; z-index: 35; width: 3.4rem; height: 3.6rem; padding: 0; border: 0; background: none; box-shadow: none;
  cursor: pointer; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1), opacity .5s; opacity: 0; -webkit-tap-highlight-color: transparent; }
.xm-gift:hover { filter: none; box-shadow: none; }
.xm-gift svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 .7rem rgba(255, 211, 138, .5)); animation: xm-gift-wiggle 2.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes xm-gift-wiggle { 0%, 70%, 100% { transform: rotate(0); } 76% { transform: rotate(-7deg); } 82% { transform: rotate(6deg); } 88% { transform: rotate(-3deg); } }
.xm-gift .lid { transform-box: fill-box; transform-origin: 0 100%; animation: xm-lid 2.4s ease-in-out infinite; }
@keyframes xm-lid { 0%, 70%, 100% { transform: rotate(0); } 80% { transform: rotate(-14deg) translateY(-2px); } }
.xm-gift.left { left: 0; transform: translateX(-100%) rotate(20deg); }
.xm-gift.right { right: 0; transform: translateX(100%) rotate(-20deg); }
.xm-gift.bottom { bottom: 0; transform: translateY(100%); }
.xm-gift.left.out { transform: translateX(-24%) rotate(12deg); opacity: 1; }
.xm-gift.right.out { transform: translateX(24%) rotate(-12deg); opacity: 1; }
.xm-gift.bottom.out { transform: translateY(28%); opacity: 1; }
.xm-gift.caught { transition: transform .45s ease-in, opacity .45s ease-in; opacity: 0; }
.xm-gift.left.caught, .xm-gift.right.caught, .xm-gift.bottom.caught { transform: scale(1.7) rotate(0); }
.xm-pop { position: fixed; z-index: 35; pointer-events: none; font-size: 1.6rem; animation: xm-pop .9s ease-out forwards; }
@keyframes xm-pop { from { transform: translate(-50%, -50%) scale(.6); opacity: 1; } to { transform: translate(-50%, -160%) scale(1.3); opacity: 0; } }

/* --- Home: the Holiday music category (home.html, homeshelves.holiday*) --------------------------- */
.holiday-cat { position: relative; border-radius: var(--radius, 1.1rem); padding: 1.1rem 1.1rem .4rem; margin: .4rem 0 1.4rem;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 107, 125, .16), transparent 55%),
    radial-gradient(120% 140% at 100% 100%, rgba(63, 214, 154, .12), transparent 55%), #15121f;
  border: 1px solid rgba(255, 179, 189, .22); overflow: hidden; }
.holiday-cat[hidden] { display: none; }
.holiday-cat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  background: repeating-linear-gradient(90deg, #ff6b7d 0 14px, #fbf8ff 14px 28px, #2f9e6e 28px 42px, #fbf8ff 42px 56px); opacity: .75; }
.holiday-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .3rem; }
.holiday-head .hc-ico { width: 2.6rem; height: 2.6rem; border-radius: .8rem; flex: none; display: grid; place-items: center; font-size: 1.4rem;
  background: linear-gradient(135deg, #e2394f, #8f1730); box-shadow: 0 6px 20px rgba(226, 57, 79, .35); }
.holiday-head h2 { margin: 0; font-size: 1.45rem; }
.holiday-head p { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; }
.holiday-cat .hshelf { margin: .5rem 0 0; }
.holiday-cat .hshelf .card-head h2 { font-size: 1.02rem; color: #ffd6db; }
.holiday-cat .hshelf .card-head .sub { font-size: .82rem; }
@media (max-width: 700px) { .holiday-cat { padding: .9rem .8rem .2rem; margin-left: -.2rem; margin-right: -.2rem; }
  .holiday-head { align-items: flex-start; gap: .65rem; } .holiday-head .hc-ico { width: 2.1rem; height: 2.1rem; font-size: 1.1rem; border-radius: .65rem; margin-top: .15rem; }
  .holiday-head h2 { font-size: 1.25rem; } .holiday-head p { font-size: .84rem; } }

@media (prefers-reduced-motion: reduce) {
  .xm *, .xm-gift svg, .xm-gift svg * { animation: none !important; }
  .xm-snow, .xm-sleigh-fly, .xm-smoke { display: none; }
  .xm-gift { transition: opacity .4s; }
  .xm-gift.left.out, .xm-gift.right.out, .xm-gift.bottom.out, .xm-gift.caught { transform: none; }
}

/* Build 153 (owner: "Santa's sleigh is always covered by the top bar on phones"): its path started at the very top of
   the screen, which on phones is under the fixed top bar. Where that bar exists (up to 1023px) the sleigh's path now
   starts at the bar's bottom edge (--top-h, measured by app.js; like the lights) and flies just below the lights. */
@media (max-width: 1023px) {
  .xm-sleigh-fly { top: var(--top-h, calc(3.5rem + env(safe-area-inset-top))); animation-name: xm-sleigh-m; }
}
@keyframes xm-sleigh-m { 0% { transform: translate(-12vw, 4.5rem); opacity: 0; } 1% { opacity: .75; }
  7% { transform: translate(50vw, 3rem) rotate(-3deg); } 14% { transform: translate(106vw, 4rem); opacity: .75; }
  14.5%, 100% { transform: translate(106vw, 4rem); opacity: 0; } }
