/* Assistant anti-flash gate: hide the legacy server-rendered assistant until the final V5 orb is ready. */
html:not(.kv-assistant-ready) body #chatToggle,
html:not(.kv-assistant-ready) body #chat{
  visibility:hidden!important;
  opacity:0!important;
  pointer-events:none!important;
}

/* QA mobile Services hero spacing fix. */
@media (max-width: 640px){
  body[data-page="services"]:not([data-service-slug]) .enhanced-hero{min-height:680px}
  body[data-page="services"]:not([data-service-slug]) .enhanced-hero-content{display:flex;flex-direction:column;align-items:stretch;gap:14px;padding-bottom:24px}
  body[data-page="services"]:not([data-service-slug]) .enhanced-message-stage{position:relative!important;min-height:104px;margin-top:8px;margin-bottom:4px;z-index:8}
  body[data-page="services"]:not([data-service-slug]) .enhanced-message{position:relative!important;inset:auto!important;width:100%;margin:0;padding:0 2px}
  body[data-page="services"]:not([data-service-slug]) .enhanced-message strong{display:block;margin-bottom:7px;font-size:1.05rem;line-height:1.2}
  body[data-page="services"]:not([data-service-slug]) .enhanced-message span{display:block;font-size:.8rem;line-height:1.45}
  body[data-page="services"]:not([data-service-slug]) .hero-actions,
  body[data-page="services"]:not([data-service-slug]) .kv-carousel-hero-actions{position:relative!important;inset:auto!important;width:100%;margin:2px 0 0!important;z-index:9}
  body[data-page="services"]:not([data-service-slug]) .hero-actions .btn,
  body[data-page="services"]:not([data-service-slug]) .kv-carousel-hero-actions .btn{width:100%;min-height:54px;white-space:normal;text-align:center;line-height:1.2;padding:15px 18px}
  body[data-page="services"]:not([data-service-slug]) .enhanced-hero-dots{position:relative!important;inset:auto!important;margin-top:4px;z-index:8}
}

/* QA desktop Home hero — one canonical layout: CTA left, dots centered to the whole hero. */
@media (min-width:641px){
  html body[data-page="home"] .kv-home-portfolio-hero{position:relative!important}
  html body[data-page="home"] .kv-home-portfolio-hero .enhanced-message-stage{position:absolute!important;left:34px!important;right:auto!important;bottom:108px!important;width:min(620px,62%)!important;max-width:620px!important}
  html body[data-page="home"] .kv-home-portfolio-hero>.hero-actions,
  html body[data-page="home"] .kv-home-portfolio-hero>.kv-carousel-hero-actions{position:absolute!important;left:34px!important;right:auto!important;bottom:36px!important;width:auto!important;max-width:44%!important;margin:0!important;transform:none!important;z-index:20!important}
  html body[data-page="home"] .kv-home-portfolio-hero>.hero-actions .kv-carousel-hero-link,
  html body[data-page="home"] .kv-home-portfolio-hero>.kv-carousel-hero-actions .kv-carousel-hero-link{width:auto!important;min-width:238px!important;max-width:420px!important;text-align:left!important;justify-content:flex-start!important}
  html body[data-page="home"] .kv-home-portfolio-hero>.enhanced-hero-dots{position:absolute!important;left:50%!important;right:auto!important;bottom:18px!important;width:auto!important;max-width:52%!important;margin:0!important;transform:translateX(-50%)!important;justify-content:center!important;z-index:21!important;overflow-x:auto!important}
}

@media (min-width:641px) and (max-width:900px){
  html body[data-page="home"] .kv-home-portfolio-hero .enhanced-message-stage{left:24px!important;bottom:112px!important;width:min(540px,70%)!important}
  html body[data-page="home"] .kv-home-portfolio-hero>.hero-actions,
  html body[data-page="home"] .kv-home-portfolio-hero>.kv-carousel-hero-actions{left:24px!important;bottom:40px!important;max-width:48%!important}
  html body[data-page="home"] .kv-home-portfolio-hero>.enhanced-hero-dots{left:50%!important;right:auto!important;max-width:46%!important;transform:translateX(-50%)!important;justify-content:center!important}
}

/* Navigation order now comes only from the normalized DOM in repair-r13.js. Reset every legacy flex order so nothing can move individual links visually. */
html body #nav a[data-page]{order:0!important}

/* Assistant phase 3 refinement only. Phase 1 launcher is intentionally untouched. */
html body #chat.kvf-stage3 #chatBody > .kvf-stage2-orb{display:none!important}

html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-orb{
  animation:kvfStage2Life 1.55s ease-in-out infinite!important;
  filter:drop-shadow(0 0 15px rgba(74,211,255,.58)) drop-shadow(0 0 22px rgba(185,82,255,.40))!important;
}
html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-halo{
  animation:kvfStage2Glow 1.35s ease-in-out infinite!important;
  filter:blur(7px)!important;
}
html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-ring-a{animation:kvfSpin 3.4s linear infinite!important}
html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-ring-b{animation:kvfSpinBack 4.7s linear infinite!important}
html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-core i{
  height:4px!important;
  left:14%!important;
  right:14%!important;
  animation:kvfStage2Wave .62s cubic-bezier(.35,0,.25,1) infinite!important;
  box-shadow:0 0 8px #57ddff,0 0 13px #c35cff,0 0 20px rgba(91,225,255,.48)!important;
}
html body #chat.kvf-stage3 #chatBody > .kvf-rail .kvf-stage3-orb .kvf-dot{width:5px!important;height:5px!important}

html body #chat.kvf-thinking #chatBody > .kvf-rail .kvf-stage3-orb .kvf-orb{
  animation:kvfThink .55s ease-in-out infinite!important;
  filter:drop-shadow(0 0 18px rgba(91,225,255,.68)) drop-shadow(0 0 27px rgba(231,82,255,.44))!important;
}
html body #chat.kvf-speaking #chatBody > .kvf-rail .kvf-stage3-orb .kvf-orb{
  animation:kvfThink .38s ease-in-out infinite!important;
  filter:drop-shadow(0 0 22px rgba(91,225,255,.78)) drop-shadow(0 0 30px rgba(231,82,255,.52))!important;
}
html body #chat.kvf-speaking #chatBody > .kvf-rail .kvf-stage3-orb .kvf-core i{animation-duration:.28s!important}

/* Phase 3 cleanup — prevent the orb rail from covering messages and remove bulky recommendation rows. Phase 1 is untouched. */
html body #chat.kvf-stage3 #chatBody > .kvf-rail{
  position:relative!important;
  top:auto!important;
  z-index:5!important;
  background:transparent!important;
  margin:0 0 8px!important;
  padding:0 0 6px!important;
  min-height:58px!important;
  height:58px!important;
}
html body #chat.kvf-stage3 #chatBody{scroll-padding-top:0!important}
html body #chat.kvf-stage3 #chatBody > .kvf-actions,
html body #chat.kvf-stage3 #chatBody > .quick-row,
html body #chat.kvf-stage3 #chatBody > .chat-actions,
html body #chat.kvf-stage3 #chatBody > .assistant-actions,
html body #chat.kvf-stage3 #chatBody > .quick{display:none!important}

@media(max-width:640px){
  html body.kvf-keyboard #chat.kvf-stage3 #chatBody > .kvf-rail{
    position:relative!important;
    top:auto!important;
    background:transparent!important;
    z-index:5!important;
  }
}
