/* ==========================================================================
   Grey Sky Capital: liveliness layer
   Techniques common in motion-graphics practice (see prompt-motion.com):
   instrument HUD chrome, odometer digits, kinetic type, outline-to-fill
   type, crossing tapes and a pointer-lit grid. Uses GSCD-2.1 tokens only.
   Paired with assets/js/motion.js. Everything is off under reduced motion.
   ========================================================================== */

/* ---- Hero HUD ---- */
.hud {
  position: absolute; inset: calc(var(--nav-h) + 16px) var(--gutter) 24px; pointer-events: none; z-index: 0;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--grey-400);
}
.hud__corner { position: absolute; width: 18px; height: 18px; border: 0 solid var(--grey-500); }
.hud__corner--tl { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.hud__corner--tr { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.hud__corner--bl { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.hud__corner--br { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }
.hud__label { position: absolute; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.hud__label--tl { top: 2px; left: 28px; }
.hud__label--tr { top: 2px; right: 28px; color: var(--grey-300); font-variant-numeric: tabular-nums; }
.hud__label--bl { bottom: 2px; left: 28px; }
.hud__rec { width: 6px; height: 6px; border-radius: 50%; background: var(--flare); animation: blink 1.6s steps(1) 3; }   /* three blinks, then steady (WCAG 2.2.2) */
.hud__sw { display: inline-block; width: 14px; height: 2px; }
.hud__sw--signal { background: var(--lime); }
.hud__sw--noise { background: var(--grey-500); margin-left: 10px; }
.hud__ruler { position: absolute; right: 28px; bottom: 2px; display: flex; align-items: center; gap: 12px; }
.hud__ticks {
  width: 140px; height: 8px;
  background-image: repeating-linear-gradient(90deg, var(--grey-500) 0 1px, transparent 1px 10px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  animation: hud-ticks 2.4s linear infinite;
}
@keyframes hud-ticks { to { background-position: 10px 0; } }
.hud__scroll::after {
  content: ''; display: inline-block; width: 1px; height: 10px; margin-left: 8px; vertical-align: -1px;
  background: var(--lime); animation: scroll-cue 1.6s var(--ease) infinite;
}
@keyframes scroll-cue {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}
.hero__inner { position: relative; z-index: 1; }
/* The hero's Pause button (main.js) holds the HUD's moving ticks and scroll cue with the video */
.hero.is-motion-paused .hud *, .hero.is-motion-paused .hud *::after { animation-play-state: paused; }
@media (max-width: 760px) {
  .hud { inset: calc(var(--nav-h) + 8px) 16px 16px; }
  .hud__label--tl, .hud__ruler, .hud__label--bl { display: none; }
}

/* HUD chrome draws in after the title */
.js .hud__corner { opacity: 0; transform: scale(.6); transition: opacity .6s var(--ease) .9s, transform .6s var(--ease) .9s; }
.js .hud__label, .js .hud__ruler { opacity: 0; transition: opacity .8s var(--ease) 1.1s; }
.js .hero.is-loaded .hud__corner { opacity: 1; transform: none; }
.js .hero.is-loaded .hud__label, .js .hero.is-loaded .hud__ruler { opacity: 1; }

/* ---- Hero title: characters resolve out of blur, one after another ---- */
.js .hero__title.is-split .line > span { transform: none !important; transition: none; }
.hero__title .ch { display: inline-block; white-space: pre; }
.js .hero__title.is-split .ch {
  opacity: 0; filter: blur(12px); transform: translateY(.18em);
  transition: opacity .7s var(--ease), filter .7s var(--ease), transform .8s var(--ease);
  transition-delay: calc(var(--i) * 38ms + 80ms);
}
.js .hero.is-loaded .hero__title.is-split .ch { opacity: 1; filter: blur(0); transform: none; }

/* ---- Kinetic headings: words rise out of a mask ---- */
.kt .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.kt .w > span { display: inline-block; transform: translateY(110%); transition: transform .85s var(--ease); transition-delay: calc(var(--i) * 30ms); }
.kt.is-in .w > span { transform: none; }

/* ---- Odometer digits ---- */
.odo { display: inline-flex; align-items: flex-start; overflow: hidden; height: 1.15em; line-height: 1.15; vertical-align: bottom; }
.odo__col { display: inline-flex; flex-direction: column; flex: none; height: auto; transition: transform 1.5s cubic-bezier(.16, 1, .3, 1); transition-delay: calc(var(--i) * 70ms); }
.odo__col > span { height: 1.15em; display: block; text-align: center; }

/* ---- Crossing tapes between performance and stance ---- */
.tapes {
  position: relative; height: 132px; overflow: hidden; z-index: 1;
  background: linear-gradient(to bottom, var(--paper-200) 50%, var(--slate-900) 50%);
}
.tape {
  position: absolute; left: -5%; right: -5%; top: 50%; overflow: hidden;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: var(--eyebrow-tr); text-transform: uppercase;
}
.tape--ink {
  background: var(--slate-900); color: var(--grey-300); transform: translateY(-50%) rotate(-2.2deg);
  border-top: 1px solid var(--slate-600); border-bottom: 1px solid var(--slate-600);
}
.tape--lime { background: var(--lime); color: #0D1215; transform: translateY(-50%) rotate(1.6deg); }
.tape .ticker__track span { padding: 14px 0; }
.tape--ink .ticker__track i { background: var(--lime); box-shadow: none; }
.tape--lime .ticker__track i { background: #0D1215; box-shadow: none; }
.ticker__track--rev { animation-direction: reverse; animation-duration: 70s; }
.tapes:hover .ticker__track { animation-play-state: paused; }

/* ---- Stance: the grid lights up around the pointer ---- */
.stance::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s var(--ease);
  background-image: linear-gradient(var(--grey-500) 1px, transparent 1px), linear-gradient(90deg, var(--grey-500) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), #000 0%, transparent 70%);
          mask-image: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), #000 0%, transparent 70%);
}
.stance.is-lit::after { opacity: .7; }
.stance .wrap { z-index: 1; }

/* ---- CTA: headline drawn as an outline, filling left to right as it scrolls into place ----
   The plain part fills first (grey-100), then the accent phrase (lime), as one sweep.
   Both run on the heading's own view timeline so they stay in sequence. */
@property --ctafill { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
.cta__title { view-timeline: --cta block; }
.cta__title-fill {
  --fill-colour: var(--grey-100);
  color: transparent; -webkit-text-stroke: 1px var(--grey-400);
  background: linear-gradient(90deg, var(--fill-colour) var(--ctafill), transparent var(--ctafill));
  -webkit-background-clip: text; background-clip: text;
}
.cta__title-fill--accent { --fill-colour: var(--lime); -webkit-text-stroke-color: var(--grey-500); }
@supports (animation-timeline: view()) {
  .cta__title-fill { animation: fill-in linear both; animation-timeline: --cta; animation-range: entry 25% cover 40%; }
  .cta__title-fill--accent { animation-range: cover 40% cover 52%; }
  @keyframes fill-in { from { --ctafill: 0%; } to { --ctafill: 100%; } }
}
@supports not (-webkit-background-clip: text) { .cta__title-fill { color: var(--grey-100); -webkit-text-stroke: 0; } }

/* ---- Hand-drawn marks on key words, drawn as they scroll into view ----
   circle    = a pen loop around the phrase
   scribble  = a quick double underline
   highlight = a marker swipe behind the words                                  */
.mk { position: relative; white-space: nowrap; --mk: var(--rust); }
/* A phrase too wide for its line at this width (a long heading at 320 px): it wraps rather than
   running off the right edge, and each line keeps its marker (WCAG 1.4.10). Set by motion.js. */
.mk.mk--wrap, .cta__title .mk.mk--wrap { white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
[data-theme="light"] .mk[data-tone="global"] { --mk: var(--azure-ink); }
[data-theme="light"] .mk[data-tone="accent"] { --mk: var(--rust); }
.hero .mk { --mk: var(--azure); }
.stance .mk { --mk: var(--lime); }
.mk__svg { position: absolute; overflow: visible; pointer-events: none; z-index: 2; }
.mk__svg path {
  fill: none; stroke: var(--mk); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1;
  transition: stroke-dashoffset .95s cubic-bezier(.65, 0, .35, 1);
}
.mk__svg path + path { transition-duration: .5s; transition-delay: .7s; }
.mk.is-drawn .mk__svg path { stroke-dashoffset: 0; }
.mk[data-mark="highlight"] {
  background-image: linear-gradient(transparent 56%, var(--lime) 56%, var(--lime) 94%, transparent 94%);
  background-repeat: no-repeat; background-size: 0% 100%; background-position: 0 0;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 .1em; margin: 0 -.1em;
  transition: background-size .9s cubic-bezier(.65, 0, .35, 1);
}
.mk[data-mark="highlight"].is-drawn { background-size: 100% 100%; }

/* ---- Typewriter for the as-of stamp ---- */
.tw-cursor { display: inline-block; width: .6em; height: 1.1em; margin-left: 2px; vertical-align: -.2em; background: var(--text-head); animation: blink 1s steps(1) infinite; }
.tw-cursor.is-done { animation: tw-out .4s steps(1) 1.2s forwards; }
@keyframes tw-out { to { opacity: 0; } }

/* ---- CTA: radar rings behind the mark ---- */
section.cta { overflow: hidden; overflow: clip; }   /* the Talk to us band only, never a .cta inside an article */
.cta__radar { position: relative; display: inline-grid; place-items: center; isolation: isolate; }
.cta__radar::before, .cta__radar::after, .cta__radar > i {
  content: ''; position: absolute; inset: -18%; border: 1px solid var(--slate-600); border-radius: 50%; z-index: -1;
  opacity: 0;
}
/* One pass of three rings when the band comes into view (motion.js adds .is-in); the last ends at 4.8 s (WCAG 2.2.2) */
.cta__radar.is-in::before, .cta__radar.is-in::after, .cta__radar.is-in > i { animation: radar 3.2s cubic-bezier(.2, .6, .3, 1) 1; }
.cta__radar.is-in::after { animation-delay: .8s; }
.cta__radar.is-in > i { animation-delay: 1.6s; }
.cta__radar > i { border-color: var(--lime); }
@keyframes radar { 0% { transform: scale(.55); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }

/* ---- Testimonial scroller progress ---- */
.voices__progress { height: 2px; background: var(--hairline); margin-top: 20px; position: relative; overflow: hidden; }
.voices__progress > span { position: absolute; inset: 0; background: var(--azure-ink); transform-origin: 0 50%; transform: scaleX(0); }

@media (prefers-reduced-motion: reduce) {
  .mk__svg path { stroke-dashoffset: 0; transition: none; }
  .mk[data-mark="highlight"] { background-size: 100% 100%; transition: none; }
  .cta__radar::before, .cta__radar::after, .cta__radar > i, .cta__radar.is-in::before, .cta__radar.is-in::after, .cta__radar.is-in > i { animation: none; }
  .kt .w > span { transform: none; }
  .js .hero__title.is-split .ch { opacity: 1; filter: none; transform: none; }
  .cta__title-fill { --ctafill: 100%; }
}
