/* Shared animation/polish layer for v2 live widgets (snow report, slopes,
   snow depth). Enqueued only when one of those blocks is on the page.
   All motion is gated on prefers-reduced-motion at the bottom. */

/* Aurora top edge — norrsken accent for the arctic-circle live cards.
   Scoped tokens (override per direction/theme if desired). */
.kab2-aurora{
    --aurora-a: #35e0b5;
    --aurora-b: #57c7f5;
    --aurora-c: #a07bf0;
    position: relative;
    overflow: hidden;
}
.kab2-aurora::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        var(--aurora-a), var(--aurora-b), var(--aurora-c), var(--aurora-a));
    background-size: 280% 100%;
    animation: kab2-aurora-flow 16s linear infinite;
    pointer-events: none;
}
@keyframes kab2-aurora-flow{
    from{ background-position: 0% 0; }
    to{ background-position: 280% 0; }
}

/* Loading state — soft fade while the API call is in flight.
   view.js toggles .kab2-loading on the widget root; the JS-locked
   container gets .kab2-fade once at init. */
.kab2-fade{ transition: opacity .35s ease; }
.kab2-loading .kab2-fade{ opacity: .55; }

/* Metric entrance — staggered rise when data lands (.kab2-ready added by
   view.js after the first successful API response). */
.kab2-ready .b-metric{
    animation: kab2-rise .55s cubic-bezier(.22, .85, .35, 1) both;
}
.kab2-ready .b-metric:nth-child(2){ animation-delay: .07s; }
.kab2-ready .b-metric:nth-child(3){ animation-delay: .14s; }
.kab2-ready .b-metric:nth-child(4){ animation-delay: .21s; }
@keyframes kab2-rise{
    from{ opacity: 0; transform: translateY(7px); }
    to{ opacity: 1; transform: none; }
}

/* Status rows (slopes & lifts) get the same treatment, gentler. */
.kab2-ready .sl__rows .b-statusrow{
    animation: kab2-rise .45s cubic-bezier(.22, .85, .35, 1) both;
}
.kab2-ready .sl__rows .b-statusrow:nth-child(2){ animation-delay: .06s; }
.kab2-ready .sl__rows .b-statusrow:nth-child(3){ animation-delay: .12s; }
.kab2-ready .sl__rows .b-statusrow:nth-child(4){ animation-delay: .18s; }

/* Block-load reveal — kab2-anim.js adds .kab2-reveal to .b-card /
   [data-kab2-reveal] elements at init (so no-JS keeps content visible) and
   .kab2-reveal--in when they enter the viewport. Swift and small: 12px rise
   over 450ms with a decisive ease-out. Stagger comes from the JS-set
   --kab2-reveal-delay custom property. */
.kab2-reveal{
    opacity: 0;
    transform: translateY(12px);
    transition:
        opacity .45s cubic-bezier(.22, .85, .35, 1),
        transform .45s cubic-bezier(.22, .85, .35, 1);
    transition-delay: var(--kab2-reveal-delay, 0s);
    will-change: opacity, transform;
}
.kab2-reveal--in{
    opacity: 1;
    transform: none;
    will-change: auto; /* release the compositor layer once settled */
}

/* Count-up settle pop — kab2-anim.js adds .kab2-pop when a count lands. */
.kab2-pop{
    display: inline-block;
    animation: kab2-pop .22s ease-out;
}
@keyframes kab2-pop{
    0%{ transform: scale(1); }
    45%{ transform: scale(1.12); }
    100%{ transform: scale(1); }
}

/* Live pill — breathing dot while the anlaggning is open. */
.kab2-ready .sl__live.b-pill--ok .b-pill__dot{
    animation: kab2-pulse 2.4s ease-in-out infinite;
}
@keyframes kab2-pulse{
    0%, 100%{ box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
    50%{ box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 0%, transparent); }
}

/* Gentle snowfall overlay — weather-widget-v3 view.js adds .kab2-snowing when
   the live forecast icon is a snow icon. Two drifting dot layers, faint
   ink-tinted so it reads on the light card surface. Decorative only. */
.kab2-snowing::after{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .35;
    background-image:
        radial-gradient(2px 2px at 20% 30%, color-mix(in srgb, var(--ink) 22%, transparent) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 70% 60%, color-mix(in srgb, var(--ink) 18%, transparent) 50%, transparent 51%),
        radial-gradient(2.5px 2.5px at 45% 80%, color-mix(in srgb, var(--ink) 15%, transparent) 50%, transparent 51%);
    background-size: 190px 230px, 250px 310px, 320px 380px;
    animation: kab2-snowfall 13s linear infinite;
}
@keyframes kab2-snowfall{
    from{ background-position: 0 0, 0 0, 0 0; }
    to{ background-position: 14px 230px, -10px 310px, 8px 380px; }
}

@media (prefers-reduced-motion: reduce){
    .kab2-aurora::before{ animation: none; }
    .kab2-fade{ transition: none; }
    .kab2-ready .b-metric,
    .kab2-ready .sl__rows .b-statusrow{ animation: none; }
    .kab2-pop{ animation: none; }
    .kab2-ready .sl__live.b-pill--ok .b-pill__dot{ animation: none; }
    .kab2-snowing::after{ content: none; }
    /* Reveal must never leave content hidden / shifted for reduced-motion. */
    .kab2-reveal{ opacity: 1; transform: none; transition: none; }
}
