/* Christmas, 28 November to 3 January (season.js sets html[data-season] from the
   device's date). A winter night at home: candlelight and frost on the same dark
   night, never red and green. Nothing here takes a tap or changes the layout.
   The bulbs keep clear of the alarm's own colours (no alarm red, no Off mint). */
:root[data-season="christmas"] {
  --vs-gold: #ffcf73;
  /* The season's character: a snowman in a rose bobble hat and a candle-gold
     scarf, who waves now and then (still for reduced motion). */
  --vs-snowman: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 64 84%22%3E%3Cdefs%3E%3CradialGradient id=%22s%22 cx=%22.38%22 cy=%22.3%22 r=%22.8%22%3E%3Cstop offset=%220%22 stop-color=%22%23fff%22/%3E%3Cstop offset=%22.65%22 stop-color=%22%23e9f1fb%22/%3E%3Cstop offset=%221%22 stop-color=%22%23b6c9e2%22/%3E%3C/radialGradient%3E%3C/defs%3E%3Cstyle%3E.arm%7Btransform-origin:48px 53px;animation:w 7s ease-in-out infinite%7D%40keyframes w%7B0%25,68%25,100%25%7Btransform:rotate(0)%7D74%25,86%25%7Btransform:rotate(-24deg)%7D80%25,92%25%7Btransform:rotate(4deg)%7D%7D%40media (prefers-reduced-motion:reduce)%7B.arm%7Banimation:none%7D%7D%3C/style%3E%3Cellipse cx=%2232%22 cy=%2281%22 rx=%2219%22 ry=%222.6%22 fill=%22%23000%22 opacity=%22.28%22/%3E%3Cpath d=%22M16 54 5 45M8.5 48 7 42.5M8.5 48 3 48.5%22 stroke=%22%239a7650%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 fill=%22none%22/%3E%3Cg class=%22arm%22%3E%3Cpath d=%22M48 53 59 42M56 45 57 39.5M56 45 61.5 45.5%22 stroke=%22%239a7650%22 stroke-width=%222.2%22 stroke-linecap=%22round%22 fill=%22none%22/%3E%3C/g%3E%3Ccircle cx=%2232%22 cy=%2262%22 r=%2219%22 fill=%22url(%23s)%22/%3E%3Ccircle cx=%2232%22 cy=%2232%22 r=%2214%22 fill=%22url(%23s)%22/%3E%3Ccircle cx=%2232%22 cy=%2257%22 r=%221.8%22 fill=%22%2326304a%22/%3E%3Ccircle cx=%2232%22 cy=%2265%22 r=%221.8%22 fill=%22%2326304a%22/%3E%3Cpath d=%22M19 42q13 7 26 0v5q-13 7-26 0Z%22 fill=%22%23ffcf73%22/%3E%3Cpath d=%22M37.5 47h5.5l1.5 12.5-5.5-1Z%22 fill=%22%23f0b64c%22/%3E%3Cpath d=%22M38.6 51.5l5.2.3M39.2 55.5l5 .4%22 stroke=%22%23ffe2a3%22 stroke-width=%221.2%22/%3E%3Ccircle cx=%2227%22 cy=%2231.5%22 r=%221.9%22 fill=%22%2326304a%22/%3E%3Ccircle cx=%2237%22 cy=%2231.5%22 r=%221.9%22 fill=%22%2326304a%22/%3E%3Ccircle cx=%2223.5%22 cy=%2236%22 r=%222.6%22 fill=%22%23ff9db0%22 opacity=%22.55%22/%3E%3Ccircle cx=%2240.5%22 cy=%2236%22 r=%222.6%22 fill=%22%23ff9db0%22 opacity=%22.55%22/%3E%3Cpath d=%22M32 34.2 41.5 36.6 32 37.4Z%22 fill=%22%23ff9f5a%22/%3E%3Cpath d=%22M28.6 39.6q3.4 2 6.8 0%22 stroke=%22%2326304a%22 stroke-width=%221.3%22 fill=%22none%22 stroke-linecap=%22round%22/%3E%3Cpath d=%22M18.4 27.5Q19 14.5 32 14.5T45.6 27.5Z%22 fill=%22%23ff9db0%22/%3E%3Crect x=%2217.4%22 y=%2224.6%22 width=%2229.2%22 height=%225%22 rx=%222.5%22 fill=%22%23ffc4d0%22/%3E%3Ccircle cx=%2232%22 cy=%2212.4%22 r=%223.8%22 fill=%22%23fff%22/%3E%3C/svg%3E");
  --vs-wire: rgba(255, 244, 224, .3);
  /* Snow lying along the top of a surface (tiles every 200px). */
  --vs-cap: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 14' preserveAspectRatio='none'%3E%3Cpath fill='%23eef4fb' d='M0 2C20 0 40 1 60 2s40 2 70 0 50-1 70 0v3Q187.5 11 175 5Q162.5 8 150 5Q137.5 12 125 5Q112.5 8 100 5Q87.5 11 75 5Q62.5 8 50 5Q37.5 12 25 5Q12.5 8 0 5Z'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- the app
   The aurora turns pine and candlelight. body becomes a stacking context so the
   snow (z-index -1) falls between the background and the content: behind the
   cards and the chat bubbles, never over the words. */
:root[data-season="christmas"] body:not(.pn) {
  z-index: 0;
  background:
    radial-gradient(120% 70% at 85% -10%, rgba(255, 196, 110, .11) 0%, transparent 55%),
    radial-gradient(90% 60% at -10% 30%, rgba(46, 150, 108, .14) 0%, transparent 60%),
    radial-gradient(100% 70% at 60% 115%, rgba(120, 170, 255, .1) 0%, transparent 60%),
    var(--color-bg);
}
.vs-snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
/* The lights are strung along the bottom edge of the top bar and hang down
   over the page (taps go through them). Placed by CSS, not measured: an
   iPhone home-screen app is still settling its size when the page loads. */
.vs-lights { position: fixed; left: 0; right: 0; top: 0; height: 22px; z-index: 11; pointer-events: none; overflow: hidden; } /* over the bar (10) */
body:not(.pn):has(.chat_top_info:not(.moo-info-panel *)) .vs-lights { top: calc(env(safe-area-inset-top, 0px) + var(--h-appbar) - 2px); }
.vs-lights svg { display: block; overflow: visible; }
.vs-lights__wire path { fill: none; stroke: var(--vs-wire); stroke-width: 1.1; }
.vs-bulb { animation: vs-twinkle 3.6s ease-in-out infinite; }
.vs-bulb__cap { fill: rgba(255, 244, 224, .42); }
.vs-bulb__glass { fill: var(--c); }
.vs-bulb__shine { fill: rgba(255, 255, 255, .55); }
@keyframes vs-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Snow lies on the main cards (Beehive, settings, medication) and along the top
   of the tab bar and the chat composer. The cards take a solid night base for
   the season, so flakes pass behind them rather than showing through. */
:root[data-season="christmas"] :is(.hx-card, .hx-person, .hx-day, .moo-settings-card, .moo-med-hero, .moo-list, .bottom_nav, .moo-chat-bar) { position: relative; }
:root[data-season="christmas"] :is(.hx-card, .hx-person, .hx-day, .hx-addslot) { background-color: var(--color-bg); }
@media (min-width: 720px) { :root[data-season="christmas"] .hx-nav { background-color: var(--color-bg); } :root[data-season="christmas"] .hx-nav::before { left: 20px; right: 20px; } } /* the sidebar */
@media (max-width: 719px) { :root[data-season="christmas"] .hx-nav::before { content: none; } } /* on a phone it is the top bar */
/* The push banner hangs below the bulbs, so none sits on its words. */
:root[data-season="christmas"] #pn_recovery_banner { top: calc(var(--h-appbar) + 22px); }
:root[data-season="christmas"] :is(.moo-settings-card, .moo-med-hero, .moo-list, .moo-tt-ledger, .moo-tt-day--work, .moo-form-card, .moo-tools__med-item, .moo-profile-hero) { background: linear-gradient(var(--surface-1), var(--surface-1)), var(--color-bg); }
:root[data-season="christmas"] .moo-tt-day--work:hover { background: linear-gradient(var(--surface-2), var(--surface-2)), var(--color-bg); }
:root[data-season="christmas"] :is(.moo-rk-nudge, .moo-gi-card) { background: linear-gradient(rgba(0, 229, 160, .06), rgba(0, 229, 160, .06)), var(--color-bg); }
/* Beehive paints its own night behind the page; for the season the body's (the
   same night, with the pine and candlelight) shows instead, so the snow does too. */
:root[data-season="christmas"] .chats_cont.hx-scroll { background: transparent; }
:root[data-season="christmas"] :is(.hx-card, .hx-person, .hx-day, .hx-nav, .moo-settings-card, .moo-med-hero, .moo-list, .bottom_nav, .moo-chat-bar)::before {
  content: ''; position: absolute; z-index: 1; pointer-events: none; height: 11px; top: -4px; left: 14px; right: 14px;
  background: var(--vs-cap) repeat-x 0 0 / 200px 100%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}
:root[data-season="christmas"] :is(.bottom_nav, .moo-chat-bar)::before { left: 0; right: 0; top: -6px; height: 12px; }
:root[data-season="christmas"] .moo-list::before { top: 0; left: 0; right: 0; } /* it clips its overflow */

/* The snowman peeks over the tab bar at its right-hand end (the bar sits at the
   foot of the screen, so he is pinned there, never measured): behind the bar,
   so only his hat and face show, and in front of the page, like a floating
   button, so words never show through him. The page leaves room below its last
   line, so nothing ends up under him. Now and then he ducks down and pops back up. */
.vs-snowman { position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--h-tabbar) - 18px); z-index: 8; width: 40px; height: 52px; pointer-events: none; background: var(--vs-snowman) center top / contain no-repeat; animation: vs-peek 9s ease-in-out infinite; }
/* (the tab bar is 9.) His pompom stands 29px above the bar: pages end 30px
   above it (Beehive's own foot gives 24px of that). */
:root[data-season="christmas"] body:has(.vs-snowman) .chats_cont { padding-bottom: 30px !important; }
:root[data-season="christmas"] body:has(.vs-snowman) .chats_cont.hx-scroll { padding-bottom: 6px !important; }
@keyframes vs-peek { 0%, 78%, 100% { transform: none; } 84%, 88% { transform: translateY(16px); } 94% { transform: translateY(-2px); } }

/* ---------------------------------------------------------------- Command Centre
   The lights run along the top of the screen inside the top bar's own padding,
   so they never touch the clock or the sound chip. The snow and the drift sit
   above the house's light and behind the screen (first in the body, z-index 1;
   the views come later at 1). The glass tiles take a solid night base for the
   season, so flakes pass behind them rather than showing through as specks.
   On the night clock everything moves in front of its backdrop. During an
   entry countdown or an alarm, the season steps aside. */
body.pn .vs-snow { z-index: 1; }
.vs-drift { position: fixed; left: 0; right: 0; bottom: 0; height: clamp(14px, calc(var(--pad) * .9), 34px); z-index: 1; pointer-events: none; }
.vs-drift svg { display: block; width: 100%; height: 100%; }
.vs-drift path { fill: url(#vs-drift-fill); }
/* The night clock's backdrop moves to the body, so the snow can fall in front
   of it and still behind the clock's words (same layer, later in the page). */
:root[data-season="christmas"] body.pn::before {
  content: ''; position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: radial-gradient(60% 60% at 50% 55%, color-mix(in oklab, var(--hc-light) 9%, #04070d), #03050a 70%);
  opacity: 0; visibility: hidden; transition: opacity 1.2s ease, visibility 0s linear 1.2s;
}
:root[data-season="christmas"] body.pn.is-ambient::before { opacity: 1; visibility: visible; transition: opacity 1.6s ease, visibility 0s; }
:root[data-season="christmas"] body.pn .pn__ambient { background: none; }
body.pn.is-ambient :is(.vs-snow, .vs-drift, .vs-lights) { z-index: 20; }
:root[data-season="christmas"] body.pn :is(.pn__key, .pn__big, .pn__climate, .pn__sos, .pn__pair-card, .pn__chip, .pn__attention li) {
  background-color: color-mix(in oklab, var(--h-night) 94%, var(--hc-light, var(--h-mist)));
}
/* Snow lying along the tops of the big surfaces: the Home and Away tiles, the
   temperature strip, the pairing card (not the keypad or the emergency hold). */
:root[data-season="christmas"] body.pn :is(.pn__climate, .pn__pair-card) { position: relative; }
:root[data-season="christmas"] body.pn :is(.pn__big, .pn__climate, .pn__pair-card)::before {
  content: ''; position: absolute; z-index: 1; pointer-events: none; height: 12px; top: -3px; left: 16px; right: 16px;
  background: var(--vs-cap) repeat-x 0 0 / 200px 100%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35));
}
:root[data-season="christmas"] body.pn .pn__big::before { top: 0; left: 0; right: 0; }
/* The snowman sits on the temperature strip's right end (on any tablet, either
   way up: a phone-width screen has no room beside the state's words), and
   stands in the drift beside the night clock. */
:root[data-season="christmas"] body.pn .pn__climate::after {
  content: ''; position: absolute; right: 26px; bottom: calc(100% - 7px); width: clamp(36px, 7dvh, 60px); aspect-ratio: 64 / 84;
  background: var(--vs-snowman) center bottom / contain no-repeat; pointer-events: none; z-index: 2;
}
:root[data-season="christmas"] body.pn .pn__ambient::after {
  content: ''; position: absolute; right: 7vw; bottom: clamp(4px, 1.4dvh, 14px); height: clamp(84px, 24dvh, 190px); aspect-ratio: 64 / 84;
  background: var(--vs-snowman) center bottom / contain no-repeat; pointer-events: none;
}
@media (max-width: 640px) { :root[data-season="christmas"] body.pn .pn__climate::after { content: none; } }
/* Upright, the warnings above the strip run the screen's width: they wrap
   before his column (he stands 26px in from the strip's end, plus a little air). */
@media (max-aspect-ratio: 1/1) and (min-width: 641px) { :root[data-season="christmas"] body.pn .pn__attention { padding-right: calc(34px + clamp(36px, 7dvh, 60px)); } }

body.pn .vs-lights { height: max(10px, calc(var(--pad) * .8)); z-index: 3; }
/* A banner (hub or network gone) takes the top edge: the lights step aside. */
body.pn:has(.pn__banner:not([hidden])) .vs-lights { visibility: hidden; }
body.pn[data-hstate="pending"] :is(.vs-snow, .vs-drift, .vs-lights),
body.pn[data-hstate="triggered"] :is(.vs-snow, .vs-drift, .vs-lights) { display: none; }
:root[data-season="christmas"] body.pn:is([data-hstate="pending"], [data-hstate="triggered"]) :is(.pn__big, .pn__climate, .pn__pair-card)::before,
:root[data-season="christmas"] body.pn:is([data-hstate="pending"], [data-hstate="triggered"]) :is(.pn__climate, .pn__ambient)::after { content: none; }
@media (max-aspect-ratio: 1/1) and (max-width: 560px) { body.pn .vs-lights { height: 12px; } }
@media (min-aspect-ratio: 1/1) and (max-height: 500px) { body.pn .vs-lights { height: 10px; } }

/* The night clock's line about the season: "12 sleeps to Christmas". */
.vs-greet {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 12px;
  font-size: clamp(16px, 2.4vh, 22px); color: var(--vs-gold);
  border: 1px solid color-mix(in oklab, var(--vs-gold) 32%, transparent);
  background: color-mix(in oklab, var(--vs-gold) 7%, transparent);
}
.vs-greet::before { content: ''; flex: none; width: 10px; height: 10px; background: currentColor; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 6px currentColor); }

@media (prefers-reduced-motion: reduce) {
  .vs-bulb, .vs-snowman { animation: none; }
}
