/* ═══════════════ AgentShip Docs Theme ═══════════════
 * Matches agentship-webapp (Inter, indigo/teal, dark default).
 * Readability-first: comfortable line length, spacing, contrast.
 * Inspired by coherent doc themes (e.g. docs.sylph.ai).
 */

/* ─── Font stack (match webapp) ─── */
body {
  --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-stack--headings: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-stack--monospace: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Menlo, monospace;
}

/* ─── Dark mode (default, match webapp) ─── */
body[data-theme="dark"],
body:not([data-theme]) {
  --color-brand-primary: #818cf8;
  --color-brand-content: #a78bfa;

  --color-foreground-primary: #f1f5f9;
  --color-foreground-secondary: #cbd5e1;
  --color-foreground-muted: #64748b;
  --color-foreground-border: rgba(148, 163, 184, 0.12);

  --color-background-primary: #0b0f1a;
  --color-background-secondary: #0f1629;
  --color-background-hover: #1a1f35;
  --color-background-hover--transparent: rgba(26, 31, 53, 0);
  --color-background-border: rgba(148, 163, 184, 0.1);

  --color-sidebar-background: #0f1629;
  --color-sidebar-background-border: rgba(148, 163, 184, 0.08);
  --color-sidebar-brand-text: #f1f5f9;
  --color-sidebar-caption-text: #818cf8;
  --color-sidebar-search-background: rgba(30, 41, 59, 0.5);
  --color-sidebar-search-background--focus: rgba(30, 41, 59, 0.8);
  --color-sidebar-search-border: rgba(148, 163, 184, 0.12);
  --color-sidebar-search-foreground: #f1f5f9;
  --color-sidebar-link-text: #cbd5e1;
  --color-sidebar-link-text--top-level: #f1f5f9;
  --color-sidebar-item-background--current: rgba(124, 58, 237, 0.1);
  --color-sidebar-item-background--hover: rgba(124, 58, 237, 0.06);
  --color-sidebar-item-expander-background--hover: rgba(124, 58, 237, 0.1);

  --color-admonition-background: rgba(124, 58, 237, 0.06);
  --color-card-background: rgba(15, 23, 42, 0.7);
  --color-card-border: rgba(148, 163, 184, 0.08);

  --color-highlight-on-target: rgba(124, 58, 237, 0.12);
  --color-inline-code-background: rgba(124, 58, 237, 0.08);
  --color-code-background: #0f1629;
  --color-code-foreground: #e2e8f0;

  --color-link: #818cf8;
  --color-link--hover: #a78bfa;
  --color-link-underline: rgba(129, 140, 248, 0.3);
  --color-link-underline--hover: rgba(129, 140, 248, 0.6);
}

/* ─── Light mode (match webapp light theme) ─── */
body[data-theme="light"] {
  --color-brand-primary: #7c3aed;
  --color-brand-content: #6d28d9;

  --color-foreground-primary: #1a1726;
  --color-foreground-secondary: #3d3a50;
  --color-foreground-muted: #706c88;
  --color-foreground-border: rgba(0, 0, 0, 0.1);

  --color-background-primary: #f5f4f8;
  --color-background-secondary: #eceaf2;
  --color-background-hover: #e4e2ec;
  --color-background-hover--transparent: rgba(228, 226, 236, 0);
  --color-background-border: rgba(0, 0, 0, 0.08);

  --color-sidebar-background: #eceaf2;
  --color-sidebar-background-border: rgba(0, 0, 0, 0.06);
  --color-sidebar-brand-text: #0e0c1a;
  --color-sidebar-caption-text: #7c3aed;
  --color-sidebar-search-background: rgba(255, 255, 255, 0.55);
  --color-sidebar-search-background--focus: rgba(255, 255, 255, 0.8);
  --color-sidebar-search-border: rgba(0, 0, 0, 0.08);
  --color-sidebar-search-foreground: #1a1726;
  --color-sidebar-link-text: #3d3a50;
  --color-sidebar-link-text--top-level: #0e0c1a;
  --color-sidebar-item-background--current: rgba(124, 58, 237, 0.08);
  --color-sidebar-item-background--hover: rgba(124, 58, 237, 0.05);
  --color-sidebar-item-expander-background--hover: rgba(124, 58, 237, 0.08);

  --color-admonition-background: rgba(124, 58, 237, 0.04);
  --color-card-background: rgba(255, 255, 255, 0.72);
  --color-card-border: rgba(0, 0, 0, 0.07);

  --color-highlight-on-target: rgba(124, 58, 237, 0.08);
  --color-inline-code-background: rgba(124, 58, 237, 0.06);
  --color-code-background: #f1eff4;
  --color-code-foreground: #1e1b24;

  --color-link: #7c3aed;
  --color-link--hover: #6d28d9;
  --color-link-underline: rgba(124, 58, 237, 0.25);
  --color-link-underline--hover: rgba(124, 58, 237, 0.5);
}

/* ─── Typography & readability ─── */
body {
  font-family: var(--font-stack);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

article {
  line-height: 1.7;
  font-size: 1rem;
}

article p {
  margin-bottom: 1rem;
  margin-top: 0;
}

article p:first-of-type {
  margin-top: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-stack--headings);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h1 {
  font-size: 2.25rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--color-foreground-primary);
}

h2 {
  font-size: 1.65rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-foreground-border);
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

h4, h5, h6 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

code, pre, .highlight pre {
  font-family: var(--font-stack--monospace);
}

/* ─── Content width & breathing room ─── */
.furo-main-content .content {
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

@media (max-width: 67em) {
  .furo-main-content .content {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* ─── Code blocks ─── */
.highlight pre,
pre.literal-block {
  border-radius: 8px;
  border: 1px solid var(--color-background-border);
  padding: 1rem 1.25rem;
  line-height: 1.55;
}

body[data-theme="dark"] .highlight pre,
body:not([data-theme]) .highlight pre,
body[data-theme="dark"] pre.literal-block {
  background: var(--color-code-background) !important;
  color: var(--color-code-foreground);
}

/* ─── Inline code ─── */
code.literal {
  border-radius: 4px;
  padding: 0.15em 0.4em;
  font-size: 0.9em;
  background: var(--color-inline-code-background);
  border: 1px solid var(--color-background-border);
}

/* ─── Sidebar brand ─── */
.sidebar-brand-text {
  font-weight: 800;
  letter-spacing: -0.03em;
}

.sidebar-tree .caption,
.sidebar-tree :not(.caption) > .caption-text {
  color: var(--color-sidebar-caption-text);
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-top: 1rem;
}

.sidebar-tree .toctree-l1 > .reference {
  font-weight: 600;
}

/* ─── Admonitions (note=indigo, tip=teal) ─── */
.admonition {
  border-radius: 8px;
  border-left-width: 4px;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
}

.admonition.note {
  border-left-color: #818cf8;
}

.admonition.tip {
  border-left-color: #34d399;
}

.admonition.warning {
  border-left-color: #fbbf24;
}

.admonition.danger,
.admonition.caution {
  border-left-color: #f87171;
}

/* ─── Tables ─── */
table.docutils {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-background-border);
}

table.docutils th {
  background: var(--color-background-secondary);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
}

table.docutils td {
  padding: 0.5rem 0.75rem;
}

/* ─── Lists ─── */
article ul,
article ol {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

article li {
  margin-bottom: 0.35rem;
}

/* ─── Links ─── */
a {
  text-decoration: none;
  border-bottom: 1px solid var(--color-link-underline);
  transition: color 0.15s, border-color 0.15s;
}

a:hover {
  border-bottom-color: var(--color-link-underline--hover);
}

/* ─── Homepage hero (first page only) ─── */
body[data-theme="dark"] .content h1:first-of-type,
body:not([data-theme]) .content h1:first-of-type {
  background: linear-gradient(135deg, #f1f5f9 0%, #a78bfa 50%, #34d399 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body[data-theme="light"] .content h1:first-of-type {
  background: linear-gradient(135deg, #0e0c1a 0%, #7c3aed 50%, #0d9668 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Horizontal rules ─── */
hr.docutils {
  border: none;
  height: 1px;
  background: var(--color-foreground-border);
  margin: 2rem 0;
}

/* ─── Hide right sidebar (TOC) ─── */
input[name="__toc"],
label[for="__toc"],
label.toc-overlay,
.overlay.toc-overlay,
.toc-overlay-icon,
.toc-header-icon,
.toc-drawer,
aside.toc-drawer {
  display: none !important;
}

.furo-main-content {
  margin-right: 0 !important;
  max-width: 100% !important;
}

article {
  max-width: 100% !important;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-foreground-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-foreground-muted);
}
