/* The holiday look (js/snow.js, js/holiday-ui.js body classes). Overlays only: nothing here changes a size or moves a control.
   hol-snow: the snow canvas over Home. hol-xmas (Dec 12 on): lights on the tab bar, under the top bar and over open sheets, a red
   ribbon rule under the top bar. hol-between: the "front is quiet" card on Home and small hints on a few tabs. */
:root {
  --hol-strand: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='108' height='18' viewBox='0 0 108 18'><path d='M0 3Q18 9 36 3T72 3T108 3' fill='none' stroke='%231b1a17' stroke-width='1.6'/><g stroke='%230b0b0b' stroke-width='1'><rect x='16.5' y='5' width='3' height='3' fill='%233a3833' stroke='none'/><ellipse cx='18' cy='11' rx='2.8' ry='4' fill='%23e0353e'/><rect x='52.5' y='3' width='3' height='3' fill='%233a3833' stroke='none'/><ellipse cx='54' cy='9' rx='2.8' ry='4' fill='%23f2eee6'/><rect x='88.5' y='5' width='3' height='3' fill='%233a3833' stroke='none'/><ellipse cx='90' cy='11' rx='2.8' ry='4' fill='%23e7b84a'/></g></svg>");
  --hol-glow: radial-gradient(circle at 18px 11px, #ff3b45aa 0 2px, #ff3b4533 5px, transparent 8px), radial-gradient(circle at 54px 9px, #fff8e8aa 0 2px, #fff8e833 5px, transparent 8px), radial-gradient(circle at 90px 11px, #ffcc5aaa 0 2px, #ffcc5a33 5px, transparent 8px);
  /* Dec 12 on: the Christmas lights (Gage 12-01: "once December 12th hits, I want Christmas lights to be all over stuff"): pixel
     bulbs in red, green, gold and white on a wire, 96 px a repeat; the glow is a second layer that twinkles (one animation each) */
  --hol-lights: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='16' viewBox='0 0 96 16'><path d='M0 2Q6 5 12 4T36 4T60 4T84 4T96 2' fill='none' stroke='%231b1a17' stroke-width='1.4'/><g shape-rendering='crispEdges'><rect x='11' y='4' width='3' height='2' fill='%235b5850'/><rect x='10' y='6' width='5' height='5' fill='%230b0b0b'/><rect x='11' y='6' width='3' height='4' fill='%23e0353e'/><rect x='12' y='7' width='1' height='1' fill='%23ff8f86'/><rect x='13' y='8' width='1' height='2' fill='%239e1d24'/><rect x='12' y='10' width='1' height='1' fill='%239e1d24'/><rect x='12' y='11' width='1' height='1' fill='%230b0b0b'/><rect x='35' y='4' width='3' height='2' fill='%235b5850'/><rect x='34' y='6' width='5' height='5' fill='%230b0b0b'/><rect x='35' y='6' width='3' height='4' fill='%233fa05a'/><rect x='36' y='7' width='1' height='1' fill='%23a6e3a1'/><rect x='37' y='8' width='1' height='2' fill='%231f5a36'/><rect x='36' y='10' width='1' height='1' fill='%231f5a36'/><rect x='36' y='11' width='1' height='1' fill='%230b0b0b'/><rect x='59' y='4' width='3' height='2' fill='%235b5850'/><rect x='58' y='6' width='5' height='5' fill='%230b0b0b'/><rect x='59' y='6' width='3' height='4' fill='%23e7b84a'/><rect x='60' y='7' width='1' height='1' fill='%23fff0b0'/><rect x='61' y='8' width='1' height='2' fill='%23a8761e'/><rect x='60' y='10' width='1' height='1' fill='%23a8761e'/><rect x='60' y='11' width='1' height='1' fill='%230b0b0b'/><rect x='83' y='4' width='3' height='2' fill='%235b5850'/><rect x='82' y='6' width='5' height='5' fill='%230b0b0b'/><rect x='83' y='6' width='3' height='4' fill='%23f2eee6'/><rect x='84' y='7' width='1' height='1' fill='%23ffffff'/><rect x='85' y='8' width='1' height='2' fill='%23b9b2a6'/><rect x='84' y='10' width='1' height='1' fill='%23b9b2a6'/><rect x='84' y='11' width='1' height='1' fill='%230b0b0b'/></g></svg>");
  --hol-lights-glow: radial-gradient(circle at 12px 8px, #ff3b45aa 0 2px, #ff3b4533 5px, transparent 8px), radial-gradient(circle at 36px 8px, #4fd06aaa 0 2px, #4fd06a33 5px, transparent 8px), radial-gradient(circle at 60px 8px, #ffcc5aaa 0 2px, #ffcc5a33 5px, transparent 8px), radial-gradient(circle at 84px 8px, #fff8e8aa 0 2px, #fff8e833 5px, transparent 8px);
}

/* ---------- snow ---------- */
#hol-snow, #hol-pile { position: fixed; left: 0; top: 0; z-index: 31; pointer-events: none; } /* over every screen and sheet (the War Room is 20, sheets 25 and 30), under the toasts (50) */
#hol-snow[hidden], #hol-pile[hidden] { display: none; }

/* ---------- the Christmas theme (Dec 12 on) ---------- */
body.hol-xmas .tabbar::before, body.hol-xmas .tabbar::after,
body.hol-xmas #home::before, body.hol-xmas #home::after {
  content: ''; position: absolute; left: 0; right: 0; height: 18px; pointer-events: none; background-repeat: repeat-x;
}
body.hol-xmas .tabbar::before { top: -16px; background-image: var(--hol-lights); z-index: 2; }
body.hol-xmas .tabbar::after { top: -16px; background-image: var(--hol-lights-glow); background-size: 96px 16px; z-index: 1; animation: hol-twinkle 2.6s steps(3) infinite alternate; }
body.hol-xmas #home::before { left: var(--hol-left, 0px); top: calc(var(--hol-top, 64px) - 12px); background-image: var(--hol-lights); background-position: 40px 0; z-index: 6; }
body.hol-xmas #home::after { left: var(--hol-left, 0px); top: calc(var(--hol-top, 64px) - 12px); background-image: var(--hol-lights-glow); background-size: 96px 16px; background-position: 40px 0; z-index: 5; animation: hol-twinkle 3.1s steps(3) infinite alternate-reverse; }
/* while the snow layer is up it draws the tab bar's own lights in the drift (js/snow.js), so the CSS strand would be a second row */
body.hol-snowing .tabbar::before, body.hol-snowing .tabbar::after { display: none; }
body.hol-xmas .topbar { box-shadow: inset 0 -2px 0 #a3161c; }
/* an open sheet: a strand along the top of the screen above it */
body.hol-xmas #modal:not([hidden])::before { content: ''; position: absolute; left: 0; right: 0; top: calc(var(--safe-t, 0px) + 2px); height: 16px; background: var(--hol-lights) repeat-x; pointer-events: none; z-index: 1; }
/* the War Room's frame: a string inside the top padding of its bottom dock (the header's buttons carry theirs in the snow) */
body.hol-xmas #warroom .wr-dock::before { content: ''; position: absolute; left: 6px; right: 6px; top: -3px; height: 16px; background: var(--hol-lights) repeat-x 20px 0; pointer-events: none; z-index: 1; }
/* a match: one string along the top edge of the HUD's dock (the frame, never over the map's middle, units or a control) */
body.hol-xmas.in-match #hud .dock::before { content: ''; position: absolute; left: 16px; right: 16px; top: -8px; height: 16px; background: var(--hol-lights) repeat-x; pointer-events: none; z-index: 2; }
body.hol-xmas.in-match #hud .dock::after { content: ''; position: absolute; left: 16px; right: 16px; top: -8px; height: 16px; background: var(--hol-lights-glow); background-size: 96px 16px; pointer-events: none; z-index: 1; animation: hol-twinkle 2.6s steps(3) infinite alternate; }
@keyframes hol-twinkle { from { opacity: .35; } to { opacity: 1; } }

/* ---------- between seasons ---------- */
.hol-teaser { position: fixed; left: 0; right: 0; top: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-t, 0px) + 12px) 14px 12px; background: #050505b8; }
.hol-teaser .ht-page {
  --tk: #d9a441; position: relative; width: 100%; max-width: 400px; max-height: 100%; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 30px 20px 20px;
  background:
    linear-gradient(var(--tk), var(--tk)) 6px 10px / 10px 2px no-repeat, linear-gradient(var(--tk), var(--tk)) 6px 10px / 2px 10px no-repeat,
    linear-gradient(var(--tk), var(--tk)) calc(100% - 6px) 10px / 10px 2px no-repeat, linear-gradient(var(--tk), var(--tk)) calc(100% - 6px) 10px / 2px 10px no-repeat,
    linear-gradient(var(--tk), var(--tk)) 6px calc(100% - 10px) / 10px 2px no-repeat, linear-gradient(var(--tk), var(--tk)) 6px calc(100% - 10px) / 2px 10px no-repeat,
    linear-gradient(var(--tk), var(--tk)) calc(100% - 6px) calc(100% - 10px) / 10px 2px no-repeat, linear-gradient(var(--tk), var(--tk)) calc(100% - 6px) calc(100% - 10px) / 2px 10px no-repeat,
    linear-gradient(180deg, #c8202a 0 4px, #57503f 4px 6px, #26231e 6px calc(100% - 4px), #16140f calc(100% - 4px));
  border: 0; box-shadow: 0 0 0 2px #0b0b0b, 0 6px 0 2px #050505, 0 18px 50px #000a; text-align: center; color: #e4d3bb;
}
.ht-kick { align-self: center; padding: 4px 9px 3px; background: #0b0b0b; font: 400 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #f27661; }
.ht-page h2 { margin: 0; font: 400 38px/.92 var(--display); letter-spacing: .03em; text-transform: uppercase; color: #fff; text-shadow: 0 3px 0 #000; }
.ht-sum { margin: 0; font-size: 13px; color: #b3aaa0; }
.ht-scene { margin: 4px 0; box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 4px #5a4d40, 0 6px 0 4px #050505; line-height: 0; }
.ht-scene .ht-px { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.ht-scene svg { width: 100%; height: auto; display: block; }
.ht-next { margin: 6px 0 0; display: grid; gap: 4px; }
.ht-next small { font: 400 12px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; color: #9b8f80; }
.ht-next b { font: 400 25px/1.02 var(--display); letter-spacing: .02em; text-transform: uppercase; color: #f2eee6; text-wrap: balance; }
.ht-next em { font-style: normal; font-size: 13px; color: #d9bd8b; }
.ht-clock { margin: 2px auto; display: grid; gap: 4px; justify-items: center; }
.ht-clock b { padding: 8px 14px 5px; background: linear-gradient(180deg, #d9a441 0 2px, #0b0b0b 2px); box-shadow: 0 0 0 2px #0b0b0b, 0 4px 0 2px #050505; font: 400 44px/1 var(--display); color: #fff; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.ht-clock small { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #9b8f80; }
.ht-note { margin: 0; font-size: 12px; color: #9b8f80; }
.ht-page .btn { align-self: center; min-width: 180px; }
.ht-lights { position: absolute; left: 0; top: -2px; width: 72%; height: auto; pointer-events: none; }
.ht-lights .off ellipse { fill: #4a4640; }
.ht-gift { position: absolute; right: -6px; bottom: -8px; width: 52px; height: 52px; transform: rotate(-6deg); pointer-events: none; }
.hol-hints { position: fixed; right: 6px; z-index: 7; pointer-events: none; }
.hol-hints svg { display: block; width: 44px; height: 44px; shape-rendering: crispEdges; }
.hol-hints[data-kind="fir"] { right: auto; left: 4px; }
.hol-hints[data-kind="fir"] svg { width: 64px; height: 42px; }
.hol-hints[data-kind="strand"] { left: 0; right: 30%; }
.hol-hints[data-kind="strand"] svg { width: 100%; height: auto; }
.hol-hints[data-kind=""] { display: none; }

@media (prefers-reduced-motion: reduce) {
  body.hol-xmas .tabbar::after, body.hol-xmas #home::after, body.hol-xmas.in-match #hud .dock::after { animation: none; opacity: .8; }
}
body.calm.hol-xmas .tabbar::after, body.calm.hol-xmas #home::after, body.calm.hol-xmas.in-match #hud .dock::after { animation: none; opacity: .8; }

/* ---------- snow on the toasts (HolToast, js/snow.js): in the menus and in a match ---------- */
.toast.hol-t { position: relative; }
.hol-tcap { position: absolute; inset: -3px; pointer-events: none; z-index: 1; } /* over the toast's 3 px white frame (its box-shadow) */
.hol-tsnow { position: absolute; left: 0; top: calc(-1 * var(--d, 6px)); display: block; overflow: visible; filter: drop-shadow(0 1px 1px #3c648c73); animation: hol-tshake .34s steps(4) .1s both; }
.hol-tglow { animation: hol-twinkle 1.9s steps(3) infinite alternate; }
.hol-tice { position: absolute; top: 100%; line-height: 0; }
.hol-tice svg { display: block; transform-origin: 50% 0; animation: hol-tgrow 2.2s steps(5) .2s both; }
.hol-tburst b { position: absolute; top: calc(-1 * var(--d, 6px) + 2px); width: var(--s, 2px); height: var(--s, 2px); background: #fff; box-shadow: 1px 1px 0 #8fb6d2; opacity: 0; animation: hol-tflake var(--t, .8s) cubic-bezier(.35, 0, .75, 1) var(--w, .12s) both; }
@keyframes hol-tshake { 0% { transform: translateX(0); } 25% { transform: translateX(-1.5px) rotate(-1deg); } 50% { transform: translateX(1.5px) rotate(1deg); } 75% { transform: translateX(-.5px); } 100% { transform: none; } }
@keyframes hol-tgrow { from { transform: scaleY(.4); } to { transform: none; } }
@keyframes hol-tflake { 0% { opacity: 0; transform: translate(0, 0); } 10% { opacity: 1; } 30% { transform: translate(calc(var(--dx) * .35), calc(var(--up) * -1)); } 80% { opacity: .9; } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
.hol-still .hol-tsnow, .hol-still .hol-tice svg, .hol-still .hol-tglow { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .hol-tsnow, .hol-tice svg, .hol-tglow { animation: none; }
  .hol-tburst { display: none; }
}

/* ---------- snowstorms in matches (MatchSnow, js/snow.js): between the map and the HUD ---------- */
#hol-match-snow { position: fixed; left: 0; top: 0; pointer-events: none; }
#hol-match-snow[hidden] { display: none; }

/* ---------- the build-up, Dec 2 to Dec 11 (hol-d1 .. hol-d10, cumulative; docs/plans/holiday-mode.md) ---------- */
#hol-deco { position: fixed; inset: 0; z-index: 7; pointer-events: none; }
#hol-deco > i { position: absolute; display: none; }
/* d1: frost in the corners */
body.hol-d1 #hol-deco .hd-frost { display: block; width: 54px; height: 54px; opacity: .55; }
body.hol-d3 #hol-deco .hd-frost { width: 70px; height: 70px; opacity: .7; }
body.hol-d6 #hol-deco .hd-frost { width: 88px; height: 88px; opacity: .8; }
.hd-frost svg { width: 100%; height: 100%; display: block; }
.hd-frost.tl { left: 0; top: 0; }
.hd-frost.tr { right: 0; top: 0; transform: scaleX(-1); }
.hd-frost.bl { left: 0; bottom: var(--bar, 70px); transform: scaleY(-1); }
.hd-frost.br { right: 0; bottom: var(--bar, 70px); transform: scale(-1, -1); }
/* d2: a fir garland along the top bar's foot, a little longer every day (from the top bar's left: --hol-left, beside the desktop's side rail) */
body.hol-d2 #hol-deco .hd-garland { display: block; left: var(--hol-left, 0px); max-width: calc(100% - var(--hol-left, 0px)); top: calc(var(--hol-top, 64px) - 5px); height: 9px; width: 12%;
  background: radial-gradient(circle at 6px 4px, #c8202a 0 1.6px, transparent 2px) 0 0 / 34px 9px repeat-x, repeating-linear-gradient(115deg, #1f5a36 0 3px, #163f27 3px 5px, #2c6b45 5px 7px);
  border-radius: 0 5px 5px 0; box-shadow: 0 1px 0 #0b0b0b, 0 -1px 0 #0b0b0b; }
body.hol-d3 #hol-deco .hd-garland { width: 22%; }
body.hol-d4 #hol-deco .hd-garland { width: 32%; }
body.hol-d5 #hol-deco .hd-garland { width: 44%; }
body.hol-d6 #hol-deco .hd-garland { width: 56%; }
body.hol-d7 #hol-deco .hd-garland { width: 68%; }
body.hol-d8 #hol-deco .hd-garland { width: 80%; }
body.hol-d9 #hol-deco .hd-garland { width: 90%; }
body.hol-d10 #hol-deco .hd-garland { width: 100%; border-radius: 0; }
/* d4 on: the tab bar's lights on the other tabs (Home draws its own in the snow), button by button */
body.hol-d4:not(.hol-xmas) .tabbar::before { content: ''; position: absolute; left: 0; top: -16px; height: 18px; width: 20%; background: var(--hol-strand) repeat-x; pointer-events: none; z-index: 2; }
body.hol-d5:not(.hol-xmas) .tabbar::before { width: 40%; }
body.hol-d6:not(.hol-xmas) .tabbar::before { width: 60%; }
body.hol-d7:not(.hol-xmas) .tabbar::before { width: 80%; }
body.hol-d8:not(.hol-xmas) .tabbar::before { width: 100%; }
/* d5 on: a snowman on Home's tab bar, a part a day */
body.hol-d5 #hol-deco[data-tab="play"] .hd-snowman { display: block; left: 2px; bottom: calc(var(--bar, 70px) - 4px); width: 34px; height: 44px; }
.hd-snowman svg { width: 100%; height: 100%; display: block; overflow: visible; }
.hd-snowman .sm6, .hd-snowman .sm7, .hd-snowman .sm8, .hd-snowman .sm9, .hd-snowman .sm10 { display: none; }
body.hol-d6 .hd-snowman .sm6, body.hol-d7 .hd-snowman .sm7, body.hol-d8 .hd-snowman .sm8, body.hol-d9 .hd-snowman .sm9, body.hol-d10 .hd-snowman .sm10 { display: inline; }
/* d9: a candy-stripe rule under the top bar */
body.hol-d9 #hol-deco .hd-candy { display: block; left: var(--hol-left, 0px); right: 0; top: calc(var(--hol-top, 64px) - 1px); height: 3px; background: repeating-linear-gradient(135deg, #c8202a 0 5px, #f2eee6 5px 10px); opacity: .9; }
/* d10: the lights under the top bar (the full theme's strand, without the twinkle until Dec 12) */
body.hol-d10:not(.hol-xmas) #home::before { content: ''; position: absolute; left: var(--hol-left, 0px); right: 0; height: 18px; top: calc(var(--hol-top, 64px) - 15px); background: var(--hol-strand) repeat-x 40px 0; pointer-events: none; z-index: 6; }

/* ---------- the caps: snow that is part of the page (js/snow.js, Snow.place; Gage 12-02) ----------
   A 0 x 0 layer in the nearest box above a piece that neither clips nor changes its layout (absolute in a positioned box, a
   relative block in a block box), inside the content that scrolls: the browser moves the cap with its piece. The cap is one inline
   SVG drawn at the piece's own size and shape (a flat top, rounded corners, a pill's ends, a circle's upper arc, a small tuft on an
   icon); a tilted piece's cap is turned with it. --cap is its depth (the season's, built by the flakes that land on it). */
.snowlayer { position: absolute; left: 0; top: 0; width: 0; height: 0; margin: 0; padding: 0; border: 0; pointer-events: none; overflow: visible; }
.snowlayer.flow { position: relative; display: block; }
.snowlayer.item { position: relative; display: block; width: 0; height: 0; } /* (a flex or grid scrolling box's own 0 x 0 item: js/snow.js layerInFlow) */
#hol-capfix { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 31; pointer-events: none; }
.snowcap { position: absolute; display: block; pointer-events: none; contain: layout style; }
.snowcap > svg { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.snowcap { transition: opacity .16s ease-in, translate .16s ease-in; }
.snowcap.off { opacity: 0; translate: 0 5px; } /* knocked off: opacity and translate on the cap itself (the compositor's), then it builds again */
.snowcap.none { visibility: hidden; }
.snowcap.parked { display: none; } /* its piece is on a hidden tab (js/snow.js place/sweep): kept for when the tab shows again */
body:not(.hol-snowing) .snowcap { display: none; }
.snowcap .sc-glow { animation: sc-twinkle 2.6s ease-in-out infinite alternate; will-change: opacity; }
@keyframes sc-twinkle { from { opacity: .2; } to { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .snowcap { transition: none; } .snowcap .sc-glow { animation: none; opacity: .5; } }
body.calm .snowcap { transition: none; }
body.calm .snowcap .sc-glow, html.fx-lite .snowcap .sc-glow { animation: none; opacity: .5; }

/* ---------- each day's new piece glitches in, on its day only (Gage 12-02: "the day that it's added, it's glitchy. And then the
   day after it's added, it's perfectly fine"). body.hol-fresh-N (js/holiday-ui.js) is the stage added today; hol-glitch is in
   css/holiday-live.css (off under calm, reduced motion and fx-lite). The tab bar's lights (day 4, and Dec 12) are on the snow
   layer and glitch there (js/snow.js compose). Day 1's Hold the Holiday button is js/hold-holiday.js. ---------- */
body.hol-fresh-1 #hol-deco .hd-frost,
body.hol-fresh-2 #hol-deco .hd-garland,
body.hol-fresh-3 .snowcap.k-play,
body.hol-fresh-5 #hol-deco .hd-snowman,
body.hol-fresh-6 .snowcap.k-frost,
body.hol-fresh-7 .snowcap.k-sw,
body.hol-fresh-8 .snowcap.k-orn,
body.hol-fresh-9 #hol-deco .hd-candy,
body.hol-fresh-10 #home::before,
body.hol-fresh-11 .snowcap.k-xmas,
body.hol-fresh-11 #home::before,
body.hol-fresh-11 #modal:not([hidden])::before { animation: hol-glitch 2.6s steps(1, end) infinite; }
body.hol-fresh-11 #home::after { animation: hol-glitch 2.6s steps(1, end) infinite; }
body.calm[class*="hol-fresh-"] #hol-deco > i, body.calm[class*="hol-fresh-"] .snowcap, body.calm[class*="hol-fresh-"] #home::before,
html.fx-lite body[class*="hol-fresh-"] #hol-deco > i, html.fx-lite body[class*="hol-fresh-"] .snowcap, html.fx-lite body[class*="hol-fresh-"] #home::before { animation: none; }
@media (prefers-reduced-motion: reduce) { body[class*="hol-fresh-"] #hol-deco > i, body[class*="hol-fresh-"] .snowcap, body[class*="hol-fresh-"] #home::before, body[class*="hol-fresh-"] #modal::before { animation: none; } }
