/* ==========================================================================
   Klar – motion layer (owner: CORE; MOTION-SPEC §1.2, §2). Linked from the chrome head block on the home
   and content pages (tools/lib/chrome.mjs MOTION_LINKS), not on konto / kuendigen.
   Here: Lenis, the head-script states (is-loading, is-repeat) with their CSS fail-safes, the intro loader,
   headline line masks, the dash-CTA frame + pulse. The page-transition sheet (.k-pt) lives in chrome.css
   (konto has page transitions but not this file).
   Rule of the layer: CSS never hides content on its own – every hidden state hangs on a class the head script
   or JS sets, and has a fail-safe; html.motion is never set under prefers-reduced-motion.
   ========================================================================== */

/* ---------- Lenis (lenis.css 1.3.23) ---------- */
html.lenis, html.lenis body { height: auto; }
html.lenis { scroll-behavior: auto !important; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent], .lenis [data-lenis-prevent-wheel], .lenis [data-lenis-prevent-touch] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }
.lenis.lenis-autoToggle { transition-property: overflow; transition-duration: 1ms; transition-behavior: allow-discrete; }

/* ---------- Head-script states (MOTION-SPEC §2.3/§2.4) ----------
   is-loading: first visit of "/" in this session – the intro covers the page; main stays hidden until the
   curtain starts to lift (is-lifting) and at most 6 s. is-repeat (home): the nav waits for its slide-in. */
.motion.is-loading, .motion.is-loading body { overflow: clip; }
.motion.is-loading:not(.is-lifting) main { visibility: hidden; animation: k-unhide 0s 6s forwards; }
@keyframes k-unhide { to { visibility: visible; } }
.motion:is(.is-loading, .is-repeat):not(.nav-in) .home .k-nav__slide { transform: translateY(-200%); animation: k-nav-failsafe 0s 6s forwards; }
@keyframes k-nav-failsafe { to { transform: none; } }

/* ---------- Intro loader (home, intro.js) ----------
   Geometry in px from JS: --l/--t/--r/--b = the box edges (lines, frame and dots follow them). */
.k-intro { display: none; }
.motion.is-loading .k-intro {
  --l: calc(50vw - 109px); --r: calc(50vw + 109px); --t: calc(50vh - 109px); --b: calc(50vh + 109px);
  display: block; position: fixed; inset: 0; z-index: calc(var(--z-nav) - 1); pointer-events: none; color: var(--klar-black);
  animation: k-intro-failsafe 0s 6.5s forwards;
}
@keyframes k-intro-failsafe { to { visibility: hidden; } }
.k-intro__sheet { position: absolute; inset: 0; background: var(--tile-lime); }
.k-intro__box { position: absolute; inset: 0; }
.k-intro__ly, .k-intro__lx, .k-intro__frame, .k-intro__dot { position: absolute; display: block; }
.k-intro__ly { top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, var(--klar-black) 20%, transparent); transform: scaleY(0); }
.k-intro__ly:nth-child(1) { left: var(--l); } .k-intro__ly:nth-child(2) { left: calc(var(--r) - 1px); }
.k-intro__lx { left: 0; right: 0; height: 1px; background: color-mix(in srgb, var(--klar-black) 20%, transparent); transform: scaleX(0); }
.k-intro__lx:nth-child(3) { top: var(--t); } .k-intro__lx:nth-child(4) { top: calc(var(--b) - 1px); }
.k-intro__frame { left: var(--l); top: var(--t); width: calc(var(--r) - var(--l)); height: calc(var(--b) - var(--t)); border: 1px solid var(--klar-black); opacity: 0; }
.k-intro__dot { left: 0; top: 0; width: 8px; height: 8px; margin: -4px 0 0 -4px; background: var(--klar-black); }
.k-intro__mark { position: absolute; left: 50%; top: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; transform-origin: 50% 50%; }
.k-intro__mark circle:first-child { opacity: 0; }
.k-intro__bar { transform-box: fill-box; transform-origin: 50% 50%; transform: scaleY(0); }
.k-intro__count {
  position: absolute; left: 50%; bottom: 30px; margin: 0; translate: -50% 0; opacity: 0;
  font-family: var(--font-hand); font-size: var(--fs-hand); font-weight: var(--w-medium); line-height: 1; font-variant-numeric: tabular-nums; color: var(--klar-black);
}
@media (max-width: 479px) { .k-intro__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; } }

/* ---------- Headline reveals (text.js): line masks keep descenders ---------- */
.k-line-mask { padding-bottom: .1em; margin-bottom: -.1em; }
.k-word { will-change: transform; }

/* ---------- Dash-CTA frame + pulse (MOTION-SPEC §2.6; used by S2 around the show CTA) ----------
   .dash-cta[data-button-frame] > .dash-cta__ring ×4 + the CTA. The button writes --p1…--p4 (its band progress)
   on the frame, so the frame lines wipe through the same colours. Infinite → inside a [data-motion-region]. */
.dash-cta { position: relative; display: inline-flex; padding: 10px; border-radius: 15px; -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); isolation: isolate; }
.dash-cta::before, .dash-cta__ring { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; }
.dash-cta::before { border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent); }
.dash-cta__ring { z-index: -1; border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); opacity: 0; animation: dash-cta-pulse 3.8s infinite; }
.dash-cta__ring:nth-of-type(2) { animation-delay: -.95s; } .dash-cta__ring:nth-of-type(3) { animation-delay: -1.9s; } .dash-cta__ring:nth-of-type(4) { animation-delay: -2.85s; }
@keyframes dash-cta-pulse { 0% { inset: 0; border-radius: 15px; opacity: 1; } 90% { inset: -18px; border-radius: 33px; opacity: 0; } 100% { inset: 0; opacity: 0; } }
.is-paused .dash-cta__ring, .dash-cta.is-paused .dash-cta__ring { animation-play-state: paused; }
@media (max-width: 479px) { .dash-cta__ring { display: none; } }
@media (prefers-reduced-motion: reduce) { .dash-cta__ring { animation: none; } }
