/* Animated hero visuals for Cyberpunk Globe hub pages.
   CSS-only, theme-token aware, and disabled under prefers-reduced-motion. */

.ahv {
  --ahv-accent: #38bdf8;
  --ahv-accent-2: #34d399;
  --ahv-line: color-mix(in srgb, var(--ahv-accent) 26%, transparent);
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 256px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line, var(--ainna-border, rgba(148, 163, 184, .22)));
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 46%, color-mix(in srgb, var(--ahv-accent) 12%, transparent), transparent 62%),
    linear-gradient(145deg, rgba(148, 163, 184, .08), transparent 72%);
  color: var(--text, var(--ainna-text, #e2e8f0));
}

.ahv::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(color-mix(in srgb, var(--ahv-accent) 7%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--ahv-accent) 7%, transparent) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 82%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 30%, transparent 82%);
}

.ahv--models { --ahv-accent: #38bdf8; --ahv-accent-2: #a78bfa; }
.ahv--business { --ahv-accent: #34d399; --ahv-accent-2: #38bdf8; }
.ahv--industry { --ahv-accent: #fbbf24; --ahv-accent-2: #38bdf8; }
.ahv--market { --ahv-accent: #22d3ee; --ahv-accent-2: #a3e635; }

/* Shared labels */
.ahv-node,
.ahv-tile,
.ahv-chip {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line, var(--ainna-border, rgba(148, 163, 184, .3)));
  border-radius: 9px;
  background: var(--bg, var(--ainna-bg, #0b1220));
  color: var(--muted, var(--ainna-text-muted, #94a3b8));
  font: 700 .62rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(2, 6, 23, .28);
  animation: ahv-float 5.2s ease-in-out infinite;
}

.ahv-node::before,
.ahv-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ahv-accent);
  box-shadow: 0 0 9px var(--ahv-accent);
}

.ahv-readout {
  position: absolute;
  bottom: 11px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted, var(--ainna-text-muted, #94a3b8));
  font: 700 .56rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ahv-readout i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ahv-accent-2);
  box-shadow: 0 0 10px var(--ahv-accent-2);
  animation: ahv-blink 1.9s ease-in-out infinite;
}

/* ── Models & infrastructure: orbital core ─────────────────────────────── */
.ahv-ring {
  position: absolute;
  border: 1px dashed var(--ahv-line);
  border-radius: 50%;
  animation: ahv-spin 26s linear infinite;
}

.ahv-ring.r1 { width: 128px; height: 128px; }
.ahv-ring.r2 { width: 186px; height: 186px; border-style: solid; border-color: color-mix(in srgb, var(--ahv-accent-2) 18%, transparent); animation-duration: 38s; animation-direction: reverse; }
.ahv-ring.r3 { width: 238px; height: 238px; border-color: color-mix(in srgb, var(--ahv-accent) 12%, transparent); animation-duration: 52s; }

.ahv-core {
  position: relative;
  z-index: 2;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  border: 1px solid color-mix(in srgb, var(--ahv-accent) 55%, transparent);
  background: radial-gradient(circle at 34% 28%, color-mix(in srgb, var(--ahv-accent-2) 26%, transparent), transparent 62%), var(--bg, var(--ainna-bg, #0b1220));
  color: var(--ahv-accent);
  box-shadow: 0 0 38px color-mix(in srgb, var(--ahv-accent) 26%, transparent);
  animation: ahv-breathe 4.4s ease-in-out infinite;
}

.ahv-core svg { width: 44px; height: 44px; }

.ahv--models .n1 { top: 13%; left: 6%; --ahv-accent: #38bdf8; }
.ahv--models .n2 { top: 14%; right: 5%; --ahv-accent: #a78bfa; animation-delay: -1.4s; }
.ahv--models .n3 { bottom: 16%; left: 6%; --ahv-accent: #34d399; animation-delay: -2.2s; }
.ahv--models .n4 { bottom: 15%; right: 5%; --ahv-accent: #fbbf24; animation-delay: -.7s; }

/* ── Business AI: connected operations pipeline ────────────────────────── */
.ahv-flow {
  position: absolute;
  top: 16%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, var(--ahv-line) 12%, var(--ahv-line) 88%, transparent);
}

.ahv-packet {
  position: absolute;
  top: 20%;
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ahv-accent-2);
  box-shadow: 0 0 14px var(--ahv-accent-2);
  animation: ahv-drop 4.6s cubic-bezier(.45, 0, .55, 1) infinite;
}

.ahv-hub {
  position: relative;
  z-index: 2;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--ahv-accent) 55%, transparent);
  background: var(--bg, var(--ainna-bg, #0b1220));
  color: var(--ahv-accent);
  box-shadow: 0 0 30px color-mix(in srgb, var(--ahv-accent) 24%, transparent);
  animation: ahv-breathe 4.6s ease-in-out infinite;
}

.ahv-hub svg { width: 34px; height: 34px; }

.ahv--business .f1 { top: 12%; left: 7%; --ahv-accent: #34d399; }
.ahv--business .f2 { top: 32%; right: 6%; --ahv-accent: #38bdf8; animation-delay: -1.2s; }
.ahv--business .f3 { bottom: 31%; left: 6%; --ahv-accent: #a78bfa; animation-delay: -2s; }
.ahv--business .f4 { bottom: 12%; right: 7%; --ahv-accent: #fbbf24; animation-delay: -.6s; }

/* ── Industry: sector grid with a scanning pass ────────────────────────── */
.ahv-tile {
  width: calc(50% - 30px);
  justify-content: flex-start;
  padding: 9px 10px;
  border-radius: 11px;
}

.ahv-tile svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--ahv-accent);
}

.ahv-tile.t1 { top: 12%; left: 6%; }
.ahv-tile.t2 { top: 12%; right: 6%; animation-delay: -1.3s; }
.ahv-tile.t3 { bottom: 19%; left: 6%; animation-delay: -2.1s; }
.ahv-tile.t4 { bottom: 19%; right: 6%; animation-delay: -.8s; }

.ahv-scan {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ahv-accent), transparent);
  opacity: .8;
  animation: ahv-scan 4.8s ease-in-out infinite;
}

/* ── Market intelligence: candlesticks + trend line ────────────────────── */
.ahv-bars {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 22%;
  height: 56%;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  z-index: 1;
}

.ahv-bars i {
  flex: 1;
  height: var(--h, 40%);
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ahv-accent) 62%, transparent), color-mix(in srgb, var(--ahv-accent) 10%, transparent));
  animation: ahv-grow 3.6s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -.35s);
}

.ahv-bars i:nth-child(even) { background: linear-gradient(180deg, color-mix(in srgb, var(--ahv-accent-2) 58%, transparent), color-mix(in srgb, var(--ahv-accent-2) 8%, transparent)); }

.ahv-line {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 20%;
  width: 86%;
  height: 46%;
  z-index: 2;
  color: var(--ahv-accent-2);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--ahv-accent-2) 45%, transparent));
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: ahv-draw 5.4s ease-in-out infinite;
}

.ahv--market .c1 { top: 10%; left: 6%; }
.ahv--market .c2 { top: 10%; right: 6%; animation-delay: -1.1s; }
.ahv--market .c3 { bottom: 12%; left: 6%; animation-delay: -1.9s; }
.ahv--market .c4 { bottom: 12%; right: 6%; animation-delay: -.5s; }

/* ── Split hero card layouts on hub pages ──────────────────────────────── */
.hero-card--split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, .85fr);
  gap: 28px;
  align-items: center;
}

.hero-card--split > .hero-copy { min-width: 0; }

.hero-card--split .ahv { min-height: 220px; }

@media (max-width: 860px) {
  .hero-card--split { grid-template-columns: 1fr; gap: 22px; }
  .hero-card--split .ahv { min-height: 236px; }
}

@keyframes ahv-spin { to { transform: rotate(360deg); } }
@keyframes ahv-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@keyframes ahv-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes ahv-blink { 50% { opacity: .3; } }
@keyframes ahv-drop { 0% { top: 20%; opacity: 1; } 85% { top: 78%; opacity: 1; } 100% { top: 80%; opacity: 0; } }
@keyframes ahv-scan { 0%, 100% { top: 19%; opacity: .15; } 50% { top: 67%; opacity: .85; } }
@keyframes ahv-grow { from { height: calc(var(--h, 40%) * .82); } to { height: var(--h, 40%); } }
@keyframes ahv-draw { 0% { stroke-dashoffset: 340; } 60%, 100% { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ahv-node, .ahv-chip, .ahv-readout i, .ahv-ring, .ahv-core, .ahv-hub,
  .ahv-packet, .ahv-scan, .ahv-bars i, .ahv-line, .ahv-tile {
    animation: none !important;
  }
  .ahv-line { stroke-dashoffset: 0; }
}
