/* AI.css — M PRO9 AI & Application Development Page — Immersive Redesign */

/* ============================================================
   GLOBAL CANVAS + SPOT — fixed, behind everything
   ============================================================ */

#ai-hero-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  /* Boost vibrancy — makes nodes read as self-luminous */
  filter: brightness(1.14) saturate(1.35) contrast(1.04);
}

.ai-hero-spot {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    circle 680px at var(--spot-x, 50%) var(--spot-y, 40%),
    rgba(49, 157, 207, 0.07) 0%,
    transparent 65%
  );
}

/* Page base — deep dark so canvas nodes glow against it.
   overflow-x on the root element is handled by the viewport, so it suppresses
   sideways scroll without turning any element into a scroll container. */
html,
body {
  overflow-x: hidden;
}

body {
  background: #060c18;
}

/* All content above canvas */
main,
#footer-placeholder {
  position: relative;
  z-index: 1;
}

/* Navbar must sit above main — dropdown extends into main's area */
#navbar-placeholder {
  position: relative;
  z-index: 10;
}

/* ============================================================
   SHARED UTILITY
   ============================================================ */

.hero-sub  { max-width: 620px; }
.cta-inner { max-width: 560px; }

/* ============================================================
   HERO — full viewport, content floats over canvas
   ============================================================ */

.ai-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 140px 0 100px;
}

/* Left-side ambient glow — sits behind text, above canvas */
.ai-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 70% at 10% 50%, rgba(49,157,207,0.12) 0%, transparent 58%);
  pointer-events: none;
  z-index: 0;
  animation: hero-glow-pulse 8s ease-in-out infinite;
}

@keyframes hero-glow-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.52; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-hero::before { animation: none; }
}

.ai-hero .container {
  position: relative;
  z-index: 2;
}

.ai-hero h1 {
  color: #ffffff;
  font-size: clamp(3rem, 7.5vw, 7rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
  max-width: 920px;
  text-shadow: 0 0 80px rgba(49,157,207,0.18);
}

.ai-hero-word {
  display: inline-block;
  overflow: hidden;
}

.ai-hero .hero-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(49,157,207,0.85);
  margin-bottom: 28px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .ai-hero {
    padding: 120px 0 80px;
    min-height: 92svh;
  }
  .ai-hero h1 {
    font-size: clamp(2.4rem, 9vw, 4rem);
  }
}

/* ============================================================
   AI SIGNAL CONSOLE — transparent, content floats
   ============================================================ */

.ai-console {
  background: transparent;
  position: relative;
}

.ai-console .section-title h2 {
  color: #ffffff;
  font-size: clamp(2.6rem, 4.5vw, 4rem);
  letter-spacing: -0.028em;
}
.ai-console .section-title p {
  color: rgba(255,255,255,0.50);
}

.ai-console-rows {
  border-top: 1px solid rgba(49,157,207,0.22);
  perspective: 1100px;
}

.ai-console-row {
  display: grid;
  grid-template-columns: 140px 1fr 140px;
  gap: 0 48px;
  padding: 44px 0;
  border-bottom: 1px solid rgba(49,157,207,0.08);
  align-items: start;
  position: relative;
  overflow: hidden;
  transition: background 0.18s ease;
  will-change: transform;
  transform-style: flat;
}

/* Scan-sweep line on reveal */
.ai-console-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(49,157,207,0.90) 50%, transparent 100%);
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

@keyframes console-sweep {
  0%   { transform: translateX(-100%); opacity: 0.9; }
  100% { transform: translateX(110%);  opacity: 0; }
}

@keyframes tag-activate {
  0%   { opacity: 0.28; color: var(--primary-light); }
  22%  { opacity: 1.00; color: #bde8ff; }
  100% { opacity: 0.60; color: var(--primary-light); }
}

.ai-console-row.is-active::before {
  animation: console-sweep 0.68s ease-out forwards;
}
.ai-console-row.is-active .ai-console-tag {
  animation: tag-activate 0.92s ease-out forwards;
}

.ai-console-row:hover {
  background: rgba(49,157,207,0.04);
}

@media (prefers-reduced-motion: reduce) {
  .ai-console-row { transition: none; }
  .ai-console-row.is-active::before     { animation: none; }
  .ai-console-row.is-active .ai-console-tag { animation: none; }
}

.ai-console-tag {
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-light);
  line-height: 1.6;
  padding-top: 4px;
}

.ai-console-main h3 {
  color: #ffffff;
  font-size: 1.08rem;
  margin-bottom: 10px;
}
.ai-console-main p {
  color: rgba(255,255,255,0.74);
  font-weight: 500;
  font-size: 0.93rem;
  line-height: 1.78;
}

.ai-console-state {
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.10em;
  color: rgba(49,157,207,0.60);
  text-align: right;
  padding-top: 4px;
  white-space: nowrap;
}

/* Console cursor blink */
.ai-console-state::after {
  content: '▋';
  animation: cursor-blink 1s step-end infinite;
  opacity: 0;
  margin-left: 3px;
}
.ai-console-row.is-active .ai-console-state::after {
  opacity: 1;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-console-state::after { animation: none; opacity: 0; }
  .ai-console-row.is-active .ai-console-state::after { opacity: 1; }
}

@media (max-width: 860px) {
  .ai-console-row { grid-template-columns: 120px 1fr; gap: 0 32px; }
  .ai-console-state { display: none; }
  .ai-console-rows { perspective: none; }
}
@media (max-width: 560px) {
  .ai-console-row { grid-template-columns: 1fr; gap: 8px; padding: 32px 0; }
  .ai-console-state { display: block; text-align: left; padding-top: 4px; }
}

/* ============================================================
   MARQUEE STRIP — keeps its own dark strip for contrast
   ============================================================ */

.ai-marquee {
  overflow: hidden;
  padding: 18px 0;
  background: rgba(4,8,15,0.88);
  border-top: 1px solid rgba(49,157,207,0.07);
  border-bottom: 1px solid rgba(49,157,207,0.07);
  position: relative;
  z-index: 1;
}

.ai-marquee-track {
  display: flex;
  width: max-content;
  animation: ai-marquee-run 34s linear infinite;
  align-items: center;
  gap: 0 30px;
}

.ai-marquee-track span {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(49,157,207,0.36);
  white-space: nowrap;
}

.ai-marquee-dot {
  color: rgba(49,157,207,0.16) !important;
}

@keyframes ai-marquee-run {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-marquee-track { animation: none; }
}

/* ============================================================
   SIGNAL SECTION — transparent, content floats
   ============================================================ */

.ai-signal {
  background: transparent;
}

.ai-signal .section-title h2 {
  color: #fff;
  font-size: clamp(2.6rem, 4.5vw, 4rem);
  letter-spacing: -0.028em;
}
.ai-signal .section-title p {
  color: rgba(255,255,255,0.50);
}

.ai-signal-header {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.75fr;
  gap: 0 48px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(49,157,207,0.22);
  margin-bottom: 0;
}

.ai-signal-col-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255,255,255,0.28);
}
.ai-signal-col-label--response { color: var(--primary-light); }
.ai-signal-col-label--output   { color: rgba(49,157,207,0.50); text-align: right; }

.ai-signal-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.75fr;
  gap: 0 48px;
  padding: 48px 0;
  border-bottom: 1px solid rgba(49,157,207,0.07);
  align-items: start;
  transition: background 0.22s ease, border-color 0.22s ease;
  position: relative;
  will-change: transform;
  transform-style: flat;
}

.ai-signal > .container {
  perspective: 1200px;
}

/* Route track line */
.ai-route-track {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1.5px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  grid-column: 1 / -1;
}
.ai-route-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(49,157,207,0.90) 42%, rgba(92,200,245,1) 58%, transparent 100%);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.ai-signal-row.is-routed .ai-route-track::after {
  transform: scaleX(1);
}

/* Traveling packet dot */
.ai-route-track::before {
  content: '';
  position: absolute;
  top: -2px; left: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(92,200,245,1);
  opacity: 0;
  box-shadow: 0 0 8px 2px rgba(92,200,245,0.7);
  pointer-events: none;
}
.ai-signal-row.is-routed .ai-route-track::before {
  animation: packet-loop 4.5s linear infinite;
}

@keyframes packet-loop {
  0%   { opacity: 0; left: -6px; }
  4%   { opacity: 1; left: 0; }
  22%  { opacity: 1; left: calc(100% - 6px); }
  27%  { opacity: 0; left: calc(100% - 6px); }
  100% { opacity: 0; left: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-route-track::after  { transform: scaleX(1); transition: none; }
  .ai-route-track::before { display: none; }
  .ai-signal-row.is-routed .ai-route-track::before { animation: none; }
}

.ai-signal-row:hover {
  border-bottom-color: rgba(49,157,207,0.22);
  background: rgba(49,157,207,0.03);
}
.ai-signal-row:last-child { border-bottom: none; }

.ai-signal-problem p {
  font-size: 1.22rem;
  color: rgba(255,255,255,0.70);
  line-height: 1.72;
  font-style: italic;
  transition: color 0.22s ease;
  padding-left: 28px;
  position: relative;
}
/* Large decorative quote mark */
.ai-signal-problem p::before {
  content: '\201C';
  position: absolute;
  left: 0;
  top: -4px;
  font-family: 'Lato', Georgia, serif;
  font-size: 3.2rem;
  font-weight: 900;
  font-style: normal;
  line-height: 1;
  color: rgba(49,157,207,0.22);
}
.ai-signal-row:hover .ai-signal-problem p { color: #fff; }

.ai-signal-solution h3 {
  color: var(--primary-light);
  font-size: 1rem;
  margin-bottom: 10px;
}
.ai-signal-solution p {
  color: rgba(255,255,255,0.74);
  font-weight: 500;
  font-size: 0.93rem;
  line-height: 1.78;
}

.ai-signal-output {
  text-align: right;
  padding-top: 4px;
}
.ai-signal-output p {
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(49,157,207,0.65);
  line-height: 1.6;
  letter-spacing: 0.03em;
}

@media (prefers-reduced-motion: reduce) {
  .ai-signal-row,
  .ai-signal-problem p { transition: none; }
}

@media (max-width: 920px) {
  .ai-signal-header { grid-template-columns: 1fr 1.4fr; }
  .ai-signal-col-label--output { display: none; }
  .ai-signal-row { grid-template-columns: 1fr 1.4fr; }
  .ai-signal-output { display: none; }
}
@media (max-width: 640px) {
  .ai-signal-header { display: none; }
  .ai-signal > .container { perspective: none; }
  .ai-signal-row { grid-template-columns: 1fr; gap: 28px; padding: 40px 0; }
  .ai-signal-problem::before {
    content: 'Problem Signal';
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin-bottom: 10px;
  }
  .ai-signal-solution::before {
    content: 'AI Route';
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-light);
    margin-bottom: 10px;
  }
  .ai-signal-problem p { font-size: 1rem; }
}

/* ============================================================
   DEPLOYMENT SECTION — transparent, single column
   ============================================================ */

.ai-deploy {
  background: transparent;
}

.ai-deploy-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 80px;
  align-items: start;
}

.ai-deploy-intro {
  margin-bottom: 64px;
}

.ai-deploy-intro h2 {
  color: #fff;
  font-size: clamp(2.6rem, 4.5vw, 4rem);
  letter-spacing: -0.028em;
  margin-bottom: 18px;
}
.ai-deploy-intro p {
  color: rgba(255,255,255,0.50);
  font-size: 1rem;
  line-height: 1.78;
  max-width: 540px;
}

.ai-deploy-steps {
  position: relative;
  border-top: 1px solid rgba(49,157,207,0.22);
  --rail-progress: 0%;
}

/* Vertical rail line */
.ai-deploy-steps::before {
  content: '';
  position: absolute;
  top: 40px;
  left: 35px;
  width: 1px;
  height: var(--rail-progress, 0%);
  max-height: calc(100% - 80px);
  background: linear-gradient(
    180deg,
    rgba(49,157,207,0.70) 0%,
    rgba(49,157,207,0.06) 100%
  );
  pointer-events: none;
  transition: none;
}

.ai-deploy-step {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0 28px;
  padding: 40px 0;
  border-bottom: 1px solid rgba(49,157,207,0.07);
  align-items: start;
  position: relative;
  z-index: 1;
  transition: background 0.2s ease;
}
.ai-deploy-step:hover {
  background: rgba(49,157,207,0.04);
  border-radius: 8px;
}

.ai-step-num {
  font-family: 'Lato', sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 2.5vw, 2.4rem);
  color: var(--primary-light);
  opacity: 0.32;
  line-height: 1;
  letter-spacing: -0.02em;
  padding-top: 4px;
  transition: opacity 0.45s ease, text-shadow 0.45s ease;
}
.ai-deploy-step:hover .ai-step-num {
  opacity: 0.70;
}
.ai-deploy-step.is-active .ai-step-num {
  opacity: 0.90;
  text-shadow: 0 0 18px rgba(49,157,207,0.40);
}
.ai-deploy-step.is-active:hover .ai-step-num {
  opacity: 1;
}

.ai-step-body h3 {
  color: #fff;
  font-size: 1.08rem;
  margin-bottom: 10px;
  transition: color 0.45s ease;
}
.ai-step-body p {
  color: rgba(255,255,255,0.74);
  font-weight: 500;
  font-size: 0.93rem;
  line-height: 1.78;
  transition: color 0.45s ease;
}
.ai-deploy-step.is-active .ai-step-body h3 {
  color: rgba(255,255,255,0.96);
}
.ai-deploy-step.is-active .ai-step-body p {
  color: rgba(255,255,255,0.90);
}

@media (prefers-reduced-motion: reduce) {
  .ai-deploy-step,
  .ai-step-num,
  .ai-step-body h3,
  .ai-step-body p { transition: none; }
}

@media (max-width: 560px) {
  .ai-deploy-step { grid-template-columns: 56px 1fr; gap: 0 20px; padding: 32px 0; }
  .ai-step-num { font-size: 1.6rem; }
  .ai-deploy-intro h2 { font-size: clamp(2rem, 8vw, 3rem); }
}

/* ============================================================
   FINAL CTA — transparent, generous spacing
   ============================================================ */

.ai-cta {
  background: transparent;
  padding: 120px 0 160px;
}

@media (max-width: 768px) {
  .ai-cta { padding: 80px 0 100px; }
}

.cta-inner {
  position: relative;
  max-width: 560px;
}

.cta-glow {
  position: absolute;
  inset: -60px -80px;
  background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(49,157,207,0.12) 0%, transparent 70%);
  pointer-events: none;
  animation: cta-pulse 4s ease-in-out infinite;
  z-index: 0;
}

.cta-inner > *:not(.cta-glow) {
  position: relative;
  z-index: 1;
}

@keyframes cta-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%       { opacity: 1;    transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .cta-glow { animation: none; }
}

/* CTA status line */
.cta-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.70rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(49,157,207,0.72);
  margin-bottom: 24px;
  opacity: 0;
  transform: translateY(8px);
}
.cta-status-line.is-visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.cta-status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(49,157,207,0.85);
  flex-shrink: 0;
  animation: status-blink 1.8s ease-in-out infinite;
}

@keyframes status-blink {
  0%, 100% { opacity: 1;    box-shadow: 0 0 6px 1px rgba(49,157,207,0.55); }
  50%       { opacity: 0.35; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-status-dot  { animation: none; }
  .cta-status-line { opacity: 1; transform: none; transition: none; }
}

/* CTA status mobile */
@media (max-width: 768px) {
  .cta-status-line { font-size: 0.62rem; letter-spacing: 0.08em; }
}

/* Magnetic CTA buttons */
.cta-buttons .btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  will-change: transform;
}

/* CTA heading accent */
.cta-inner h2 {
  color: #ffffff;
  font-size: clamp(2.4rem, 4.5vw, 4rem);
  letter-spacing: -0.028em;
  margin-bottom: 18px;
  position: relative;
}
.cta-inner h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, rgba(49,157,207,0.85) 0%, transparent 100%);
}

/* ============================================================
   HERO: scanline sweep (one-shot) + dot-grid ambient
   ============================================================ */

.ai-hero-scan {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(49,157,207,0.50) 20%,
    rgba(255,255,255,0.88) 50%,
    rgba(49,157,207,0.50) 80%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

/* subtle dot grid — depth layer behind hero text */
.ai-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle 1.2px at center, rgba(49,157,207,0.20) 0%, transparent 100%);
  background-size: 38px 38px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 72% 80% at 28% 50%, black 25%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 72% 80% at 28% 50%, black 25%, transparent 78%);
}

/* ============================================================
   DEPLOY VISUAL: animated pipeline diagram
   ============================================================ */

.ai-deploy-visual {
  position: sticky;
  top: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0 60px;
}

/* subtle hex-dot grid behind pipeline */
.ai-deploy-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle 1px at center, rgba(49,157,207,0.30) 0%, transparent 100%);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.16;
  mask-image: radial-gradient(ellipse 65% 65% at 50% 50%, black 0%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 65% 65% at 50% 50%, black 0%, transparent 100%);
}

.ai-pipeline {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 200px;
}

.ai-pipeline-glow {
  position: absolute;
  width: 300px;
  top: -20px;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 70% 55% at 50% 50%, rgba(49,157,207,0.07) 0%, transparent 70%);
  pointer-events: none;
  animation: pipeline-bg-pulse 5s ease-in-out infinite;
}

@keyframes pipeline-bg-pulse {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1;   }
}

@media (prefers-reduced-motion: reduce) {
  .ai-pipeline-glow { animation: none; opacity: 0.8; }
}

/* node container */
.ai-pipeline-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

/* halo — centered on the 72px body (body top = 0, center = 36px) */
.ai-pn-halo {
  position: absolute;
  width: 120px;
  height: 120px;
  top: 36px;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(49,157,207,0.22) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.ai-pipeline-node.is-active .ai-pn-halo {
  opacity: 1;
  animation: pn-halo-pulse 2.5s ease-in-out infinite;
}
@keyframes pn-halo-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 0.85; }
  50%       { transform: translate(-50%, -50%) scale(1.28); opacity: 1;    }
}

/* spinning dashed ring */
.ai-pn-ring {
  position: absolute;
  width: 92px;
  height: 92px;
  top: 36px;
  left: 50%;
  border-radius: 50%;
  border: 1px dashed rgba(49,157,207,0);
  pointer-events: none;
  transition: border-color 0.55s ease;
  animation: pn-ring-spin 10s linear infinite;
}
.ai-pipeline-node.is-active .ai-pn-ring {
  border-color: rgba(49,157,207,0.30);
}
@keyframes pn-ring-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-pn-halo { animation: none !important; }
  .ai-pn-ring { animation: none; transform: translate(-50%, -50%); }
}

/* node circle body */
.ai-pn-body {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid rgba(49,157,207,0.18);
  background: rgba(6,12,24,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(49,157,207,0.40);
  position: relative;
  z-index: 1;
  transition: border-color 0.55s ease, color 0.55s ease, box-shadow 0.55s ease;
}
.ai-pipeline-node.is-active .ai-pn-body {
  border-color: rgba(49,157,207,0.72);
  color: rgba(49,157,207,1);
  box-shadow:
    0 0 24px rgba(49,157,207,0.32),
    0 0 72px rgba(49,157,207,0.10),
    inset 0 0 24px rgba(49,157,207,0.08);
}

.ai-pn-label {
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.60rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(49,157,207,0.30);
  transition: color 0.55s ease;
  white-space: nowrap;
}
.ai-pipeline-node.is-active .ai-pn-label {
  color: rgba(49,157,207,0.80);
}

/* edge connector */
.ai-pipeline-edge {
  position: relative;
  width: 1px;
  height: 60px;
  margin: 0 auto;
}

.ai-pe-line {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(49,157,207,0.24) 0%, rgba(49,157,207,0.06) 100%);
}

/* traveling data packet dot */
.ai-pe-packet {
  position: absolute;
  left: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(49,157,207,0.92);
  box-shadow: 0 0 8px 2px rgba(49,157,207,0.55);
  animation: pe-packet-flow 2.4s linear infinite;
  animation-delay: var(--pd, 0s);
  opacity: 0;
}

@keyframes pe-packet-flow {
  0%   { top: -4px; opacity: 0; }
  8%   { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: calc(100% - 3px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-pe-packet { animation: none; top: 50%; opacity: 0.35; }
}

/* pipeline status badge */
.ai-pipeline-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 22px;
  font-family: ui-monospace, 'Courier New', Courier, monospace;
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(49,157,207,0.36);
}
.ai-pipeline-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(49,157,207,0.72);
  flex-shrink: 0;
  animation: status-blink 1.8s ease-in-out infinite;
}

/* responsive: stack to single column below 960px
   Pipeline switches from sticky vertical to horizontal mini-strip */
@media (max-width: 960px) {
  .ai-deploy-inner {
    grid-template-columns: 1fr;
  }

  /* ── Show pipeline as horizontal strip on mobile ── */
  .ai-deploy-visual {
    display: flex;
    position: static;             /* remove sticky — flow naturally */
    padding: 0 0 56px;
    justify-content: center;
    align-items: flex-start;
  }

  /* Suppress decorative layers that only work in vertical/sticky context */
  .ai-deploy-visual::before { display: none; }
  .ai-pipeline-glow         { display: none; }
  .ai-pipeline-status       { display: none; }

  /* Horizontal pipeline container */
  .ai-pipeline {
    flex-direction: row;
    align-items: flex-start;  /* align node tops so edge margin trick works */
    justify-content: center;
    width: 100%;
    max-width: 500px;
    gap: 0;
  }

  /* Horizontal connector: 1 px tall, width instead of height,
     margin-top = half the 52 px body so the line runs through circle centres */
  .ai-pipeline-edge {
    width: 28px;
    height: 1px;
    flex-shrink: 0;
    margin: 26px 0 0;   /* half of 52 px body centres the line */
  }
  .ai-pipeline-edge .ai-pe-line {
    background: linear-gradient(90deg, rgba(49,157,207,0.30) 0%, rgba(49,157,207,0.08) 100%);
  }
  /* Vertical packet animation does not apply to a horizontal line */
  .ai-pe-packet { display: none; }

  /* Simplify nodes — hide halos and spinning rings, shrink body */
  .ai-pn-halo { display: none; }
  .ai-pn-ring { display: none; }
  .ai-pn-body {
    width: 52px;
    height: 52px;
  }
}

/* ============================================================
   RESPONSIVE POLISH — 480 · 430 · 390 · 360 px
   Fills the gaps left by existing breakpoints.
   ============================================================ */

/* ── 1. Touch devices: release GPU from hover-only will-change ── */
@media (hover: none) {
  .ai-console-row,
  .ai-signal-row {
    will-change: auto;
  }
}

/* ── 2. Hero — sub-430px ── */
@media (max-width: 430px) {
  .ai-hero {
    padding: 108px 0 68px;
  }
  .ai-hero h1 {
    font-size: clamp(1.85rem, 8.5vw, 2.4rem);
    letter-spacing: -0.02em;
  }
  .hero-sub {
    font-size: 0.93rem;
    max-width: 100%;
  }
}

/* ── 3. Section titles — reduce minimum at sub-480px ── */
@media (max-width: 480px) {
  .ai-console .section-title h2,
  .ai-signal .section-title h2 {
    font-size: clamp(1.75rem, 7vw, 2.4rem);
    letter-spacing: -0.02em;
  }
}

/* ── 4. Buttons — full-width stacked layout at ≤390px ── */
@media (max-width: 390px) {
  .hero-btns,
  .cta-buttons {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-btns .btn,
  .cta-buttons .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
    min-height: 48px;
  }
}

/* ── 5. CTA — prevent negative-inset glow bleed on narrow screens ──
   Must be `clip`, not `hidden`: per CSS overflow spec, `overflow-x: hidden`
   with `overflow-y: visible` forces overflow-y to compute to `auto`, which
   turned this section into its own scroll container with a nested scrollbar.
   `clip` clips on the x axis without ever creating a scroll container. */
.ai-cta {
  overflow-x: clip;
  overflow-y: visible;
}
@media (max-width: 640px) {
  .cta-glow {
    inset: -40px -20px; /* shrink bleed from 80px to 20px each side */
  }
}

/* ── 6. Deploy section ── */
@media (max-width: 768px) {
  .ai-deploy-intro {
    margin-bottom: 48px; /* was 64px — reduced for mobile */
  }
}
@media (max-width: 560px) {
  /* Rail line re-aligned: step-num column shrinks to 56px → center = 28px */
  .ai-deploy-steps::before {
    left: 28px;
  }
}
@media (max-width: 430px) {
  .ai-deploy-intro h2 {
    font-size: clamp(1.75rem, 8vw, 2.2rem);
  }
  .ai-deploy-step {
    padding: 28px 0;
  }
}

/* ── 7. Console rows — ultra-small spacing ── */
@media (max-width: 390px) {
  .ai-console-row {
    padding: 28px 0;
  }
  .ai-console-tag {
    font-size: 0.60rem;
    letter-spacing: 0.08em;
  }
}

/* ── 8. Signal rows — ultra-small spacing + quote trim ── */
@media (max-width: 390px) {
  .ai-signal-row {
    gap: 22px;
    padding: 32px 0;
  }
  .ai-signal-problem p {
    font-size: 0.95rem;
  }
  .ai-signal-problem p::before {
    font-size: 2.4rem; /* trim decorative quote mark at very small screens */
  }
}

/* ── 9. Neural canvas — lighter GPU filter on mobile ── */
@media (max-width: 768px) {
  #ai-hero-canvas {
    filter: brightness(1.06) saturate(1.18) contrast(1.02);
  }
}

/* ── 10. Mobile pipeline — label/size reductions ──
   At ≤480px labels overflow the node width (label text wider than circle),
   so hide them and tighten edge connectors.
   At ≤400px shrink node bodies further for very narrow viewports.
   ── */
@media (max-width: 480px) {
  .ai-pn-label { display: none; }
  .ai-pipeline-edge { width: 22px; }
}
@media (max-width: 400px) {
  .ai-pn-body {
    width: 44px;
    height: 44px;
  }
  /* Recentre edge: half of 44 px body = 22 px */
  .ai-pipeline-edge {
    width: 18px;
    margin-top: 22px;
  }
}

/* ── 11. Hover states visible by default on touch devices ──
   .ai-signal-row:hover brightens the problem text to #fff.
   On coarse/no-hover displays make it always-on at a readable level. ── */
@media (hover: none) {
  .ai-signal-row .ai-signal-problem p {
    color: rgba(255, 255, 255, 0.82);
  }
}

/* ============================================================
   MOBILE PARITY v15
   All rules ≤768px or narrower. Desktop (≥769px) untouched.
   ============================================================ */

/* ── 12. Hero subtitle: restrain line width for comfortable reading ── */
@media (max-width: 768px) {
  .ai-hero .hero-sub {
    max-width: 92%;
  }
}

/* ── 13. Section headings: fill the 481–768px gap where clamp min
   of 2.6rem is too large for a phone. Below 480px already handled. ── */
@media (min-width: 481px) and (max-width: 768px) {
  .ai-console .section-title h2,
  .ai-signal .section-title h2 {
    font-size: clamp(1.85rem, 6.5vw, 2.4rem);
    letter-spacing: -0.02em;
  }
}

/* Deploy intro h2 has its own 560px override so fill 561–768px only ── */
@media (min-width: 561px) and (max-width: 768px) {
  .ai-deploy-intro h2 {
    font-size: clamp(1.85rem, 6.5vw, 2.4rem);
    letter-spacing: -0.028em;
  }
}

/* ── 14. Hero + CTA buttons: near-full-width tap targets at 390–640px.
   (Below 390px the existing full-width stack already applies.) ── */
@media (max-width: 640px) {
  .ai-hero .hero-btns .btn,
  .ai-cta .cta-buttons .btn {
    min-width: min(85%, 280px);
    text-align: center;
    justify-content: center;
  }
}

/* ── 15. Signal section: stronger accent divider between stacked rows ── */
@media (max-width: 640px) {
  .ai-signal-row + .ai-signal-row {
    border-top: 1px solid rgba(49, 157, 207, 0.14);
  }
}

/* ── 16. Touch: suppress hover background states that can linger ── */
@media (hover: none) {
  .ai-console-row:hover {
    background: transparent;
  }
  .ai-deploy-step:hover {
    background: transparent;
  }
}

/* ============================================================
   MOBILE NEURAL CANVAS — interaction guard (v16)
   Canvas pointer-events are already off globally (see #ai-hero-canvas
   rule at top). These rules are belt-and-suspenders plus reduced-motion.
   JS disables tap-explosion + cursor-attraction on touch/mobile;
   the natural driftX/driftY + sin-bob in the canvas loop provides
   the calm ambient drift on mobile.
   ============================================================ */

/* Belt-and-suspenders: ensure canvas and glow spot never intercept
   taps on mobile, regardless of JS execution order. */
@media (max-width: 768px), (pointer: coarse) {
  #ai-hero-canvas,
  .ai-hero-spot {
    pointer-events: none !important;
  }
}

/* Reduced-motion: JS already skips canvas init entirely, but hide
   the element at CSS level as a fallback for extreme cases. */
@media (prefers-reduced-motion: reduce) {
  #ai-hero-canvas {
    display: none !important;
  }
}

/* ============================================================
   MOBILE READABILITY SHIELD — v17
   Subtle glass layer behind text-heavy content on mobile.
   All rules ≤768px only. Desktop (≥769px) unchanged.
   No new animations, no layout shift, no horizontal overflow.
   ============================================================ */

/* ── Hero: soft glass wrapper around all text/buttons ── */
@media (max-width: 768px) {
  .ai-hero .container {
    background: linear-gradient(
      155deg,
      rgba(6, 18, 34, 0.54) 0%,
      rgba(6, 18, 34, 0.28) 100%
    );
    border: 1px solid rgba(49, 157, 207, 0.13);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
      0 12px 36px rgba(0, 0, 0, 0.22),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
}

/* ── Console rows: individual glass cards ──
   Removes the top border on the wrapper (cards carry their own),
   converts each row to a rounded glass card with inner spacing. */
@media (max-width: 768px) {
  .ai-console-rows {
    border-top: none;
  }
  .ai-console-row {
    background: rgba(6, 18, 34, 0.74);
    border: 1px solid rgba(49, 157, 207, 0.12);
    border-radius: 12px;
    padding: 28px 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.03);
    margin-bottom: 8px;
  }
  .ai-console-row:last-child { margin-bottom: 0; }
}

/* ── Signal rows: glass cards ──
   :last-child rule restores full border (overrides desktop border-bottom:none). */
@media (max-width: 768px) {
  .ai-signal-row {
    background: rgba(6, 18, 34, 0.70);
    border: 1px solid rgba(49, 157, 207, 0.10);
    border-radius: 14px;
    padding-left: 14px;
    padding-right: 14px;
    overflow: hidden;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow:
      0 6px 20px rgba(0, 0, 0, 0.16),
      inset 0 1px 0 rgba(255, 255, 255, 0.03);
    margin-bottom: 10px;
  }
  .ai-signal-row:last-child {
    border-bottom: 1px solid rgba(49, 157, 207, 0.10);
    margin-bottom: 0;
  }
}

/* ── Deploy steps: glass cards ──
   No horizontal padding added — preserves vertical rail alignment. */
@media (max-width: 768px) {
  .ai-deploy-step {
    background: rgba(6, 18, 34, 0.70);
    border: 1px solid rgba(49, 157, 207, 0.10);
    border-radius: 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow:
      0 6px 18px rgba(0, 0, 0, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.03);
    margin-bottom: 8px;
  }
  .ai-deploy-step:last-child { margin-bottom: 0; }
}

/* ── CTA block: glass wrapper ── */
@media (max-width: 768px) {
  .ai-cta .cta-inner {
    background: rgba(6, 18, 34, 0.70);
    border: 1px solid rgba(49, 157, 207, 0.13);
    border-radius: 18px;
    padding: 36px 24px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
      0 10px 30px rgba(0, 0, 0, 0.20),
      inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
}

/* ============================================================
   MOBILE READING MOTION POLISH — v18
   Micro-motion for reading experience. ≤768px only.
   Desktop (≥769px) unchanged. No new heavy animations.
   ============================================================ */

/* ── is-reading: smooth transition so the active highlight fades in/out ──
   Adds to existing transitions on each element, not replaces them.
   JS (ai-gsap.js mobileMM) toggles .is-reading via ScrollTrigger. */
@media (max-width: 768px) {
  .ai-console-row,
  .ai-deploy-step {
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.18s ease;
  }
  .ai-signal-row {
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.22s ease;
  }

  .ai-console-row.is-reading,
  .ai-signal-row.is-reading,
  .ai-deploy-step.is-reading {
    border-color: rgba(49, 157, 207, 0.32);
    box-shadow:
      0 12px 34px rgba(0, 0, 0, 0.24),
      0 0 0 1px rgba(49, 157, 207, 0.10),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }
}

/* ── Signal pulse: one-shot text glow on console tags + step numbers ──
   .is-pulsed added by JS after the GSAP reveal completes (~700ms delay). */
@keyframes aiMobileTagPulse {
  0%   { text-shadow: none; }
  45%  { text-shadow: 0 0 14px rgba(49, 157, 207, 0.60); }
  100% { text-shadow: none; }
}

@media (max-width: 768px) {
  .ai-console-tag.is-pulsed {
    animation: aiMobileTagPulse 0.80s 0.60s ease-out both;
  }
  .ai-step-num.is-pulsed {
    animation: aiMobileTagPulse 0.90s 0.70s ease-out both;
  }
}

/* ── CTA primary button: slow breathing glow — duration 4.2s, very low opacity ── */
@keyframes aiCtaGlow {
  0%, 100% { box-shadow: 0 0 0px 0px rgba(49, 157, 207, 0.00); }
  50%       { box-shadow: 0 0 22px 5px rgba(49, 157, 207, 0.20); }
}

@media (max-width: 768px) {
  .ai-cta .cta-buttons .btn-primary {
    animation: aiCtaGlow 4.2s ease-in-out infinite;
  }
}

/* ── Reduced-motion: kill ALL micro-motion additions from this block ── */
@media (prefers-reduced-motion: reduce) {
  .ai-console-tag.is-pulsed,
  .ai-step-num.is-pulsed {
    animation: none !important;
    text-shadow: none;
  }
  .ai-cta .cta-buttons .btn-primary {
    animation: none !important;
  }
}

@media (prefers-reduced-motion: reduce) and (max-width: 768px) {
  .ai-console-row,
  .ai-signal-row,
  .ai-deploy-step {
    transition: none !important;
  }
}

/* ============================================================
   MOBILE HERO ROBOT PRESENCE — v22 (composition upgrade)
   Key changes vs v21:
   - Robot/halo size min(62vw,260px) → min(72vw,300px) (inline style updated too)
   - Robot right: 0 → -8px in inline style (emerging from edge)
   - Robot/halo bottom 14vh → 10vh (higher into hero zone)
   - Halo glow: inset -40%, center 0.52 (stronger, more cinematic)
   - Status pill → AI assistant micro-panel (#ai-robot-panel)
   - Panel at right: 8px, bottom: 10px (nameplate unit below robot)
   - Fade range 55%-72% → 65%-85% in ai-robot.js
   All rules ≤768px. Desktop (≥769px) untouched.
   ============================================================ */

/* ── Halo: ambient glow + orbit ring ── */
#ai-robot-halo {
  display: none;
  position: fixed;
  pointer-events: none;
}

@media (max-width: 768px) {
  #ai-robot-halo {
    display: block;
    right: 0;
    bottom: 12vh;
    width: min(78vw, 330px);
    height: min(78vw, 330px);
    z-index: 2;
    overflow: visible;
  }

  /* Breathing radial glow — wider spread, stronger center */
  #ai-robot-halo::before {
    content: '';
    position: absolute;
    inset: -50%;
    border-radius: 50%;
    background: radial-gradient(
      circle,
      rgba(49, 157, 207, 0.62) 0%,
      rgba(49, 157, 207, 0.24) 30%,
      rgba(49, 157, 207, 0.08) 58%,
      transparent 70%
    );
    animation: aiHaloPulse 4s ease-in-out infinite;
  }

  /* Orbit scan ring — 2px luminous arc */
  #ai-robot-halo::after {
    content: '';
    position: absolute;
    inset: -9%;
    border-radius: 50%;
    border: 3px solid rgba(49, 157, 207, 0.20);
    border-top-color: rgba(49, 157, 207, 0.95);
    border-right-color: rgba(49, 157, 207, 0.55);
    animation: aiOrbitSpin 5.5s linear infinite;
  }
}

@keyframes aiHaloPulse {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1.00; }
}

@keyframes aiOrbitSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── AI assistant micro-panel — premium nameplate below robot ── */
#ai-robot-panel {
  display: none;
  position: fixed;
  pointer-events: none;
}

@media (max-width: 768px) {
  #ai-robot-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    left: 12px;
    bottom: 16px;
    z-index: 3;
    width: min(210px, calc(100vw - 24px));
    padding: 14px 18px 16px;
    background: rgba(4, 11, 22, 0.95);
    border: 1px solid rgba(49, 157, 207, 0.55);
    border-radius: 14px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    overflow: hidden;
    box-shadow:
      0 0 48px rgba(49, 157, 207, 0.22),
      0 0 0 1px rgba(49, 157, 207, 0.08),
      0 8px 32px rgba(0, 0, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.09);
  }

  /* Holographic top accent line */
  #ai-robot-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(49, 157, 207, 0.90), transparent);
  }
}

/* Panel header: live dot + kicker */
.ai-rpanel-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-rpanel-live {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #319dcf;
  box-shadow: 0 0 7px 1px rgba(49, 157, 207, 0.75);
  animation: aiRpanelLive 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes aiRpanelLive {
  0%, 100% { opacity: 1;    }
  50%       { opacity: 0.30; }
}

.ai-rpanel-kicker {
  font-family: ui-monospace, 'Courier New', monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(49, 157, 207, 0.68);
}

/* Panel main row: status text + animated dots */
.ai-rpanel-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-rpanel-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  white-space: nowrap;
}

.ai-rpanel-dots {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-shrink: 0;
}

.ai-rpanel-dots i {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #319dcf;
  font-style: normal;
  animation: aiPanelDot 1.5s ease-in-out infinite;
}
.ai-rpanel-dots i:nth-child(2) { animation-delay: 0.22s; }
.ai-rpanel-dots i:nth-child(3) { animation-delay: 0.44s; }

@keyframes aiPanelDot {
  0%, 100% { opacity: 0.22; transform: scale(0.75); }
  50%       { opacity: 1.00; transform: scale(1.20); }
}

/* Waveform bars */
.ai-rpanel-wave {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 18px;
}

.ai-rpanel-wave span {
  display: block;
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: rgba(49, 157, 207, 0.78);
  transform-origin: bottom center;
  animation: aiPanelWave 1.4s ease-in-out infinite;
}
.ai-rpanel-wave span:nth-child(1) { height: 62%;  animation-delay: 0.00s; }
.ai-rpanel-wave span:nth-child(2) { height: 100%; animation-delay: 0.16s; }
.ai-rpanel-wave span:nth-child(3) { height: 78%;  animation-delay: 0.32s; }
.ai-rpanel-wave span:nth-child(4) { height: 92%;  animation-delay: 0.48s; }
.ai-rpanel-wave span:nth-child(5) { height: 54%;  animation-delay: 0.64s; }

@keyframes aiPanelWave {
  0%, 100% { transform: scaleY(0.38); opacity: 0.38; }
  50%       { transform: scaleY(1.00); opacity: 1.00; }
}

/* Short viewport safety — hide panel on phones < 700px tall */
@media (max-width: 768px) and (max-height: 700px) {
  #ai-robot-panel { display: none !important; }
}

/* Reduced motion: hide all robot presence envelope elements */
@media (prefers-reduced-motion: reduce) {
  #ai-robot-halo,
  #ai-robot-panel { display: none !important; }
}

/* ============================================================
   MOBILE ROBOT SCENE MESSAGES — v23
   Transition classes for dynamic panel text.
   All rules ≤768px. Desktop (≥769px) untouched.
   ============================================================ */

@media (max-width: 768px) {
  /* Text fades out/in when message changes */
  .ai-rpanel-text {
    transition: opacity 0.21s ease, transform 0.21s ease;
  }
  #ai-robot-panel.is-switching .ai-rpanel-text {
    opacity: 0;
    transform: translateY(8px);
  }

  /* Panel border/shadow brightens briefly while speaking */
  #ai-robot-panel {
    transition: border-color 0.28s ease, box-shadow 0.28s ease;
  }
  #ai-robot-panel.is-speaking {
    border-color: rgba(49, 157, 207, 0.92);
    box-shadow:
      0 0 64px rgba(49, 157, 207, 0.42),
      0 0 0 1px rgba(49, 157, 207, 0.18),
      0 8px 32px rgba(0, 0, 0, 0.65),
      inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }

  /* Waveform brightens on message change — filter avoids transform conflict */
  .ai-rpanel-wave {
    transition: filter 0.18s ease;
  }
  #ai-robot-panel.is-speaking .ai-rpanel-wave {
    filter: brightness(2.4) saturate(1.5);
  }

  /* Halo soft scale burst — transform is separate from opacity in aiHaloPulse */
  #ai-robot-halo.is-boosted::before {
    animation: aiHaloPulse 4s ease-in-out infinite, aiHaloBoost 0.55s ease-out 1;
  }
}

@keyframes aiHaloBoost {
  0%   { transform: scale(1.00); }
  35%  { transform: scale(1.34); }
  100% { transform: scale(1.00); }
}

/* Reduced motion: disable all message-transition effects */
@media (prefers-reduced-motion: reduce) {
  .ai-rpanel-text  { transition: none !important; }
  #ai-robot-panel  { transition: none !important; }
  .ai-rpanel-wave { transition: none !important; }
  #ai-robot-panel.is-switching .ai-rpanel-text {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================================
   MOBILE AI COMPANION STAGE — v25
   Hero layout fix: content top-aligned, stage zone at bottom.
   Standby rings: visible placeholder while GLB loads.
   Panel: reunited with robot on right side.
   All rules ≤768px. Desktop (≥769px) untouched.
   ============================================================ */

/* ── Hero mobile: content at top, stage zone at bottom ── */
@media (max-width: 768px) {
  .ai-hero {
    align-items: flex-start;
    min-height: 100svh;
    padding: 120px 0 clamp(100px, 28svh, 260px);
  }
}

/* ── Stage atmosphere — bottom-right of hero behind robot ── */
.ai-stage-glow { display: none; }

@media (max-width: 768px) {
  .ai-stage-glow {
    display: block;
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 62%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
      ellipse at 70% 88%,
      rgba(49, 157, 207, 0.14) 0%,
      rgba(23, 63, 100, 0.06) 42%,
      transparent 64%
    );
  }

  /* Ground ellipse — stage floor spotlight */
  .ai-stage-glow::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 6%;
    width: 54%;
    height: 22px;
    border-radius: 50%;
    background: rgba(49, 157, 207, 0.18);
    filter: blur(12px);
  }
}

/* ── Halo standby rings — loading placeholder ── */
.ai-halo-standby { display: none; }

@media (max-width: 768px) {
  .ai-halo-standby {
    display: block;
    position: absolute;
    inset: 16%;
    border-radius: 50%;
    border: 1.5px solid rgba(49, 157, 207, 0.28);
    animation: aiStandbyPulse 2.2s ease-in-out infinite;
    pointer-events: none;
  }

  /* Inner dashed ring */
  .ai-halo-standby::before {
    content: '';
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    border: 1px dashed rgba(49, 157, 207, 0.16);
    animation: aiStandbyPulse 2.2s ease-in-out infinite 0.65s;
  }

  /* Ambient fill */
  .ai-halo-standby::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(
      circle,
      rgba(49, 157, 207, 0.10) 0%,
      transparent 62%
    );
  }

  /* Fade out standby rings once model is loaded */
  #ai-robot-halo.is-loaded .ai-halo-standby {
    opacity: 0;
    transition: opacity 0.65s ease;
  }
}

@keyframes aiStandbyPulse {
  0%, 100% { opacity: 0.30; transform: scale(0.96); }
  50%       { opacity: 0.88; transform: scale(1.04); }
}

/* ── Halo: updated size + position ── */
@media (max-width: 768px) {
  #ai-robot-halo {
    bottom: 14vh;
    width: min(82vw, 340px);
    height: min(82vw, 340px);
  }
}

/* ── Panel: right side — unified with robot ── */
@media (max-width: 768px) {
  #ai-robot-panel {
    left: unset;
    right: 12px;
    bottom: 12px;
    width: min(200px, calc(100vw - 24px));
  }
}

/* ── Text overflow: ellipsis for long messages ── */
.ai-rpanel-text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── Short-phone adjustments (≤700px tall, e.g. iPhone SE) ── */
@media (max-width: 768px) and (max-height: 700px) {
  .ai-hero { padding-bottom: 160px; }

  #ai-robot-halo {
    bottom: 8px;
    width: min(62vw, 250px);
    height: min(62vw, 250px);
  }
}
