/* ═══════════════════════════════════════════════════════════════
   बोल (bol.sh) — Multilingual Voice RAG
   Professional UI Theme: Deep Slate / Obsidian (Linear/Vercel style)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');

:root {
  /* Core Palette */
  --bg:          #09090b; /* Deep Obsidian */
  --bg-card:     #121214; /* Slightly lighter for cards */
  --bg-glass:    rgba(255, 255, 255, 0.03);
  
  --line:        rgba(255, 255, 255, 0.1);
  --line-hot:    rgba(255, 255, 255, 0.25);
  
  --fg:          #fafafa;
  --fg-dim:      #a1a1aa;
  --fg-faint:    #52525b;

  /* Accent Colors */
  --accent:      #ffffff;
  --accent-dim:  rgba(255, 255, 255, 0.8);
  --success:     #10b981;
  --success-bg:  rgba(16, 185, 129, 0.1);
  --warning:     #f59e0b;
  --warning-bg:  rgba(245, 158, 11, 0.1);
  --danger:      #ef4444;
  --danger-bg:   rgba(239, 68, 68, 0.1);

  /* Typography */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --deva: 'Noto Sans Devanagari', var(--sans);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gut: clamp(16px, 5vw, 40px);
}

/* ── Base Reset & Setup ──────────────────────────────────────── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ── Ambient Background Glow ─────────────────────────────────── */
.vignette {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
}

.ai-glow {
  position: fixed;
  width: 45vw; height: 45vw;
  border-radius: 50%;
  filter: blur(90px);
  z-index: -2;
  opacity: 0.15;
  animation: float-glow 20s infinite alternate ease-in-out;
  pointer-events: none;
  mix-blend-mode: screen;
}
.g1 { background: #3b82f6; top: -10%; left: -10%; animation-delay: 0s; }
.g2 { background: #8b5cf6; bottom: 0%; right: -10%; animation-delay: -5s; animation-duration: 25s; }
.g3 { background: #10b981; top: 40%; left: 30%; width: 35vw; height: 35vw; animation-duration: 30s; }

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(15vw, 5vw) scale(1.1); }
  100% { transform: translate(-10vw, 15vw) scale(0.9); }
}

/* ── Top Bar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gut);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(9, 9, 11, 0.8);
  border-bottom: 1px solid var(--line);
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 10px var(--warning);
}
.brand-name { font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; font-size: 14px; }
.brand-name .dim { color: var(--fg-faint); font-weight: 400; }

.status { display: flex; gap: 8px; align-items: center; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px;
  color: var(--fg-dim); text-decoration: none;
  padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-glass);
  transition: all 0.2s var(--ease);
}
.stat-chip.link:hover { color: var(--fg); border-color: var(--line-hot); }
.stat-chip .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint);
}
.stat-chip.ready .dot { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* ── Hero Section (Act I) ─────────────────────────────────────── */
.stage {
  display: flex; flex-direction: column;
  padding: 80px var(--gut) 40px;
  max-width: 900px;
  margin: 0 auto;
}

.hero { text-align: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--fg-dim);
  padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg-glass);
  margin-bottom: 32px;
}
.pulse {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.wordmark {
  margin: 0 0 24px;
  display: flex; align-items: baseline; justify-content: center; gap: 16px;
}
.wordmark .deva {
  font-family: var(--deva); font-weight: 700;
  font-size: clamp(64px, 12vw, 120px);
  line-height: 1;
  color: var(--fg);
  letter-spacing: -0.02em;
}
.wordmark .latin {
  font-family: var(--mono); font-weight: 500; font-size: 14px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--fg-faint);
}
.cursor {
  display: inline-block; width: 8px; height: 1em; background: var(--accent);
  vertical-align: text-bottom; margin-left: 4px; animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.lede {
  font-size: 16px; color: var(--fg-dim); line-height: 1.6;
  max-width: 600px; margin: 0 auto 40px;
}
.lede strong { color: var(--fg); font-weight: 500; }

/* ── State Changes on Answer ─────────────────────────────────── */
body.answered .hero { margin-top: 0; }
body.answered .eyebrow, body.answered .lede { display: none; }
body.answered .wordmark .deva { font-size: 48px; }
body.answered .wordmark .latin { font-size: 10px; }
body.answered .stage { justify-content: flex-start; min-height: auto; padding-top: 90px; }

/* ── Input Console ───────────────────────────────────────────── */
.console { max-width: 680px; margin: 0 auto; width: 100%; }
.console-row {
  display: flex; align-items: center; gap: 12px;
}

.mic {
  flex-shrink: 0;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--fg);
  display: grid; place-items: center;
  cursor: pointer; transition: all 0.2s var(--ease);
}
.mic:hover { border-color: var(--line-hot); background: var(--bg-glass); }
.mic.rec { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.mic-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.field-wrap {
  flex: 1; display: flex; align-items: center;
  border: 1px solid var(--line); border-radius: 26px;
  background: var(--bg-card);
  padding: 4px 6px 4px 20px;
  transition: all 0.2s var(--ease);
}
.field-wrap:focus-within {
  border-color: var(--line-hot);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}
#q {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--sans); font-size: 15px;
  padding: 12px 0;
}
#q::placeholder { color: var(--fg-faint); }

.go {
  width: 36px; height: 36px; border-radius: 50%;
  border: none; background: var(--fg); color: var(--bg);
  cursor: pointer; display: grid; place-items: center;
  transition: transform 0.2s var(--ease);
}
.go:hover { transform: scale(1.05); }
.go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }

.hint {
  text-align: center; margin-top: 12px; font-family: var(--mono); font-size: 11px;
  color: var(--fg-dim); min-height: 16px;
}

/* ── Sample Chips ────────────────────────────────────────────── */
.samples {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin-top: 24px;
}
.sample {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--fg-dim); background: var(--bg-glass);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.sample:hover { color: var(--fg); border-color: var(--line-hot); background: rgba(255, 255, 255, 0.08); }
.sample.ghost { font-family: var(--mono); font-size: 12px; border-style: dashed; }

/* ── Voice Modal ─────────────────────────────────────────────── */
.voice-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.voice-modal.active { display: flex; }
.voice-card {
  background: rgba(15, 15, 17, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  border-radius: 32px; padding: 48px; text-align: center; 
  width: 100%; max-width: 420px; position: relative; overflow: hidden;
}
.voice-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at top center, rgba(255,255,255,0.04), transparent 60%);
  pointer-events: none;
}
.voice-modal-close {
  position: absolute; top: 20px; right: 20px; width: 32px; height: 32px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); 
  border-radius: 50%; color: var(--fg-dim);
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s var(--ease); z-index: 10;
}
.voice-modal-close:hover { background: rgba(255,255,255,0.1); color: var(--fg); }
.voice-status { font-family: var(--sans); font-size: 20px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 24px; color: var(--fg); }
.voice-subtext { color: var(--fg-faint); font-size: 13px; font-family: var(--sans); }
.voice-mic-wrap { display: flex; justify-content: center; margin-bottom: 32px; }
.voice-mic-btn {
  width: 80px; height: 80px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, rgba(239,68,68,1), rgba(185,28,28,1));
  box-shadow: 0 12px 32px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
  position: relative; transition: transform 0.2s var(--ease);
}
.voice-mic-btn:hover { transform: scale(1.05); }
.voice-modal-icon { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2; z-index: 2; }
.voice-wave-container { background: transparent; height: 60px; margin-bottom: 16px; }

.voice-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1.5px solid rgba(239,68,68,0.6);
  animation: pulse-ring 2s infinite cubic-bezier(0.2, 0, 0.2, 1);
  pointer-events: none;
}
.r1 { animation-delay: 0s; }
.r2 { animation-delay: 0.6s; }
.r3 { animation-delay: 1.2s; }
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ── Conversation Feed ───────────────────────────────────────── */
.convo-feed {
  width: 100%; max-width: 760px; margin: 40px auto 0;
  display: flex; flex-direction: column; gap: 24px;
}
.convo-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
}
.convo-title { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--fg-dim); }
.convo-clear-btn {
  background: transparent; border: 1px solid var(--line); color: var(--fg-dim);
  font-family: var(--mono); font-size: 10px; border-radius: 4px; padding: 4px 8px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.convo-clear-btn:hover { background: var(--bg-glass); color: var(--fg); border-color: var(--line-hot); }

.convo-turn { display: flex; flex-direction: column; gap: 16px; animation: slideUp 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* User Query Bubble */
.user-query-wrap {
  align-self: flex-end; max-width: 80%;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line);
  border-radius: 16px 16px 4px 16px; padding: 12px 16px;
}
.user-query-text { font-size: 15px; color: var(--fg); }

/* Assistant Card */
.assistant-card {
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: 16px 16px 16px 4px; padding: 24px;
}
.main-answer { font-size: 16px; color: var(--fg); line-height: 1.6; margin: 0 0 20px; }
.main-answer.muted { color: var(--fg-dim); }

.meta-details-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--line); padding-top: 16px; margin-bottom: 16px;
}
.detail-chip {
  font-family: var(--mono); font-size: 10px; padding: 4px 8px; border-radius: 4px;
  background: var(--bg-glass); border: 1px solid var(--line); color: var(--fg-dim);
}
.detail-chip.good { color: var(--success); border-color: var(--success-bg); background: var(--success-bg); }
.detail-chip.warn { color: var(--warning); border-color: var(--warning-bg); background: var(--warning-bg); }
.detail-chip.bad { color: var(--danger); border-color: var(--danger-bg); background: var(--danger-bg); }

/* Sources / Context */
.sources details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sources summary { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); cursor: pointer; }
.src {
  margin: 12px 0; padding-left: 12px; border-left: 2px solid var(--line-hot);
  font-size: 14px; color: var(--fg-dim);
}
.src .meta { font-family: var(--mono); font-size: 10px; color: var(--fg-faint); margin-top: 4px; }

/* ── Telemetry (Bottom Metrics) ──────────────────────────────── */
.telemetry {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px;
  max-width: 760px; margin: 60px auto 0; padding-bottom: 40px;
}
.tele {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; text-align: center;
  transition: border-color 0.2s var(--ease);
}
.tele b {
  display: block; font-family: var(--mono); font-size: 24px; font-weight: 500; color: var(--fg);
}
.tele span {
  display: block; font-family: var(--mono); font-size: 10px; color: var(--fg-dim); margin-top: 4px; text-transform: uppercase;
}
.tele.run {
  background: transparent; border-color: var(--line-hot); cursor: pointer; color: var(--fg);
}
.tele.run:hover { background: var(--bg-glass); border-color: var(--fg-faint); }

/* ── Footer / Markdown Content Formatting (Act II) ────────────── */
.act {
  max-width: 800px; margin: 80px auto; padding: 0 var(--gut);
}
.act-head { margin-bottom: 40px; }
.act-num { font-family: var(--mono); font-size: 12px; color: var(--fg-faint); margin-bottom: 8px; display: block; }
.act-head h2 { font-size: 24px; font-weight: 600; margin: 0 0 16px; color: var(--fg); letter-spacing: -0.02em; }
.act-head p { font-size: 15px; color: var(--fg-dim); line-height: 1.6; }

/* Ghost Buttons */
.ghost-btn {
  background: transparent; border: 1px dashed var(--line); border-radius: 8px;
  color: var(--fg-dim); font-family: var(--mono); font-size: 12px; padding: 12px 24px;
  cursor: pointer; width: 100%; transition: all 0.2s var(--ease);
}
.ghost-btn:hover { color: var(--fg); border-color: var(--line-hot); background: var(--bg-glass); }

/* Styling Markdown Content (Headers, paragraphs, code) */
.findings h3 { font-size: 18px; font-weight: 600; color: var(--fg); margin: 32px 0 12px; }
.findings p { font-size: 15px; color: var(--fg-dim); margin: 0 0 16px; line-height: 1.6; }
.findings code {
  font-family: var(--mono); font-size: 13px;
  background: rgba(255,255,255,0.08); padding: 2px 6px; border-radius: 4px; color: var(--fg);
}

.grid-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; margin: 24px 0; }
.grid-table th { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line-hot); color: var(--fg); font-weight: 500; }
.grid-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); color: var(--fg-dim); }
.grid-table tr.total td { color: var(--fg); font-weight: 600; border-bottom: none; }

/* The Bottom Footer */
.foot {
  max-width: 800px; margin: 80px auto; padding: 40px var(--gut);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end;
  font-family: var(--sans); font-size: 13px; color: var(--fg-dim);
}
.foot a { color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line-hot); }
.foot a:hover { border-bottom-color: var(--fg); }
.foot-meta { text-align: right; font-family: var(--mono); font-size: 11px; }
.foot-meta span { display: block; }
.deva.small { font-family: var(--deva); font-size: 24px; font-weight: 600; color: var(--fg); margin-bottom: 8px; display: inline-block; }

/* Scroll Cue */
.scroll-cue {
  text-align: center; margin-top: 60px; font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  color: var(--fg-faint); display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-cue i { display: block; width: 1px; height: 24px; background: linear-gradient(to bottom, var(--fg-faint), transparent); }

/* Animation Utility */
.anim {
  opacity: 0; animation: fadeUp 0.6s var(--ease) forwards;
  animation-delay: var(--d);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
