/* ============================================================
   AlliedTech — PREMIUM FX LAYER
   Apple/Samsung-grade motion & polish. Loads after custom.css.
   Everything is progressive enhancement + reduced-motion safe.
   ============================================================ */

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; }

/* ---- Scroll progress bar (top of viewport) ---- */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #1B66D6, #E0A23D);
  z-index: 9999; pointer-events: none;
}

/* ---- Upgraded reveal: soft blur + rise (Apple-style) ---- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(6px);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--i, 0) * 90ms);
  will-change: opacity, transform, filter;
}
.js [data-reveal="left"]  { transform: translateX(-32px); }
.js [data-reveal="right"] { transform: translateX(32px); }
.js [data-reveal="fade"]  { transform: none; }
.js [data-reveal="scale"] { transform: scale(0.94); }
.js [data-reveal].is-visible { opacity: 1; transform: none; filter: blur(0); }

/* ---- Hero headline: word-by-word rise (split by premium.js) ---- */
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.split-word > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--w, 0) * 60ms + 150ms);
}
.split-ready .split-word > span { transform: translateY(0); }
html:not(.js) .split-word > span { transform: none; }

/* ---- Scroll-linked parallax media (data-speed) ---- */
[data-speed] { will-change: transform; }

/* ---- 3D tilt cards ---- */
.tilt-card { transform-style: preserve-3d; transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 0.35s ease; }
.tilt-card:hover { box-shadow: 0 24px 64px -16px rgba(11, 31, 58, 0.25); }
.tilt-card .tilt-inner { transform: translateZ(24px); }

/* ---- Magnetic buttons (premium.js adds subtle pull) ---- */
.btn-magnetic { transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1); will-change: transform; }

/* ---- Frosted nav on scroll (Apple-style density change) ---- */
#navbar { transition: background 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease; }
#navbar.navbar-scrolled {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 1px 0 rgba(11, 31, 58, 0.06), 0 8px 32px rgba(11, 31, 58, 0.08);
}

/* ---- Cinematic media: slow Ken-Burns zoom while in view ---- */
.kenburns img, .kenburns video { transition: transform 12s cubic-bezier(0.16, 1, 0.3, 1); transform: scale(1); }
.kenburns.is-inview img, .kenburns.is-inview video { transform: scale(1.08); }

/* ---- Featured metric quote band ---- */
.metric-ring {
  background: conic-gradient(#1B66D6 var(--pct, 75%), rgba(27, 102, 214, 0.12) 0);
  border-radius: 9999px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}

/* ---- Star rating ---- */
.stars { display: inline-flex; gap: 2px; color: #E0A23D; }
.stars svg { width: 15px; height: 15px; }

/* ---- Avatar polish ---- */
.avatar-face {
  width: 46px; height: 46px; border-radius: 9999px; overflow: hidden; flex-shrink: 0;
  border: 2px solid #fff; box-shadow: 0 2px 10px rgba(11, 31, 58, 0.15);
  background: #F4F7FB;
}
.avatar-face img { width: 100%; height: 100%; object-fit: cover; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar-face { margin-left: -12px; }
.avatar-stack .avatar-face:first-child { margin-left: 0; }

/* ---- Soft-noise texture for dark bands (subtle, Apple-like depth) ---- */
.noise::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.035; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Process timeline ---- */
.process-line { position: absolute; left: 23px; top: 8px; bottom: 8px; width: 2px; background: #E2E8F0; overflow: hidden; }
.process-line > span {
  position: absolute; inset: 0; background: linear-gradient(180deg, #1B66D6, #E0A23D);
  transform-origin: top; transform: scaleY(var(--progress, 0));
}
.process-step-num {
  width: 48px; height: 48px; border-radius: 9999px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid #E2E8F0; color: #0B1F3A;
  font-family: "IBM Plex Mono", monospace; font-weight: 500; position: relative; z-index: 1;
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}
.process-step.is-visible .process-step-num {
  background: #1B66D6; color: #fff; border-color: #1B66D6;
  box-shadow: 0 0 0 6px rgba(27, 102, 214, 0.12);
}

/* ---- Big statement type (scroll-fades word opacity like Apple copy) ---- */
.statement-text span { opacity: 0.18; transition: opacity 0.5s ease; }
.statement-text span.lit { opacity: 1; }

/* ---- Reduced motion: kill everything ---- */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { transition: none !important; opacity: 1 !important; transform: none !important; filter: none !important; }
  .split-word > span { transform: none !important; transition: none !important; }
  .kenburns img, .kenburns video { transition: none !important; transform: none !important; }
  .scroll-progress { display: none; }
  .tilt-card, .btn-magnetic { transition: none !important; transform: none !important; }
  .statement-text span { opacity: 1 !important; }
}
