/*
 * Holiday theme (js/holiday.js, Helpers/SeasonalTheme.cs). Every rule here is inert unless the theme
 * is on: holiday.js mounts the lockup overlay (.hd-hold) or sets <html data-holiday-loaders="on">, and
 * Blazor renders the .sw-react-tray--more picker, the .sw-fcard__event--challenge badge and the
 * snowflake reaction only while their pieces are on. Plain CSS: no Razor or Tailwind change.
 * Light only, as the app is: the lockup sits on the loader's own cream ground in both themes.
 */

/* ---- MAUI boot lockup (over Supwell/wwwroot/index.html's loader) ----------------------------
   raceday.css's overlay, to the pixel: a fixed cream cover beside #app that outlives Blazor's first
   render, the mark in the exact box of the loader's .logo-image (200 x 72.66, 1rem under it) and the
   caption in the 36px spinner slot, under #blazor-error-ui (10000). holiday.js checks that position
   is fixed before keeping it, so a missing stylesheet means no overlay at all. */
.hd-hold {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background-color: #efeae6; /* the loader's surface-200 cream */
    opacity: 1;
    /* FADE_MS in holiday.js; easing is the app's --ease-in-out motion token. */
    transition: opacity 250ms var(--ease-in-out, cubic-bezier(.4, 0, .2, 1));
}
.hd-hold.hd-out { opacity: 0; pointer-events: none; }

.hd-hold > .hd { display: flex; flex-direction: column; align-items: center; }
.hd-hold .hd-mark { position: relative; width: 200px; height: 72.66px; margin-bottom: 1rem; }
.hd-hold .hd-word, .hd-hold .hd-wire { position: absolute; top: 0; left: 0; width: 200px; height: 72.66px; display: block; overflow: visible; }
.hd-hold .hd-word { fill: #373c2b; } /* --sw-olive */
.hd-hold .hd-wire { fill: none; stroke: #373c2b; stroke-width: .9; stroke-linecap: round; opacity: .55; }

/* The lights: separate HTML boxes (not SVG children) so transform/opacity/filter animate on the
   compositor while the WebView boots. left/top is the bulb's hanging point on the wire; delays are
   inline per bulb (lit from 0ms, 70ms apart; the twinkle from 1.3s, which only a slow boot reaches). */
.hd-hold .hd-bulb {
    position: absolute; display: block; width: 6px; height: 8.5px; margin-left: -3px;
    border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
    background: var(--hd-bulb); box-shadow: 0 0 5px 1px var(--hd-glow);
    opacity: 0; transform-origin: 50% 0; will-change: transform, opacity;
    animation-name: hd-on, hd-twinkle;
    animation-duration: 380ms, 2400ms;
    animation-timing-function: ease, ease-in-out;
    animation-iteration-count: 1, infinite;
    animation-fill-mode: both, none;
}
/* The socket the bulb hangs from. */
.hd-hold .hd-bulb::before {
    content: ""; position: absolute; left: 1.25px; top: -1.6px; width: 3.5px; height: 2.4px; border-radius: .8px; background: #373c2b;
}
.hd-hold .hd-bulb--r { --hd-bulb: #c8513f; --hd-glow: rgba(200, 81, 63, .5); }   /* terracotta */
.hd-hold .hd-bulb--g { --hd-bulb: #5a8a2f; --hd-glow: rgba(90, 138, 47, .5); }   /* go-green */
.hd-hold .hd-bulb--y { --hd-bulb: #e0aa1c; --hd-glow: rgba(224, 170, 28, .55); } /* amber gold */

/* Caption starts at 120ms and is readable by ~200ms, so even the minimum hold shows it. */
.hd-hold .hd-cap {
    height: 36px; white-space: nowrap; text-transform: uppercase;
    font: 500 11px/14px 'JetBrains Mono', ui-monospace, Menlo, monospace; letter-spacing: .5px;
    color: #3F4531; /* olive ink, 8.4:1 on the cream ground */
    opacity: 0; animation: hd-cap 240ms cubic-bezier(.2, .8, .2, 1) 120ms both;
}

@keyframes hd-on {
    0%   { opacity: 0; transform: scale(.4) rotate(-14deg); animation-timing-function: cubic-bezier(.2, .8, .3, 1); }
    60%  { opacity: 1; transform: scale(1.18) rotate(6deg); animation-timing-function: cubic-bezier(.4, 0, .2, 1); }
    100% { opacity: 1; transform: none; }
}
/* A soft swing and dim, back to rest by 40% so neighbours (190ms apart) twinkle in turn. */
@keyframes hd-twinkle {
    0%, 40%, 100% { transform: none; filter: none; }
    15% { transform: rotate(-7deg); filter: brightness(1.18) saturate(1.1); }
    28% { transform: rotate(4deg); filter: brightness(.82); }
}
@keyframes hd-cap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Reduced motion: a static, lit lockup, and holiday.js removes it without the fade. */
@media (prefers-reduced-motion: reduce) {
    .hd-hold { transition: none; }
    .hd-hold .hd .hd-bulb, .hd-hold .hd .hd-cap { animation: none; opacity: 1; transform: none; }
}

/* ---- Spinners: the snowflake -----------------------------------------------------------------
   A six-arm flake (a 60deg turn lands on the same silhouette) in olive with a volt heart, in place of
   today's loading glyphs. A race day's own glyph wins (:not([data-race-day])). Two plain selectors per
   rule, never :is(), so an older Android WebView cannot drop a whole list.
   - Pull to refresh (SwPullToRefresh: Feed, Forums, Mileage, Marketplace): the flake sits inside the disc's olive
     progress arc, which still closes as you pull; the grey track and the arrow step aside, and the
     whole svg turns while it refreshes (sw.css's own spin, stopped by reduced motion as today). Only on
     a disc that is out (.is-on, feedControls.js): at rest the disc draws nothing at all, as today's.
     (feedControls.js moves the disc to <body>; inside the Feed's layer iOS drew it over the first card.)
   - LoadingSpinner Medium (h-8) and Large (h-12): border-t-black is LoadingSpinner.razor's only;
     Small, inside buttons, and .rd-plain, under the black logo, keep their ring. */
html[data-holiday-loaders="on"]:not([data-race-day]) .sw-ptr.is-on .sw-ptr__svg,
html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-8:not(.rd-plain),
html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-12:not(.rd-plain) {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233F4531' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Cpath transform='rotate(60 12 12)' d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Cpath transform='rotate(120 12 12)' d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23FDF312' stroke-width='1.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
/* Pull to refresh: the flake inside the arc (15 of the svg's 26px), the track and the arrow gone. */
html[data-holiday-loaders="on"]:not([data-race-day]) .sw-ptr.is-on .sw-ptr__svg { background-size: 15px 15px; }
html[data-holiday-loaders="on"]:not([data-race-day]) .sw-ptr.is-on .sw-ptr__svg > circle:not(.sw-ptr__arc),
html[data-holiday-loaders="on"]:not([data-race-day]) .sw-ptr.is-on .sw-ptr__svg > .sw-ptr__arrow { display: none; }
/* LoadingSpinner Medium and Large: the flake at 70% of the box, 2.4s a turn. */
html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-8:not(.rd-plain),
html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-12:not(.rd-plain) {
    border-width: 0; border-color: transparent; border-radius: 0;
    background-size: 70% 70%; animation-duration: 2.4s;
}
/* Reduced motion: the LoadingSpinner turns at half speed (the selectors verbatim, after the 2.4s rule,
   so each wins by coming later); the pulls already stand still (sw.css stops their spin). */
@media (prefers-reduced-motion: reduce) {
    html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-8:not(.rd-plain),
    html[data-holiday-loaders="on"]:not([data-race-day]) .animate-spin.border-t-black.h-12:not(.rd-plain) { animation-duration: 4.8s; }
}

/* ---- Reactions: the picker with the seasonal reaction (ReactionScope) ------------------------
   Seven discs instead of six: a touch smaller, so the pill still fits a 320px screen (7 x 40 + 6 x 2
   + 10 = 302px). */
.sw-react-tray--more .sw-react-tray__opt { width: 40px; height: 40px; }
.sw-react-tray--more .sw-react-tray__emoji.sw-ricon { width: 32px; height: 32px; }

/* ---- Challenge badge on a feed run (FeedItemCard; sw.css .sw-fcard__event is the chip) --------- */
.sw-fcard__event--challenge {
    gap: 5px; padding: 4px 9px 4px 7px; border-radius: 999px; cursor: pointer;
    background: var(--sw-olive, #373c2b); color: var(--sw-cream, #f6f3e6);
    font-weight: 600; letter-spacing: .04em; max-width: 100%;
    -webkit-tap-highlight-color: transparent;
}
.sw-fcard__event--challenge .sw-fcard__event-ico { flex: none; width: 13px; height: 13px; display: block; }
.sw-fcard__event--challenge .sw-fcard__event-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-fcard__event--challenge:focus-visible { outline: 2px solid var(--sw-olive, #373c2b); outline-offset: 2px; }
.sw-fhead + .sw-fcard__event--challenge { margin-top: 10px; }
.sw-fcard__event--challenge + .sw-fcard__title { margin-top: 8px; }

/* ---- The ❄️ reaction's flurry (holiday.js snowBurst, on the member's own pick) -----------------
   A fixed cover over the whole page that takes no taps (under the lockup's 9999 and #blazor-error-ui):
   white dots with a soft olive edge, so they read on the cream ground and on white cards, and every
   fifth an olive six-arm flake (the loaders' own). Each falls 34-62vh with a little sway and turn,
   fading in and out; the cover fades over SNOW_FADE_MS at the end and leaves the DOM. Transforms and
   opacity only. Reduced motion (.hd-snow--still, and the media query as a backstop): a still dusting
   that fades in and out. */
.hd-snow {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 9990;
    pointer-events: none; overflow: hidden; contain: strict;
    opacity: 1; transition: opacity 400ms ease; /* SNOW_FADE_MS */
}
.hd-snow.hd-snow--out { opacity: 0; }
.hd-snow__f {
    position: absolute; display: block; width: var(--s); height: var(--s); margin-left: calc(var(--s) / -2);
    border-radius: 50%; background: #fff;
    box-shadow: 0 0 0 .5px rgba(55, 60, 43, .16), 0 1px 3px rgba(55, 60, 43, .3);
    opacity: 0; will-change: transform, opacity;
    animation: hd-snow-fall var(--t) cubic-bezier(.3, .1, .6, 1) var(--d) both;
}
.hd-snow__f--x {
    border-radius: 0; box-shadow: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233F4531' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Cpath transform='rotate(60 12 12)' d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Cpath transform='rotate(120 12 12)' d='M12 2.5v19M12 6.2 9.6 4.1M12 6.2l2.4-2.1M12 17.8l-2.4 2.1M12 17.8l2.4 2.1'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23FDF312' stroke-width='1.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
@keyframes hd-snow-fall {
    0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
    15%  { opacity: var(--o); }
    50%  { transform: translate3d(calc(var(--dx) * -.5), calc(var(--fall) * .5), 0) rotate(calc(var(--r) * .5)); }
    80%  { opacity: var(--o); }
    100% { opacity: 0; transform: translate3d(var(--dx), var(--fall), 0) rotate(var(--r)); }
}
/* Reduced motion: nothing falls; the dusting fades in, holds and fades out with the cover. */
.hd-snow--still { animation: hd-snow-in 200ms ease backwards; } /* not forwards: the fade-out is a transition */
.hd-snow--still .hd-snow__f { animation: none; opacity: var(--o); }
@keyframes hd-snow-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .hd-snow__f { animation: none; opacity: var(--o); }
}
