/**
 * DotAgents Documentation Theme
 * Matches dotagents.com + dotagentsprotocol.com design system
 * Dark-first · JetBrains Mono + Inter · technical operator manual
 */

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

/* ── Brand tokens (shared with dotagents.com) ── */
:root {
  --da-bg: #080a0b;
  --da-surface: #111518;
  --da-surface-raised: #151b1f;
  --da-border: #243038;
  --da-border-light: #34424a;
  --da-fg: #d9e0df;
  --da-fg-muted: #98a5a3;
  --da-fg-dim: #66706f;
  --da-accent-green: #4ec9b0;
  --da-accent-blue: #569cd6;
  --da-accent-amber: #ce9178;
  --da-accent-rose: #d16969;
  --da-accent-cyan: #9cdcfe;
  --da-accent-violet: #b392f0;
  --da-accent-teal: #73c991;
  --da-shadow-card: 0 18px 46px rgba(0, 0, 0, 0.24);

  /* Docusaurus overrides – light mode */
  --ifm-color-primary: #16866f;
  --ifm-color-primary-dark: #137760;
  --ifm-color-primary-darker: #106953;
  --ifm-color-primary-darkest: #0c4d3e;
  --ifm-color-primary-light: #25a98d;
  --ifm-color-primary-lighter: #4ec9b0;
  --ifm-color-primary-lightest: #91e8d3;
  --ifm-code-font-size: 95%;
  --ifm-font-family-base: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --ifm-font-family-monospace: 'JetBrains Mono', ui-monospace, monospace;
  --ifm-heading-font-weight: 700;
  --docusaurus-highlighted-code-line-bg: rgba(78, 201, 176, 0.12);
}

/* ── Dark mode – the primary mode ── */
[data-theme='dark'] {
  --ifm-color-primary: #4ec9b0;
  --ifm-color-primary-dark: #31b69a;
  --ifm-color-primary-darker: #25a98d;
  --ifm-color-primary-darkest: #16866f;
  --ifm-color-primary-light: #78dcc6;
  --ifm-color-primary-lighter: #9eead9;
  --ifm-color-primary-lightest: #cef7ee;
  --ifm-background-color: var(--da-bg);
  --ifm-background-surface-color: var(--da-surface);
  --ifm-navbar-background-color: rgba(8, 10, 11, 0.92);
  --ifm-footer-background-color: #0a0a0a;
  --ifm-font-color-base: var(--da-fg);
  --ifm-heading-color: #fff;
  --ifm-link-color: var(--da-accent-cyan);
  --ifm-link-hover-color: #f7fffc;
  --ifm-menu-color: var(--da-fg-muted);
  --ifm-menu-color-active: #fff;
  --ifm-toc-link-color: var(--da-fg-muted);
  --ifm-breadcrumb-color-active: #fff;
  --ifm-tabs-color-active: var(--da-accent-green);
  --ifm-hr-border-color: var(--da-border);
  --ifm-card-background-color: var(--da-surface);
  --docusaurus-highlighted-code-line-bg: rgba(78, 201, 176, 0.14);
}

/* ── Global body ── */
[data-theme='dark'] body {
  background: var(--da-bg);
}

/* ── Navbar ── */
.navbar {
  box-shadow: none;
}

[data-theme='dark'] .navbar {
  border-bottom: 1px solid var(--da-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.navbar__title {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 800;
  letter-spacing: 0;
  color: #fff;
}

.navbar__link {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0;
}

[data-theme='dark'] .navbar__link {
  color: var(--da-fg-muted);
}

[data-theme='dark'] .navbar__link:hover,
[data-theme='dark'] .navbar__link--active {
  color: var(--da-fg);
}

/* ── Sidebar ── */
.menu__link {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

[data-theme='dark'] .menu__link {
  color: var(--da-fg-muted);
}

[data-theme='dark'] .menu__link:hover {
  color: var(--da-fg);
  background: rgba(255, 255, 255, 0.03);
}

[data-theme='dark'] .menu__link--active:not(.menu__link--sublist) {
  color: #fff;
  border-left: 2px solid var(--da-accent-green);
  padding-left: calc(var(--ifm-menu-link-padding-horizontal) - 2px);
  background: rgba(78, 201, 176, 0.07);
}

[data-theme='dark'] .menu__list-item-collapsible:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* ── Headings ── */
[data-theme='dark'] h1,
[data-theme='dark'] h2,
[data-theme='dark'] h3,
[data-theme='dark'] h4 {
  color: #fff;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

/* ── Code blocks ── */
.prism-code {
  border-radius: 8px;
}

[data-theme='dark'] pre {
  background-color: #101010 !important;
  border: 1px solid var(--da-border) !important;
  border-radius: 8px !important;
}

[data-theme='dark'] code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  border-radius: 4px;
}

[data-theme='dark'] :not(pre) > code {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--da-border);
  color: var(--da-accent-cyan);
  padding: 2px 6px;
}

/* ── Tables ── */
table {
  display: table;
  width: 100%;
}

[data-theme='dark'] table {
  border-collapse: collapse;
}

[data-theme='dark'] table th {
  background-color: var(--da-surface);
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

[data-theme='dark'] table td,
[data-theme='dark'] table th {
  border-color: var(--da-border);
}

[data-theme='dark'] table tr:nth-child(2n) {
  background-color: rgba(255, 255, 255, 0.015);
}

/* ── Blockquotes ── */
blockquote {
  border-left-color: var(--ifm-color-primary);
}

[data-theme='dark'] blockquote {
  border-left-color: var(--da-accent-amber);
  background-color: rgba(206, 145, 120, 0.06);
  color: var(--da-fg-muted);
}

/* ── Admonitions / alerts ── */
[data-theme='dark'] .alert {
  border-radius: 8px;
  border-width: 1px;
}

/* ── Cards / surfaces ── */
[data-theme='dark'] .card {
  border: 1px solid var(--da-border);
  background: var(--da-surface);
  border-radius: 8px;
  box-shadow: var(--da-shadow-card);
  transition: transform 0.22s ease, border-color 0.22s ease;
}

[data-theme='dark'] .card:hover {
  transform: translateY(-2px);
  border-color: #3a3a3a;
}

/* ── Footer ── */
[data-theme='dark'] .footer {
  border-top: 1px solid var(--da-border);
}

.footer__title {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

[data-theme='dark'] .footer__link-item {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--da-fg-muted);
}

[data-theme='dark'] .footer__link-item:hover {
  color: var(--da-fg);
}

[data-theme='dark'] .footer__copyright {
  color: var(--da-fg-dim);
  font-size: 0.8rem;
}

/* ── TOC (right sidebar) ── */
[data-theme='dark'] .table-of-contents__link {
  color: var(--da-fg-muted);
  font-size: 0.82rem;
}

[data-theme='dark'] .table-of-contents__link:hover,
[data-theme='dark'] .table-of-contents__link--active {
  color: #fff;
}

/* ── Pagination ── */
[data-theme='dark'] .pagination-nav__link {
  border-color: var(--da-border);
  background: var(--da-surface);
  border-radius: 8px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

[data-theme='dark'] .pagination-nav__link:hover {
  border-color: var(--da-border-light);
  transform: translateY(-1px);
}

[data-theme='dark'] .pagination-nav__sublabel {
  color: var(--da-fg-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

[data-theme='dark'] .pagination-nav__label {
  color: #fff;
}

/* ── Breadcrumbs ── */
[data-theme='dark'] .breadcrumbs__link {
  color: var(--da-fg-muted);
  font-size: 0.82rem;
}

[data-theme='dark'] .breadcrumbs__link:hover {
  color: var(--da-fg);
}

/* ── Search ── */
[data-theme='dark'] .DocSearch-Button {
  border: 1px solid var(--da-border) !important;
  background: var(--da-surface) !important;
  border-radius: 8px !important;
}

/* ── Smooth transitions ── */
.menu__link,
.navbar__link {
  transition: color 0.15s ease;
}

/* ── Feature cards (landing page) ── */
.feature-card {
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--da-border);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.38);
}

[data-theme='dark'] .feature-card {
  background: var(--da-surface);
  border-color: var(--da-border);
}

[data-theme='dark'] .feature-card:hover {
  border-color: #3a3a3a;
  background: #171717;
}

/* ── Improve readability ── */
article {
  max-width: 800px;
}

.markdown > h2 {
  margin-top: 2.5rem;
}

.markdown > h3 {
  margin-top: 2rem;
}

/* ── Scrollbar (dark mode) ── */
[data-theme='dark'] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

[data-theme='dark'] ::-webkit-scrollbar-track {
  background: var(--da-bg);
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: var(--da-border);
  border-radius: 4px;
}

[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: var(--da-border-light);
}
