/* ==========================================================
   OpenClaw AI Documentation — Main Stylesheet
   Dark theme, developer-doc style
   Primary: Purple  |  Accent: Electric Blue
   ========================================================== */

/* === CSS Layers — declare order for cascade management === */
@layer base, layout, components, utilities, themes;

/* === Google Fonts Import === */
/* Google Fonts loaded via <link> in HTML head (see apply_critical_css.py) */
/* === CSS Custom Properties === */
:root {
  /* Backgrounds */
  --bg-base:     #0a0a0f;
  --bg-surface:  #111118;
  --bg-elevated: #1a1a26;
  --bg-code:     #0d0d1a;
  --bg-sidebar:  #0c0c14;
  --bg-hover:    #1e1e2e;
  --bg-active:   #231a35;

  /* Borders */
  --border-subtle:  #1a1a28;
  --border-default: #252535;
  --border-strong:  #353550;

  /* Text */
  --text-primary:   #e8e8f2;
  --text-secondary: #9898b8;
  --text-muted:     #5a5a7a;
  --text-inverse:   #0a0a0f;

  /* Purple (Primary) */
  --purple:        #9333ea;
  --purple-light:  #a855f7;
  --purple-lighter:#c084fc;
  --purple-dark:   #7c3aed;
  --purple-bg:     rgba(147, 51, 234, 0.08);
  --purple-border: rgba(147, 51, 234, 0.25);
  --purple-glow:   rgba(147, 51, 234, 0.35);

  /* Blue (Accent) */
  --blue:       #3b82f6;
  --blue-light: #60a5fa;
  --blue-bg:    rgba(59, 130, 246, 0.08);

  /* Status */
  --green:      #22c55e;
  --green-bg:   rgba(34, 197, 94, 0.08);
  --yellow:     #eab308;
  --yellow-bg:  rgba(234, 179, 8, 0.08);
  --red:        #ef4444;
  --red-bg:     rgba(239, 68, 68, 0.08);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;

  /* Layout */
  --sidebar-w:  272px;
  --toc-w:      232px;
  --header-h:   60px;
  --content-max: 800px;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.7);

  /* Border Radius */
  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Transitions */
  --t-fast:   0.15s ease;
  --t-normal: 0.25s ease;
  --t-slow:   0.4s ease;
}

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--purple-light);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--purple-lighter); }

img, svg { display: block; max-width: 100%; }

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea {
  font-family: inherit;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Selection === */
::selection {
  background: var(--purple-dark);
  color: #fff;
}

/* ==========================================================
   HEADER
   ========================================================== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-logo svg { width: 28px; height: 28px; }
.header-logo:hover { color: var(--text-primary); }
.logo-icon { color: var(--purple-light); }

.header-search {
  flex: 1;
  max-width: 420px;
  margin-left: 24px;
}

.search-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: 14px;
  transition: border-color var(--t-fast), background var(--t-fast);
  cursor: text;
}
.search-trigger:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.search-trigger svg { width: 15px; height: 15px; flex-shrink: 0; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: var(--text-muted);
  margin-left: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Version badge */
.version-badge {
  padding: 3px 8px;
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-light);
  letter-spacing: 0.3px;
}

/* === Version Selector Dropdown === */
.version-selector {
  position: relative;
}
.version-selector > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-light);
  letter-spacing: 0.3px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}
.version-selector > summary::-webkit-details-marker { display: none; }
.version-selector > summary::after {
  content: '▾';
  font-size: 10px;
  margin-left: 2px;
  transition: transform 0.15s;
  display: inline-block;
}
.version-selector[open] > summary::after { transform: rotate(180deg); }
.version-selector > summary:hover {
  background: var(--purple-border);
  border-color: var(--purple-light);
}
.version-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  padding: 4px;
  z-index: 200;
}
.version-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: default;
  transition: background 0.1s, color 0.1s;
}
.version-option:hover {
  background: var(--purple-bg);
  color: var(--text-primary);
}
.version-option.is-current {
  color: var(--purple-light);
  font-weight: 600;
  cursor: default;
}
.version-option .ver-tag {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 99px;
  background: var(--purple-bg);
  color: var(--purple-light);
  border: 1px solid var(--purple-border);
}

/* === Tooltip Component === */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 300;
  max-width: 260px;
  white-space: normal;
  text-align: center;
}
[data-tooltip]:hover::after {
  opacity: 1;
}
[data-tooltip].tooltip-right::after {
  left: calc(100% + 8px);
  bottom: auto;
  top: 50%;
  transform: translateY(-50%);
}
[data-tooltip].tooltip-bottom::after {
  top: calc(100% + 6px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
}


.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  transition: transform var(--t-normal);
}

.sidebar-inner {
  padding: 20px 12px 40px;
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
  line-height: 1.4;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--purple-bg);
  color: var(--purple-light);
  border: 1px solid var(--purple-border);
}
.nav-item.active:hover {
  background: rgba(147, 51, 234, 0.12);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(3px);
  z-index: 850;
}

/* ==========================================================
   MAIN LAYOUT
   ========================================================== */
.layout {
  margin-left: var(--sidebar-w);
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
  display: flex;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 36px 48px 80px;
  max-width: calc(var(--content-max) + var(--toc-w) + 80px);
}

.content-with-toc {
  display: grid;
  grid-template-columns: 1fr var(--toc-w);
  gap: 48px;
  align-items: start;
  max-width: 1100px;
}

.content { min-width: 0; }

/* ==========================================================
   TABLE OF CONTENTS
   ========================================================== */
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto;
}

.toc-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-list {
  list-style: none;
  padding: 0;
}

.toc-list li { margin: 0; }

.toc-list a {
  display: block;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  transition: color var(--t-fast), border-color var(--t-fast);
  line-height: 1.4;
}
.toc-list a:hover {
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.toc-list a.active {
  color: var(--purple-light);
  border-color: var(--purple-light);
  background: var(--purple-bg);
}

.toc-list .toc-h3 a {
  padding-left: 20px;
  font-size: 12px;
}

/* ==========================================================
   BREADCRUMBS
   ========================================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--t-fast);
}
.breadcrumb a:hover { color: var(--text-secondary); }
.breadcrumb-sep { color: var(--border-strong); }
.breadcrumb-current { color: var(--text-secondary); }

/* ==========================================================
   TYPOGRAPHY
   ========================================================== */
.content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--purple-lighter) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.content h2:first-of-type { margin-top: 8px; border-top: none; }

.content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 12px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 24px;
  margin-bottom: 10px;
}

.content p {
  font-size: 15.5px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 18px;
}

.content strong { color: var(--text-primary); font-weight: 600; }
.content em { color: var(--purple-lighter); font-style: italic; }

.content ul, .content ol {
  margin: 0 0 18px 0;
  padding-left: 22px;
}
.content li {
  font-size: 15.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}
.content li::marker { color: var(--purple-light); }
.content ul { list-style: disc; }
.content ol { list-style: decimal; }

.content hr {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 40px 0;
}

/* Lead text */
.lead {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 32px;
}

/* ==========================================================
   CODE BLOCKS
   ========================================================== */
.content code {
  font-family: var(--font-mono);
  font-size: 13.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xs);
  padding: 2px 6px;
  color: var(--purple-lighter);
}

.code-block {
  position: relative;
  margin: 24px 0;
  border-radius: var(--r-md);
  background: var(--bg-code);
  border: 1px solid var(--border-default);
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-subtle);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  background: transparent;
  transition: all var(--t-fast);
}
.copy-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.copy-btn.copied {
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.3);
}
.copy-btn svg { width: 13px; height: 13px; }

.code-block pre {
  padding: 20px;
  overflow-x: auto;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.code-block pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: #c9d1d9;
}

/* Inline code in headings */
h2 code, h3 code { font-size: 0.85em; }

/* Terminal output style */
.code-block.terminal .code-block-header { background: rgba(34, 197, 94, 0.05); }
.code-block.terminal .code-lang { color: var(--green); }

/* ==========================================================
   HIGHLIGHT.JS — Custom Token Colors (matches site palette)
   Overrides github-dark.min.css to use our purple/blue theme
   ========================================================== */
.hljs                          { background: transparent; color: #c9d1d9; }
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in                 { color: #a855f7; font-weight: 600; } /* purple */
.hljs-type,
.hljs-class                    { color: #c084fc; }                   /* purple-lighter */
.hljs-string,
.hljs-attr                     { color: #7ee787; }                   /* green-string */
.hljs-number,
.hljs-literal                  { color: #79c0ff; }                   /* blue-number */
.hljs-comment,
.hljs-quote                    { color: #6e7681; font-style: italic; }/* muted comment */
.hljs-variable,
.hljs-template-variable,
.hljs-params                   { color: #ffa657; }                   /* orange param */
.hljs-name,
.hljs-tag                      { color: #7ee787; }                   /* green tag */
.hljs-attribute                { color: #60a5fa; }                   /* blue attr */
.hljs-operator,
.hljs-punctuation               { color: #8b949e; }                  /* muted */
.hljs-meta                     { color: #79c0ff; }                   /* blue meta */
.hljs-section,
.hljs-title                    { color: #c084fc; font-weight: 600; } /* purple title */
.hljs-function .hljs-title     { color: #60a5fa; font-weight: 600; } /* blue fn name */
.hljs-addition                 { color: #7ee787; background: rgba(34,197,94,0.08); }
.hljs-deletion                 { color: #f85149; background: rgba(239,68,68,0.08); }

/* ==========================================================
   TABLES
   ========================================================== */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14.5px;
  overflow: hidden;
  border-radius: var(--r-md);
  border: 1px solid var(--border-default);
}

.content th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}

.content td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.content tr:last-child td { border-bottom: none; }
.content tr:hover td { background: var(--bg-hover); }
.content td code { font-size: 12.5px; }

/* ==========================================================
   CALLOUT BOXES
   ========================================================== */
.callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  margin: 24px 0;
  border: 1px solid;
  font-size: 14.5px;
  line-height: 1.65;
}
.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.callout-body { color: var(--text-secondary); }
.callout-body strong { display: block; margin-bottom: 4px; font-size: 14px; }
.callout-body p { margin-bottom: 8px; font-size: 14.5px; }
.callout-body p:last-child { margin-bottom: 0; }
.callout-body code { font-size: 13px; }

.callout-note   { background: var(--blue-bg);   border-color: rgba(59,130,246,0.25);  color: var(--blue-light); }
.callout-tip    { background: var(--green-bg);  border-color: rgba(34,197,94,0.25);   color: var(--green); }
.callout-warning{ background: var(--yellow-bg); border-color: rgba(234,179,8,0.25);   color: var(--yellow); }
.callout-danger { background: var(--red-bg);    border-color: rgba(239,68,68,0.25);   color: var(--red); }
.callout-note .callout-body strong   { color: var(--blue-light); }
.callout-tip .callout-body strong    { color: var(--green); }
.callout-warning .callout-body strong{ color: var(--yellow); }
.callout-danger .callout-body strong { color: var(--red); }

/* ==========================================================
   CARDS
   ========================================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.card:hover {
  border-color: var(--purple-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--purple-border);
}

.card-icon {
  width: 40px; height: 40px;
  background: var(--purple-bg);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--purple-light);
}
.card-icon svg { width: 20px; height: 20px; }

.card h3, .card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.card p, .card-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* Link card */
.card-link {
  display: block;
  text-decoration: none;
}
.card-link:hover { color: inherit; }

/* ==========================================================
   BUTTONS
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple-dark);
}
.btn-primary:hover {
  background: var(--purple-dark);
  color: #fff;
  box-shadow: 0 0 20px var(--purple-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--purple-border);
  color: var(--purple-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}

.btn svg { width: 16px; height: 16px; }

.github-stars-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  border-radius: var(--r-xs);
  opacity: 0.9;
  transition: opacity var(--t-fast);
}
.btn-ghost:hover .github-stars-badge { opacity: 1; }

@media (max-width: 640px) {
  .github-stars-badge { display: none; }
}

/* ==========================================================
   BADGES
   ========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-xs);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border: 1px solid;
}
.badge-purple { background: var(--purple-bg); border-color: var(--purple-border); color: var(--purple-light); }
.badge-blue   { background: var(--blue-bg);   border-color: rgba(59,130,246,0.25); color: var(--blue-light); }
.badge-green  { background: var(--green-bg);  border-color: rgba(34,197,94,0.25);  color: var(--green); }
.badge-yellow { background: var(--yellow-bg); border-color: rgba(234,179,8,0.25);  color: var(--yellow); }
.badge-red    { background: var(--red-bg);    border-color: rgba(239,68,68,0.25);  color: var(--red); }

/* ==========================================================
   STEPS / NUMBERED LIST
   ========================================================== */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 24px 0; }
.steps li {
  counter-increment: step;
  display: flex;
  gap: 16px;
  padding: 0 0 24px;
  position: relative;
}
.steps li:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 4px;
  width: 2px;
  background: var(--border-default);
}
.step-number {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--purple-bg);
  border: 2px solid var(--purple-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--purple-light);
}
.step-content { flex: 1; padding-top: 5px; }
.step-content h4 { margin-top: 0; margin-bottom: 8px; color: var(--text-primary); font-size: 15px; }
.step-content p  { margin-bottom: 12px; font-size: 14.5px; }

/* ==========================================================
   PAGE HEADER
   ========================================================== */
.page-header {
  margin-bottom: 40px;
}
.page-header h1 { margin-bottom: 12px; }
.page-header .lead { margin-bottom: 20px; }
.page-header .meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================
   PREV / NEXT NAVIGATION
   ========================================================== */
.doc-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 60px;
  padding-top: 32px;
  border-top: 1px solid var(--border-default);
}

.doc-nav-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 16px 20px;
  transition: border-color var(--t-fast);
  display: block;
  color: inherit;
}
.doc-nav-card:hover {
  border-color: var(--purple-border);
  color: inherit;
}
.doc-nav-card.next { text-align: right; }
.doc-nav-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.doc-nav-title { font-size: 15px; font-weight: 600; color: var(--purple-light); }

/* ==========================================================
   HERO (Home page)
   ========================================================== */
.hero {
  position: relative;
  padding: 64px 0 80px;
  max-width: 720px;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--purple-light);
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #fff 0%, var(--purple-lighter) 60%, var(--blue-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 36px;
  max-width: 560px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 48px 0;
}
@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .feature-grid { grid-template-columns: 1fr; }
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.feature-card:hover {
  border-color: var(--purple-border);
  box-shadow: 0 4px 16px rgba(147,51,234,0.1);
}
.feature-icon {
  width: 44px; height: 44px;
  background: var(--purple-bg);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  color: var(--purple-light);
  font-size: 22px;
}
.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.feature-card p {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* Integration logos */
.integrations-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}
.integration-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: border-color var(--t-fast), color var(--t-fast);
}
.integration-chip:hover {
  border-color: var(--purple-border);
  color: var(--text-primary);
}

/* ==========================================================
   SEARCH MODAL
   ========================================================== */
.search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 64px 20px;
}
.search-modal.open { display: block; }

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.search-modal-inner {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.search-modal-header svg { color: var(--text-muted); width: 18px; height: 18px; flex-shrink: 0; }

.search-modal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text-primary);
  placeholder: var(--text-muted);
}

.search-modal-close {
  padding: 4px 8px;
  border: 1px solid var(--border-default);
  border-radius: var(--r-xs);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}
.search-modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.search-results { padding: 12px 0; max-height: 400px; overflow-y: auto; }
.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.search-result:hover, .search-result.focused { background: var(--bg-hover); }
.search-result-icon { color: var(--purple-light); flex-shrink: 0; }
.search-result-text { flex: 1; }
.search-result-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.search-result-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.search-no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  padding: 40px 48px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.footer-desc { font-size: 13.5px; color: var(--text-muted); max-width: 400px; line-height: 1.6; }
.footer-copyright { font-size: 12px; color: var(--text-muted); margin-top: 16px; }
.footer-links { display: flex; gap: 32px; flex-wrap: wrap; }
.footer-col h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); margin-bottom: 10px; }
.footer-col a { display: block; font-size: 13.5px; color: var(--text-muted); margin-bottom: 7px; transition: color var(--t-fast); }
.footer-col a:hover { color: var(--text-secondary); }

/* ==========================================================
   TABS
   ========================================================== */
.tabs {
  margin: 24px 0;
}
.tab-list {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
  bottom: -1px;
  border: 1px solid transparent;
  border-bottom-color: transparent;
}
.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  color: var(--purple-light);
  background: var(--bg-surface);
  border-color: var(--border-default);
  border-bottom-color: var(--bg-surface);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================
   ACCORDION / COLLAPSIBLE
   ========================================================== */
.accordion { margin: 16px 0; }
.accordion-item {
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  overflow: hidden;
}
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  text-align: left;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 500;
  transition: background var(--t-fast);
}
.accordion-trigger:hover { background: var(--bg-hover); }
.accordion-trigger svg { width: 16px; height: 16px; color: var(--text-muted); transition: transform var(--t-fast); flex-shrink: 0; }
.accordion-item.open .accordion-trigger svg { transform: rotate(180deg); }
.accordion-content {
  display: none;
  padding: 16px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.accordion-item.open .accordion-content { display: block; }
/* Alias for accordion-body class used in HTML */
.accordion-body {
  display: none;
  padding: 16px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-base);
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.accordion-item.open .accordion-body { display: block; }

/* ==========================================================
   BLOG CARDS
   ========================================================== */
.blog-featured { margin-bottom: 40px; }
.blog-featured-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple-light);
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  border-radius: 4px;
  padding: 3px 10px;
  margin-bottom: 12px;
}
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0 40px;
}
.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: border-color var(--t-fast), transform var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.blog-card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
}
.blog-card-featured {
  border-color: var(--purple-border);
  background: linear-gradient(135deg, var(--bg-surface), rgba(147,51,234,0.05));
}
.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.blog-date { font-size: 12px; color: var(--text-muted); }
.blog-category {
  font-size: 11px;
  font-weight: 600;
  color: var(--blue-light);
  background: var(--blue-bg);
  padding: 2px 8px;
  border-radius: 4px;
}
.blog-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin: 0;
}
.blog-card-title a { color: inherit; text-decoration: none; }
.blog-card-title a:hover { color: var(--purple-light); }
.blog-card-excerpt {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
  flex: 1;
}
.blog-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.blog-author { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.blog-read-time { font-size: 12px; color: var(--text-muted); }

/* ==========================================================
   RESOURCE CARDS
   ========================================================== */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 24px 0 40px;
}
.resource-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 20px;
  text-decoration: none;
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.resource-card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  text-decoration: none;
}
.resource-card-icon {
  flex-shrink: 0;
  color: var(--purple-light);
  margin-top: 2px;
}
.resource-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}
.resource-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 8px;
  line-height: 1.5;
}
.resource-link {
  font-size: 12px;
  color: var(--purple-light);
  font-weight: 500;
}

/* ==========================================================
   TAG CLOUD
   ========================================================== */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 32px;
}
.tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.tag:hover {
  border-color: var(--purple);
  color: var(--purple-light);
  background: var(--purple-bg);
}

/* ==========================================================
   STEP COMPONENTS (div-based steps)
   ========================================================== */
.step {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  position: relative;
}
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -16px;
  width: 2px;
  background: var(--border-default);
}
.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--purple-bg);
  border: 2px solid var(--purple-border);
  color: var(--purple-light);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-content { flex: 1; padding-top: 6px; }
.step-content h3 { font-size: 15.5px; margin-bottom: 10px; }

/* Wide content (no TOC, full width) */
.content-wide { max-width: 900px; }

/* ==========================================================
   RESPONSIVE — Tablet
   ========================================================== */
@media (max-width: 1200px) {
  .content-with-toc {
    grid-template-columns: 1fr;
  }
  .toc-sidebar { display: none; }
}

@media (max-width: 1024px) {
  .main-content { padding: 28px 32px 60px; }
}

/* ==========================================================
   RESPONSIVE — Mobile
   ========================================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open {
    display: block;
  }
  .sidebar-toggle {
    display: flex;
  }

  .layout {
    margin-left: 0;
  }
  .footer {
    margin-left: 0;
    grid-template-columns: 1fr;
    padding: 32px 24px;
  }
  .footer-links { gap: 24px; }

  .main-content {
    padding: 24px 20px 60px;
  }

  .header-search { display: none; }

  .hero h1 { font-size: 2.2rem; }
  .hero p  { font-size: 16px; }

  .doc-nav { grid-template-columns: 1fr; }
}

/* ==========================================================
   UTILITIES
   ========================================================== */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.text-purple  { color: var(--purple-light); }
.text-blue    { color: var(--blue-light); }
.text-green   { color: var(--green); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.mb-0 { margin-bottom: 0 !important; }
.mt-0 { margin-top: 0 !important; }

/* ==========================================================
   SIDEBAR SUB-NAVIGATION
   ========================================================== */
.nav-sub {
  padding-left: 8px;
  border-left: 2px solid var(--border-default);
  margin: 4px 0 8px;
}
.nav-item-sub {
  font-size: 13px;
  padding-left: 20px;
  opacity: 0.85;
  color: var(--text-secondary);
}
.nav-item-sub.active {
  opacity: 1;
  color: var(--purple-light) !important;
  background: var(--purple-bg);
}

/* ==========================================================
   PREV / NEXT NAVIGATION
   ========================================================== */
.prev-next {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-default);
  gap: 16px;
}
.prev-next-link {
  color: var(--purple-light);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--t-fast);
}
.prev-next-link:hover {
  color: var(--purple);
}

/* ==========================================================
   CARD LINK (anchor wrapping a card)
   ========================================================== */
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-link:hover {
  border-color: var(--purple) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================
   CARDS GRID
   ========================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
  margin-bottom: 32px;
}

/* ==========================================================
   INLINE BADGES (blue, green, purple)
   ========================================================== */
.badge-blue {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.badge-purple {
  background: rgba(147, 51, 234, 0.15);
  color: var(--purple-light);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* ==========================================================
   READ TIME
   ========================================================== */
.read-time {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================
   PRINT
   ========================================================== */
@media print {
  .header, .sidebar, .toc-sidebar, .doc-nav, .footer,
  .search-trigger, .copy-btn { display: none !important; }
  .layout { margin-left: 0; }
  .main-content { padding: 0; }
  body { background: #fff; color: #000; }
  .content h1, .content h2, .content h3 { color: #000; -webkit-text-fill-color: #000; }
  .content p, .content li { color: #333; }
}

/* ==========================================================
   TABS COMPONENT
   ========================================================== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  gap: 0;
  margin-bottom: 0;
  overflow-x: auto;
}
.tab,
.tab-btn {
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  outline: none;
}
.tab:hover, .tab-btn:hover { color: var(--text-primary); }
.tab.active,
.tab-btn.active {
  color: var(--purple-light);
  border-bottom-color: var(--purple-light);
}
.tab-panels { padding: 24px 0; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ==========================================================
   ACCORDION COMPONENT
   ========================================================== */
.accordion {
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.accordion-item {
  border-bottom: 1px solid var(--border-default);
}
.accordion-item:last-child { border-bottom: none; }
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast);
}
.accordion-trigger:hover { background: var(--bg-elevated); }
.accordion-trigger[aria-expanded="true"],
.accordion-item.open .accordion-trigger { color: var(--purple-light); }
.accordion-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: transform var(--t-fast);
}
.accordion-item.open .accordion-icon,
.accordion-trigger[aria-expanded="true"] .accordion-icon {
  transform: rotate(180deg);
  opacity: 1;
}
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.accordion-content.open,
.accordion-item.open .accordion-content { max-height: 600px; }
.accordion-body { padding: 0 20px 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }

/* ==========================================================
   SCROLL FADE-IN ANIMATION
   ========================================================== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================
   COPY BUTTON SUCCESS STATE
   ========================================================== */
.copy-btn.success {
  color: var(--green) !important;
  border-color: var(--green) !important;
}
.copy-btn.success::after {
  content: '✓';
  position: absolute;
  font-size: 13px;
}

/* ==========================================================
   BACK TO TOP BUTTON
   ========================================================== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-fast), border-color var(--t-fast);
  z-index: 50;
  color: var(--text-secondary);
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-to-top:hover {
  border-color: var(--purple-border);
  color: var(--purple-light);
}

/* ==========================================================
   EXAMPLE CALLOUT (purple)
   ========================================================== */
.callout.example {
  background: rgba(147, 51, 234, 0.06);
  border-left-color: var(--purple);
}
.callout.example .callout-title { color: var(--purple-lighter); }

/* ==========================================================
   SKIP TO CONTENT (Accessibility)
   ========================================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--purple);
  color: #fff;
  font-size: 13px;
  border-radius: var(--r-md);
  z-index: 9999;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 16px; }

/* Typography enhancement */
body { text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ==========================================================
   SEARCH — KEYBOARD NAVIGATION ACTIVE STATE
   ========================================================== */
.search-result.active {
  background: var(--bg-elevated);
  outline: 1px solid var(--purple-border);
  outline-offset: -1px;
}
.search-result.active .search-result-title { color: var(--purple-light); }

/* ==========================================================
   EDIT ON GITHUB — INJECTED FOOTER LINKS
   ========================================================== */
.edit-on-github {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 36px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.edit-github-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}
.edit-github-link:hover { color: var(--purple-light); }
.edit-github-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.edit-github-issue { margin-left: auto; }
@media (max-width: 600px) { .edit-github-issue { margin-left: 0; } }

/* ==========================================================
   SCROLL PROGRESS BAR
   ========================================================== */
#scroll-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--purple), var(--blue-light));
  z-index: 1001;
  transition: width 0.08s linear;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

/* ==========================================================
   CSS CONTAINMENT — faster layout recalculation for cards
   ========================================================== */
.card,
.feature-card,
.blog-card,
.doc-nav-card,
.callout,
.accordion-item {
  contain: layout style;
}

/* ==========================================================
   KEYBOARD FOCUS — :focus-visible for accessibility
   ========================================================== */
:focus-visible {
  outline: 2px solid var(--purple-light);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--purple-light);
  outline-offset: 3px;
}

/* Remove outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================
   REDUCED MOTION — respect user preference
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .fade-in { opacity: 1 !important; transform: none !important; }
  .back-to-top { transition: none !important; }
}

/* ==========================================================
   CSS GRID & FLEXBOX UTILITIES
   ========================================================== */
.flex          { display: flex; }
.flex-col      { display: flex; flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-center     { justify-content: center; }
.justify-between    { justify-content: space-between; }
.justify-end        { justify-content: flex-end; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.gap-6  { gap: 24px; }
.gap-8  { gap: 32px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================
   LOADING SKELETON ANIMATION
   ========================================================== */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
}
.skeleton * { visibility: hidden; }

.skeleton-text  { height: 16px; margin-bottom: 8px; border-radius: var(--r-xs); }
.skeleton-title { height: 28px; width: 60%; margin-bottom: 16px; border-radius: var(--r-xs); }
.skeleton-card  {
  height: 120px;
  border-radius: var(--r-lg);
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

/* ==========================================================
   CALLOUT — EXAMPLE (purple)
   ========================================================== */
.callout-example {
  background: var(--purple-bg);
  border-color: var(--purple-border);
}
.callout-example .callout-body strong { color: var(--purple-lighter); }

/* ==========================================================
   DARK MODE IMAGE FILTER
   ========================================================== */
img:not([src$=".svg"]):not([data-no-filter]) {
  filter: brightness(0.92) saturate(0.95);
}
img:not([src$=".svg"]):not([data-no-filter]):hover {
  filter: brightness(1) saturate(1);
  transition: filter var(--t-normal);
}

/* ==========================================================
   LIGHT THEME
   ========================================================== */
[data-theme="light"] {
  --bg-base:     #f8f8fc;
  --bg-surface:  #ffffff;
  --bg-elevated: #f0f0fa;
  --bg-code:     #f4f4fb;
  --bg-sidebar:  #f5f5fa;
  --bg-hover:    #ede7f6;
  --bg-active:   #e8d5f5;

  --border-subtle:  #e4e4f0;
  --border-default: #d0d0e8;
  --border-strong:  #b0b0cc;

  --text-primary:   #0f0f1a;
  --text-secondary: #3c3c5c;
  --text-muted:     #6a6a8a;
  --text-inverse:   #f8f8fc;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
}

[data-theme="light"] .header {
  background: rgba(248, 248, 252, 0.92);
}

[data-theme="light"] .code-block pre code {
  color: #24292e;
}

[data-theme="light"] img:not([src$=".svg"]):not([data-no-filter]) {
  filter: none;
}

[data-theme="light"] .hero h1 {
  background: linear-gradient(135deg, #0f0f1a 0%, var(--purple) 60%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================================
   THEME TOGGLE BUTTON
   ========================================================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ==========================================================
   FEATURE CARDS AS LINKS
   ========================================================== */
a.feature-card {
  display: block;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
a.feature-card:hover {
  color: inherit;
}

/* ==========================================================
   HERO STATS
   ========================================================== */
.hero-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.hero-stat strong {
  color: var(--text-secondary);
  font-weight: 600;
}
.hero-stat-sep {
  color: var(--border-strong);
}

/* ==========================================================
   INTEGRATION CHIPS AS LINKS
   ========================================================== */
a.integration-chip {
  text-decoration: none;
  cursor: pointer;
}
a.integration-chip:hover {
  color: var(--purple-light);
  border-color: var(--purple-border);
}

/* ==========================================================
   USE CASE TABS (index.html)
   ========================================================== */
.uc-tabs {
  margin: 0 0 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.uc-tab-list {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-elevated);
  overflow-x: auto;
}

.uc-tab {
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.uc-tab:hover { color: var(--text-primary); }
.uc-tab.active {
  color: var(--purple-light);
  border-bottom-color: var(--purple-light);
  background: var(--bg-surface);
}

.uc-panels { padding: 0; }
.uc-panel { display: none; }
.uc-panel.active { display: block; }

.uc-panel-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 28px 32px;
  align-items: start;
}
@media (max-width: 768px) {
  .uc-panel-inner { grid-template-columns: 1fr; padding: 20px; }
}

.uc-desc h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.uc-desc p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0;
}

.uc-code pre {
  background: var(--bg-code);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 18px 20px;
  font-size: 12.5px;
  line-height: 1.65;
  overflow-x: auto;
  margin: 0;
}
.uc-code pre code {
  color: #c9d1d9;
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  font-family: var(--font-mono);
}

/* ==========================================================
   TESTIMONIALS (index.html)
   ========================================================== */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 48px;
}
@media (max-width: 900px) {
  .testimonials-grid { grid-template-columns: 1fr; }
}

.testimonial-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.testimonial-quote {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0;
  flex: 1;
  font-style: italic;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 12px;
}

.testimonial-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--purple-bg);
  border: 1px solid var(--purple-border);
  color: var(--purple-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.testimonial-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.testimonial-role {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================
   CSS CONTAINER QUERIES — adaptive card layouts
   ========================================================== */
.card-grid { container-type: inline-size; }
@container (max-width: 480px) {
  .card { padding: 14px; }
  .card h3, .card-title { font-size: 13.5px; }
}

.blog-grid { container-type: inline-size; }
@container (max-width: 600px) {
  .blog-card { padding: 16px; }
  .blog-card-title { font-size: 14.5px; }
}

/* ==========================================================
   NEWSLETTER SECTION (index.html)
   ========================================================== */
.newsletter-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  padding: 36px 40px;
  margin: 48px 0;
  text-align: center;
}
.newsletter-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-primary);
}
.newsletter-section p {
  font-size: 14.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}
.newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 420px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}
.newsletter-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t-fast);
}
.newsletter-input:focus {
  border-color: var(--purple-border);
}
.newsletter-input::placeholder { color: var(--text-muted); }

/* === System Requirements Bar === */
.sysreq-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 12px 20px;
  margin: 0 0 36px;
  font-size: 13px;
}
.sysreq-label {
  font-weight: 600;
  color: var(--purple-light);
  margin-right: 4px;
  white-space: nowrap;
}
.sysreq-item {
  color: var(--text-secondary);
  white-space: nowrap;
}
.sysreq-sep {
  color: var(--border-subtle);
  user-select: none;
}
@media (max-width: 520px) {
  .sysreq-sep { display: none; }
  .sysreq-bar { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* === Expected Output Block === */
.expected-output-block {
  margin: 24px 0 36px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
}
.expected-output-header {
  background: color-mix(in srgb, var(--purple-bg) 60%, transparent);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.expected-output-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* === Integration Logos (provider badges) === */
.integration-logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px 4px 10px;
  border-radius: 99px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.integration-logo-chip:hover {
  border-color: var(--purple-border);
  color: var(--purple-light);
}
.integration-logo-chip svg {
  flex-shrink: 0;
}

/* === Integration Branded Chip Variants === */
.integration-chip--openai  { border-color: rgba(16,163,127,.35); color: #10a37f; }
.integration-chip--openai:hover  { background: rgba(16,163,127,.08); border-color: #10a37f; }
.integration-chip--claude  { border-color: rgba(204,91,54,.35); color: #cc5b36; }
.integration-chip--claude:hover  { background: rgba(204,91,54,.08); border-color: #cc5b36; }
.integration-chip--ollama  { border-color: rgba(255,148,51,.35); color: #ff9433; }
.integration-chip--ollama:hover  { background: rgba(255,148,51,.08); border-color: #ff9433; }
.integration-chip--telegram { border-color: rgba(40,167,229,.35); color: #28a7e5; }
.integration-chip--telegram:hover { background: rgba(40,167,229,.08); border-color: #28a7e5; }
.integration-chip--discord  { border-color: rgba(88,101,242,.35); color: #5865f2; }
.integration-chip--discord:hover  { background: rgba(88,101,242,.08); border-color: #5865f2; }
[data-theme="light"] .integration-chip--openai  { color: #0c8060; }
[data-theme="light"] .integration-chip--claude  { color: #9e3a1f; }
[data-theme="light"] .integration-chip--telegram { color: #1881b5; }
[data-theme="light"] .integration-chip--discord  { color: #3c44b0; }

/* === Hero animated gradient background === */
@keyframes hero-gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(147, 51, 234, 0.08) 0%,
    rgba(59, 130, 246, 0.05) 33%,
    rgba(16, 185, 129, 0.04) 66%,
    rgba(147, 51, 234, 0.08) 100%);
  background-size: 300% 300%;
  animation: hero-gradient-shift 12s ease infinite;
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }

/* ==========================================================================
   BLOG POST FOOTER — author meta, share, related, comments
   ========================================================================== */

.blog-meta-author,
.blog-meta-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82em;
  color: var(--text-secondary);
  margin-left: 10px;
}

.blog-post-footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border-color);
}

/* Share row */
.blog-share {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 44px;
}
.blog-share-label {
  color: var(--text-secondary);
  font-size: 0.9em;
}
.blog-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s, border-color 0.2s;
}
.blog-share-btn.btn-success {
  color: var(--green, #22c55e);
  border-color: var(--green, #22c55e);
}
.blog-share-feedback {
  font-size: 0.82em;
  color: var(--green, #22c55e);
  font-weight: 500;
}

/* Related articles grid */
.blog-related h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}
.blog-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 44px;
}
.blog-related-card {
  display: block;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.blog-related-card:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(147,51,234,0.12);
}
.blog-related-card .rc-category {
  font-size: 0.73em;
  color: var(--purple-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 600;
}
.blog-related-card .rc-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
}

/* Giscus / comments */
.blog-comments {
  margin-top: 8px;
}
.blog-comments h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.blog-comments-note {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px 24px;
  font-size: 0.9em;
  color: var(--text-secondary);
  line-height: 1.6;
}
.blog-comments-note a { color: var(--purple-light); }

