/* ──────────────────────────────────────────────────────────────
   Anna 3D Voice Demo — Styles
   Tokens from vw-shared.css:
     --vw-accent:#7c3aed  --vw-accent-bright:#9b6dff
     --vw-brand-lavender:#c4b5ff  --vw-brand-indigo:#5a2896
     --vw-brand-indigo-deep:#3d1668
   Fonts: Space Grotesk (body), JetBrains Mono (mono)
   ────────────────────────────────────────────────────────────── */

/* ── Section wrapper ──────────────────────────────────────── */
.anna-demo-section {
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(124,58,237,0.07), transparent 65%),
    var(--vw-surface-2, #0d0a17);
  border-top: 1px solid var(--vw-border-soft, rgba(255,255,255,0.06));
  border-bottom: 1px solid var(--vw-border-soft, rgba(255,255,255,0.06));
  padding: 72px 0 80px;
}

.anna-demo-section .vw-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.anna-demo-section .section-header {
  text-align: center;
  max-width: 56ch;
  margin-bottom: 40px;
}

.anna-demo-section .section-header .vw-eyebrow {
  margin-bottom: 12px;
}

.anna-demo-section .section-header h2 {
  margin: 0 0 12px;
}

.anna-demo-section .section-header p {
  font-size: 15.5px;
  color: var(--vw-text-2, rgba(255,255,255,0.6));
  margin: 0;
  line-height: 1.6;
}

/* ── Chip strip ───────────────────────────────────────────── */
.anna-demo__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
  width: 100%;
}

@media (max-width: 620px) {
  .anna-demo__chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .anna-demo__chips::-webkit-scrollbar { display: none; }
}

.anna-chip {
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--vw-border-strong, rgba(255,255,255,0.12));
  background: rgba(255,255,255,0.03);
  color: var(--vw-text-2, rgba(255,255,255,0.6));
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms, color 150ms, border-color 150ms, box-shadow 150ms, transform 150ms;
}

.anna-chip:hover {
  border-color: var(--vw-accent-bright, #9b6dff);
  color: var(--vw-text-1, #fff);
  transform: translateY(-1px);
}

.anna-chip[aria-pressed="true"],
.anna-chip.is-active {
  background: linear-gradient(135deg, var(--vw-brand-indigo, #5a2896), var(--vw-accent, #7c3aed));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(90,40,150,0.40);
}

/* ── Main stage ───────────────────────────────────────────── */
#annaStage {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 16 / 10;
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% 55%, rgba(90,40,150,0.22), #060410 70%);
  box-shadow:
    0 0 0 1px rgba(196,181,255,0.08),
    0 32px 80px rgba(76,29,149,0.35),
    0 8px 24px rgba(0,0,0,0.55);
  isolation: isolate;
}

/* Poster — instant paint / fallback */
.anna-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 32px;
  pointer-events: none;
  z-index: 1;
  display: block;
}

/* WebGL canvas */
#annaCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.8s ease;
}

#annaCanvas.is-ready {
  opacity: 1;
}

/* When 3D is live, hide the poster */
#annaStage.has-3d .anna-poster {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* Call UI now renders on the WebGL phone screen; #annaScreen = a11y-only live region */
.sr-only,
#annaScreen.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ── Control bar (below the phone) ── */
.anna-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 26px;
}
.anna-controls-bar .anna-speaker-tag { margin-left: 0; }
.anna-play-label { display: inline-block; }

/* Inner card for the call UI */
.anna-screen__card {
  background: rgba(10, 6, 22, 0.82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(196,181,255,0.14);
  border-radius: 16px;
  padding: 18px 20px 16px;
  width: min(340px, 88%);
  box-shadow: 0 8px 40px rgba(76,29,149,0.28), 0 2px 8px rgba(0,0,0,0.4);
  pointer-events: auto;
}

/* Header row: biz name + LIVE pip */
.anna-screen__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(196,181,255,0.08);
}

#annaBiz {
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 14px;
  font-weight: 650;
  color: var(--vw-text-1, #fff);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anna-screen__live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #34d399;
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(52,211,153,0.10);
  border: 1px solid rgba(52,211,153,0.20);
}

.anna-screen__live::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 5px #34d399;
  animation: anna-pulse 2s ease-in-out infinite;
}

@keyframes anna-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Captions */
#annaCaptions {
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--vw-text-2, rgba(255,255,255,0.6));
  min-height: 58px;
  margin-bottom: 10px;
}

#annaCaptions.speaker-anna { color: var(--vw-brand-lavender, #c4b5ff); }
#annaCaptions.speaker-caller { color: var(--vw-text-2, rgba(255,255,255,0.65)); }

.anna-word {
  opacity: 0.3;
  transition: opacity 0.12s ease;
  display: inline;
}

.anna-word.is-spoken {
  opacity: 1;
  color: var(--vw-brand-lavender, #c4b5ff);
}

#annaCaptions.speaker-caller .anna-word.is-spoken {
  color: var(--vw-text-1, #fff);
}

/* Waveform */
#annaWave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  margin-bottom: 12px;
}

#annaWave .anna-bar {
  width: 3px;
  background: var(--vw-accent-bright, #9b6dff);
  border-radius: 2px;
  transform-origin: bottom;
  transition: height 0.06s ease;
  min-height: 3px;
}

#annaWave.is-idle .anna-bar {
  height: 3px !important;
}

/* CSS animation fallback when WebAudio unavailable */
@keyframes anna-bar-1 { 0%,100%{height:4px} 50%{height:18px} }
@keyframes anna-bar-2 { 0%,100%{height:9px} 45%{height:22px} }
@keyframes anna-bar-3 { 0%,100%{height:14px} 40%{height:6px} }
@keyframes anna-bar-4 { 0%,100%{height:6px} 55%{height:20px} }
@keyframes anna-bar-5 { 0%,100%{height:11px} 48%{height:3px} }

#annaWave.css-fallback .anna-bar:nth-child(5n+1) { animation: anna-bar-1 0.9s ease-in-out infinite; }
#annaWave.css-fallback .anna-bar:nth-child(5n+2) { animation: anna-bar-2 1.1s ease-in-out infinite 0.15s; }
#annaWave.css-fallback .anna-bar:nth-child(5n+3) { animation: anna-bar-3 0.8s ease-in-out infinite 0.3s; }
#annaWave.css-fallback .anna-bar:nth-child(5n+4) { animation: anna-bar-4 1.0s ease-in-out infinite 0.45s; }
#annaWave.css-fallback .anna-bar:nth-child(5n+5) { animation: anna-bar-5 0.95s ease-in-out infinite 0.1s; }

/* Controls row */
.anna-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

#annaPlay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: var(--font-body, 'Space Grotesk', sans-serif);
  font-size: 13.5px;
  font-weight: 650;
  background: linear-gradient(135deg, var(--vw-brand-indigo, #5a2896), var(--vw-accent, #7c3aed));
  color: #fff;
  box-shadow: 0 4px 14px rgba(90,40,150,0.40);
  transition: filter 140ms, transform 120ms;
  white-space: nowrap;
}

#annaPlay:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

#annaPlay:active { transform: translateY(0); }

#annaPlay:focus-visible {
  outline: 2px solid var(--vw-brand-lavender, #c4b5ff);
  outline-offset: 2px;
}

/* Speaker label */
.anna-speaker-tag {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--vw-text-3, rgba(255,255,255,0.35));
  margin-left: auto;
}

/* ── Static / reduced-motion fallback ─────────────────────── */
#annaDemo.is-static #annaCanvas {
  display: none;
}

#annaDemo.is-static .anna-poster {
  opacity: 1 !important;
  transition: none;
}

/* Poster always shows until 3D ready */
@media (prefers-reduced-motion: reduce) {
  #annaCanvas { display: none !important; }
  .anna-poster { opacity: 1 !important; }
  #annaScreen {
    transform: none !important;
  }
  .anna-word { transition: none; }
  #annaPlay { transition: none; }
}

/* ── Mobile layout ────────────────────────────────────────── */
@media (max-width: 520px) {
  .anna-demo-section { padding: 52px 0 60px; }
  #annaStage { aspect-ratio: 4 / 3; border-radius: 14px; }
  .anna-screen__card { padding: 14px 15px 12px; }
  #annaCaptions { font-size: 12.5px; min-height: 50px; }
  #annaPlay { font-size: 12.5px; padding: 8px 15px; }
}
