/* Dattva site-wide theme — dark (default) matches home landing navy */

[data-theme="dark"] {
  --bg: #020617;
  --surface: rgba(9, 17, 34, 0.7);
  --raised: rgba(9, 17, 34, 0.7);
  --border: rgba(255, 255, 255, 0.06);
  --border-hi: rgba(255, 255, 255, 0.08);
  --text: #cbd5e1;
  --text-bright: #f8fafc;
  --text-dim: #94a3b8;
  --muted: #94a3b8;
  --subtle: #64748b;
  --accent: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.14);
  --accent-dim: rgba(37, 99, 235, 0.12);
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 50% 20%, rgba(37, 99, 235, 0.18), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(59, 130, 246, 0.12), transparent 30%),
    radial-gradient(circle at 12% 55%, rgba(99, 102, 241, 0.08), transparent 38%),
    linear-gradient(to bottom, #020817, #030b1a, #020617);
  background-attachment: fixed;
  min-height: 100vh;
}

[data-theme="dark"] body:has(.page-wrap)::before,
[data-theme="dark"] body:has(.article-shell)::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(37, 99, 235, 0.14), transparent 55%),
    radial-gradient(circle at 95% 25%, rgba(59, 130, 246, 0.08), transparent 32%),
    radial-gradient(circle at 5% 75%, rgba(139, 92, 246, 0.05), transparent 40%);
}

[data-theme="dark"] .nav {
  background: rgba(255, 255, 255, 0.95);
  border-bottom-color: rgba(226, 232, 240, 0.9);
}

[data-theme="dark"] .nav-logo {
  color: #0f172a;
}

[data-theme="dark"] .nav-links a {
  color: #94a3b8;
}

[data-theme="dark"] .nav-links a:hover {
  color: #334155;
}

[data-theme="dark"] .nav-links a.active {
  color: #0f172a;
}

.nav .nav-links a.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  letter-spacing: normal;
  transition: background-color 0.15s ease;
  opacity: 1;
}

.nav .nav-links a.nav-cta:hover {
  color: #ffffff;
  background: #1d4ed8;
  opacity: 1;
}

[data-theme="dark"] .nav-cta,
[data-theme="light"] .nav-cta {
  color: #ffffff;
  background: #2563eb;
}

[data-theme="dark"] .article-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .footer {
  background: rgba(2, 8, 23, 0.55);
}

/* ── Research page: icon + knob switch (research pages only) ── */

.research-theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 58px;
  height: 30px;
  padding: 0 5px 0 9px;
  border-radius: 999px;
  border: 1.5px solid #0f172a;
  background: transparent;
  color: #0f172a;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.research-theme-switch:hover {
  border-color: #334155;
}

[data-theme="dark"] .research-theme-switch {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.research-theme-switch-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.research-theme-switch-sun,
.research-theme-switch-moon {
  width: 14px;
  height: 14px;
}

.research-theme-switch-sun {
  display: block;
}

.research-theme-switch-moon {
  display: none;
}

[data-theme="dark"] .research-theme-switch-sun {
  display: none;
}

[data-theme="dark"] .research-theme-switch-moon {
  display: block;
}

.research-theme-switch-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #0f172a;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] .research-theme-switch-knob {
  background: #fff;
  border-color: #fff;
}

/* ── Theme toggle (Day / Night pills) — all pages except research ── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #94a3b8);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  line-height: 1;
  white-space: nowrap;
}

.theme-toggle-btn:hover {
  color: var(--text, #334155);
}

.theme-toggle-btn.active[data-theme-choice="light"] {
  background: #e5e7eb;
  color: #0f172a;
  border-color: #d1d5db;
}

.theme-toggle-btn.active[data-theme-choice="dark"] {
  background: #0f172a;
  color: #f8fafc;
  border-color: #1e293b;
}

.theme-toggle-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

[data-theme="dark"] .theme-toggle-btn:not(.active) {
  color: #64748b;
}

[data-theme="dark"] .theme-toggle-btn:not(.active):hover {
  color: #94a3b8;
}

@media (max-width: 720px) {
  .nav-links {
    display: flex !important;
    align-items: center;
    gap: 0;
  }

  .nav-links > li:not(:has(.theme-toggle)):not(:has(.research-theme-switch)) {
    display: none;
  }

  .theme-toggle {
    position: static;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .theme-toggle-label {
    display: none;
  }

  .theme-toggle-btn {
    padding: 8px 10px;
  }
}
