/* Jatoba motion layer. CSS only: the site ships no JavaScript and its security header blocks scripts.
   Everything that moves sits inside prefers-reduced-motion: no-preference, so people who ask their
   device for less motion get the static page. Scroll-driven parts sit inside @supports, so browsers
   without them show the finished page, never a hidden one. Nothing flashes more than 3 times a second. */

@view-transition { navigation: auto }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none } }

@property --mo-n { syntax: "<integer>"; initial-value: 0; inherits: false }

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

  /* ---------- page load: the hero arrives in order ---------- */
  .hero > * { animation: mo-rise .85s cubic-bezier(.2,.7,.2,1) backwards }
  .hero > .eyebrow { animation-delay: .05s }
  .hero > h1 { animation-delay: .18s }
  .hero > .accent-rule { animation-name: mo-draw; animation-delay: .5s; transform-origin: left center }
  .hero > .lede { animation-delay: .6s }
  .hero > .mono-line { animation-delay: .75s }
  .hero > .terminal { animation-delay: .9s }
  .hero > .row-btns { animation-delay: 1.15s }
  .hero > .chips { animation-delay: 1.3s }
  .hero .chips .code-chip { animation: mo-pop .5s cubic-bezier(.2,.9,.3,1.3) backwards }
  .hero .chips .code-chip:nth-child(1) { animation-delay: 1.45s }
  .hero .chips .code-chip:nth-child(2) { animation-delay: 1.53s }
  .hero .chips .code-chip:nth-child(3) { animation-delay: 1.61s }
  .hero .chips .code-chip:nth-child(4) { animation-delay: 1.69s }
  .hero .chips .code-chip:nth-child(5) { animation-delay: 1.77s }
  .hero .chips .code-chip:nth-child(6) { animation-delay: 1.85s }

  /* the terminal types its four lines, then a cursor blinks (the comment line is the first span, so the four commands are spans 2 to 5) */
  .hero .terminal .t-comment { animation: mo-fade .6s ease 1.0s backwards }
  .hero .terminal .t-typed { animation: mo-type 1s steps(26, end) backwards }
  .hero .terminal .t-prompt { animation: mo-fade .3s ease backwards }
  .hero .terminal .t-cmdline:nth-of-type(2) .t-typed { animation-delay: 1.5s }
  .hero .terminal .t-cmdline:nth-of-type(3) .t-typed { animation-delay: 2.3s }
  .hero .terminal .t-cmdline:nth-of-type(4) .t-typed { animation-delay: 3.1s }
  .hero .terminal .t-cmdline:nth-of-type(5) .t-typed { animation-delay: 3.9s }
  .hero .terminal .t-cmdline:nth-of-type(2) .t-prompt { animation-delay: 1.45s }
  .hero .terminal .t-cmdline:nth-of-type(3) .t-prompt { animation-delay: 2.25s }
  .hero .terminal .t-cmdline:nth-of-type(4) .t-prompt { animation-delay: 3.05s }
  .hero .terminal .t-cmdline:nth-of-type(5) .t-prompt { animation-delay: 3.85s }
  .hero .terminal .t-cmdline:last-of-type .t-typed::after {
    content: "\2588"; content: "\2588" / ""; margin-left: .25ch; color: var(--accent-text);
    animation: mo-blink 1.1s steps(1, end) 4.9s infinite; opacity: 0;
  }

  /* the second headline line gets one slow shine, once */
  @supports ((background-clip: text) or (-webkit-background-clip: text)) and (color: color-mix(in srgb, red, blue)) {
    .hero h1 .accent {
      background-image: linear-gradient(100deg, var(--accent-text) 0 40%, color-mix(in srgb, var(--accent-text) 40%, #fff) 50%, var(--accent-text) 60% 100%);
      background-size: 260% 100%; background-repeat: no-repeat;
      -webkit-background-clip: text; background-clip: text;
      -webkit-text-fill-color: transparent; color: transparent;
      animation: mo-sheen 2.6s ease 1.2s both;
    }
  }

  /* ---------- the logo assembles, then the coral slab breathes ---------- */
  .brand-logo .lg-s1, .brand-logo .lg-s2, .brand-logo .lg-s3 { transform-box: fill-box; transform-origin: center }
  .brand-logo .lg-s1 { animation: mo-slab .9s cubic-bezier(.2,.8,.2,1) .05s backwards }
  .brand-logo .lg-s2 { animation: mo-slab .9s cubic-bezier(.2,.8,.2,1) .2s backwards }
  .brand-logo .lg-s3 { animation: mo-slab .9s cubic-bezier(.2,.8,.2,1) .35s backwards, mo-ember 3.4s ease-in-out 1.6s infinite }
  .brand-logo .lg-w { animation: mo-wipe 1s cubic-bezier(.6,0,.2,1) .5s backwards }

  /* ---------- hero background: the network is alive ---------- */
  .hero-glow::before { animation: mo-glow 9s ease-in-out infinite alternate }
  .net svg { animation: mo-float 16s ease-in-out infinite alternate }
  .net svg line { stroke-dasharray: 3 6; animation: mo-flow 18s linear infinite }
  .net svg circle { transform-box: fill-box; transform-origin: center; animation: mo-twinkle 5s ease-in-out infinite }
  .net svg circle:nth-of-type(2n) { animation-duration: 7s; animation-delay: -2s }
  .net svg circle:nth-of-type(3n) { animation-duration: 6s; animation-delay: -4s }
  .net svg circle:nth-of-type(5n) { animation-duration: 8.5s; animation-delay: -1s }

  /* ---------- hover: everything answers the pointer ---------- */
  .card { transition: background-color .2s, border-color .2s, color .2s, translate .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s }
  .nav-desktop a:not(.nav-cta) {
    background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 2px no-repeat;
    padding-bottom: .3rem; transition: background-size .3s ease, color .2s;
  }
  .btn-primary span[aria-hidden], .btn-secondary span[aria-hidden], .nav-cta span[aria-hidden] { display: inline-block; transition: transform .25s cubic-bezier(.2,.7,.2,1) }
  .code-chip { transition: translate .2s ease, border-color .2s ease, background-color .2s }
  .door { transition: border-color .2s, translate .25s cubic-bezier(.2,.7,.2,1), background-color .2s }
  .spine-rows li { transition: border-color .2s, translate .25s cubic-bezier(.2,.7,.2,1) }
  .brand-logo { transition: transform .4s cubic-bezier(.2,.7,.2,1) }
  .btn-primary, .nav-cta { transition: background-color .2s, translate .2s ease, box-shadow .25s }
  @media (hover: hover) {
    .card:hover { translate: 0 -4px; border-color: var(--accent); box-shadow: 0 14px 34px var(--shadow), 0 0 0 1px var(--accent-glow) }
    .nav-desktop a:not(.nav-cta):hover { background-size: 100% 2px }
    .btn-primary:hover span[aria-hidden] { transform: translateX(5px) }
    .btn-secondary:hover span[aria-hidden] { transform: translate(3px, -3px) }
    .btn-primary:hover, .nav-cta:hover { translate: 0 -2px; box-shadow: 0 10px 24px var(--accent-glow) }
    .code-chip:hover { translate: 0 -3px; border-color: var(--accent) }
    .door:hover { translate: 6px 0 }
    .spine-rows li:hover { translate: 6px 0; border-color: var(--accent) }
    .brand:hover .brand-logo { transform: scale(1.04) }
  }
  .btn-primary:active, .nav-cta:active { translate: 0 0 }

  /* ---------- scroll: sections reveal as you reach them ---------- */
  @supports (animation-timeline: view()) {
    .section .eyebrow, .section .section-label, .section .display-lg, .section .body-text, .section .lede,
    .card, .graphic-frame, .pullquote-lg, .door, .node, .spine .head, .frame-caption,
    .frame, .strip, .svc, .step, .pcard, .custom-bar, .find, .report, .facts, .block h2, .block .body-text, .checks li, .tl li,
    .faq details, .post-card, .prose > *, .section-grid > * {
      animation: mo-reveal linear both; animation-timeline: view(); animation-range: entry 0% cover 22%;
    }
    .pgrid > :nth-child(2), .find-list > :nth-child(2), .svc-grid > :nth-child(2) { animation-range: entry 6% cover 26% }
    .pgrid > :nth-child(3), .find-list > :nth-child(3), .svc-grid > :nth-child(3) { animation-range: entry 12% cover 30% }
    .find-list > :nth-child(4), .svc-grid > :nth-child(4) { animation-range: entry 18% cover 34% }
    .step:nth-child(2) { animation-range: entry 5% cover 26% }
    .step:nth-child(3) { animation-range: entry 10% cover 30% }
    .step:nth-child(4) { animation-range: entry 15% cover 34% }
    .checks li:nth-child(n+2), .tl li:nth-child(n+2) { animation-range: entry 6% cover 28% }
    .grid-3 > :nth-child(2), .grid-2 > :nth-child(2) { animation-range: entry 6% cover 26% }
    .grid-3 > :nth-child(3) { animation-range: entry 12% cover 30% }
    .spine-rows li { animation: mo-slide-in linear both; animation-timeline: view(); animation-range: entry 0% cover 24% }
    .spine-rows li:nth-child(2) { animation-range: entry 5% cover 28% }
    .spine-rows li:nth-child(3) { animation-range: entry 10% cover 32% }
    .spine-rows li:nth-child(4) { animation-range: entry 15% cover 36% }
    .spine-rows li:nth-child(5) { animation-range: entry 20% cover 40% }
    .spine .divider { transform-origin: top; animation: mo-draw-y linear both; animation-timeline: view(); animation-range: entry 0% cover 40% }
    .card.featured {
      animation: mo-reveal linear both, mo-featured 4.5s ease-in-out 1s infinite;
      animation-timeline: view(), auto; animation-range: entry 0% cover 22%, normal;
    }

    /* the three McKinsey numbers count up as their cards arrive */
    .stat .n-real { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
    .stat .n-count { counter-reset: mo-n var(--mo-n); animation-timeline: view(); animation-range: entry 10% cover 34%; animation-fill-mode: both; animation-timing-function: ease-out }
    .stat .n-count::before { content: counter(mo-n) }
    .stat .n-count.c80 { animation-name: mo-c80 }
    .stat .n-count.c37 { animation-name: mo-c37 }
    .stat .n-count.c6 { animation-name: mo-c6 }
  }

  /* ---------- scroll: a coral line under the header fills as you read ---------- */
  @supports (animation-timeline: scroll()) {
    .site-header::after {
      content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
      background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #ffd7a8));
      transform-origin: left; transform: scaleX(0);
      animation: mo-progress linear both; animation-timeline: scroll(root block);
    }
  }
}

@keyframes mo-rise { from { opacity: 0; transform: translateY(22px) } to { opacity: 1; transform: none } }
@keyframes mo-draw { from { transform: scaleX(0) } to { transform: scaleX(1) } }
@keyframes mo-draw-y { from { transform: scaleY(0) } to { transform: scaleY(1) } }
@keyframes mo-pop { from { opacity: 0; transform: translateY(8px) scale(.85) } to { opacity: 1; transform: none } }
@keyframes mo-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes mo-type { from { clip-path: inset(0 100% 0 0) } to { clip-path: inset(0 0 0 0) } }
@keyframes mo-blink { 0%, 55% { opacity: 1 } 56%, 100% { opacity: 0 } }
@keyframes mo-sheen { from { background-position: 100% 0 } to { background-position: 0% 0 } }
@keyframes mo-slab { from { opacity: 0; transform: translate(-28%, 34%) } to { opacity: 1; transform: none } }
@keyframes mo-wipe { from { clip-path: inset(0 100% 0 0); opacity: .2 } to { clip-path: inset(0 0 0 0); opacity: 1 } }
@keyframes mo-ember { 0%, 100% { filter: drop-shadow(0 0 0 transparent) } 50% { filter: drop-shadow(0 0 7px #ff5d4dcc) } }
@keyframes mo-glow { from { opacity: .7; transform: translateX(-50%) scale(1) } to { opacity: 1; transform: translateX(-50%) scale(1.18) } }
@keyframes mo-float { from { transform: translateY(0) } to { transform: translateY(-14px) } }
@keyframes mo-flow { to { stroke-dashoffset: -90 } }
@keyframes mo-twinkle { 0%, 100% { opacity: .45; transform: scale(1) } 50% { opacity: 1; transform: scale(1.7) } }
@keyframes mo-reveal { from { opacity: 0; transform: translateY(34px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes mo-slide-in { from { opacity: 0; transform: translateX(-26px) } to { opacity: 1; transform: none } }
@keyframes mo-featured { 0%, 100% { box-shadow: 0 0 0 0 transparent } 50% { box-shadow: 0 0 0 4px var(--accent-glow), 0 10px 30px var(--accent-glow) } }
@keyframes mo-progress { to { transform: scaleX(1) } }
@keyframes mo-c80 { from { --mo-n: 0 } to { --mo-n: 80 } }
@keyframes mo-c37 { from { --mo-n: 0 } to { --mo-n: 37 } }
@keyframes mo-c6 { from { --mo-n: 0 } to { --mo-n: 6 } }
