/* ============================================================
   ART Agent Docs v2 — Design System
   ============================================================ */

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

:root {
  /* Colors */
  --c-bg:        #ffffff;
  --c-surface:   #f8f9fb;
  --c-border:    #e2e6ec;
  --c-text:      #1a1f36;
  --c-text-2:    #525f7f;
  --c-text-3:    #8898aa;
  --c-accent:    #0070f3;
  --c-accent-bg: #eef6ff;
  --c-green:     #0cce6b;
  --c-green-bg:  #eafff3;
  --c-amber:     #f5a623;
  --c-amber-bg:  #fff8e6;
  --c-red:       #e25950;
  --c-code-bg:   #0d1117;
  --c-code-text: #c9d1d9;
  --c-sidebar:   #f8f9fb;
  --c-sidebar-active: #0070f3;

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

  /* Layout */
  --sidebar-w: 260px;
  --header-h: 56px;
  --content-max: 980px;
  --gap: 24px;
  --radius: 8px;
}

/* Dark mode */
[data-theme="dark"] {
  --c-bg:        #0d1117;
  --c-surface:   #161b22;
  --c-border:    #30363d;
  --c-text:      #e6edf3;
  --c-text-2:    #8b949e;
  --c-text-3:    #6e7681;
  --c-accent:    #58a6ff;
  --c-accent-bg: #0d1f3c;
  --c-green-bg:  #0d2818;
  --c-amber-bg:  #2d2000;
  --c-code-bg:   #0d1117;
  --c-code-text: #c9d1d9;
  --c-sidebar:   #0d1117;
}

/* --- Base --- */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--f-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; padding: 0 24px;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.85);
}
[data-theme="dark"] .site-header { background: rgba(13,17,23,0.85); }

.site-header .logo {
  font-weight: 700; font-size: 16px; color: var(--c-text);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.site-header .logo span { color: var(--c-accent); }
.header-nav { display: flex; gap: 4px; margin-left: 32px; }
.header-nav a {
  padding: 6px 12px; border-radius: 6px; font-size: 13.5px; font-weight: 500;
  color: var(--c-text-2); text-decoration: none; transition: all .15s;
}
.header-nav a:hover, .header-nav a.active { color: var(--c-accent); background: var(--c-accent-bg); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Theme toggle */
.theme-toggle {
  background: none; border: 1px solid var(--c-border); border-radius: 6px;
  padding: 6px 8px; cursor: pointer; font-size: 14px; color: var(--c-text-2);
  transition: all .15s;
}
.theme-toggle:hover { color: var(--c-text); border-color: var(--c-text-3); }

/* GitHub link */
.gh-link {
  font-size: 13px; color: var(--c-text-2); text-decoration: none;
  display: flex; align-items: center; gap: 6px;
}
.gh-link:hover { color: var(--c-text); }

/* Legacy-docs link (opt-in pointer to the older mkdocs site) */
.legacy-link {
  font-size: 12px; color: var(--c-text-3); text-decoration: none;
  padding: 4px 8px; border: 1px solid var(--c-border); border-radius: 6px;
  transition: all .15s;
}
.legacy-link:hover { color: var(--c-text); border-color: var(--c-text-3); }

/* --- Layout --- */
.layout { display: flex; margin-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 20px 16px;
  border-right: 1px solid var(--c-border);
  background: var(--c-sidebar);
  font-size: 13.5px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }

.sidebar-section { margin-bottom: 20px; }
.sidebar-section h4 {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text-3); margin-bottom: 6px; padding: 0 8px;
}
.sidebar-section a {
  display: block; padding: 5px 8px; border-radius: 5px;
  color: var(--c-text-2); text-decoration: none; transition: all .12s;
  font-weight: 450;
}
.sidebar-section a:hover { color: var(--c-text); background: var(--c-surface); }
.sidebar-section a.active { color: var(--c-sidebar-active); background: var(--c-accent-bg); font-weight: 600; }

/* Content */
.content { flex: 1; min-width: 0; padding: 32px 56px 80px; display: flex; justify-content: center; }
.content-inner { max-width: var(--content-max); width: 100%; }
.content-inner > * + * { margin-top: 22px; }

/* Mobile sidebar toggle */
.sidebar-toggle { display: none; }

/* --- Typography --- */
h1 { font-size: 28px; font-weight: 700; line-height: 1.25; margin-bottom: 8px; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 650; line-height: 1.3; margin: 40px 0 12px; padding-top: 20px;
     border-top: 1px solid var(--c-border); letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
h4 { font-size: 14px; font-weight: 650; margin: 24px 0 8px; color: var(--c-text);
     letter-spacing: -0.005em; }
h2:first-of-type { border-top: none; margin-top: 24px; }
p { margin: 0 0 16px; color: var(--c-text); }
.subtitle { font-size: 17px; color: var(--c-text-2); margin-bottom: 24px; line-height: 1.55; }
a { color: var(--c-accent); }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
hr { border: none; border-top: 1px solid var(--c-border); margin: 32px 0; }

/* --- Prose lists --- */
.content-inner ol,
.content-inner ul {
  margin: 0 0 18px; padding-left: 26px; color: var(--c-text);
}
.content-inner li { margin: 0 0 8px; line-height: 1.6; padding-left: 4px; }
.content-inner li:last-child { margin-bottom: 0; }
.content-inner ol { counter-reset: none; }
.content-inner ol > li::marker { color: var(--c-text-3); font-weight: 600; font-size: 0.92em; }
.content-inner ul > li::marker { color: var(--c-accent); }
/* Nested lists tighten up */
.content-inner li > ol,
.content-inner li > ul { margin: 8px 0 4px; }

/* Inline code */
code:not(pre code) {
  font-family: var(--f-mono); font-size: 0.875em;
  background: var(--c-surface); border: 1px solid var(--c-border);
  padding: 1px 5px; border-radius: 4px; color: var(--c-text);
}

/* --- Code blocks --- */
pre {
  background: var(--c-code-bg); color: var(--c-code-text);
  padding: 16px 20px; border-radius: var(--radius);
  overflow-x: auto; font-size: 13px; line-height: 1.6;
  margin: 0 0 16px; border: 1px solid var(--c-border);
}
pre code {
  font-family: var(--f-mono); background: none; border: none; padding: 0;
  color: inherit; font-size: inherit;
}
.code-block {
  position: relative; margin: 0 0 16px; border: 1px solid var(--c-border);
  border-radius: var(--radius); overflow: hidden; background: var(--c-code-bg);
}
.code-block pre {
  margin: 0; border: 0; border-radius: 0; padding-top: 18px;
}
.code-block-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 14px 0;
}
.code-block-label {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-text-3);
}
.code-block-copy {
  appearance: none; border: 1px solid var(--c-border); background: var(--c-surface);
  color: var(--c-text-2); border-radius: 6px; padding: 5px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
  opacity: 0; transform: translateY(-2px);
}
.code-block-copy.is-visible,
.code-block:hover .code-block-copy,
.code-block:focus-within .code-block-copy { opacity: 1; transform: translateY(0); }
.code-block-copy:hover { color: var(--c-text); border-color: var(--c-text-3); }
.code-label {
  display: inline-block; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-text-3); margin-bottom: 6px;
}

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
thead th {
  text-align: left; font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--c-text-3); padding: 8px 12px;
  border-bottom: 2px solid var(--c-border);
}
tbody td {
  padding: 10px 12px; border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--c-surface); }

/* --- Cards --- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 16px 0 24px; }
.card {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 20px; transition: all .15s; text-decoration: none; color: var(--c-text);
  display: block;
}
.card:hover { border-color: var(--c-accent); box-shadow: 0 2px 8px rgba(0,112,243,.08); text-decoration: none; }
.card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card p { font-size: 13px; color: var(--c-text-2); margin: 0; }
.card .badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px; margin-bottom: 8px;
}
.badge-blue { background: var(--c-accent-bg); color: var(--c-accent); }
.badge-green { background: var(--c-green-bg); color: var(--c-green); }
.badge-amber { background: var(--c-amber-bg); color: var(--c-amber); }

/* --- Callouts --- */
.callout {
  border-left: 3px solid var(--c-accent);
  background: var(--c-accent-bg);
  padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 16px 0 20px; font-size: 14px;
}
.callout p { margin: 0; }
.callout strong { font-weight: 600; }
.callout.tip { border-color: var(--c-green); background: var(--c-green-bg); }
.callout.warn { border-color: var(--c-amber); background: var(--c-amber-bg); }

/* --- Status pills (used in hardening matrix etc.) --- */
.pill {
  display: inline-block;
  font: 600 10px/1 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
  background: var(--c-green-bg); color: var(--c-green);
  border: 1px solid var(--c-green);
  white-space: nowrap;
}
.pill.warn    { background: var(--c-amber-bg); color: var(--c-amber); border-color: var(--c-amber); }
.pill.planned { background: transparent;       color: var(--c-text-2); border-color: var(--c-border); }

/* --- Disclosure summary used under diagrams --- */
.az-details-summary {
  cursor: pointer; color: var(--c-text-2);
  font-size: 13px; margin-bottom: 12px;
}

/* --- Comparison table --- */
.compare-table { margin: 16px 0 24px; }
.compare-table td:first-child { font-weight: 600; white-space: nowrap; }
.regions-note { margin: 8px 0 16px; }
.regions-note-text { margin: 0; font-size: 13px; }
.regions-footnote {
  font-size: 13px;
  color: var(--c-text-2);
  margin-top: 4px;
}
.regions-links {
  font-size: 13px;
  color: var(--c-text-2);
  margin-top: 8px;
}

/* --- Hero (index page) --- */
.hero { padding: 20px 0 8px; }
.hero-layout { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.hero-copy { flex: 1; min-width: 0; }
.hero-logo {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(15, 24, 44, 0.12);
}
.hero h1 { font-size: 36px; letter-spacing: -0.03em; }
.hero .subtitle { font-size: 19px; max-width: 600px; }
.hero-actions { display: flex; gap: 12px; margin-top: 20px; }
.hero-diagram { margin-top: 4px; }
.hero-legacy { margin: -4px 0 8px; }
.hero-legacy summary {
  cursor: pointer;
  color: var(--c-text-2);
  font-size: 13px;
}
.hero-legacy-diagram { margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  text-decoration: none; transition: all .15s;
}
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover { opacity: .9; text-decoration: none; }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { border-color: var(--c-text-3); text-decoration: none; }

/* Feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 8px 0 28px; }
.feature {
  padding: 18px;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
}
.feature-icon { font-size: 24px; margin-bottom: 8px; }
.feature h3 { font-size: 15px; margin: 0 0 4px; }
.feature p { font-size: 13.5px; color: var(--c-text-2); margin: 0; }

/* Quick start code */
.quickstart-block {
  background: linear-gradient(180deg, rgba(7, 12, 22, 0.96), rgba(10, 14, 24, 0.98));
  border-radius: 18px; padding: 22px 22px 18px; margin: 24px 0;
  border: 1px solid var(--c-border); box-shadow: 0 16px 32px rgba(0,0,0,.14);
}
.quickstart-block .step { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.quickstart-block .step:last-child { margin-bottom: 0; }
.quickstart-block .step-num {
  flex-shrink: 0; width: 24px; height: 24px;
  background: var(--c-accent); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; margin-top: 2px;
}
.quickstart-block .step-content { flex: 1; }
.quickstart-block .step-label { color: var(--c-text-3); font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.quickstart-block code { color: var(--c-code-text); font-family: var(--f-mono); font-size: 14px; }
.quickstart-block .step-note { color: var(--c-text-3); font-size: 12px; margin-top: 4px; }
.quickstart-block .clone-callout {
  margin: 2px 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(88,166,255,.22);
  background: linear-gradient(135deg, rgba(88,166,255,.16), rgba(88,166,255,.04));
}
.quickstart-block .clone-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #e6edf3;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.quickstart-block .clone-hint {
  margin: 0;
  color: rgba(230,237,243,.86);
  font-size: 12px;
  line-height: 1.5;
}
.quickstart-intro {
  margin: 0 0 16px; color: rgba(255,255,255,.84); font-size: 14px; line-height: 1.6;
}
.quickstart-reasons {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 20px;
}
.quickstart-reason {
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; padding: 14px;
}
.quickstart-reason h4 { margin: 0 0 6px; font-size: 13px; color: #fff; }
.quickstart-reason p { margin: 0; font-size: 12.5px; line-height: 1.55; color: rgba(255,255,255,.72); }
.quickstart-highlights {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 20px;
}
.quickstart-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px;
  border-radius: 999px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08); color: rgba(255,255,255,.82);
  font-size: 12px; line-height: 1;
}
@media (max-width: 820px) {
  .quickstart-reasons { grid-template-columns: 1fr; }
}

/* --- Architecture diagrams --- */
.arch-diagram {
  margin: 20px 0 24px; text-align: center;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  overflow: hidden; background: var(--c-surface);
  transition: all .15s;
}
.arch-diagram img {
  display: block; max-width: 100%; height: auto; margin: 0 auto;
}
.arch-diagram.contain img { object-fit: contain; max-height: 600px; padding: 16px; }
.arch-diagram.tall img { max-height: 800px; }
.arch-diagram figcaption {
  font-size: 12px; color: var(--c-text-3); padding: 8px 16px;
  border-top: 1px solid var(--c-border); text-align: center;
}
/* Clickable expand */
.arch-diagram[data-expandable] { cursor: pointer; position: relative; }
.arch-diagram[data-expandable]:hover {
  border-color: var(--c-accent);
  box-shadow: 0 4px 16px rgba(0,112,243,.12);
}
.arch-diagram[data-expandable]::after {
  content: '⤢ Click to expand'; position: absolute; bottom: 8px; right: 12px;
  font-size: 11px; color: var(--c-text-3); background: rgba(255,255,255,.85);
  padding: 2px 8px; border-radius: 4px; opacity: 0; transition: opacity .15s;
}
[data-theme="dark"] .arch-diagram[data-expandable]::after { background: rgba(13,17,23,.85); }
.arch-diagram[data-expandable]:hover::after { opacity: 1; }

/* Mermaid diagrams also clickable */
.az-diagram {
  cursor: pointer;
  margin: 16px 0 24px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  transition: all .15s;
  position: relative;
}
.az-diagram:hover {
  border-color: var(--c-accent);
  box-shadow: 0 4px 16px rgba(0,112,243,.12);
}
.az-diagram svg { display: block; width: 100%; height: auto; margin: 0 auto; }
.az-diagram-caption {
  font-size: 12px; color: var(--c-text-3); padding: 8px 16px;
  border-top: 1px solid var(--c-border); text-align: center;
}
.az-diagram::after {
  content: '⤢ Click to expand'; position: absolute; bottom: 8px; right: 12px;
  font-size: 11px; color: var(--c-text-3); background: rgba(255,255,255,.85);
  padding: 2px 8px; border-radius: 4px; opacity: 0; transition: opacity .15s;
}
[data-theme="dark"] .az-diagram::after { background: rgba(13,17,23,.85); }
.az-diagram:hover::after { opacity: 1; }

/* Lightbox overlay (legacy; kept for compatibility) */
.lightbox-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.85); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  cursor: zoom-out; align-items: center; justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
  max-width: 95vw; max-height: 92vh; object-fit: contain;
  border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

/* Enhanced diagram modal with drag & zoom */
.diagram-modal {
  display: none; position: fixed; inset: 0; z-index: 200;
}
.diagram-modal.open { display: flex; }
.diagram-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
}
.diagram-modal-container {
  position: relative; z-index: 201;
  display: flex; flex-direction: column;
  width: 90vw; height: 90vh;
  max-width: 1200px; max-height: 800px;
  background: var(--c-bg);
  border-radius: 12px;
  box-shadow: 0 16px 64px rgba(0,0,0,.4);
  overflow: hidden;
  margin: auto;
}
.diagram-modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.diagram-modal-title {
  font-size: 13px; font-weight: 600; color: var(--c-text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}
.diagram-modal-controls {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.diagram-zoom-btn {
  appearance: none;
  border: 1px solid var(--c-border);
  background: var(--c-bg);
  color: var(--c-text-2);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.diagram-zoom-btn:hover {
  color: var(--c-text);
  border-color: var(--c-text-3);
  background: var(--c-surface);
}
.diagram-zoom-level {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-2);
  min-width: 45px;
  text-align: center;
}
.diagram-modal-close {
  appearance: none;
  border: 1px solid var(--c-border);
  background: transparent;
  color: var(--c-text-2);
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.diagram-modal-close:hover {
  color: var(--c-text);
  border-color: var(--c-text-3);
  background: var(--c-surface);
}
.diagram-modal-canvas {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  position: relative;
  padding: 20px;
}
.diagram-modal-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transform-origin: center;
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}
.diagram-modal-content img,
.diagram-modal-content svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}
/* SVG host inside modal — keep diagram-scoped fills, drop container chrome */
.diagram-modal-content .modal-diagram-host {
  margin: 0; border: none; background: transparent;
  box-shadow: none; cursor: default;
  width: 100%; max-width: 1100px; display: flex;
}
.diagram-modal-content .modal-diagram-host::after { content: none; display: none; }
.diagram-modal-content .modal-diagram-host:hover { border: none; box-shadow: none; }
.diagram-modal-content .modal-diagram-host svg { pointer-events: none; }

/* Side-by-side diagrams */
.diagram-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0 24px;
}
@media (max-width: 768px) { .diagram-pair { grid-template-columns: 1fr; } }

/* --- Mermaid --- */
.mermaid { margin: 16px 0 24px; text-align: center; }
.mermaid svg { max-width: 100%; }

/* --- Tabs --- */
.tab-group { margin: 16px 0 24px; }
.tab-buttons { display: flex; gap: 0; border-bottom: 1px solid var(--c-border); }
.tab-btn {
  padding: 8px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--c-text-2); background: none; border: none;
  border-bottom: 2px solid transparent; cursor: pointer;
  transition: all .15s; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--c-text); }
.tab-btn.active { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.tab-panel { display: none; padding: 16px 0 0; }
.tab-panel.active { display: block; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { display: none; position: fixed; z-index: 90; left: 0; top: var(--header-h);
    width: 280px; height: calc(100vh - var(--header-h)); }
  .sidebar.open { display: block; }
  .sidebar-toggle { display: block; }
  .content { padding: 24px 20px 60px; }
  .content-inner > * + * { margin-top: 18px; }
  .feature-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .hero h1 { font-size: 28px; }
  .hero { padding-top: 16px; }
  .hero-layout { flex-direction: column-reverse; gap: 12px; }
  .hero-logo { width: 80px; height: 80px; }
  .hero-actions { flex-wrap: wrap; }
}

/* --- Utility --- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--c-text-2); }
.text-small { font-size: 13px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ============================================================
   Search (⌘K)
   ============================================================ */

/* Header trigger */
.search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 10px 0 12px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 6px; cursor: pointer;
  color: var(--c-text-3); font-family: var(--f-sans); font-size: 13px;
  min-width: 180px; transition: all .15s;
}
.search-trigger:hover { color: var(--c-text-2); border-color: var(--c-text-3); }
.search-trigger-icon { font-size: 14px; opacity: .8; }
.search-trigger-label { flex: 1; text-align: left; }
.search-trigger-kbd {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  padding: 2px 6px; border-radius: 4px;
  background: var(--c-bg); border: 1px solid var(--c-border);
  color: var(--c-text-3);
}
@media (max-width: 768px) {
  .search-trigger { min-width: 0; width: 32px; padding: 0; justify-content: center; }
  .search-trigger-label, .search-trigger-kbd { display: none; }
}

/* Modal */
.search-modal { display: none; position: fixed; inset: 0; z-index: 300; }
.search-modal.open { display: block; }
html.search-open { overflow: hidden; }

.search-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 20, 30, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
[data-theme="dark"] .search-modal-backdrop { background: rgba(0, 0, 0, 0.65); }

.search-modal-panel {
  position: relative; margin: 80px auto 0;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  background: var(--c-bg); border: 1px solid var(--c-border);
  border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.search-modal-input-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--c-border);
}
.search-modal-icon { font-size: 18px; color: var(--c-text-3); }
.search-modal-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--f-sans); font-size: 16px; color: var(--c-text);
  padding: 4px 0;
}
.search-modal-input::placeholder { color: var(--c-text-3); }
.search-modal-esc {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  padding: 3px 7px; border-radius: 4px;
  background: var(--c-surface); border: 1px solid var(--c-border);
  color: var(--c-text-3);
}

.search-modal-status {
  padding: 8px 18px; font-size: 12px; color: var(--c-text-3);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
}

.search-modal-results {
  flex: 1; overflow-y: auto; padding: 6px;
}
.search-modal-results::-webkit-scrollbar { width: 8px; }
.search-modal-results::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 4px; }

.search-result {
  display: block; padding: 10px 14px; margin: 2px 0;
  border-radius: 8px; text-decoration: none;
  color: var(--c-text); transition: background .12s;
}
.search-result:hover, .search-result.active {
  background: var(--c-accent-bg); text-decoration: none;
}
.search-result-crumbs {
  font-size: 12px; color: var(--c-text-3); margin-bottom: 4px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.search-arrow { color: var(--c-text-3); margin: 0 2px; }
.search-result-title {
  font-size: 14px; font-weight: 600; color: var(--c-text);
}
.search-result.active .search-result-title { color: var(--c-accent); }
.search-result-snippet {
  font-size: 13px; line-height: 1.5; color: var(--c-text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-result mark {
  background: var(--c-amber-bg); color: var(--c-text);
  padding: 0 2px; border-radius: 3px; font-weight: 600;
}
[data-theme="dark"] .search-result mark { background: rgba(245,166,35,.22); color: var(--c-text); }

.search-modal-footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; font-size: 11px; color: var(--c-text-3);
  border-top: 1px solid var(--c-border); background: var(--c-surface);
}
.search-modal-footer kbd {
  font-family: var(--f-mono); font-size: 10px;
  padding: 2px 5px; border-radius: 3px; margin-right: 2px;
  background: var(--c-bg); border: 1px solid var(--c-border);
  color: var(--c-text-2);
}
.search-modal-credit { margin-left: auto; opacity: .75; }
@media (max-width: 540px) {
  .search-modal-panel { margin-top: 24px; max-height: calc(100vh - 32px); }
  .search-modal-credit { display: none; }
}

/* ============================================================
   Certification page
   ============================================================ */

/* Three-up overview cards (Apprentice / Creator / Maestro) */
.cert-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0 40px;
}
.cert-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 24px 20px; transition: all .15s;
  color: var(--c-text); text-decoration: none;
}
.cert-card:hover { border-color: var(--c-accent); box-shadow: 0 4px 16px rgba(0,112,243,.10); text-decoration: none; }
.cert-card img { width: 140px; height: 140px; object-fit: contain; margin-bottom: 14px; }
.cert-card .level-num {
  font: 600 11px/1 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--c-text-3); margin-bottom: 4px;
}
.cert-card h3 { font-size: 18px; margin: 0 0 8px; }
.cert-card p { font-size: 13.5px; color: var(--c-text-2); margin: 0 0 16px; min-height: 60px; }
.cert-card .cert-card-cta {
  margin-top: auto;
  font-size: 13px; font-weight: 600; color: var(--c-accent);
}

/* Detailed level section */
.cert-level {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  align-items: start;
  padding: 32px 0;
  border-top: 1px solid var(--c-border);
}
.cert-level:first-of-type { border-top: none; padding-top: 8px; }
.cert-level-badge {
  position: sticky; top: calc(var(--header-h) + 16px);
  text-align: center;
}
.cert-level-badge img { width: 160px; height: 160px; object-fit: contain; }
.cert-level-badge .level-tag {
  display: inline-block;
  font: 600 11px/1 var(--f-sans); letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 12px;
  background: var(--c-accent-bg); color: var(--c-accent);
  margin-top: 12px;
}
.cert-level-body h3 { font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em; }
.cert-level-body .lead { font-size: 15px; color: var(--c-text-2); margin: 0 0 20px; }
.cert-level-body h4 {
  font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--c-text-3);
  margin: 20px 0 8px;
}

/* Checklist (replaces github-style [ ] task lists) */
.checklist {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px;
}
.checklist li {
  padding-left: 26px; position: relative;
  font-size: 13.5px; color: var(--c-text);
  line-height: 1.5; padding-top: 4px; padding-bottom: 4px;
}
.checklist li::before {
  content: '';
  position: absolute; left: 0; top: 7px;
  width: 16px; height: 16px;
  border: 1.5px solid var(--c-text-3);
  border-radius: 3px;
  background: transparent;
}
.checklist.single-col { grid-template-columns: 1fr; }

/* Process steps – reuse quickstart-block visual */
.cert-process { margin: 16px 0 28px; }
.cert-process-step {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--c-surface);
}
.cert-process-step .step-num {
  flex-shrink: 0; width: 28px; height: 28px;
  background: var(--c-accent); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; margin-top: 1px;
}
.cert-process-step .step-body { flex: 1; }
.cert-process-step h4 { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.cert-process-step p { font-size: 13.5px; color: var(--c-text-2); margin: 0; }
.cert-process-step code {
  background: var(--c-bg); border: 1px solid var(--c-border);
  padding: 1px 5px; border-radius: 3px; font-size: 12.5px;
}

/* Hall of fame */
.hall-of-fame { margin: 16px 0 32px; }
.hall-of-fame details {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px;
}
.hall-of-fame details[open] { background: var(--c-surface); }
.hall-of-fame summary {
  cursor: pointer; font-weight: 600; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  list-style: none;
}
.hall-of-fame summary::-webkit-details-marker { display: none; }
.hall-of-fame summary::before {
  content: '▸'; font-size: 10px; color: var(--c-text-3);
  transition: transform .15s;
}
.hall-of-fame details[open] summary::before { transform: rotate(90deg); }
.hall-of-fame .hof-tag {
  display: inline-block; font: 600 10px/1 var(--f-sans);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 10px;
  margin-left: auto;
}
.hall-of-fame .hof-tag.maestro    { background: var(--c-amber-bg); color: var(--c-amber); }
.hall-of-fame .hof-tag.creator    { background: var(--c-accent-bg); color: var(--c-accent); }
.hall-of-fame .hof-tag.apprentice { background: var(--c-green-bg); color: var(--c-green); }
.hall-of-fame table { margin: 14px 0 0; }

/* Profile snippet block (markdown code preview) */
.profile-snippet {
  border: 1px solid var(--c-border); border-radius: var(--radius);
  padding: 18px; margin: 12px 0 24px;
  background: var(--c-surface);
}
.profile-snippet .snippet-preview {
  border-bottom: 1px solid var(--c-border);
  padding-bottom: 14px; margin-bottom: 14px;
  display: flex; gap: 16px; align-items: center;
}
.profile-snippet .snippet-preview img { width: 80px; height: 80px; }
.profile-snippet .snippet-preview .snippet-text strong { display: block; margin-bottom: 4px; font-size: 14px; }
.profile-snippet .snippet-preview .snippet-text span { font-size: 13px; color: var(--c-text-2); }
.profile-snippet pre { margin: 0; }

@media (max-width: 900px) {
  .cert-overview { grid-template-columns: 1fr; }
  .cert-level { grid-template-columns: 1fr; }
  .cert-level-badge { position: static; }
  .cert-level-badge img { width: 120px; height: 120px; }
  .checklist { grid-template-columns: 1fr; }
}
