/*
 * trivit.app at Christmas (Design, christmas-site send 1, 2 December; approved by Martin step by step).
 *
 * Everything here hangs off `html.xm`, which the page sets for itself from the visitor's own date
 * (build.js, xmEarly): on through 31 December 2026, off by itself on 1 January. Values are Design's,
 * from the package's skin and motion stylesheets; christmas.js draws the garland, the snow, the
 * village and its cast.
 */

/* Dark only, the switch hidden, on every page. */
html.xm .rooms { display: none; }

/* Matte gold for text and rings, a cranberry main button, and the two washes in evergreen and
   cranberry. As specific as halloween.css's room rule, so it wins over the rooms in premium.css. On
   the premium pages --teal is text links and focus rings, so they go gold. */
:root.xm[data-room] {
  --accent: #E9BC5B;
  --btn: #B3161F;
  --btn-on: #FFF8EC;
  --btn-edge: transparent;
  --glow-a: rgba(16, 92, 62, .42);
  --glow-b: rgba(168, 24, 34, .30);
  --teal: #E9BC5B;
  --teal-edge: #B98F35;
  --onteal: #12100E;
  --pill-lift: 0 10px 34px rgba(120, 10, 18, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
}
/* /play has no premium skin, and its pill is --teal itself. */
:root.xm.xm-play[data-room] { --teal: #B3161F; --teal-edge: #8A0F17; --onteal: #FFF8EC; }
html.xm .pill { box-shadow: var(--pill-lift); }
html.xm .strip .js-count { color: var(--accent); }
/* The board's lit ring is --accent already; its glow is set on the board itself, so it is set there. */
html.xm .hb-box { --hb-lit-glow: rgba(233, 188, 91, .45); }
/* On a phone the low left wash is drawn over the first 1110 of the page and ended in a hard line above
   the village once the page grew, so under 760 it is off. */
@media (max-width: 759px) { :root.xm[data-room] { --glow-a: rgba(16, 92, 62, 0); } }

/* Nothing decorative may widen the page: the garland, the sleigh and the village reach the edges. */
html.xm body { overflow-x: clip; }

/* ---------- /play's Costume switch, beside Grid (Martin, 2 December): only while there is a costume ---------- */
.costumeset { display: none; }
html.xm .costumeset { display: flex; margin-left: 14px; }
html.xm .costumeset .costume-pic { display: flex; }
.costume-ico { display: block; }
/* On a phone the two switches sit closer, so both fit beside the count down to 320 in every language. */
@media (max-width: 430px) { html.xm .costumeset { margin-left: 4px; } html.xm .strip-l .gridset { gap: 6px; } }
/* At 320, French and Portuguese need a few pixels more: the strip tracks a little tighter on /play, in December. */
@media (max-width: 340px) { html.xm .costumeset { margin-left: 0; } html.xm.xm-play .strip { letter-spacing: .02em; } html.xm .strip-l .gridset { gap: 4px; } }

/* ---------- the greeting, front page only, where Halloween's line stood ---------- */
.xm-line { display: none; }
html.xm .xm-line {
  display: flex;
  align-items: center;
  margin: -6px 0 26px;
  font-family: var(--ed);
  font-style: italic;
  font-weight: 400;
  font-size: 34px;
  line-height: 1.1;
  color: var(--accent);
}
@media (max-width: 759px) { html.xm .xm-line { font-size: 30px; margin: 0 0 20px; } }

/* ---------- the board's third face: round an ornament, angular a star, notched a tree ---------- */
.hb-card .xmc { display: none; }
html.xm .hb-card .tc:not(.xmc) { display: none; }
html.xm .hb-card .xmc { display: block; }

/* ---------- the moon behind the board, and Santa across it in Christmas week ---------- */
html.xm .hw-moon { display: block; position: absolute; left: 44%; top: -27%; width: 62%; pointer-events: none; z-index: -1; }
html.xm .hw-moon svg { display: block; width: 100%; height: auto; overflow: visible; }
.xm-sleigh { display: none; }
html.xm[data-xm-week="4"] .xm-sleigh {
  display: block;
  position: absolute;
  left: 53.5%;
  top: -7.5%;
  width: 44%;
  z-index: -1;
  pointer-events: none;
  transform: rotate(-9deg);
  opacity: 0;
}
.xm-sleigh svg { display: block; width: 100%; height: auto; overflow: visible; }
html.xm[data-xm-week="4"] .xm-sleigh.fly { opacity: 1; animation: xmSleigh 11s linear both; }
@keyframes xmSleigh { from { left: 2%; top: 6%; } to { left: 104%; top: -24%; } }
@media (max-width: 759px) {
  html.xm .hw-moon { left: 50%; top: -24%; width: 58%; }
  html.xm[data-xm-week="4"] .xm-sleigh { left: 52%; top: -4%; width: 46%; }
}

/* ---------- the garland, under the date strip ---------- */
.xm-top { position: absolute; left: 0; right: 0; height: 60px; overflow: hidden; pointer-events: none; z-index: 2; }
.xm-top svg { position: absolute; left: 0; top: 0; display: block; overflow: visible; }

/* ---------- the snow: pinned to the window, so every screen of a long page has it ---------- */
.xm-fall { position: fixed; inset: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.xm-fall i, .xm-band i {
  position: absolute;
  top: -12px;
  border-radius: 50%;
  background: #FFFFFF;
  will-change: transform;
  animation: xmFall var(--d) linear var(--dl) infinite;
}
@keyframes xmFall { from { transform: translate3d(0, -4vh, 0); } to { transform: translate3d(var(--sw), 108vh, 0); } }
/* On /play under 900 the board fills the column, so the snow falls only in a band over the strip and
   the header, and again over the village: never over the board being played. */
.xm-band { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 3; overflow: hidden; }
.xm-band i { animation-name: xmBand; }
@keyframes xmBand { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--sw), var(--fall), 0); } }

/* ---------- the lights twinkle, on the garland and on the tree ---------- */
.xm-tw { animation: xmTwinkle var(--td, 3.6s) ease-in-out var(--tl, 0s) infinite; }
@keyframes xmTwinkle { 0%, 100% { opacity: .10; } 50% { opacity: .42; } }

/* ---------- the village on the snow, and the footer as the snow continued ---------- */
.xm-hill { display: none; }
html.xm .xm-hill { display: block; position: relative; margin: 36px calc(50% - 50vw) -1px; pointer-events: none; }
html.xm .xm-hill svg { display: block; width: 100%; height: auto; }
html.xm .xm-hill .xm-door { transition: opacity 260ms ease; }
.xm-poof { animation: xmPoof 420ms ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes xmPoof { from { transform: scale(.4); opacity: .95; } to { transform: scale(2.4); opacity: 0; } }
html.xm footer {
  border-top: 0;
  background: #131B27;
  box-shadow: 0 0 0 100vmax #131B27;
  clip-path: inset(0 -100vmax);
}

/* Reduce Motion: the flakes and the lights stand still, and Santa stands on the moon, as the Halloween
   bat perched (F78). */
@media (prefers-reduced-motion: reduce) {
  .xm-fall i, .xm-band i, .xm-tw { animation: none; }
  html.xm[data-xm-week="4"] .xm-sleigh { opacity: 1; }
  html.xm .xm-hill .xm-door { transition: none; }
}
