/* ==========================================================================
   SAV — Motion.
   Two systems share this file:
     · the static/fallback system (CSS transitions driven by sav-motion.js)
     · the cinema system (GSAP + Lenis, sav-cinema.js) — <html class="cinema">
   Only transform, translate, opacity and clip-path animate.
   ========================================================================== */

/* ---- Fallback reveal (no GSAP, or reduced motion turned into static) ---- */
.js:not(.cinema) [data-reveal] {
	opacity: 0;
	transform: translate3d(0, 22px, 0);
	transition: opacity var(--motion-reveal) var(--ease-out), transform var(--motion-reveal) var(--ease-out);
	transition-delay: calc(var(--i, 0) * 90ms);
}
.js:not(.cinema) [data-reveal="scale"] { transform: translate3d(0, 16px, 0) scale(.98); }
.js:not(.cinema) [data-reveal].is-inview { opacity: 1; transform: none; }

@keyframes sav-rise  { from { opacity: 0; transform: translate3d(0, 18px, 0); } to { opacity: 1; transform: none; } }
@keyframes sav-panel { from { opacity: 0; transform: translate3d(0, 28px, 0) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sav-nav   { from { opacity: 0; transform: translate3d(0, -10px, 0); } to { opacity: 1; transform: none; } }
.js:not(.cinema).sav-home .sav-header       { animation: sav-nav 560ms var(--ease-out) both; }
.js:not(.cinema) [data-enter]               { animation: sav-rise 720ms var(--ease-out) both; animation-delay: calc(180ms + var(--i, 0) * 110ms); }
.js:not(.cinema) .sav-hero .sav-hero__panel { animation: sav-panel 900ms var(--ease-out) both; animation-delay: calc(520ms + var(--i, 0) * 160ms); }
.js:not(.cinema) .sav-pipe__step { color: var(--sav-fg); }
.js:not(.cinema) .sav-pipe__step::before { background: var(--sav-electric); border-color: var(--sav-electric); }

/* ---- Cinema: GSAP owns every transform; CSS steps back ------------------ */
html.cinema { scroll-behavior: auto; }
.cinema [data-reveal] { transition: none; }
.cinema [data-enter] { animation: none; }
.cinema .sav-hero__panel { animation: none; transform-style: preserve-3d; }
.cinema h1, .cinema h2 { text-wrap: pretty; }
.sav-line { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.12em; }
.sav-word { display: inline-block; will-change: transform; }

/* Ambient light breathes, very slowly. Status pulses stay; nothing else loops. */
@keyframes sav-breathe { from { scale: 1; } to { scale: 1.07; } }
.cinema .sav-hero .sav-glow, .cinema .sav-final .sav-glow { animation: sav-breathe 14s ease-in-out infinite alternate; }
@keyframes sav-cue { 0% { transform: scaleY(0); transform-origin: 50% 0; } 50% { transform: scaleY(1); transform-origin: 50% 0; } 51% { transform-origin: 50% 100%; } 100% { transform: scaleY(0); transform-origin: 50% 100%; } }
.cinema .sav-hero__scrollcue span { animation: sav-cue 2.4s cubic-bezier(.65, 0, .35, 1) infinite; }
html:not(.cinema) .sav-hero__scrollcue { display: none; }

/* Lenis */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* Progress rail */
.sav-progress { position: fixed; left: 0; right: 0; top: 0; height: 2px; z-index: calc(var(--z-header) + 1); background: linear-gradient(90deg, var(--sav-sky), var(--sav-electric)); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
.admin-bar .sav-progress { top: 32px; }
@media (max-width: 782px) { .admin-bar .sav-progress { top: 46px; } }
html:not(.cinema) .sav-progress { display: none; }

/* Micro-interactions (both systems) */
[data-count] { font-variant-numeric: tabular-nums; }
.btn, .card, .sav-connector, .sav-case, .sav-pillar, .sav-post {
	transition:
		box-shadow var(--motion-normal) var(--ease-standard),
		border-color var(--motion-normal) var(--ease-standard),
		background-color var(--motion-normal) var(--ease-standard),
		color var(--motion-normal) var(--ease-standard),
		transform var(--motion-normal) var(--ease-standard);
}
.btn__arrow { display: inline-block; transition: transform var(--motion-fast) var(--ease-standard); }
.btn:hover .btn__arrow, .btn:focus-visible .btn__arrow,
.link-arrow:hover .btn__arrow, .link-arrow:focus-visible .btn__arrow { transform: translateX(3px); }
.link-underline { background-image: linear-gradient(currentColor, currentColor); background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size var(--motion-normal) var(--ease-standard); }
.link-underline:hover, .link-underline:focus-visible { background-size: 100% 1px; }

/* Reduced motion: a clean static page. Nothing hidden, nothing moving. */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.js [data-reveal] { opacity: 1; transform: none; transition: none; }
	.js.sav-home .sav-header, .js [data-enter], .js .sav-hero .sav-hero__panel { animation: none; }
	.sav-glow, .sav-hero__scrollcue span, .sav-panel__live i, .btn--primary::after, .btn--primary::before { animation: none !important; }
	.card::before, .sav-hero__panel::before, .sav-stack__tile::before { display: none; }
	.sav-marquee__track { animation: none !important; flex-wrap: wrap; min-width: 0; }
	.sav-marquee__track[aria-hidden="true"] { display: none; }
	.sav-marquee { flex-wrap: wrap; }
	.sav-voices__wall { -webkit-mask-image: none; mask-image: none; }
	.sav-voice__play-ring { animation: none; }
	.sav-hero__scrollcue, .sav-progress, .sav-cut__veil { display: none; }
	.sav-pipe__step { color: var(--sav-fg); }
	.sav-pipe__step::before { background: var(--sav-electric); border-color: var(--sav-electric); }
	*, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* --- Intro: the S mark draws, the slashes sweep, the navy lifts into the hero.
   Once per session (html.intro is set from sessionStorage), cinema only. ---- */
.sav-intro { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; overflow: hidden; color: var(--sav-white); will-change: transform; isolation: isolate; }
html.cinema.intro .sav-intro { display: flex; }
.sav-intro.sav-dark::after { z-index: 0; }
.sav-intro__glow { position: absolute; left: 50%; top: 50%; width: min(120vw, 1100px); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; pointer-events: none; z-index: 0;
	background: radial-gradient(closest-side, rgba(0, 212, 255, .22), rgba(0, 102, 255, .12) 45%, rgba(0, 102, 255, 0) 72%); }
.sav-intro__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 0 24px; }
.sav-intro__lockup { width: clamp(240px, 46vw, 540px); }
.sav-intro__svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Origin rules only for the shapes the timeline moves; the MEDIA GROUP glyphs carry a scale() in their transform attribute and must keep the default origin. */
.sav-intro__svg path:not([transform]), .sav-intro__svg circle, .sav-intro__svg g.sav-intro__letter { transform-box: fill-box; transform-origin: 50% 100%; }
.sav-intro__svg path[fill="#0066FF"]:not([transform]) { will-change: transform, filter; }
.sav-intro__bar { width: clamp(140px, 22vw, 220px); height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .10); overflow: hidden; margin-top: 6px; }
.sav-intro__bar span { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--sav-cyan), var(--sav-blue)); transform: scaleX(0); transform-origin: 0 50%; box-shadow: 0 0 14px rgba(0, 212, 255, .7); }
.sav-intro__line { margin: 0; font-size: .6875rem; letter-spacing: .5em; text-transform: uppercase; color: var(--sav-cyan); opacity: 0; white-space: nowrap; }
.sav-intro__edge { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; z-index: 2; background: linear-gradient(90deg, transparent, var(--sav-cyan) 30%, var(--sav-blue) 70%, transparent); box-shadow: 0 0 28px 4px rgba(0, 212, 255, .45); opacity: 0; }
/* While the intro plays nothing may scroll underneath it — the sheet must lift onto the top of the hero, not the middle of the page. */
html.intro, html.intro body { overflow: hidden; height: 100%; }   /* set inline in <head>, so it holds before any script runs; cinema.js clears it, and a 4.5 s safety timer in the head does too */
html.intro-done, html.intro-done body { overflow: visible; height: auto; }
@media (max-width: 480px) { .sav-intro__lockup { width: min(78vw, 300px); } .sav-intro__line { font-size: .5625rem; letter-spacing: .32em; } }
