/* =============================================================================
   NB SPINNER  -  experiment started 2026-11-24
   -----------------------------------------------------------------------------
   Replaces the Telerik 3-dot loader with the Nichibles logo, but ONLY for large
   loaders (.k-loader-lg, 72px). The logo's small outer dot (lower right) is
   masked off the static logo and re-drawn as a separate dot that orbits it.

   Anything smaller than 50px - medium, small, and loaders inside buttons -
   keeps Telerik's own dots, because the logo is too small to read there.

   SCOPE: only elements with BOTH .k-loader and .k-loader-lg, i.e.
          <TelerikLoader Size="LoaderSize.Large"> and large loader containers.
          No .razor files were changed for this.

   ROLLBACK (any one of these):
     1. Delete the line marked "NB-SPINNER" (the <link> to this file) in
        wwwroot/index.html, env/dev/index.html and env/prod/index.html, then
        redeploy. This file can then be deleted too.
     2. git revert <the commit that added this file>.

   DEPENDS ON: Telerik theme classes .k-loader, .k-loader-canvas and
        .k-loader-lg (checked against Telerik UI for Blazor 16.0.0).
        Re-check after Telerik upgrades.

   GEOMETRY (measured from img/NB_Logo.png, 512 x 512):
        circle radius 245 | outer dot radius 42 (diameter 84) | dot centre
        303 px from circle centre at 45 deg. Fractions below are of image width.
   ============================================================================= */

.k-loader.k-loader-lg {
    --nb-s: 72px;                               /* overall spinner box */
    --nb-logo: calc(var(--nb-s) * 0.72);        /* drawn logo size, leaves room for the orbit */
    --nb-dot: calc(var(--nb-logo) * 0.164);     /* 84 / 512  */
    --nb-orbit: calc(var(--nb-logo) * 0.592);   /* 303 / 512 */
    --nb-dot-color: #679990;                    /* sampled from the logo's outer dot */

    position: relative;
    display: inline-block;
    box-sizing: border-box;
    width: var(--nb-s);
    height: var(--nb-s);
    padding: 0;
    line-height: 0;
    color: transparent;
}

/* hide Telerik's three animated segments */
.k-loader.k-loader-lg > .k-loader-canvas { display: none; }

/* static logo, with the outer dot masked off (the dot sits beyond 1.02 of half-width,
   the circle ends at 0.96, so the cut at 98-99% removes only the dot) */
.k-loader.k-loader-lg::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--nb-logo);
    height: var(--nb-logo);
    transform: translate(-50%, -50%);
    background: url("/img/NB_Logo.png") center / contain no-repeat;
    -webkit-mask-image: radial-gradient(circle closest-side, #000 98%, transparent 99%);
    mask-image: radial-gradient(circle closest-side, #000 98%, transparent 99%);
}

/* the orbiting dot: starts at 45 deg, exactly where the logo's own dot sits */
.k-loader.k-loader-lg::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--nb-dot);
    height: var(--nb-dot);
    margin: calc(var(--nb-dot) / -2) 0 0 calc(var(--nb-dot) / -2);
    border-radius: 50%;
    background: var(--nb-dot-color);
    transform: rotate(45deg) translateX(var(--nb-orbit));
    animation: nb-orbit 1.1s linear infinite;
    will-change: transform;
}

@keyframes nb-orbit {
    from { transform: rotate(45deg)  translateX(var(--nb-orbit)); }
    to   { transform: rotate(405deg) translateX(var(--nb-orbit)); }
}

/* keep the activity cue for reduced-motion users, but much calmer */
@media (prefers-reduced-motion: reduce) {
    .k-loader.k-loader-lg::after { animation-duration: 4s; }
}
