:root {
  --ink: #0e1116;
  --panel: #161b22;
  --panel-raised: #1c222b;
  --fog: #2a3140;
  --paper: #e8eaed;
  --muted: #8a93a6;
  --signal: #f5b942;   /* amber — answers */
  --wave: #4fd1c5;      /* cyan — voice / listening */
  --danger: #e5757a;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius-lg: 24px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ---------- HOME VIEW ---------- */

.home-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hero {
  width: 100%;
  max-width: 640px;
  text-align: center;
}

.wordmark-hero {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 5rem);
  letter-spacing: 0.02em;
  margin: 0;
  background: linear-gradient(135deg, var(--paper) 40%, var(--wave) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  margin: 8px 0 40px;
}

/* ---------- SEARCH PILL / WAVEFORM ---------- */

.search-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--fog);
  border-radius: 999px;
  padding: 10px 10px 10px 22px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

.search-pill:focus-within {
  border-color: var(--wave);
  box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.15), 0 12px 40px rgba(0,0,0,0.35);
}

.search-pill.small {
  padding: 6px 6px 6px 16px;
  max-width: 520px;
  flex: 1;
}

.wave-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.35;
}

.wave-path {
  fill: none;
  stroke: var(--fog);
  stroke-width: 1.5;
  transition: stroke 0.3s ease;
}

.search-pill.listening .wave-path { stroke: var(--wave); }
.search-pill.thinking .wave-path { stroke: var(--signal); }

.search-input {
  position: relative;
  z-index: 1;
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 10px 0;
}

.search-input::placeholder { color: var(--muted); }

.mic-btn, .go-btn {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: var(--paper);
  background: var(--panel-raised);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.mic-btn:hover, .go-btn:hover { background: var(--fog); }
.mic-btn:active, .go-btn:active { transform: scale(0.94); }

.mic-btn.active {
  background: var(--wave);
  color: var(--ink);
}

.go-btn {
  background: var(--signal);
  color: var(--ink);
}
.go-btn:hover { background: #f8c766; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--fog);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chip:hover {
  border-color: var(--wave);
  color: var(--paper);
}

.mic-status {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--wave);
  min-height: 1.2em;
  margin-top: 16px;
}

/* ---------- RESULTS VIEW ---------- */

.results-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.results-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 0 28px;
  position: sticky;
  top: 0;
  background: linear-gradient(var(--ink) 80%, transparent);
  z-index: 5;
}

.wordmark-small {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.results-content { display: flex; flex-direction: column; gap: 18px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 10px;
}

.answer-card {
  background: var(--panel);
  border: 1px solid var(--fog);
  border-left: 3px solid var(--signal);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.answer-text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--paper);
}

.answer-text .cite {
  font-family: var(--font-mono);
  font-size: 0.75em;
  color: var(--wave);
  cursor: pointer;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--fog);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.result-card:hover {
  border-color: var(--wave);
  transform: translateY(-1px);
}

.result-index {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  width: 20px;
}

.result-domain {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--wave);
  margin-bottom: 4px;
}

.result-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--paper);
}

.result-desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.state-message {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  padding: 20px 2px;
}

.state-message.error { color: var(--danger); }

@media (max-width: 480px) {
  .results-topbar { flex-wrap: wrap; }
  .wordmark-small { width: 100%; }
}
