/* ============================================================
   KeyMouse IT — V2 motion & atmosphere layer (loads after site.css)
   Living-system visuals, scroll storytelling, soft depth.
   Ambient animations are transform/opacity loops that REST visible —
   they never gate content visibility.
   ============================================================ */

/* ---- Atmosphere ---- */
.mesh {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.mesh::before, .mesh::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px);
}
.mesh::before { width: 620px; height: 620px; top: -180px; right: -120px; background: radial-gradient(circle, rgba(37,99,255,0.16), transparent 70%); }
.mesh::after  { width: 520px; height: 520px; bottom: -160px; left: -120px; background: radial-gradient(circle, rgba(124,58,237,0.10), transparent 70%); }

.grid-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(17,24,39,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(17,24,39,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
}

.glass {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow: var(--sh-lg), inset 0 1px 0 rgba(255,255,255,0.7);
}

.grad-text {
  background: linear-gradient(110deg, #2563FF 0%, #7C3AED 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---- Living system: nodes, flow, packets ---- */
@keyframes flowDash { to { stroke-dashoffset: -28; } }
.flow-line { stroke-dasharray: 3 7; animation: flowDash 1.1s linear infinite; }

@keyframes nodeFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.node-float { animation: nodeFloat 4.5s ease-in-out infinite; }

@keyframes corePulse { 0% { transform: scale(0.82); opacity: 0.5; } 70%,100% { transform: scale(1.5); opacity: 0; } }
.core-ring { animation: corePulse 3s ease-out infinite; }
.core-ring.d { animation-delay: 1.5s; }

@keyframes coreGlow { 0%,100% { box-shadow: 0 18px 50px rgba(37,99,255,0.4), inset 0 2px 0 rgba(255,255,255,0.3); } 50% { box-shadow: 0 22px 64px rgba(37,99,255,0.6), inset 0 2px 0 rgba(255,255,255,0.3); } }
.core-glow { animation: coreGlow 3.4s ease-in-out infinite; }

@keyframes packetMove { 0% { offset-distance: 0%; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { offset-distance: 100%; opacity: 0; } }
.packet { position: absolute; top: 0; left: 0; width: 7px; height: 7px; border-radius: 50%; animation: packetMove 2.4s linear infinite; will-change: offset-distance, opacity; }

/* sweep shimmer for active node */
@keyframes nodeIn { from { transform: translateY(9px) scale(0.97); } to { transform: none; } }
.node-in { animation: nodeIn 0.5s var(--ease) both; }

/* ---- Problem: disconnected -> connected ---- */
@keyframes driftA { 0%,100% { transform: translate(0,0) rotate(-4deg); } 50% { transform: translate(6px,-7px) rotate(-1deg); } }
@keyframes driftB { 0%,100% { transform: translate(0,0) rotate(3deg); } 50% { transform: translate(-7px,5px) rotate(6deg); } }
@keyframes driftC { 0%,100% { transform: translate(0,0) rotate(-2deg); } 50% { transform: translate(5px,6px) rotate(-5deg); } }
.drift-a { animation: driftA 6s ease-in-out infinite; }
.drift-b { animation: driftB 7s ease-in-out infinite; }
.drift-c { animation: driftC 6.5s ease-in-out infinite; }

/* ---- Why comparison ---- */
.cmp-r { transition: background 0.2s var(--ease); }
.cmp-r:hover { background: rgba(37,99,255,0.02); }
.cmp-r .cmp-arrow { transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), background 0.22s var(--ease), color 0.22s var(--ease); }
.cmp-r:hover .cmp-arrow { transform: translateX(3px); background: var(--blue); color: #fff; box-shadow: var(--sh-blue); }

/* ---- Final CTA network bg ---- */
@keyframes netFloat { 0%,100% { transform: translate(0,0); } 50% { transform: translate(0,-14px); } }
.net-node { animation: netFloat 6s ease-in-out infinite; }

/* marquee for logos */
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.marquee-track { display: flex; width: max-content; animation: marquee 50s linear infinite; }
.marquee-mask { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }

/* solution mini-diagram + hover reveal */
.sol-card .sol-diagram { opacity: 0.9; transition: opacity 0.3s var(--ease); }
.sol-card:hover .sol-diagram .dot-pulse { animation: solPulse 1.4s ease-in-out infinite; }
@keyframes solPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
.sol-reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.34s var(--ease); }
.sol-reveal-inner { overflow: hidden; opacity: 0; transition: opacity 0.3s var(--ease) 0.05s; margin-top: 0; }
.sol-card:hover .sol-reveal { grid-template-rows: 1fr; }
.sol-card:hover .sol-reveal-inner { opacity: 1; margin-top: 16px; }
/* touch / no-hover devices: always show the reveal (no hover-only content) */
@media (hover: none), (max-width: 760px) {
  .sol-reveal { grid-template-rows: 1fr !important; }
  .sol-reveal-inner { opacity: 1 !important; margin-top: 16px !important; }
}

/* ---- Capabilities: open on desktop, accordion on mobile ---- */
.cap-body { display: grid; grid-template-rows: 1fr; }
.cap-body-inner { overflow: hidden; }
.cap-chev { display: none; }
.cap-head { cursor: default !important; }

@media (max-width: 1024px) {
  .v2-hero-grid { grid-template-columns: 1fr !important; }
  .cap-stack { flex-direction: column; }
  .cap-arrow { padding: 14px 0 !important; transform: rotate(90deg); }
  .cap-chev { display: block; }
  .cap-head { cursor: pointer !important; }
  .cap-body { grid-template-rows: 0fr; transition: grid-template-rows 0.32s var(--ease); }
  .cap-body.open { grid-template-rows: 1fr; }
  .sig-row { flex-direction: column; gap: 14px; }
  .sig-stage { justify-content: flex-start !important; max-width: 320px; margin: 0 auto; }
  .sig-arrow { transform: rotate(90deg); align-self: center; }
  /* industry: stack rail + main */
  .ind-grid { grid-template-columns: 1fr !important; }
  .ind-rail { display: flex !important; overflow-x: auto; gap: 8px !important; padding: 6px !important; -webkit-overflow-scrolling: touch; }
  .ind-rail > button { flex: 0 0 auto !important; min-width: 168px; margin-bottom: 0 !important; }
  .ind-rail-hint { display: none !important; }
  .ind-ledgers { grid-template-columns: 1fr !important; gap: 14px !important; }
  .ind-core { flex-direction: row !important; justify-content: center; padding: 6px 0; }
  .ind-core .ind-conn { display: none !important; }
}
@media (max-width: 880px) {
  .grid-3 { grid-template-columns: 1fr 1fr !important; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr !important; }
}
@media (max-width: 760px) {
  .feat-case { grid-template-columns: 1fr !important; }
  .cases-supp { grid-template-columns: 1fr !important; }
  .grid-4 { grid-template-columns: 1fr 1fr !important; }
  .faq-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .faq-grid > * { min-width: 0; }
  .faq-grid .faq-sticky { position: static !important; }
  .faq-reassure { flex-wrap: wrap; }
  .faq-reassure-btn { width: 100%; justify-content: center; }
  .form-grid { grid-template-columns: 1fr !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 32px 24px !important; }
  /* why -> stacked comparison cards */
  .cmp-card { box-shadow: none !important; border: 0 !important; background: transparent !important; }
  .cmp-head { display: none !important; }
  .cmp-r { flex-direction: column !important; gap: 0 !important; border: 1px solid var(--line) !important; border-radius: 16px !important; margin-bottom: 14px; box-shadow: var(--sh-sm); overflow: hidden; background: #fff; }
  .cmp-r > div { width: 100% !important; flex: none !important; justify-content: flex-start !important; text-align: left !important; padding: 16px 18px !important; }
  .cmp-r .cmp-agency { background: #FBFCFE; }
  .cmp-r .cmp-spine { width: 100% !important; height: 0 !important; }
  .cmp-r .cmp-spine > span:first-child { display: none !important; }
  .cmp-r .cmp-arrow { position: absolute; right: 18px; top: -16px; transform: rotate(90deg); }
  .proc-grid { grid-template-columns: 1fr !important; gap: 0 !important; position: relative; }
  .proc-grid::before { content: ""; position: absolute; left: 27px; top: 28px; bottom: 28px; width: 2px; background: var(--line-strong); }
  .proc-line { display: none !important; }
  .proc-step { flex-direction: row !important; text-align: left !important; align-items: flex-start !important; gap: 18px; padding: 14px 0; }
  .proc-step .proc-dot { width: 48px !important; height: 48px !important; transform: none !important; }
  .proc-body { padding-top: 2px; }
  .proc-body > div:first-child { margin-top: 0 !important; }
}
@media (max-width: 560px) {
  .display { font-size: clamp(34px, 11vw, 44px); }
  .h2 { font-size: clamp(27px, 8vw, 34px); }
  .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .hero-metrics { grid-template-columns: 1fr 1fr !important; gap: 20px 16px !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; }
  .container { padding: 0 18px; }
  .section { padding: 60px 0; }
  .cta-pad { padding-top: 84px !important; padding-bottom: 84px !important; }
}
@media (max-width: 400px) {
  .hero-metrics { grid-template-columns: 1fr 1fr !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
}

@media (prefers-reduced-motion: reduce) {
  .flow-line, .node-float, .core-ring, .core-glow, .packet, .drift-a, .drift-b, .drift-c, .net-node, .marquee-track { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ---- Living system: mobile-native stacked flow ---- */
.ls-mobile { display: none; flex-direction: column; align-items: center; padding: 18px 18px 26px; gap: 4px; }
.ls-m-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.ls-m-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ls-m-chip { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; background: #fff; border: 1px solid var(--line-strong); border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--text); box-shadow: var(--sh-sm); }
.ls-m-arrow { padding: 8px 0; }
.ls-m-core { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 18px 22px; border-radius: 18px; color: #fff; box-shadow: 0 14px 36px rgba(37,99,255,0.34); }
.ls-m-core span { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
@media (max-width: 560px) {
  .ls-desktop { display: none !important; }
  .ls-mobile { display: flex; }
}

/* ---- Sticky mobile bottom CTA ---- */
.mobile-cta-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90;
  display: none; align-items: center; gap: 12px;
  background: rgba(11,17,32,0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 16px; padding: 11px 12px 11px 18px;
  box-shadow: 0 16px 40px rgba(11,17,32,0.4);
  transform: translateY(140%); transition: transform 0.34s var(--ease);
}
.mobile-cta-bar.show { transform: none; }
.mobile-cta-bar .mc-txt { flex: 1; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.25; }
.mobile-cta-bar .mc-txt span { display: block; font-size: 11.5px; font-weight: 500; color: #9FB0C8; margin-top: 1px; }
.mobile-cta-bar .mc-btn { flex-shrink: 0; background: var(--blue); color: #fff; border: 0; border-radius: 11px; padding: 12px 16px; font-family: var(--font); font-size: 14px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--sh-blue); }
@media (max-width: 768px) {
  .mobile-cta-bar { display: flex; }
}
@media (prefers-reduced-motion: reduce) {
  .mobile-cta-bar { transition: none; }
}
