/* =========================================================
   Digitrade motion system
   - Scoped under html.motion (added by motion.js only when motion is allowed),
     so without JS or with prefers-reduced-motion everything renders statically.
   - Durations: 220ms (UI), 720ms (reveal), 1100ms (hero / drawings). One easing family.
   ========================================================= */
:root {
  --m-ease: cubic-bezier(.22, .8, .24, 1);
  --m-ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --m-reveal: 720ms;
  --m-dist: 26px;
}

/* ---------- Page transitions (cross-document View Transitions, progressive) ---------- */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out 220ms var(--m-ease-in-out) both; }
::view-transition-new(root) { animation: vt-in 380ms var(--m-ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Scroll reveals ---------- */
.motion [data-anim] {
  opacity: 0;
  transition: opacity var(--m-reveal) var(--m-ease), transform var(--m-reveal) var(--m-ease), clip-path 1000ms var(--m-ease-in-out), filter var(--m-reveal) var(--m-ease);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
.motion [data-anim="up"] { transform: translate3d(0, var(--m-dist), 0); }
.motion [data-anim="down"] { transform: translate3d(0, calc(var(--m-dist) * -1), 0); }
.motion [data-anim="left"] { transform: translate3d(calc(var(--m-dist) * -1.4), 0, 0); }
.motion [data-anim="right"] { transform: translate3d(calc(var(--m-dist) * 1.4), 0, 0); }
.motion [data-anim="scale"] { transform: scale(.94); }
.motion [data-anim="pop"] { transform: translate3d(0, 14px, 0) scale(.9); transition-timing-function: cubic-bezier(.18, .9, .22, 1); }
.motion [data-anim="blur"] { filter: blur(10px); transform: translate3d(0, 12px, 0); }
.motion [data-anim="clip"] { opacity: 1; clip-path: inset(0 0 100% 0 round 24px); transform: translate3d(0, 20px, 0) scale(1.03); }
.motion [data-anim="fade"] { transform: none; }
.motion [data-anim].is-in { opacity: 1; transform: none; filter: none; }
/* only the wipe kind clips; anything else must not crop content that overflows its box (e.g. hero chips) */
.motion [data-anim="clip"].is-in { clip-path: inset(0 0 0 0 round 0); }
.motion [data-anim].is-done { will-change: auto; }

/* Headline word cascade */
.h-split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.h-split .w > span { display: inline-block; }
.motion .h-split .w > span { transform: translate3d(0, 105%, 0); transition: transform 900ms var(--m-ease); transition-delay: calc(var(--d, 0ms) + var(--i) * 45ms); }
.motion .h-split.is-in .w > span { transform: none; }

/* ---------- Header: shrink + hide on scroll down, show on scroll up ---------- */
.site-header { transition: transform 380ms var(--m-ease), box-shadow 200ms; }
/* hide-on-scroll removed: header stays visible */

/* Mega menu items slide in */
.motion .has-menu.is-open > .mega a, .motion .has-menu.is-open > .mega .mega__col { animation: mega-in 360ms var(--m-ease) both; }
.motion .has-menu.is-open > .mega a:nth-child(2) { animation-delay: 30ms; }
.motion .has-menu.is-open > .mega a:nth-child(3) { animation-delay: 60ms; }
.motion .has-menu.is-open > .mega a:nth-child(4) { animation-delay: 90ms; }
.motion .has-menu.is-open > .mega a:nth-child(5) { animation-delay: 120ms; }
.motion .has-menu.is-open > .mega a:nth-child(6) { animation-delay: 150ms; }
.motion .has-menu.is-open > .mega a:nth-child(n+7) { animation-delay: 180ms; }
@keyframes mega-in { from { opacity: 0; transform: translateY(6px); } }

/* Mobile menu */
.motion .mobile-menu:not([hidden]) { animation: mm-in 320ms var(--m-ease) both; }
.motion .mobile-menu:not([hidden]) details { animation: mm-item 420ms var(--m-ease) both; }
.motion .mobile-menu:not([hidden]) details:nth-child(2) { animation-delay: 40ms; }
.motion .mobile-menu:not([hidden]) details:nth-child(3) { animation-delay: 80ms; }
.motion .mobile-menu:not([hidden]) details:nth-child(4) { animation-delay: 120ms; }
.motion .mobile-menu:not([hidden]) details:nth-child(5) { animation-delay: 160ms; }
.motion .mobile-menu:not([hidden]) .mobile-menu__cta { animation: mm-item 420ms 200ms var(--m-ease) both; }
@keyframes mm-in { from { opacity: 0; } }
@keyframes mm-item { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Buttons & links ---------- */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn:active { transform: translateY(0) scale(.97); }
.btn--primary::after, .btn--lime::after, .cta-box .btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform 700ms var(--m-ease);
}
.btn--primary:hover::after, .btn--lime:hover::after, .cta-box .btn:hover::after { transform: translateX(120%); }
.link-arrow { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 300ms var(--m-ease); }

/* Spotlight that follows the pointer on cards (desktop) */
@media (hover: hover) and (pointer: fine) {
  .cap-card, .icard, .agent, .tcards article, .ncards article, .ecards article, .linkcards article, .option, .compare__col, .stairs li, .paths > div {
    position: relative; isolation: isolate;
  }
  .cap-card::before, .icard::before, .agent::before, .tcards article::before, .ncards article::before, .ecards article::before, .linkcards article::before, .option::before, .stairs li::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; opacity: 0;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(152, 229, 103, .22), transparent 60%);
    transition: opacity 300ms;
  }
  .cap-card:hover::before, .icard:hover::before, .agent:hover::before, .tcards article:hover::before, .ncards article:hover::before, .ecards article:hover::before, .linkcards article:hover::before, .option:hover::before, .stairs li:hover::before { opacity: 1; }
  .icard, .agent, .tcards article, .ncards article, .ecards article, .linkcards article, .stairs li, .duo-cards article, .certs article {
    transition: transform 320ms var(--m-ease), box-shadow 320ms var(--m-ease);
  }
  .icard:hover, .agent:hover, .tcards article:hover, .ncards article:hover, .ecards article:hover, .linkcards article:hover, .stairs li:hover, .duo-cards article:hover, .certs article:hover {
    transform: translateY(-4px); box-shadow: 0 14px 34px rgba(22, 51, 0, .09);
  }
  .chip, .icard__ic, .feature__icon, .cap-card img { transition: transform 420ms cubic-bezier(.18, .9, .22, 1); }
  .icard:hover .icard__ic, .cap-card:hover img, .feature:hover .feature__icon, .duo-cards article:hover .chip, .rows li:hover .chip, .svc li:hover .chip, .methods li:hover .chip { transform: scale(1.1) rotate(-4deg); }
  .rows li, .explore a, .paths a { transition: background-color 240ms; }
  .media-split__media, .page-hero__media, .tab-panel__img, .flow__media { transition: transform 600ms var(--m-ease); }
  .media-split:hover .media-split__media { transform: scale(1.015); }
}

/* ---------- Tabs: sliding indicator ---------- */
.tabs__bar { position: relative; }
.tabs__ink { position: absolute; top: 8px; bottom: 8px; left: 0; width: var(--bw, 100%); background: #fff; clip-path: inset(0 var(--r, 100%) 0 var(--l, 0) round 999px); transition: clip-path 460ms var(--m-ease); pointer-events: none; z-index: 0; }
.tabs__bar.has-ink button { position: relative; z-index: 1; }
.tabs__bar.has-ink button[aria-selected="true"] { background: transparent; }
@media (max-width: 767px) { .tabs__ink { top: 6px; bottom: 6px; } }

/* ---------- Hero ambient ---------- */
.motion .hc-card--front { animation: float-a 7s ease-in-out infinite; }
.motion .hc-card--back { animation: float-b 8s ease-in-out infinite; }
.motion .hc-badge { animation: float-c 6s ease-in-out infinite; }
.motion .hc-bar { transform-origin: left; animation: bar-grow 1.4s 1.1s var(--m-ease) both; }
.motion .hc-bar--b { animation-delay: 1.3s; }
@keyframes float-a { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-3deg) translateY(-6px); } }
@keyframes float-b { 0%, 100% { transform: rotate(12deg) translateY(0); } 50% { transform: rotate(10deg) translateY(5px); } }
@keyframes float-c { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes bar-grow { from { transform: scaleX(0); } }
.motion .tile { animation: float-c 6s ease-in-out infinite; }
.motion .tile:nth-child(2) { animation-delay: -2s; }
.motion .tile:nth-child(3) { animation-delay: -4s; }
.motion .glass-chip { animation: float-c 5.5s ease-in-out infinite; }

/* Photo heroes: slow Ken Burns */
.sol-hero, .contact__info { background-size: cover; }
/* Ken Burns on a copy of the photo (scale only, so the image always covers the full width) */
.motion .sol-hero { overflow: hidden; }
.motion .sol-hero::after { content: ""; position: absolute; inset: 0; z-index: -2; background: inherit; background-size: cover; transform-origin: 50% 40%; animation: kb 18s ease-out both; }
@keyframes kb { from { transform: scale(1.12); } to { transform: scale(1); } }

/* Hub diagram (home) */
.motion .hub__lines path { stroke-dasharray: var(--len, 300); stroke-dashoffset: var(--len, 300); transition: stroke-dashoffset 1100ms var(--m-ease-in-out); transition-delay: var(--d, 0ms); }
.motion .hub.is-in .hub__lines path { stroke-dashoffset: 0; }
.motion .hub__core { opacity: 0; scale: .4; transition: opacity 500ms var(--m-ease), scale 700ms cubic-bezier(.18, .9, .22, 1); }
.motion .hub.is-in .hub__core { opacity: 1; scale: 1; }
.motion .hub__node { opacity: 0; scale: .7; transition: opacity 500ms var(--m-ease), scale 600ms cubic-bezier(.18, .9, .22, 1), transform .25s var(--ease); transition-delay: var(--d, 0ms); }
.motion .hub.is-in .hub__node { opacity: 1; scale: 1; }
.hub::before { animation: hub-glow 6s ease-in-out infinite; }
@keyframes hub-glow { 50% { transform: scale(1.06); opacity: .8; } }

/* How it works: wave path drawn by scroll position (motion.js sets --p 0..1) */
.motion .wave__svg path { stroke-dasharray: var(--len, 2000); stroke-dashoffset: calc(var(--len, 2000) * (1 - var(--p, 0))); }
.motion .wave__dot { transition: background-color 400ms, box-shadow 400ms, scale 500ms cubic-bezier(.18, .9, .22, 1); }
.motion .wave li.is-reached .wave__dot { background: var(--green-500); box-shadow: 0 0 0 6px #fff, 0 0 0 12px rgba(102, 200, 28, .2); scale: 1.1; }

/* Steppers, stairs, check rows: number count-up feel */
.motion .stepper b, .motion .stages b, .motion .stairs .big, .motion .wave b { display: inline-block; transition: transform 800ms var(--m-ease), opacity 800ms; }

/* Workflow arrows (home) draw in */
.motion .flow__arrow { clip-path: inset(0 0 100% 0); transition: clip-path 1200ms var(--m-ease-in-out) 300ms; }
.motion .flow__arrow.is-drawn { clip-path: inset(0 0 0 0); }

/* Video play button ripple */
.video__play::before, .video__play::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(152, 229, 103, .7); pointer-events: none; }
.motion .video__play::before { animation: ripple 2.6s var(--m-ease) infinite; }
.motion .video__play::after { animation: ripple 2.6s 1.3s var(--m-ease) infinite; }
@keyframes ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }

/* CTA circles drift */
.motion .cta__shapes i:nth-child(1) { animation: drift-a 16s ease-in-out infinite; }
.motion .cta__shapes i:nth-child(2) { animation: drift-b 19s ease-in-out infinite; }
@keyframes drift-a { 50% { translate: -18px 14px; } }
@keyframes drift-b { 50% { translate: 16px -12px; } }

/* VS badge pulse */
.motion .compare__vs { animation: vs 3.2s ease-in-out infinite; }
@keyframes vs { 50% { box-shadow: 0 0 0 14px rgba(102, 200, 28, .15); } }

/* 404 */
.motion .nf__code { display: inline-block; animation: nf-float 5s ease-in-out infinite; }
@keyframes nf-float { 50% { transform: translateY(-10px); } }

/* Success states */
.motion .csuccess__icon, .motion .psuccess__icon { animation: pop-in 700ms cubic-bezier(.18, .9, .22, 1) both; }
.motion .csuccess__icon .ico path, .motion .psuccess__icon .ico path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 600ms 300ms var(--m-ease) forwards; }
@keyframes pop-in { from { transform: scale(.4); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Form fields: label lift on focus */
.field:focus-within label, .pfield:focus-within label { color: var(--green-800); transition: color 200ms; }

/* Reading progress (legal pages) */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: transparent; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; background: var(--green-500); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* Logos marquee-like idle shimmer */
.motion .logos__list img { transition: opacity .3s, filter .3s, transform .4s var(--m-ease); }
.logos__list li:hover img { filter: none; transform: translateY(-2px); }

/* ---------- Reduced motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .motion [data-anim], .motion .h-split .w > span { opacity: 1 !important; transform: none !important; clip-path: none !important; filter: none !important; }
}
@media print {
  .motion [data-anim], .motion .h-split .w > span { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .read-progress, .cbanner { display: none !important; }
}
