/* ==========================================================================
   adk-fluent — Documentation Design System
   A cohesive visual language for world-class developer documentation.

   Architecture:
     1. Design tokens (CSS custom properties)
     2. Theme transitions & dark mode
     3. Typography system
     4. Code presentation
     5. Navigation & wayfinding
     6. Content containers (cards, admonitions, tabs, tables)
     7. Hero & landing page
     8. API reference polish
     9. Reading progress & UX
    10. Responsive & print
    11. Accessibility
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */

:root {
  /* ---- Brand ---- */
  --adk-accent: #4f46e5;
  --adk-accent-hover: #4338ca;
  --adk-accent-light: #6366f1;
  --adk-accent-lighter: #818cf8;
  --adk-accent-bg: #eef2ff;
  --adk-accent-bg-hover: #e0e7ff;

  /* ---- Semantic palette ---- */
  --adk-success: #059669;
  --adk-success-bg: #ecfdf5;
  --adk-warning: #d97706;
  --adk-warning-bg: #fffbeb;
  --adk-danger: #dc2626;
  --adk-danger-bg: #fef2f2;
  --adk-info: #0284c7;
  --adk-info-bg: #f0f9ff;

  /* ---- Surfaces ---- */
  --adk-surface: #f8fafc;
  --adk-surface-raised: #ffffff;
  --adk-border: #e2e8f0;
  --adk-border-hover: #cbd5e1;
  --adk-text-muted: #64748b;
  --adk-text-faint: #94a3b8;

  /* ---- Gradients ---- */
  --adk-gradient-start: #4f46e5;
  --adk-gradient-mid: #7c3aed;
  --adk-gradient-end: #a855f7;
  --adk-hero-bg: linear-gradient(135deg, #eef2ff 0%, #faf5ff 50%, #f0fdf4 100%);

  /* ---- Elevation ---- */
  --adk-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --adk-shadow-md: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --adk-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.07), 0 4px 10px rgba(0, 0, 0, 0.04);
  --adk-shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.04);

  /* ---- Motion ---- */
  --adk-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --adk-duration: 0.2s;
  --adk-transition: var(--adk-duration) var(--adk-ease);

  /* ---- Radii ---- */
  --adk-radius-sm: 6px;
  --adk-radius-md: 8px;
  --adk-radius-lg: 12px;
  --adk-radius-pill: 100px;

  /* ---- Spacing ---- */
  --adk-content-gap: 1.5rem;

  /* ---- Mermaid ---- */
  --mermaid-font-family: var(--font-stack);

  /* ---- Reading progress ---- */
  --adk-progress: 0%;
}


/* --------------------------------------------------------------------------
   Dark mode tokens
   -------------------------------------------------------------------------- */

[data-theme="dark"] {
  --adk-accent: #818cf8;
  --adk-accent-hover: #a5b4fc;
  --adk-accent-light: #a5b4fc;
  --adk-accent-lighter: #c7d2fe;
  --adk-accent-bg: rgba(99, 102, 241, 0.1);
  --adk-accent-bg-hover: rgba(99, 102, 241, 0.18);

  --adk-success: #34d399;
  --adk-success-bg: rgba(5, 150, 105, 0.1);
  --adk-warning: #fbbf24;
  --adk-warning-bg: rgba(217, 119, 6, 0.1);
  --adk-danger: #f87171;
  --adk-danger-bg: rgba(220, 38, 38, 0.1);
  --adk-info: #38bdf8;
  --adk-info-bg: rgba(2, 132, 199, 0.1);

  --adk-surface: #131c31;
  --adk-surface-raised: #1a2540;
  --adk-border: #1e2d4a;
  --adk-border-hover: #2d3f5e;
  --adk-text-muted: #94a3b8;
  --adk-text-faint: #64748b;

  --adk-hero-bg: linear-gradient(
    135deg,
    rgba(49, 46, 129, 0.2) 0%,
    rgba(88, 28, 135, 0.15) 50%,
    rgba(6, 78, 59, 0.08) 100%
  );

  --adk-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);
  --adk-shadow-md: 0 1px 3px rgba(0, 0, 0, 0.2);
  --adk-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.25);
  --adk-shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);
}


/* ==========================================================================
   2. THEME TRANSITIONS & DARK MODE
   ========================================================================== */

/* Smooth color transitions when toggling theme */
body,
.sidebar-drawer,
.page,
.content,
.toc-drawer {
  transition:
    background-color 0.3s var(--adk-ease),
    color 0.3s var(--adk-ease),
    border-color 0.3s var(--adk-ease);
}

/* Mermaid diagrams: use Furo's built-in dark awareness instead of invert hack */
[data-theme="dark"] .mermaid {
  filter: none;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}


/* ==========================================================================
   3. TYPOGRAPHY SYSTEM
   ========================================================================== */

/* ---- Headings ---- */

.content h1 {
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 0;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--adk-accent);
}

.content h2 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--adk-border);
}

.content h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2rem;
  color: var(--color-foreground-primary);
}

.content h4 {
  font-weight: 600;
  margin-top: 1.5rem;
}

/* ---- Body text ---- */

.content p {
  line-height: 1.75;
}

.content li {
  line-height: 1.7;
}

/* ---- Inline code: refined pill ---- */
/* Exclude code inside headings (API method signatures get their own treatment) */

.content code:not(pre code):not(h1 code):not(h2 code):not(h3 code):not(h4 code) {
  background: var(--adk-accent-bg);
  color: var(--adk-accent);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--adk-transition), border-color var(--adk-transition);
}

.content code:not(pre code):not(h1 code):not(h2 code):not(h3 code):not(h4 code):hover {
  border-color: var(--adk-accent-light);
}

[data-theme="dark"] .content code:not(pre code):not(h1 code):not(h2 code):not(h3 code):not(h4 code) {
  background: rgba(99, 102, 241, 0.12);
  color: var(--adk-accent-lighter);
}

/* Code inside headings: clean monospace, no pill background */
.content h1 code,
.content h2 code,
.content h3 code,
.content h4 code {
  background: none;
  color: inherit;
  padding: 0;
  border: none;
  font-size: 0.9em;
  font-weight: 600;
}

/* ---- Links ---- */

.content a:not(.sd-card):not(.headerlink) {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--adk-transition), text-decoration-color var(--adk-transition);
}

.content a:not(.sd-card):not(.headerlink):hover {
  text-decoration-thickness: 2px;
}

/* ---- Header anchor links (pilcrow ¶) ---- */

.headerlink {
  opacity: 0;
  font-size: 0.7em;
  padding-left: 0.3em;
  color: var(--adk-text-faint);
  text-decoration: none;
  transition: opacity var(--adk-transition), color var(--adk-transition);
  vertical-align: middle;
}

h1:hover .headerlink,
h2:hover .headerlink,
h3:hover .headerlink,
h4:hover .headerlink,
.headerlink:focus-visible {
  opacity: 1;
}

.headerlink:hover {
  color: var(--adk-accent);
  opacity: 1;
}


/* ==========================================================================
   4. CODE PRESENTATION
   ========================================================================== */

/* ---- Code blocks ---- */

.content pre {
  border: 1px solid var(--adk-border);
  border-left: 3px solid var(--adk-accent);
  border-radius: var(--adk-radius-md);
  box-shadow: var(--adk-shadow-md);
  margin: var(--adk-content-gap) 0;
  transition: box-shadow var(--adk-transition), border-color var(--adk-transition);
  position: relative;
}

.content pre:hover {
  box-shadow: var(--adk-shadow-lg);
  border-color: var(--adk-border-hover);
  border-left-color: var(--adk-accent);
}

/* ---- Copy button ---- */

.content pre .copybtn {
  opacity: 0;
  transition: opacity var(--adk-transition), background var(--adk-transition);
  border-radius: var(--adk-radius-sm);
}

.content pre:hover .copybtn {
  opacity: 0.6;
}

.content pre .copybtn:hover {
  opacity: 1;
  background: var(--adk-accent);
  color: white;
}

/* Copy success state — brief green flash */
.content pre .copybtn.success {
  opacity: 1;
  background: var(--adk-success);
  color: white;
  transition: background 0.15s var(--adk-ease);
}

/* ---- Language labels via highlight class ---- */

.content .highlight[class*="highlight-"] {
  position: relative;
}

.content .highlight[class*="highlight-"]::before {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.15rem 0.6rem;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-stack--monospace);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--adk-text-faint);
  background: var(--adk-surface);
  border-bottom-left-radius: var(--adk-radius-sm);
  border-left: 1px solid var(--adk-border);
  border-bottom: 1px solid var(--adk-border);
  z-index: 1;
  pointer-events: none;
}

.content .highlight-python::before { content: "python"; }
.content .highlight-bash::before,
.content .highlight-shell::before,
.content .highlight-console::before { content: "shell"; }
.content .highlight-yaml::before { content: "yaml"; }
.content .highlight-json::before { content: "json"; }
.content .highlight-toml::before { content: "toml"; }
.content .highlight-javascript::before,
.content .highlight-js::before { content: "js"; }
.content .highlight-typescript::before,
.content .highlight-ts::before { content: "ts"; }
.content .highlight-text::before { content: "text"; }
.content .highlight-markdown::before,
.content .highlight-md::before { content: "md"; }
.content .highlight-ini::before { content: "ini"; }
.content .highlight-diff::before { content: "diff"; }


/* ==========================================================================
   5. NAVIGATION & WAYFINDING
   ========================================================================== */

/* ---- Active sidebar item ---- */

.sidebar-tree .current-page > .reference {
  font-weight: 700;
  color: var(--adk-accent);
  border-right: 3px solid var(--adk-accent);
  padding-right: 0.5rem;
}

/* ---- Sidebar section captions ---- */

.sidebar-tree .caption {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--adk-text-muted);
  font-weight: 700;
  margin-top: 1.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--adk-border);
}

/* ---- "On this page" (TOC sidebar) ---- */

.toc-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--adk-text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--adk-border);
  margin-bottom: 0.5rem;
}

.toc-tree a {
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 0.2rem 0;
  color: var(--adk-text-muted);
  transition: color var(--adk-transition), border-color var(--adk-transition);
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
  display: block;
}

.toc-tree a:hover {
  color: var(--adk-accent);
  border-left-color: var(--adk-accent-lighter);
}

.toc-tree a.active {
  color: var(--adk-accent);
  font-weight: 600;
  border-left-color: var(--adk-accent);
}

/* ---- Reading progress bar ---- */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--adk-progress);
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--adk-gradient-start),
    var(--adk-gradient-mid),
    var(--adk-gradient-end)
  );
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 2px 0;
}


/* ==========================================================================
   6. CONTENT CONTAINERS
   ========================================================================== */

/* ---- Cards ---- */

.sd-card {
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-lg);
  box-shadow: var(--adk-shadow-md);
  transition: all var(--adk-transition);
  overflow: hidden;
}

.sd-card:hover {
  box-shadow: var(--adk-shadow-lg);
  transform: translateY(-2px);
  border-color: var(--adk-accent-light);
}

.sd-card .sd-card-header {
  background: var(--adk-accent-bg);
  border-bottom: 1px solid var(--adk-border);
  font-weight: 600;
}

.sd-card .sd-card-body {
  padding: 1.2rem;
}

/* Card title links */
.sd-card .sd-card-title a {
  color: var(--color-foreground-primary);
  text-decoration: none;
  font-weight: 600;
}

.sd-card:hover .sd-card-title a {
  color: var(--adk-accent);
}


/* ---- Admonitions ---- */

.admonition {
  border-radius: var(--adk-radius-md);
  border: 1px solid var(--adk-border);
  border-left: 4px solid;
  box-shadow: var(--adk-shadow-sm);
  margin: var(--adk-content-gap) 0;
  overflow: hidden;
}

.admonition.important,
.admonition.note {
  border-left-color: var(--adk-accent);
  background: var(--adk-accent-bg);
}

.admonition.tip,
.admonition.hint {
  border-left-color: var(--adk-success);
  background: var(--adk-success-bg);
}

.admonition.warning,
.admonition.caution {
  border-left-color: var(--adk-warning);
  background: var(--adk-warning-bg);
}

.admonition.danger,
.admonition.error {
  border-left-color: var(--adk-danger);
  background: var(--adk-danger-bg);
}

.admonition .admonition-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}


/* ---- Tab sets ---- */

.sd-tab-set {
  border-radius: var(--adk-radius-md);
  overflow: hidden;
  border: 1px solid var(--adk-border);
  box-shadow: var(--adk-shadow-md);
  margin: var(--adk-content-gap) 0;
}

.sd-tab-set > label {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.6rem 1.2rem;
  transition: all var(--adk-transition);
  border-bottom: 2px solid transparent;
}

.sd-tab-set > label:hover {
  background: var(--adk-accent-bg);
}

.sd-tab-set > input:checked + label {
  border-bottom-color: var(--adk-accent);
  color: var(--adk-accent);
}


/* ---- Tables ---- */

.content table {
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-md);
  overflow: hidden;
  width: 100%;
  margin: var(--adk-content-gap) 0;
  box-shadow: var(--adk-shadow-sm);
}

.content table thead th {
  background: var(--adk-accent-bg);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--adk-accent);
  text-align: left;
}

.content table tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--adk-border);
  font-size: 0.92rem;
}

.content table tbody tr:last-child td {
  border-bottom: none;
}

.content table tbody tr {
  transition: background var(--adk-transition);
}

.content table tbody tr:hover {
  background: var(--adk-accent-bg);
}

[data-theme="dark"] .content table thead th {
  background: rgba(99, 102, 241, 0.08);
}


/* ---- Blockquotes ---- */

.content blockquote {
  border-left: 3px solid var(--adk-accent);
  background: var(--adk-accent-bg);
  padding: 0.75rem 1.25rem;
  border-radius: 0 var(--adk-radius-md) var(--adk-radius-md) 0;
  margin: var(--adk-content-gap) 0;
  font-size: 0.92rem;
}

.content blockquote p {
  margin: 0.25rem 0;
}


/* ---- Definition lists (API docs) ---- */

.content dl dt {
  font-weight: 600;
  margin-top: 1rem;
}

.content dl dd {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--adk-border);
}


/* ---- "See also" admonition ---- */

.seealso {
  border: 1px solid var(--adk-border);
  border-left: 3px solid var(--adk-accent-light);
  border-radius: var(--adk-radius-md);
  padding: 0.75rem 1rem;
  background: var(--adk-surface);
}

.seealso .admonition-title {
  font-size: 0.75rem;
}


/* ==========================================================================
   7. HERO & LANDING PAGE
   ========================================================================== */

.hero-section {
  background: var(--adk-hero-bg);
  border-radius: var(--adk-radius-lg);
  padding: 3rem 2.5rem;
  margin: -1rem -0.5rem 2.5rem -0.5rem;
  text-align: center;
  border: 1px solid var(--adk-border);
  position: relative;
  overflow: hidden;
}

/* Subtle grid pattern overlay */
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 70, 229, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

[data-theme="dark"] .hero-section::before {
  background-image:
    linear-gradient(rgba(129, 140, 248, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(129, 140, 248, 0.04) 1px, transparent 1px);
}

.hero-section h1 {
  border: none;
  font-size: 2.4rem;
  background: linear-gradient(
    135deg,
    var(--adk-gradient-start),
    var(--adk-gradient-mid),
    var(--adk-gradient-end)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  position: relative;
}

.hero-section .hero-tagline {
  font-size: 1.15rem;
  color: var(--adk-text-muted);
  max-width: 600px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
  position: relative;
}

/* ---- Hero stats ---- */

.hero-section .hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  position: relative;
}

.hero-section .hero-stat {
  text-align: center;
}

.hero-section .hero-stat .stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--adk-accent);
  display: block;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero-section .hero-stat .stat-label {
  font-size: 0.72rem;
  color: var(--adk-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
  font-weight: 600;
}

/* ---- Install snippet on hero ---- */

.hero-install {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--adk-surface-raised);
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-pill);
  padding: 0.5rem 1.25rem;
  margin-top: 1.5rem;
  font-family: var(--font-stack--monospace);
  font-size: 0.85rem;
  color: var(--adk-text-muted);
  position: relative;
  box-shadow: var(--adk-shadow-sm);
}

.hero-install code {
  background: none;
  color: var(--adk-accent);
  padding: 0;
  border: none;
  font-weight: 600;
}


/* ==========================================================================
   8. JOURNEY CARDS — Learning Path
   ========================================================================== */

.journey-step {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem;
  margin: 0.75rem 0;
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-lg);
  transition: all var(--adk-transition);
  position: relative;
  background: var(--adk-surface-raised);
}

.journey-step:hover {
  border-color: var(--adk-accent-light);
  box-shadow: var(--adk-shadow-lg);
  transform: translateX(4px);
}

.journey-step::before {
  content: attr(data-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--adk-gradient-start), var(--adk-gradient-mid));
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

[data-theme="dark"] .journey-step::before {
  box-shadow: 0 2px 8px rgba(129, 140, 248, 0.2);
}

.journey-step .journey-content h4 {
  margin: 0 0 0.25rem 0;
  font-weight: 700;
  color: var(--color-foreground-primary);
}

.journey-step .journey-content h4 a {
  color: inherit;
  text-decoration: none;
}

.journey-step:hover .journey-content h4 a {
  color: var(--adk-accent);
}

.journey-step .journey-content p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--adk-text-muted);
  line-height: 1.55;
}

/* Connector line between journey steps */
.journey-step + .journey-step::after {
  content: "";
  position: absolute;
  left: 1.85rem;
  top: -0.75rem;
  width: 2px;
  height: 0.75rem;
  background: linear-gradient(to bottom, var(--adk-accent-lighter), var(--adk-accent));
}


/* ==========================================================================
   9. API REFERENCE POLISH
   ========================================================================== */

/* ---- Method signatures in h4 ---- */
/* API pages render: <h4><code>.method(args) -> Self</code> <badge>Category</badge></h4> */

.content h4 code.docutils {
  font-family: var(--font-stack--monospace);
  font-size: 0.88em;
  font-weight: 600;
  color: var(--color-foreground-primary);
  background: none;
  padding: 0;
  border: none;
}

/* Method name highlight — the leading dot+name */
.content h4 code.docutils .pre:first-child {
  color: var(--adk-accent);
  font-weight: 700;
}

/* Return type arrow and type */
.content h4 code.docutils .pre:last-child {
  color: var(--adk-text-muted);
  font-weight: 400;
}

/* Method group section headers (h3 like "Callbacks", "Configuration") */
.content h3 + h4 {
  margin-top: 1.25rem;
}

/* ---- Badges — method categories ---- */

.sd-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15em 0.55em;
  border-radius: var(--adk-radius-pill);
  vertical-align: middle;
  text-transform: uppercase;
}

/* Category-specific badge colors — override sphinx-design defaults */
.sd-badge.sd-bg-success,
.sd-badge.sd-bg-success.sd-bg-text-success {
  background: var(--adk-success-bg) !important;
  color: var(--adk-success) !important;
  border: 1px solid currentColor;
}

.sd-badge.sd-bg-info,
.sd-badge.sd-bg-info.sd-bg-text-info {
  background: var(--adk-info-bg) !important;
  color: var(--adk-info) !important;
  border: 1px solid currentColor;
}

.sd-badge.sd-bg-primary,
.sd-badge.sd-bg-primary.sd-bg-text-primary {
  background: var(--adk-accent-bg) !important;
  color: var(--adk-accent) !important;
  border: 1px solid currentColor;
}

.sd-badge.sd-bg-warning,
.sd-badge.sd-bg-warning.sd-bg-text-warning {
  background: var(--adk-warning-bg) !important;
  color: var(--adk-warning) !important;
  border: 1px solid currentColor;
}

.sd-badge.sd-bg-danger,
.sd-badge.sd-bg-danger.sd-bg-text-danger {
  background: var(--adk-danger-bg) !important;
  color: var(--adk-danger) !important;
  border: 1px solid currentColor;
}

/* ---- Comparison table highlights ---- */

.comparison-winner {
  background: var(--adk-success-bg);
  font-weight: 700;
}

/* ---- Line count badges ---- */

.lines-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--adk-gradient-start), var(--adk-gradient-mid));
  color: white;
  font-weight: 700;
  padding: 0.15em 0.65em;
  border-radius: var(--adk-radius-pill);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   10. PREV/NEXT PAGE NAVIGATION
   ========================================================================== */

.related-pages {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--adk-border);
  display: flex;
  gap: 1rem;
}

.related-pages a {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-lg);
  text-decoration: none;
  transition: all var(--adk-transition);
  background: var(--adk-surface-raised);
}

.related-pages a:hover {
  border-color: var(--adk-accent-light);
  box-shadow: var(--adk-shadow-lg);
  transform: translateY(-2px);
}

.related-pages a .page-info .context {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--adk-text-faint);
}

.related-pages a .page-info .title {
  font-weight: 600;
  color: var(--color-foreground-primary);
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.related-pages a:hover .page-info .title {
  color: var(--adk-accent);
}

.related-pages .furo-related-icon {
  color: var(--adk-text-faint);
  transition: color var(--adk-transition);
  flex-shrink: 0;
}

.related-pages a:hover .furo-related-icon {
  color: var(--adk-accent);
}

/* Previous link: right-align text */
.related-pages .prev-page .page-info {
  text-align: right;
}


/* ==========================================================================
   11. ANNOUNCEMENT BAR (Furo built-in)
   ========================================================================== */

/* Furo's announcement uses .announcement class on the banner div */
.announcement {
  background: linear-gradient(90deg, var(--adk-gradient-start), var(--adk-gradient-mid));
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
}

.announcement a {
  font-weight: 700;
  text-decoration-line: underline;
  text-underline-offset: 2px;
}

.announcement a:hover {
  opacity: 0.85;
}


/* ==========================================================================
   12. SEARCH & HIGHLIGHTING
   ========================================================================== */

/* Search result highlight */
.highlighted {
  background: rgba(251, 191, 36, 0.25);
  padding: 0.1em 0.2em;
  border-radius: 3px;
  border-bottom: 2px solid var(--adk-warning);
}

[data-theme="dark"] .highlighted {
  background: rgba(251, 191, 36, 0.15);
}

/* Sphinx search results page */
.search .context {
  font-size: 0.9rem;
  color: var(--adk-text-muted);
  line-height: 1.6;
}


/* ==========================================================================
   13. TABLE RESPONSIVENESS
   ========================================================================== */

/* Horizontal scroll wrapper for wide tables on mobile */
.content .table-wrapper,
.content table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tabular numbers for numeric table cells */
.content table tbody td {
  font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   14. SIDEBAR LOGO
   ========================================================================== */

/* Scale the logo SVG nicely in the sidebar */
.sidebar-brand {
  padding: 1rem;
}

.sidebar-logo {
  max-height: 2.2rem;
  width: auto;
}

/* Hide the project name when logo is present (Furo setting) */


/* ==========================================================================
   15. RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
  .hero-section {
    padding: 2rem 1.25rem;
    margin: 0 0 1.5rem 0;
  }

  .hero-section h1 {
    font-size: 1.7rem;
  }

  .hero-section .hero-stats {
    gap: 1.25rem;
  }

  .hero-section .hero-stat .stat-number {
    font-size: 1.4rem;
  }

  .journey-step {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .journey-step + .journey-step::after {
    display: none;
  }

  .content table {
    font-size: 0.85rem;
  }

  .content table thead th,
  .content table tbody td {
    padding: 0.5rem 0.6rem;
  }

  /* Stack prev/next on mobile */
  .related-pages {
    flex-direction: column;
  }

  .related-pages .prev-page .page-info {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .hero-section .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
}


/* ==========================================================================
   16. PRINT
   ========================================================================== */

@media print {
  .reading-progress,
  .announcement {
    display: none;
  }

  .hero-section {
    background: none;
    border: 1px solid #ccc;
  }

  .hero-section::before {
    display: none;
  }

  .hero-section h1 {
    -webkit-text-fill-color: initial;
    color: #333;
  }

  .sd-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .content pre {
    box-shadow: none;
    border-left-color: #999;
  }

  .content pre .copybtn {
    display: none;
  }

  .related-pages a {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}


/* ==========================================================================
   17. ACCESSIBILITY
   ========================================================================== */

/* Focus ring for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.sd-tab-set > label:focus-visible,
.sd-card:focus-visible {
  outline: 2px solid var(--adk-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Ensure sufficient contrast for muted text */
[data-theme="dark"] .content blockquote p,
[data-theme="dark"] .journey-step .journey-content p {
  color: var(--adk-text-muted);
}

/* Skip link (injected by Furo, styled here) */
.skip-link:focus {
  background: var(--adk-accent);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 10000;
}


/* ==========================================================================
   18. DARK MODE REFINEMENTS
   ========================================================================== */

/* Deeper dark surfaces — match the standalone visual references */
[data-theme="dark"] {
  --adk-surface: #131c31;
  --adk-surface-raised: #1a2540;
  --adk-border: #1e2d4a;
  --adk-border-hover: #2d3f5e;
}

/* Mermaid: remove old invert hack, rely on theme config */
[data-theme="dark"] .mermaid {
  filter: none;
  background: transparent;
}

/* Dark mode announcement bar legibility */
[data-theme="dark"] .announcement {
  background: linear-gradient(90deg, #312e81, #4c1d95);
}

/* Dark mode cards get a subtle border glow on hover */
[data-theme="dark"] .sd-card:hover {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(129, 140, 248, 0.1);
}

/* Dark mode code blocks get deeper surfaces */
[data-theme="dark"] .content pre {
  border-color: var(--adk-border);
  background: rgba(0, 0, 0, 0.2);
}

/* Dark mode tab sets */
[data-theme="dark"] .sd-tab-set {
  border-color: var(--adk-border);
  background: rgba(0, 0, 0, 0.1);
}

/* Dark mode journey steps */
[data-theme="dark"] .journey-step {
  background: var(--adk-surface-raised);
  border-color: var(--adk-border);
}

/* Dark mode prev/next */
[data-theme="dark"] .related-pages a {
  background: var(--adk-surface-raised);
  border-color: var(--adk-border);
}

[data-theme="dark"] .related-pages a:hover {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(129, 140, 248, 0.1);
}


/* ==========================================================================
   19. HERO ARCHITECTURE DIAGRAM
   ========================================================================== */

.hero-diagram {
  max-width: 640px;
  margin: 1.5rem auto 0.5rem;
  position: relative;
}

.hero-flow-svg {
  width: 100%;
  height: auto;
}

/* Entrance animation for hero diagram nodes */
.hero-node {
  opacity: 0;
  animation: heroFadeSlide 0.6s var(--adk-ease) forwards;
  animation-delay: var(--delay, 0s);
}

.hero-arrow {
  opacity: 0;
  animation: heroFadeIn 0.4s var(--adk-ease) forwards;
  animation-delay: var(--delay, 0s);
}

.hero-label {
  opacity: 0;
  animation: heroFadeIn 0.4s var(--adk-ease) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes heroFadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes heroFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-node,
  .hero-arrow,
  .hero-label {
    opacity: 1;
    animation: none;
  }
}

@media (max-width: 768px) {
  .hero-diagram {
    max-width: 100%;
    margin: 1rem auto 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hero-flow-svg {
    min-width: 480px;
  }
}


/* ==========================================================================
   20. VISUAL REFERENCE CARDS (User Guide)
   ========================================================================== */

.visual-ref-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1rem 0 0;
}

.visual-ref-card {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-lg);
  background: var(--adk-surface-raised);
  transition: all 0.25s var(--adk-ease);
  position: relative;
  overflow: hidden;
}

.visual-ref-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.04) 0%, rgba(124, 58, 237, 0.02) 100%);
  transition: opacity 0.25s var(--adk-ease);
}

.visual-ref-card:hover {
  border-color: var(--adk-accent-light);
  box-shadow: var(--adk-shadow-lg), 0 0 0 1px rgba(99, 102, 241, 0.05);
  transform: translateX(4px);
}

.visual-ref-card:hover::before {
  opacity: 1;
}

[data-theme="dark"] .visual-ref-card:hover {
  border-color: rgba(129, 140, 248, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 20px rgba(99, 102, 241, 0.05);
}

.visual-ref-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  color: var(--adk-accent);
  position: relative;
}

.visual-ref-content {
  flex: 1;
  min-width: 0;
  position: relative;
}

.visual-ref-content h4 {
  margin: 0 0 0.35rem 0;
  font-weight: 700;
  font-size: 0.95rem;
}

.visual-ref-content h4 a {
  color: var(--color-foreground-primary);
  text-decoration: none;
  transition: color var(--adk-transition);
}

.visual-ref-card:hover h4 a {
  color: var(--adk-accent);
}

.visual-ref-content p {
  margin: 0 0 0.6rem 0;
  font-size: 0.85rem;
  color: var(--adk-text-muted);
  line-height: 1.5;
}

.visual-ref-content p code {
  font-size: 0.82em;
}

.visual-ref-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.vr-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.15em 0.55em;
  border-radius: var(--adk-radius-pill);
  color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tag-color) 25%, transparent);
}

@media (max-width: 768px) {
  .visual-ref-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .visual-ref-tags {
    justify-content: center;
  }
}


/* ==========================================================================
   21. ARCHITECTURE DIAGRAMS (inline SVGs in content)
   ========================================================================== */

.arch-diagram-wrapper {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--adk-border);
  border-radius: var(--adk-radius-lg);
  background: var(--adk-surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.arch-diagram {
  width: 100%;
  height: auto;
  min-width: 500px;
}

[data-theme="dark"] .arch-diagram-wrapper {
  background: rgba(0, 0, 0, 0.15);
  border-color: var(--adk-border);
}

/* Diagram hover polish */
.arch-diagram-wrapper:hover {
  border-color: var(--adk-border-hover);
  box-shadow: var(--adk-shadow-md);
}

/* Diagram entrance animation (triggered by IntersectionObserver) */
.arch-diagram-wrapper {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--adk-ease), transform 0.5s var(--adk-ease), border-color 0.2s var(--adk-ease), box-shadow 0.2s var(--adk-ease);
}

.arch-diagram-wrapper.diagram-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .arch-diagram-wrapper {
    opacity: 1;
    transform: none;
  }
}


/* ==========================================================================
   22. PREMIUM MICRO-INTERACTIONS
   ========================================================================== */

/* Smooth gradient border on hero h1 */
.hero-section h1 {
  position: relative;
  animation: heroTitleIn 0.8s var(--adk-ease) both;
}

@keyframes heroTitleIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-section .hero-tagline {
  animation: heroSubIn 0.8s var(--adk-ease) 0.15s both;
}

@keyframes heroSubIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero-install {
  animation: heroSubIn 0.8s var(--adk-ease) 0.3s both;
}

.hero-stats {
  animation: heroSubIn 0.8s var(--adk-ease) 0.45s both;
}

@media (prefers-reduced-motion: reduce) {
  .hero-section h1,
  .hero-section .hero-tagline,
  .hero-install,
  .hero-stats {
    animation: none;
  }
}

/* Stat counter hover glow */
.hero-stat .stat-number {
  transition: text-shadow 0.3s var(--adk-ease), transform 0.3s var(--adk-ease);
}

.hero-stat:hover .stat-number {
  text-shadow: 0 0 20px rgba(79, 70, 229, 0.4);
  transform: scale(1.05);
}

[data-theme="dark"] .hero-stat:hover .stat-number {
  text-shadow: 0 0 24px rgba(129, 140, 248, 0.5);
}

/* Card shimmer on hover (subtle moving gradient) */
.sd-card {
  position: relative;
  overflow: hidden;
}

.sd-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(79, 70, 229, 0.03) 45%,
    rgba(79, 70, 229, 0.06) 50%,
    rgba(79, 70, 229, 0.03) 55%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.6s var(--adk-ease);
  pointer-events: none;
}

.sd-card:hover::after {
  transform: translateX(100%);
}

[data-theme="dark"] .sd-card::after {
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(129, 140, 248, 0.04) 45%,
    rgba(129, 140, 248, 0.08) 50%,
    rgba(129, 140, 248, 0.04) 55%,
    transparent 60%
  );
}

/* Journey step hover — accent line left */
.journey-step {
  border-left: 3px solid transparent;
  transition: all 0.25s var(--adk-ease), border-left-color 0.25s var(--adk-ease);
}

.journey-step:hover {
  border-left-color: var(--adk-accent);
}

/* Inline code subtle pulse on hover */
.content code:not(pre code):not(h1 code):not(h2 code):not(h3 code):not(h4 code):hover {
  background: var(--adk-accent-bg-hover);
}

/* Table row hover — subtle left accent */
.content table tbody tr {
  border-left: 3px solid transparent;
}

.content table tbody tr:hover {
  border-left-color: var(--adk-accent);
}

/* Admonition entrance — subtle slide in */
.admonition {
  animation: admonitionIn 0.4s var(--adk-ease) both;
}

@keyframes admonitionIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .admonition {
    animation: none;
  }
}


/* ==========================================================================
   23. TYPOGRAPHY REFINEMENTS
   ========================================================================== */

/* First paragraph after h2 — slightly larger for lead-in feel */
.content h2 + p {
  font-size: 1.02em;
  color: var(--color-foreground-secondary, inherit);
}

/* Section dividers — subtle gradient instead of flat line */
.content h2 {
  border-image: linear-gradient(90deg, var(--adk-border), transparent) 1;
}

/* Heading hover reveal — accent underline */
.content h2:hover {
  border-image: linear-gradient(90deg, var(--adk-accent), var(--adk-accent-light), transparent) 1;
}

/* Content links — subtle gradient underline on hover */
.content a:not(.sd-card):not(.headerlink):hover {
  text-decoration-color: var(--adk-accent);
}


/* ==========================================================================
   24. FOOTER POLISH
   ========================================================================== */

/* Footer icons — hover glow */
.bottom-of-page a svg {
  transition: color 0.2s var(--adk-ease), filter 0.2s var(--adk-ease);
}

.bottom-of-page a:hover svg {
  filter: drop-shadow(0 0 6px rgba(79, 70, 229, 0.4));
  color: var(--adk-accent);
}

[data-theme="dark"] .bottom-of-page a:hover svg {
  filter: drop-shadow(0 0 8px rgba(129, 140, 248, 0.5));
}


/* ==========================================================================
   25. DECISION GUIDE & FLOWCHART STYLING
   ========================================================================== */

/* ASCII flowcharts get monospace treatment with accent background */
.content pre:has(code:not([class])) {
  background: var(--adk-surface);
  border-left-color: var(--adk-accent-light);
}


/* ==========================================================================
   26. COOKBOOK GRID POLISH
   ========================================================================== */

/* Make the grid cards feel more intentional */
.sd-row > .sd-col {
  transition: transform 0.2s var(--adk-ease);
}

/* Grid item cards — staggered hover */
.sd-card .sd-card-body p {
  font-size: 0.88rem;
  line-height: 1.55;
}
