/* ─────────────────────────────  Base typography  ───────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&display=swap');

body { font-family: 'Inter', system-ui, sans-serif; background: #f8f9f6; }
.serif, h1, h2, h3 { font-family: 'Source Serif 4', Georgia, serif; }
.stat-num { font-feature-settings: 'tnum' 1; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Subtle topographic page background */
body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='20' viewBox='0 0 100 20'%3E%3Cpath d='M21.184 20c.357-.13.72-.264 1.088-.402l1.768-.661C33.64 15.347 39.647 14 50 14c10.271 0 15.362 1.222 24.629 4.928.955.383 1.869.74 2.75 1.072h6.225c-2.51-.73-5.139-1.691-8.233-2.928C65.888 13.278 60.562 12 50 12c-10.626 0-16.855 1.397-26.66 5.063l-1.767.662c-2.475.923-4.66 1.674-6.724 2.275h6.335zm0-20C13.258 2.892 8.077 4 0 4V2c5.744 0 9.951-.574 14.85-2h6.334zM77.38 0C85.239 2.966 90.502 4 100 4V2c-6.842 0-11.386-.542-16.396-2h-6.225zM0 14c8.44 0 13.718-1.21 22.272-4.402l1.768-.661C33.64 5.347 39.647 4 50 4c10.271 0 15.362 1.222 24.629 4.928C84.112 12.722 89.438 14 100 14v-2c-10.271 0-15.362-1.222-24.629-4.928C65.888 3.278 60.562 2 50 2 39.374 2 33.145 3.397 23.34 7.063l-1.767.662C13.223 10.84 8.163 12 0 12v2z' fill='%23006d3b' fill-opacity='0.04' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* ─────────────────────────────  Layered hero  ───────────────────────────── */
.hero-section { position: relative; overflow: hidden; background-color: #003a1f; }
.hero-bg-image    { position: absolute; inset: 0; background-image: url('photo.jpg'); background-size: cover; background-position: center; opacity: 0.55; }
.hero-bg-gradient { position: absolute; inset: 0; background:
    radial-gradient(ellipse at 20% 30%, rgba(0,109,59,0.6), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(58,138,150,0.35), transparent 60%),
    linear-gradient(180deg, #002818 0%, #003a1f 40%, #005a30 100%);
}
.hero-bg-pattern {
  position: absolute; inset: 0; opacity: 0.12;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(0,40,24,0.65) 100%); }

/* ─────────────────────────────  Card + interaction polish  ───────────────────────────── */
.search-glow:focus { box-shadow: 0 0 0 3px rgba(0,109,59,0.18); }

#results > .doc-row, .fact-card-hover {
  background: #fff;
  border: 1px solid #dcefe2;
  border-radius: 12px;
  padding: 14px 16px;
  transition: all 0.18s ease;
  position: relative;
  cursor: default;
}
#results > .doc-row:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,90,48,0.08); border-color: #b8dec5; }
#results > .doc-row::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: linear-gradient(180deg, #006d3b, #3d9261); border-radius: 12px 0 0 12px;
}

.fade-in { animation: fadeIn 0.4s cubic-bezier(0.4,0,0.2,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

#mic-btn.recording { background: #fee2e2 !important; color: #dc2626 !important; }

/* Quick chip styling */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 3px 10px; border-radius: 9999px;
  background: #f0f9f3; color: #005a30; border: 1px solid #dcefe2;
  cursor: pointer; transition: all 0.15s ease;
}
.chip:hover { background: #dcefe2; border-color: #b8dec5; }
.chip.active { background: #006d3b; color: white; border-color: #006d3b; }
.chip-count { color: #5fac7c; font-size: 10px; font-weight: 600; }

/* Optgroup styling */
select optgroup { font-weight: 600; color: #005a30; background: #f0f9f3; }
select optgroup option { font-weight: 400; padding-left: 14px; color: #1f2937; }

/* Fund tooltip */
#fund-tooltip { animation: fadeIn 0.15s ease; }

/* Download summary */
#download-summary { font-size: 13px; }
#download-summary .summary-card {
  background: #f0f9f3; border: 1px solid #b8dec5; border-radius: 12px; padding: 16px;
  color: #003a1f;
}
#download-summary .summary-card.err  { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }
#download-summary .summary-card.warn { background: #fffbeb; border-color: #fde68a; color: #78350f; }
#download-summary details summary { cursor: pointer; padding: 6px 0; color: #005a30; font-weight: 500; }
#download-summary ul { margin: 4px 0 0 16px; font-family: ui-monospace, monospace; font-size: 11px; }

/* Health pill */
#health-dot.ok  { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }
#health-dot.err { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.18); }

/* Result row internals */
.doc-row .doc-title { font-weight: 600; color: #003a1f; font-size: 13px; line-height: 1.35; }
.doc-row .doc-meta  { color: #475569; font-size: 11px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 10px; }
.doc-row .doc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.doc-row .badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px;
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  background: #f0f9f3; color: #005a30;
}
