/* ── retrAI docs — cohesive dark theme ── */

/* ── Design Tokens ── */
:root {
  --retrai-bg: #0d1117;
  --retrai-bg-surface: #161b22;
  --retrai-bg-elevated: #1c2128;
  --retrai-border: rgba(139, 92, 246, 0.15);
  --retrai-border-focus: rgba(139, 92, 246, 0.4);
  --retrai-violet: #8b5cf6;
  --retrai-violet-light: #a78bfa;
  --retrai-violet-pale: #c4b5fd;
  --retrai-violet-white: #ddd6fe;
  --retrai-text: #e6edf3;
  --retrai-text-muted: #9ca3af;
  --retrai-text-subtle: #bcc5d0;
  --retrai-glow: rgba(139, 92, 246, 0.12);
}

/* ── Global overrides (slate / dark mode) ── */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--retrai-bg);
  --md-default-fg-color: var(--retrai-text);
  --md-primary-fg-color: var(--retrai-violet);
  --md-primary-bg-color: var(--retrai-bg-surface);
  --md-accent-fg-color: var(--retrai-violet-light);
  --md-typeset-a-color: var(--retrai-violet-light);
  --md-code-bg-color: var(--retrai-bg-surface);
}

/* ── Header — unified bar ── */
[data-md-color-scheme="slate"] .md-header {
  background: var(--retrai-bg-surface) !important;
  border-bottom: 1px solid var(--retrai-border);
  box-shadow: none;
}

[data-md-color-scheme="slate"] .md-header__title {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--retrai-text) !important;
}

/* Header logo — fix the white bg on the PNG */
[data-md-color-scheme="slate"] .md-header__button.md-logo img {
  filter: drop-shadow(0 0 0 transparent);
  mix-blend-mode: screen;
  border-radius: 6px;
}

/* ── Navigation tabs — VISIBLE on dark bg ── */
[data-md-color-scheme="slate"] .md-tabs {
  background: var(--retrai-bg-surface) !important;
  border-bottom: 1px solid var(--retrai-border);
}

[data-md-color-scheme="slate"] .md-tabs__link {
  color: var(--retrai-text-subtle) !important;
  opacity: 1 !important;
  font-weight: 500;
  transition: color 0.2s ease;
}

[data-md-color-scheme="slate"] .md-tabs__link:hover {
  color: #fff !important;
}

[data-md-color-scheme="slate"] .md-tabs__link--active {
  color: var(--retrai-violet-pale) !important;
  font-weight: 600;
}

/* ── Page body ── */
[data-md-color-scheme="slate"] .md-main {
  background: var(--retrai-bg) !important;
}

/* ── Sidebar ── */
[data-md-color-scheme="slate"] .md-sidebar {
  background: var(--retrai-bg) !important;
}

[data-md-color-scheme="slate"] .md-nav__link {
  color: var(--retrai-text-muted) !important;
}

[data-md-color-scheme="slate"] .md-nav__link--active {
  color: var(--retrai-violet-light) !important;
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-nav__link:hover {
  color: var(--retrai-text) !important;
}

/* ── Hero section ── */
.hero {
  text-align: center;
  padding: 4rem 2rem 3rem;
  background: var(--retrai-bg-surface);
  border-radius: 16px;
  margin-bottom: 2.5rem;
  border: 1px solid var(--retrai-border-focus);
  box-shadow:
    0 0 80px var(--retrai-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

/* Gradient glow behind hero */
.hero::before {
  content: "";
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 500px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.15) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.hero>* {
  position: relative;
  z-index: 1;
}

/* Hero logo — remove white background */
.hero img {
  mix-blend-mode: screen;
  border-radius: 12px;
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg,
      #fff 0%,
      var(--retrai-violet-white) 25%,
      var(--retrai-violet-pale) 50%,
      var(--retrai-violet-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--retrai-text-subtle);
  font-size: 1.2rem;
  max-width: 540px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero .badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: var(--retrai-violet-pale);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0.2rem;
  transition: all 0.2s ease;
}

.hero .badge:hover {
  background: rgba(139, 92, 246, 0.22);
  border-color: rgba(139, 92, 246, 0.55);
  transform: translateY(-1px);
}

/* ── Code blocks ── */
[data-md-color-scheme="slate"] .md-typeset pre {
  border-radius: 10px;
  border: 1px solid var(--retrai-border);
  background: var(--retrai-bg-surface) !important;
}

[data-md-color-scheme="slate"] .highlight {
  background: var(--retrai-bg-surface) !important;
}

/* ── Admonitions ── */
[data-md-color-scheme="slate"] .admonition {
  border-left-color: var(--retrai-violet) !important;
  background: var(--retrai-bg-elevated) !important;
  border-radius: 8px;
}

/* ── Tables ── */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  border: 1px solid var(--retrai-border);
  border-radius: 10px;
  overflow: hidden;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: var(--retrai-bg-elevated);
  color: var(--retrai-violet-pale);
  font-weight: 600;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) td {
  border-top: 1px solid var(--retrai-border);
}

/* ── Grid cards ── */
[data-md-color-scheme="slate"] .md-typeset .grid.cards>ul>li {
  background: var(--retrai-bg-surface) !important;
  border: 1px solid var(--retrai-border) !important;
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards>ul>li:hover {
  border-color: var(--retrai-border-focus) !important;
  box-shadow: 0 0 24px var(--retrai-glow);
}

/* ── Mermaid diagrams ── */
[data-md-color-scheme="slate"] .mermaid {
  background: var(--retrai-bg-surface);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid var(--retrai-border);
}

/* ── Footer ── */
[data-md-color-scheme="slate"] .md-footer {
  background: var(--retrai-bg-surface) !important;
  border-top: 1px solid var(--retrai-border);
}

/* ── Table of contents label ── */
[data-md-color-scheme="slate"] .md-nav--secondary>.md-nav__title {
  color: var(--retrai-text-muted);
  box-shadow: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

/* ── Search ── */
[data-md-color-scheme="slate"] .md-search__form {
  background: var(--retrai-bg-elevated) !important;
  border: 1px solid var(--retrai-border);
  border-radius: 8px;
}

/* ── Content links ── */
[data-md-color-scheme="slate"] .md-typeset a {
  color: var(--retrai-violet-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

[data-md-color-scheme="slate"] .md-typeset a:hover {
  border-bottom-color: var(--retrai-violet-light);
}

/* ── Content tabs ── */
[data-md-color-scheme="slate"] .md-typeset .tabbed-labels>label {
  color: var(--retrai-text-muted);
}

[data-md-color-scheme="slate"] .md-typeset .tabbed-labels>label--active,
[data-md-color-scheme="slate"] .md-typeset .tabbed-labels>label:hover {
  color: var(--retrai-violet-light);
}

/* ── Headings ── */
[data-md-color-scheme="slate"] .md-typeset h1,
[data-md-color-scheme="slate"] .md-typeset h2 {
  color: var(--retrai-text) !important;
  font-weight: 700;
}

[data-md-color-scheme="slate"] .md-typeset h2 {
  border-bottom: 1px solid var(--retrai-border);
  padding-bottom: 0.4rem;
}