/* =====================================================================
   /capabilities — animation layer (loaded after capabilities.css).
   Purely additive: every hidden/start state is gated behind html.cap-anim-ready
   (set by /js/cap-anim.js) or behind prefers-reduced-motion:no-preference, so the
   page reads exactly as before without JS or with reduced motion.
   Prefix: cap-a-*. The enquiry form itself is styled elsewhere (enquiry-anim.css).
   ===================================================================== */

@property --cap-ang{syntax:"<angle>";inherits:false;initial-value:0deg;}

/* ---------- Hero: decorative chip + circuit traces (injected by JS) ---------- */
.cap-hero{position:relative;}
.cap-hero > .wrap{position:relative;z-index:1;}
.cap-a-fx{position:absolute;z-index:0;pointer-events:none;top:50%;right:max(-80px,calc(50% - 760px));width:min(640px,58vw);aspect-ratio:1;transform:translateY(-46%);
  -webkit-mask-image:linear-gradient(90deg,transparent 0%,#000 32%,#000 100%);mask-image:linear-gradient(90deg,transparent 0%,#000 32%,#000 100%);opacity:.9;}
.cap-a-fx svg{width:100%;height:100%;display:block;overflow:visible;}
.cap-a-fx .tr{fill:none;stroke:rgba(51,173,221,.34);stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;}
.cap-a-fx .tr.o{stroke:rgba(248,162,48,.32);}
.cap-a-fx .pulse{fill:none;stroke:url(#capAGrad);stroke-width:2.4;stroke-linecap:round;stroke-dasharray:26 400;stroke-dashoffset:426;opacity:0;}
.cap-a-fx .node{fill:#33ADDD;opacity:.75;}
.cap-a-fx .node.o{fill:#F8A230;}
.cap-a-fx .die{fill:rgba(11,36,64,.55);stroke:rgba(51,173,221,.55);stroke-width:1.5;}
.cap-a-fx .die-in{fill:none;stroke:rgba(255,255,255,.14);stroke-width:1;}
.cap-a-fx .cell{fill:rgba(51,173,221,.22);}
.cap-a-fx .cell.o{fill:rgba(248,162,48,.28);}
.cap-a-fx .pin{fill:rgba(179,161,133,.7);}
.cap-a-fx .glow{fill:url(#capAGlow);}
@media (max-width:900px){
  .cap-a-fx{width:520px;right:-240px;top:auto;bottom:-120px;transform:none;opacity:.45;}
}
@media (max-width:560px){ .cap-a-fx{display:none;} }

/* ---------- Capability cards: icon, index number, accent line ---------- */
#choose-capability .card{overflow:hidden;}
/* the static gradient border (style.css .card::before) is replaced by the rotating ring */
#choose-capability .card::before{display:none;}
.cap-a-idx{position:absolute;right:20px;top:14px;z-index:-1;font-family:var(--font-display);font-weight:700;font-size:64px;line-height:1;letter-spacing:-.04em;color:var(--mist-2);opacity:.7;pointer-events:none;transition:color .4s,transform .6s var(--ease);}
#choose-capability .card:hover .cap-a-idx{color:rgba(16,121,191,.16);transform:translateY(-4px) scale(1.06);}
.cap-a-icon{display:flex;align-items:center;justify-content:center;width:56px;height:56px;margin:0 0 20px;border-radius:14px;background:linear-gradient(140deg,rgba(16,121,191,.10),rgba(248,162,48,.10));color:var(--blue-ink);border:1px solid rgba(16,121,191,.16);}
.cap-a-icon svg{width:30px;height:30px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;}
.cap-a-line{position:absolute;left:0;top:0;height:3px;width:100%;background:var(--brand-gradient);transform:scaleX(0);transform-origin:left;}
/* rotating gradient border on hover */
.cap-a-ring{position:absolute;inset:0;z-index:-1;border-radius:inherit;padding:1.5px;pointer-events:none;opacity:0;transition:opacity .35s;
  background:conic-gradient(from var(--cap-ang),#1079BF,#33ADDD,#B3A185,#F8A230,#1079BF);
  -webkit-mask:linear-gradient(#000 0 0) content-box,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);}
#choose-capability .card:hover .cap-a-ring,#choose-capability .card:focus-within .cap-a-ring{opacity:1;}

/* ---------- Trust stats ---------- */
.cap-trust .stat{position:relative;}
.cap-trust .stat > b{display:inline-block;background:linear-gradient(90deg,var(--navy) 0%,var(--blue-ink) 50%,var(--navy) 100%);background-size:200% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;}
.cap-a-bar{display:block;height:3px;width:56px;margin:12px 0 10px;border-radius:3px;background:var(--brand-gradient);transform-origin:left;}

/* ---------- Selection steps: numbered badges + travelling signal ---------- */
.cap-a-num{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;margin-bottom:16px;border-radius:50%;font-family:var(--font-mono);font-size:13px;font-weight:600;color:var(--white);background:var(--navy);box-shadow:0 0 0 6px rgba(16,121,191,.10);position:relative;z-index:1;}
.step:hover .cap-a-num{background:var(--orange);color:var(--navy);}
.steps .track{overflow:visible;}
.cap-a-dot{position:absolute;top:50%;left:0;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;background:var(--orange);box-shadow:0 0 0 4px rgba(248,162,48,.25),0 0 18px rgba(248,162,48,.8);opacity:0;}

/* ---------- Notes: accent rule ---------- */
.cap-note{position:relative;}

/* ---------- CTA section: aurora + orbiting ring behind the heading ---------- */
.cap-cta{position:relative;}
.cap-a-aurora{position:absolute;inset:-10%;z-index:-1;pointer-events:none;opacity:.55;
  background:radial-gradient(40% 35% at 20% 30%,rgba(16,121,191,.55),transparent 70%),radial-gradient(35% 30% at 80% 20%,rgba(248,162,48,.30),transparent 70%),radial-gradient(45% 40% at 60% 80%,rgba(51,173,221,.35),transparent 70%);filter:blur(30px);}
.cap-cta-head{position:relative;}

/* ======================= MOTION (only when allowed) ======================= */
@media (prefers-reduced-motion:no-preference){

  /* Hero entrance — CSS only, runs on first paint, ends fully visible (no JS needed) */
  .cap-hero .breadcrumb,.cap-hero .lead,.cap-hero .cap-sub,.cap-hero .actions{animation:capARise .9s var(--ease) both;}
  .cap-hero .breadcrumb{animation-delay:.05s;}
  .cap-hero .lead{animation-delay:.35s;}
  .cap-hero .cap-sub{animation-delay:.5s;}
  .cap-hero .actions{animation-delay:.65s;}
  .cap-hero .actions .link-arrow span{display:inline-block;animation:capANudge 2.2s ease-in-out 1.6s infinite;}

  /* Hero fx */
  .cap-a-fx{animation:capAFade 1.4s var(--ease) .2s both;}
  .cap-a-fx .tr{stroke-dasharray:var(--len,600);stroke-dashoffset:var(--len,600);animation:capADraw 2.2s var(--ease) forwards;animation-delay:calc(.3s + var(--d,0) * .12s);}
  .cap-a-fx .pulse{animation:capAPulse 3.6s linear infinite;animation-delay:calc(2s + var(--d,0) * .55s);}
  .cap-a-fx .node{transform-box:fill-box;transform-origin:center;animation:capABlink 2.8s ease-in-out infinite;animation-delay:calc(var(--d,0) * .35s);}
  .cap-a-fx .cell{animation:capACell 4s ease-in-out infinite;animation-delay:calc(var(--d,0) * .25s);}
  .cap-a-fx .chip{transform-box:fill-box;transform-origin:center;animation:capAFloat 7s ease-in-out infinite;}
  .cap-a-fx .glow{animation:capABreathe 5s ease-in-out infinite;}

  /* Cards: accent line draws, icon strokes draw on reveal; ring spins on hover */
  html.cap-anim-ready #choose-capability .card.in .cap-a-line{animation:capALine 1s var(--ease) forwards;animation-delay:calc(.25s + var(--i,0) * .12s);}
  html.cap-anim-ready #choose-capability .card .cap-a-icon svg *{stroke-dasharray:120;stroke-dashoffset:120;}
  html.cap-anim-ready #choose-capability .card.in .cap-a-icon svg *{animation:capAIconDraw 1.4s var(--ease) forwards;animation-delay:calc(.35s + var(--i,0) * .15s);}
  #choose-capability .card:hover .cap-a-icon{animation:capAWiggle .6s var(--ease);}
  #choose-capability .card:hover .cap-a-ring{animation:capASpin 3s linear infinite;}

  /* Stats: underline grows, numbers shimmer once revealed */
  html.cap-anim-ready .cap-trust .cap-a-bar{transform:scaleX(0);}
  html.cap-anim-ready .cap-trust .stats.in .cap-a-bar{animation:capALine 1s var(--ease) forwards;}
  html.cap-anim-ready .cap-trust .stats.in .stat:nth-child(2) .cap-a-bar{animation-delay:.15s;}
  html.cap-anim-ready .cap-trust .stats.in .stat:nth-child(3) .cap-a-bar{animation-delay:.3s;}
  .cap-trust .stats.in .stat > b{animation:capAShimmer 3.5s ease-in-out 1.2s infinite;}

  /* Steps: badges pop in sequence, a signal dot travels the track */
  html.cap-anim-ready .steps .cap-a-num{transform:scale(0);}
  html.cap-anim-ready .steps.in .cap-a-num{animation:capAPop .6s cubic-bezier(.3,1.6,.5,1) forwards;}
  html.cap-anim-ready .steps.in .step:nth-of-type(2) .cap-a-num{animation-delay:.25s;}
  html.cap-anim-ready .steps.in .step:nth-of-type(3) .cap-a-num{animation-delay:.5s;}
  .steps.in .cap-a-num{box-shadow:0 0 0 6px rgba(16,121,191,.10);}
  .steps.in .cap-a-dot{animation:capATravel 4.5s var(--ease) 1.4s infinite;}

  /* Ticks: each check pops in turn */
  html.cap-anim-ready .ticks li::before{transform:scale(0);}
  html.cap-anim-ready .ticks.in li::before{animation:capAPop .55s cubic-bezier(.3,1.6,.5,1) forwards;}
  html.cap-anim-ready .ticks.in li:nth-child(2)::before{animation-delay:.18s;}
  html.cap-anim-ready .ticks.in li:nth-child(3)::before{animation-delay:.36s;}
  html.cap-anim-ready .ticks li{opacity:0;transform:translateX(-10px);transition:opacity .6s var(--ease),transform .6s var(--ease);}
  html.cap-anim-ready .ticks.in li{opacity:1;transform:none;}
  html.cap-anim-ready .ticks.in li:nth-child(2){transition-delay:.18s;}
  html.cap-anim-ready .ticks.in li:nth-child(3){transition-delay:.36s;}

  /* Notes: left accent rule grows */
  .cap-note::before{content:"";position:absolute;left:-18px;top:4px;bottom:4px;width:3px;border-radius:3px;background:var(--brand-gradient);transform:scaleY(0);transform-origin:top;transition:transform .9s var(--ease) .2s;}
  .cap-note.in::before{transform:scaleY(1);}

  /* CTA: drifting aurora; arriving via #project-enquiry gives the heading a glow pulse */
  .cap-a-aurora{animation:capAAurora 14s ease-in-out infinite alternate;}
  #project-enquiry:target .cap-cta-head h2{animation:capAHi 1.6s var(--ease) .4s 2;}
  .cap-cta .link-arrow:hover span{display:inline-block;animation:capANudge .8s ease-in-out infinite;}
}
@media (max-width:900px){ .cap-note::before{left:-12px;} }

@keyframes capARise{from{opacity:0;transform:translateY(18px);}to{opacity:1;transform:none;}}
@keyframes capAFade{from{opacity:0;}to{opacity:.9;}}
@keyframes capADraw{to{stroke-dashoffset:0;}}
@keyframes capAPulse{0%{stroke-dashoffset:426;opacity:0;}8%{opacity:1;}85%{opacity:1;}100%{stroke-dashoffset:0;opacity:0;}}
@keyframes capABlink{0%,100%{opacity:.35;transform:scale(.8);}50%{opacity:1;transform:scale(1.25);}}
@keyframes capACell{0%,100%{opacity:.45;}50%{opacity:1;}}
@keyframes capAFloat{0%,100%{transform:translateY(0) rotate(0deg);}50%{transform:translateY(-10px) rotate(-1.2deg);}}
@keyframes capABreathe{0%,100%{opacity:.55;}50%{opacity:1;}}
@keyframes capALine{to{transform:scaleX(1);}}
@keyframes capAIconDraw{to{stroke-dashoffset:0;}}
@keyframes capAWiggle{0%,100%{transform:none;}30%{transform:rotate(-8deg) scale(1.08);}60%{transform:rotate(6deg) scale(1.08);}}
@keyframes capASpin{to{--cap-ang:360deg;}}
@keyframes capAShimmer{0%,60%,100%{background-position:100% 0;}30%{background-position:0 0;}}
@keyframes capAPop{to{transform:scale(1);}}
@keyframes capATravel{0%{left:0;opacity:0;}8%{opacity:1;}88%{opacity:1;}100%{left:100%;opacity:0;}}
@keyframes capAAurora{0%{transform:translate3d(-3%,0,0) scale(1);}100%{transform:translate3d(3%,-4%,0) scale(1.08);}}
@keyframes capAHi{0%,100%{text-shadow:none;}40%{text-shadow:0 0 28px rgba(51,173,221,.8),0 0 2px rgba(255,255,255,.6);}}
@keyframes capANudge{0%,100%{transform:translateX(0);}50%{transform:translateX(5px);}}

.cap-a-fx.is-off *{animation-play-state:paused !important;}
