/* Capital Signal homepage motion: the page moves as it is read. The headline blurs in, the glass panes
   loop through what Capital Signal reads, two sections pin while their steps advance, shapes and rows
   slide with the scroll, the map rises and the trust heading settles from scrambled letters.

   Rules:
   - Every effect sits inside `prefers-reduced-motion: no-preference`. With reduced motion asked for,
     the page is static and complete: no blur, scramble, parallax or pinning, and the hero shows a result.
   - Nothing is hidden by default. The hero plays a CSS entrance that ends fully visible. Everything else
     is hidden only by classes site.js adds (`.cs-rv`, `.cs-gl-live`, `.cs-map-js` and so on), so if the
     script never runs the page reads in full.
   - Only transform, opacity and filter are animated. Scroll-linked effects are driven by one
     requestAnimationFrame-throttled scroll handler in site.js, which writes transforms only. */

:root {
  --motion-ease: cubic-bezier(.2, .65, .25, 1);   /* A long, calm settle. */
  --motion-ease-in-out: cubic-bezier(.45, 0, .25, 1);
  --motion-rise: 24px;                             /* How far content travels as it appears. */
  --motion-reveal: 900ms;                          /* Fade and rise of revealed content. */
  --motion-stagger: 90ms;                          /* Gap between items in a row of cards. */
  --motion-hover: 220ms;                           /* Card and link hover. */
}

@media (prefers-reduced-motion: no-preference) {

  @keyframes cs-rise { from { opacity: 0; transform: translateY(var(--motion-rise)); } }
  @keyframes cs-fade { from { opacity: 0; } }
  @keyframes cs-blur { from { opacity: 0; filter: blur(18px); } to { opacity: 1; filter: blur(0); } }
  @keyframes cs-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
  @keyframes cs-pane-in { from { opacity: 0; translate: 0 120px; } }
  @keyframes cs-spin { to { transform: rotate(360deg); } }

  /* ---------------------------------------------------------------- hero */
  /* The headline comes into focus from a blur; the lines around it rise after it. */
  .cs-hm-hero .cs-h1 { animation: cs-blur 1100ms var(--motion-ease) 120ms both; }
  .cs-hm-hero .cs-hero-sub { animation: cs-blur 1000ms var(--motion-ease) 420ms both; }
  .cs-hm-hero .cs-eyebrow { animation: cs-fade 900ms var(--motion-ease) 60ms both; }
  .cs-hm-hero .cs-ctas { animation: cs-rise 900ms var(--motion-ease) 640ms both; }
  /* The panes rise into place from the back of the row forward (`translate`, so the 3D turn stays). */
  .cs-pane { animation: cs-pane-in 1300ms var(--motion-ease) both; animation-delay: calc(500ms + var(--i) * 110ms); }
  .cs-glass-move { will-change: transform; }
  .cs-gl-spin { animation: cs-spin 900ms linear infinite; }

  /* Focus travels along the row: the pane in focus lifts and turns forward while its face brightens and
     its content fades up; the pane it leaves settles back down. Then it reads (a bar fills) and shows
     what it found. */
  .cs-pane { transition: transform 620ms var(--motion-ease); will-change: transform; }
  .cs-pane::before, .cs-pane::after { transition: opacity 480ms var(--motion-ease); }
  .cs-pane-c { transition: opacity 240ms ease; }
  .cs-pane.is-on .cs-pane-c { transition: opacity 360ms ease 220ms; }
  .cs-gl-read, .cs-gl-res { transition: opacity 320ms var(--motion-ease), transform 400ms var(--motion-ease); }
  @keyframes cs-bar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  .cs-gl-live .cs-pane.is-reading .cs-gl-bar i { animation: cs-bar var(--read-ms, 1800ms) cubic-bezier(.4, 0, .6, 1) both; }
  @keyframes cs-shimmer { 50% { opacity: .45; } }
  .cs-gl-live .cs-pane.is-reading .cs-gl-lines i { animation: cs-shimmer 1200ms ease-in-out infinite; }
  .cs-gl-live .cs-pane.is-reading .cs-gl-lines i:nth-child(2n) { animation-delay: 200ms; }
  .cs-gl-paused .cs-gl-bar i, .cs-gl-paused .cs-gl-lines i, .cs-gl-paused .cs-gl-spin { animation-play-state: paused; }

  /* ---------------------------------------------------------------- logos marquee */
  @keyframes cs-marquee { to { transform: translateX(-50%); } }
  .cs-marquee-track { animation: cs-marquee 48s linear infinite; }
  .cs-marquee:hover .cs-marquee-track { animation-play-state: paused; }

  /* ---------------------------------------------------------------- section nav */
  .cs-secnav { transition: opacity 400ms var(--motion-ease), visibility 0s linear 400ms; }
  .cs-secnav.cs-secnav-on { transition: opacity 400ms var(--motion-ease), visibility 0s; }
  .cs-secnav a { transition: color 300ms ease; }
  .cs-secnav a::before { transition: opacity 300ms ease; }

  /* ---------------------------------------------------------------- scroll reveals (site.js adds .cs-rv) */
  /* Hiding is instant (it happens off screen); only the move to `.cs-in` is transitioned.
     site.js drops the classes once a reveal has finished, which hands the block back to its hover style. */
  .cs-page .cs-rv:not(.cs-in) { opacity: 0; transform: translateY(var(--motion-rise)); }
  .cs-page .cs-rv.cs-in { transition: opacity var(--motion-reveal) var(--motion-ease), transform var(--motion-reveal) var(--motion-ease); transition-delay: var(--rv-delay, 0ms); }
  /* Large panels only fade, so a tall block never appears to slide; the lead card grows into place. */
  .cs-page .cs-rv-fade:not(.cs-in) { transform: none; }
  .cs-page .cs-rv-scale:not(.cs-in) { transform: scale(.9); }
  .cs-page .cs-rv-scale.cs-in { transition-duration: 1100ms; }

  /* Lines in the figures draw once the figure is in view. */
  .cs-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
  .cs-rv .cs-draw { stroke-dashoffset: 1; }
  .cs-rv.cs-in .cs-draw { stroke-dashoffset: 0; transition: stroke-dashoffset 1400ms var(--motion-ease-in-out); transition-delay: calc(var(--rv-delay, 0ms) + 300ms); }

  /* Fig. 2: the layers settle onto the stack one by one, Capital Signal last, then data flows up
     to a published insight. The flow runs only while the figure is on screen. */
  .cs-rv .cs-stack .cs-layer { opacity: 0; transform: translateY(-18px); }
  .cs-rv.cs-in .cs-stack .cs-layer { opacity: 1; transform: none; transition: opacity 600ms var(--motion-ease), transform 700ms var(--motion-ease); transition-delay: calc(var(--rv-delay, 0ms) + 200ms + var(--i) * 160ms); }
  .cs-rv .cs-stack .cs-serve { opacity: 0; }
  .cs-rv.cs-in .cs-stack .cs-serve { opacity: 1; transition: opacity 600ms ease calc(var(--rv-delay, 0ms) + 1000ms); }
  @keyframes cs-serve { 0% { opacity: 0; transform: none; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-62px); } }
  .cs-stack .cs-flow circle { animation: cs-serve 3600ms var(--motion-ease-in-out) infinite; }
  .cs-stack .cs-flow circle:nth-child(2) { animation-delay: 1200ms; }
  .cs-stack .cs-flow circle:nth-child(3) { animation-delay: 2400ms; }
  .cs-fig-off .cs-stack .cs-flow circle { animation-play-state: paused; }

  /* ---------------------------------------------------------------- steps */
  /* The visual cross-fades to the active step; the open step's text rises in. Each visual has its own
     entrance, which plays when its step opens (once the section has been seen). Before and after, every
     part sits in its final place, so a still frame is always complete. */
  .cs-sv { transition: opacity 600ms var(--motion-ease), visibility 0s linear 600ms; }
  .cs-sv.is-on { transition: opacity 600ms var(--motion-ease), visibility 0s; }
  .cs-steps-js .cs-step.is-on .cs-step-d { animation: cs-rise 600ms var(--motion-ease) both; }
  .cs-step-bar { transition: opacity 300ms ease; }
  @keyframes cs-mail-roll { from { translate: 0 0; } to { translate: 0 var(--mail-shift, 0px); } }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-sv-mail.cs-roll .cs-mail-stack { animation: cs-mail-roll var(--mail-dur, 8s) cubic-bezier(.45, 0, .55, 1) var(--mail-wait, 1.4s) both; }
  .cs-steps-paused .cs-steps-vis .cs-sv-mail.cs-roll .cs-mail-stack { animation-play-state: paused; }
  @keyframes cs-pop { from { opacity: 0; transform: scale(.86); } }
  @keyframes cs-slide-l { from { opacity: 0; transform: translateX(-16px); } }
  @keyframes cs-back-in { from { transform: translate(0, 0); opacity: 0; } }
  @keyframes cs-today { from { transform: translateX(-20%); } }
  @keyframes cs-fade-in { from { opacity: 0; } }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-win { animation: cs-rise 640ms var(--motion-ease) both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-back { animation: cs-back-in 760ms var(--motion-ease) 160ms both; }
  /* 1. feed items arrive one by one, the match tag lands last */
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-items li { animation: cs-rise 520ms var(--motion-ease) both; animation-delay: calc(360ms + var(--n) * 160ms); }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-rail li { animation: cs-slide-l 480ms var(--motion-ease) both; animation-delay: 260ms; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-match { animation: cs-pop 420ms var(--motion-ease) 1100ms both; }
  /* 2. the line draws in, the markers land along it, the area fills, then the callout */
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-line { animation: cs-draw 1500ms var(--motion-ease-in-out) 300ms both; stroke-dasharray: 1; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-area { animation: cs-fade-in 900ms ease 1100ms both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-pt { animation: cs-pop 380ms var(--motion-ease) both; animation-delay: calc(420ms + var(--n) * 190ms); }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-end { animation: cs-pop 420ms var(--motion-ease) 1700ms both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-callout { animation: cs-rise 520ms var(--motion-ease) 1850ms both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-kpis div { animation: cs-rise 520ms var(--motion-ease) both; animation-delay: 300ms; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-kpis div + div { animation-delay: 420ms; }
  /* 3. the days come in, today's marker moves from Monday to Tuesday, then what's coming up */
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-days li { animation: cs-rise 480ms var(--motion-ease) both; animation-delay: calc(300ms + var(--n) * 110ms); }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-now { animation: cs-today 1200ms var(--motion-ease-in-out) 700ms both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-next { animation: cs-rise 520ms var(--motion-ease) 1500ms both; }
  /* 4. the alert lands, wires draw out to each channel, each channel lights in turn */
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-alert { animation: cs-pop 520ms var(--motion-ease) 260ms both; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-wire { animation: cs-draw 700ms var(--motion-ease-in-out) both; animation-delay: calc(640ms + var(--n) * 140ms); }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mk-nodes li { animation: cs-slide-l 480ms var(--motion-ease) both; animation-delay: calc(1100ms + var(--n) * 140ms); }
  /* delivery: rows of the briefing email and the chats arrive one after another */
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-mail-item { animation: cs-rise 560ms var(--motion-ease) both; animation-delay: var(--item-delay, 0ms); }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-chat { animation: cs-rise 560ms var(--motion-ease) both; animation-delay: 220ms; }
  .cs-steps-seen .cs-steps-vis .cs-sv.is-on .cs-chat + .cs-chat { animation-delay: 380ms; }

  /* The live alert card: the sweep is driven by site.js; rows and the alert ease into their new state. */
  .cs-scan2-rd, .cs-scan2-ok { transition: opacity 260ms ease; }
  .cs-scan2-alert { transition: opacity 360ms var(--motion-ease), transform 420ms var(--motion-ease); }
  .cs-scan2-line { will-change: transform; }

  /* ---------------------------------------------------------------- coverage map */
  .cs-map-spin { animation: cs-spin 1000ms linear infinite; }
  .cs-map-move { will-change: transform; transform-origin: 50% 100%; }
  .cs-cap, .cs-cap-ring { transform-box: fill-box; transform-origin: center; }
  @keyframes cs-cap-in { from { opacity: 0; transform: scale(.2); } }
  @keyframes cs-cap-ring { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(3.4); } }
  .cs-map-js .cs-cap { opacity: 0; }
  .cs-map-on .cs-cap { opacity: 1; animation: cs-cap-in 700ms var(--motion-ease) both; animation-delay: calc(200ms + var(--i) * 220ms); }
  .cs-map-on .cs-cap-ring { animation: cs-cap-ring 1400ms ease-out both; animation-delay: calc(260ms + var(--i) * 220ms); }
  .cs-map-on .cs-cap-act .cs-cap-ring { animation: cs-cap-ring 2400ms ease-out calc(260ms + 7 * 220ms) infinite; }

  /* ---------------------------------------------------------------- scroll-linked layers */
  .cs-geo [data-geo], .cs-faq-pat-in, .cs-who-slide .cs-who-row { will-change: transform; }

  /* ---------------------------------------------------------------- header */
  .cs-hdr { transition: border-color 300ms ease; }
  .cs-hdr.cs-scrolled { border-bottom-color: var(--line-300); }

  /* ---------------------------------------------------------------- hover: rules darken, nothing casts a shadow */
  .cs-insight, .cs-plan, .cs-who-row > li { transition: transform var(--motion-hover) var(--motion-ease), border-color var(--motion-hover) ease; }
  @media (hover: hover) {
    .cs-insight:hover, .cs-plan:hover, .cs-who-row > li:hover { transform: translateY(-3px); }
    .cs-plan:not(.cs-plan-feat):hover, .cs-who-row > li:not(.cs-who-cta):hover { border-color: var(--line-500); }
  }
  .cs-btn > span[aria-hidden], .cs-textlink > span[aria-hidden], .cs-hm-link > span[aria-hidden] { display: inline-block; transition: transform var(--motion-hover) var(--motion-ease); }
  .cs-btn:hover > span[aria-hidden], .cs-textlink:hover > span[aria-hidden], .cs-hm-link:hover > span[aria-hidden] { transform: translateX(3px); }
  .cs-btn { transition: background-color var(--motion-hover) ease, border-color var(--motion-hover) ease, color var(--motion-hover) ease; }
  .cs-step-btn { transition: color 300ms ease; }

  /* ---------------------------------------------------------------- FAQ */
  /* The plus turns into a minus instead of switching. */
  .cs-faq .cs-faq-v { transform-box: fill-box; transform-origin: center; transition: transform 300ms var(--motion-ease), opacity 300ms ease; }
  .cs-faq details[open] .cs-faq-v { display: inline; transform: rotate(90deg); opacity: 0; }
  /* Answers open smoothly where the browser supports animating to auto height; elsewhere they open as before. */
  @supports selector(::details-content) {
    .cs-faq { interpolate-size: allow-keywords; }
    .cs-faq details::details-content { block-size: 0; overflow: clip; transition: block-size 360ms var(--motion-ease), content-visibility 360ms allow-discrete; }
    .cs-faq details[open]::details-content { block-size: auto; }
  }
  .cs-faq details[open] .cs-faq-a { animation: cs-fade 420ms ease both; }
}
