/* ibuildrigs motion layer (v4). Loaded on every page after v2.css.
   Everything here is either inert without motion.js, or only applies while
   html[data-motion] is set, which never happens for reduced-motion visitors. */

/* ---------- Lenis smooth scroll ---------- */
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] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- First paint: hold the hero still until the intro starts (3 s safety timeout in <head>) ---------- */
html[data-motion="pending"] :is(.hero-kicker, .hero h1, .hero-lede, .hero-ctas, .hero-facts, .hero-graphic, .sw-hero > div > *, .sw-jump, main .page-title, .crumbs) { opacity: 0; }

/* Split headings: lines sit inside clipping masks while they rise into place */
.ln-mask { padding-bottom: .06em; margin-bottom: -.06em; }

/* ---------- Smart header: slides away on the way down, back on the way up ---------- */
.site-header { transition: box-shadow .2s ease, transform .4s cubic-bezier(.2, .7, .2, 1); }
html.hdr-hidden .site-header { transform: translateY(-100%); box-shadow: none; }

/* ---------- Home: 3D mark (Zdog canvas replaces the SVG when it can run) ---------- */
.hero-graphic { position: relative; }
.hero-graphic canvas { position: absolute; inset: -12%; width: 124%; height: 124%; display: block; }
.hero-graphic.is-3d svg { visibility: hidden; }

/* ---------- Home: capability band (moves with scroll speed; static line without motion) ---------- */
.band { border-block: 1px solid var(--line); overflow: hidden; padding-block: 18px; margin-top: 8px; }
.band-track { display: flex; width: max-content; will-change: transform; }
.band-list { display: flex; align-items: center; flex-shrink: 0; list-style: none; margin: 0; padding: 0; }
.band-list li { display: flex; align-items: center; gap: 28px; padding-right: 28px; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.25rem, 2.6vw, 2rem); letter-spacing: -0.015em; white-space: nowrap; }
.band-list li::after { content: ""; width: 12px; height: 13px; background: var(--text); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.band-list li:nth-child(even) { color: var(--text-dim); }
.band-list + .band-list { display: none; }
html[data-motion="gsap"] .band-list + .band-list { display: flex; }

/* ---------- Pinned process timeline (desktop, motion only) ---------- */
.steps-progress { position: absolute; left: -1px; right: -1px; top: -1px; height: 2px; background: var(--text); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
.steps-boxed { position: relative; }
html[data-motion="gsap"] .steps-boxed .step-num { transition: color .3s ease; }
.steps-boxed li.is-on .step-num { color: var(--text); }

/* ---------- Software: sticky section bar ---------- */
.sw-subnav { position: sticky; top: var(--header-h); z-index: 90; background: var(--header-bg, var(--bg)); border-bottom: 1px solid var(--line); transition: transform .4s cubic-bezier(.2, .7, .2, 1); }
@supports (backdrop-filter: blur(8px)) { .sw-subnav { backdrop-filter: blur(8px); } }
html.hdr-hidden .sw-subnav { transform: translateY(calc(-1 * var(--header-h))); }
.sw-subnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sw-subnav ul::-webkit-scrollbar { display: none; }
.sw-subnav a { position: relative; display: flex; align-items: center; min-height: 48px; padding: 0 14px; font-size: 14px; font-weight: 500; color: var(--text-dim); white-space: nowrap; }
.sw-subnav li:first-child a { padding-left: 0; }
.sw-subnav a:hover, .sw-subnav a[aria-current="true"] { color: var(--text); }
.sw-subnav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--text); transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s cubic-bezier(.2, .7, .2, 1); }
.sw-subnav li:first-child a::after { left: 0; }
.sw-subnav a[aria-current="true"]::after { transform: scaleX(1); }
.sw-subnav a:focus-visible { outline-offset: -2px; }
/* Jump targets on the software page clear the section bar too (with or without script) */
main:has(.sw-subnav) :is(section, article)[id] { scroll-margin-top: 56px; }

/* ---------- Motion off: reduced-motion visitors and print always get a still page ---------- */
@media (prefers-reduced-motion: reduce) {
  html.hdr-hidden .site-header, html.hdr-hidden .sw-subnav { transform: none; }
  .band-track { transform: none !important; }
}
@media print {
  html[data-motion] * { opacity: 1 !important; visibility: visible !important; transform: none !important; }
  .band, .sw-subnav, .hero-graphic canvas { display: none !important; }
}
