/* ============================================================
   ChainAware Docs — Static Site CSS
   Styling for ChainAware Learn — chainaware.ai/learn
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Variables (light theme) ─────────────────────────── */
:root {
  /* Primary blue scale */
  --primary-1:  255 255 255;
  --primary-2:  247 250 255;
  --primary-3:  241 248 255;
  --primary-4:  233 243 255;
  --primary-5:  224 238 255;
  --primary-6:  213 230 255;
  --primary-7:  198 218 253;
  --primary-8:  182 205 246;
  --primary-9:  52  109 219;   /* accent blue */
  --primary-10: 57  115 225;
  --primary-11: 87  110 152;
  --primary-12: 24  29  38;

  /* Neutral/tint scale */
  --tint-1:  255 255 255;
  --tint-2:  249 250 251;
  --tint-3:  246 247 250;
  --tint-4:  240 242 246;
  --tint-5:  234 237 242;
  --tint-6:  226 230 236;
  --tint-7:  213 217 224;
  --tint-8:  200 205 213;
  --tint-9:  121 133 155;
  --tint-10: 110 122 143;
  --tint-11: 106 110 119;
  --tint-12: 28  29  31;

  /* Semantic tokens */
  --color-bg:           rgb(var(--tint-1));
  --color-bg-subtle:    rgb(var(--tint-2));
  --color-bg-muted:     rgb(var(--tint-3));
  --color-border:       rgb(var(--tint-6));
  --color-border-hover: rgb(var(--tint-7));
  --color-text:         rgb(var(--tint-12));
  --color-text-muted:   rgb(var(--tint-10));
  --color-text-subtle:  rgb(var(--tint-9));
  --color-accent:       rgb(var(--primary-9));
  --color-accent-hover: rgb(var(--primary-10));
  --color-accent-light: rgb(var(--primary-3));
  --color-accent-text:  rgb(var(--primary-11));

  /* Layout */
  --sidebar-width:      272px;
  --header-height:      64px;
  --content-max-width:  752px;
  --toc-width:          224px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;

  /* Spacing */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.07), 0 1px 2px -1px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

/* ── Dark theme ───────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-1:  13  18  28;
    --primary-2:  16  22  36;
    --primary-3:  19  27  47;
    --primary-9:  76  130 240;
    --primary-10: 88  141 248;
    --primary-11: 147 175 220;
    --primary-12: 218 230 248;

    --tint-1:  17  18  20;
    --tint-2:  22  24  27;
    --tint-3:  28  31  36;
    --tint-4:  35  39  46;
    --tint-5:  44  49  57;
    --tint-6:  55  61  72;
    --tint-7:  72  79  93;
    --tint-8:  96  105 122;
    --tint-9:  145 155 174;
    --tint-10: 160 170 188;
    --tint-11: 175 183 198;
    --tint-12: 237 239 244;
  }
}

[data-theme="dark"] {
  --primary-1:  13  18  28;
  --primary-2:  16  22  36;
  --primary-3:  19  27  47;
  --primary-9:  76  130 240;
  --primary-10: 88  141 248;
  --primary-11: 147 175 220;
  --primary-12: 218 230 248;

  --tint-1:  17  18  20;
  --tint-2:  22  24  27;
  --tint-3:  28  31  36;
  --tint-4:  35  39  46;
  --tint-5:  44  49  57;
  --tint-6:  55  61  72;
  --tint-7:  72  79  93;
  --tint-8:  96  105 122;
  --tint-9:  145 155 174;
  --tint-10: 160 170 188;
  --tint-11: 175 183 198;
  --tint-12: 237 239 244;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;       /* 15px */
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout Shell ─────────────────────────────────────────── */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-body {
  display: flex;
  flex: 1;
  padding-top: var(--header-height);
}

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: 30;
  display: flex;
  align-items: center;
  background-color: rgb(var(--tint-1) / 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgb(var(--tint-6) / 0.5);
  box-shadow: 0 1px 0 rgb(var(--tint-12) / 0.04);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 1.5rem 0 1.25rem;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9375rem;
  flex-shrink: 0;
}

.site-logo img {
  height: 28px;
  width: auto;
}

.site-logo-text {
  font-weight: 600;
  color: var(--color-text);
}

/* Header search */
.header-search {
  flex: 1;
  max-width: 280px;
}

.header-search input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-subtle);
  color: var(--color-text);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.header-search input:focus {
  border-color: var(--color-accent);
  background: var(--color-bg);
}

.header-search input::placeholder {
  color: var(--color-text-subtle);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.header-btn-ghost {
  color: var(--color-text-muted);
  background: transparent;
}
.header-btn-ghost:hover {
  background: rgb(var(--tint-4));
  color: var(--color-text);
}

.header-btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.header-btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* Social icon buttons */
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.header-icon-btn:hover {
  background: rgb(var(--tint-4));
  color: var(--color-text);
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.theme-toggle:hover {
  background: rgb(var(--tint-4));
  color: var(--color-text);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 0;
  border-right: 1px solid rgb(var(--tint-6) / 0.6);
  background: var(--color-bg);
  z-index: 20;
  scrollbar-width: thin;
  scrollbar-color: rgb(var(--tint-6)) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgb(var(--tint-6));
  border-radius: 2px;
}

/* Sidebar sections */
.sidebar-section {
  margin-bottom: 0.25rem;
}

.sidebar-section-title {
  padding: 0.5rem 1.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-subtle);
}

/* Sidebar nav items */
.sidebar-nav {
  list-style: none;
}

.sidebar-nav-item {
  display: block;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 0;
  line-height: 1.5;
  transition: color 0.12s, background-color 0.12s;
  position: relative;
}

.sidebar-nav-link:hover {
  color: var(--color-text);
  background: rgb(var(--tint-3));
}

.sidebar-nav-link.active {
  color: var(--color-accent);
  background: rgb(var(--primary-3));
  font-weight: 500;
}

.sidebar-nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--color-accent);
  border-radius: 0 2px 2px 0;
}

/* Nested nav (sub-items) */
.sidebar-nav-sub {
  list-style: none;
  padding-left: 1rem;
  margin: 0.125rem 0;
}

.sidebar-nav-sub .sidebar-nav-link {
  font-size: 0.8125rem;
  padding: 0.3rem 1.25rem;
  color: var(--color-text-subtle);
}

.sidebar-nav-sub .sidebar-nav-link:hover {
  color: var(--color-text-muted);
  background: rgb(var(--tint-3));
}

.sidebar-nav-sub .sidebar-nav-link.active {
  color: var(--color-accent);
  background: rgb(var(--primary-3));
}

/* Sidebar icons */
.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ── Main content area ────────────────────────────────────── */
.page-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.content-with-toc {
  display: flex;
  width: 100%;
  max-width: calc(var(--content-max-width) + var(--toc-width) + 3rem);
}

/* ── Article ──────────────────────────────────────────────── */
.article {
  flex: 1;
  min-width: 0;
  max-width: var(--content-max-width);
  padding: 2.5rem 2rem 4rem;
}

/* ── Page header (breadcrumb + title) ─────────────────────── */
.page-header {
  margin-bottom: 2rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
}

.breadcrumb a {
  color: var(--color-text-subtle);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--color-text-muted);
}
.breadcrumb-sep {
  color: rgb(var(--tint-7));
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

.page-description {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ── Prose (markdown content) ─────────────────────────────── */
.prose {
  color: var(--color-text);
  font-size: 0.9375rem;
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  color: var(--color-text);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2em;
  margin-bottom: 0.75em;
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.prose h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.375rem; padding-bottom: 0.4em; border-bottom: 1px solid var(--color-border); }
.prose h3 { font-size: 1.125rem; }
.prose h4 { font-size: 1rem; }
.prose h5, .prose h6 { font-size: 0.9375rem; }

.prose p {
  margin-bottom: 1.25em;
}

.prose a {
  color: var(--color-accent);
  text-decoration: none;
  border-bottom: 1px solid rgb(var(--primary-7));
  transition: color 0.12s, border-color 0.12s;
}
.prose a:hover {
  color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* CTA buttons inside .prose must not inherit link colour or underline */
.prose a.cta-btn {
  border-bottom: none;
}
.prose a.cta-btn--primary {
  color: #fff;
}
.prose a.cta-btn--outline {
  color: var(--color-accent);
}
.prose a.cta-btn--ghost {
  color: var(--color-text-muted);
}

.prose strong { font-weight: 600; }
.prose em { font-style: italic; }

.prose ul,
.prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1.25em;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-bottom: 0.4em; }
.prose li > ul, .prose li > ol { margin-top: 0.4em; margin-bottom: 0; }

/* Inline code */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: rgb(var(--tint-3));
  border: 1px solid rgb(var(--tint-5));
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
  color: rgb(var(--primary-11));
}

/* Code blocks */
.prose pre {
  background: rgb(var(--tint-12));
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin-bottom: 1.5em;
  position: relative;
  border: 1px solid rgb(var(--tint-11) / 0.2);
}

.prose pre code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  color: rgb(var(--tint-3));
  line-height: 1.7;
}

/* Blockquote */
.prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5em 0;
  background: rgb(var(--primary-3));
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--color-text-muted);
  font-style: italic;
}

/* Tables */
.prose .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5em;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.prose thead {
  background: var(--color-bg-subtle);
}

.prose th {
  padding: 0.625rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
}

.prose td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose tr:hover td {
  background: var(--color-bg-subtle);
}

/* Horizontal rule */
.prose hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5em 0;
}

/* Images */
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin: 1.5em 0;
}

/* ── Hint / callout blocks ────────────────────────────────── */
.hint {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5em;
  border: 1px solid transparent;
  font-size: 0.9rem;
  line-height: 1.6;
}

.hint-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.1em;
}

.hint-info {
  background: rgb(var(--primary-3));
  border-color: rgb(var(--primary-6));
  color: rgb(var(--primary-12));
}

.hint-warning {
  background: rgb(255 247 230);
  border-color: rgb(255 220 130);
  color: rgb(100 70 10);
}

.hint-danger {
  background: rgb(255 237 237);
  border-color: rgb(255 195 195);
  color: rgb(150 30 30);
}

.hint-success {
  background: rgb(237 252 243);
  border-color: rgb(180 235 205);
  color: rgb(20 100 50);
}

[data-theme="dark"] .hint-warning {
  background: rgb(60 45 10);
  border-color: rgb(100 80 20);
  color: rgb(255 220 130);
}
[data-theme="dark"] .hint-danger {
  background: rgb(60 20 20);
  border-color: rgb(100 40 40);
  color: rgb(255 160 160);
}
[data-theme="dark"] .hint-success {
  background: rgb(15 50 30);
  border-color: rgb(30 100 60);
  color: rgb(100 220 150);
}

/* ── Cards (index pages) ──────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2em;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-bg);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  box-shadow: var(--shadow-xs);
}

.card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  background: var(--color-bg-subtle);
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.card-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.card-description {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  line-height: 1.5;
}

/* ── Table of Contents (right sidebar) ───────────────────── */
.toc {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 2.5rem 0 4rem 1.5rem;
}

.toc-sticky {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  scrollbar-width: none;
}
.toc-sticky::-webkit-scrollbar { display: none; }

.toc-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-subtle);
  margin-bottom: 0.75rem;
}

.toc-nav {
  list-style: none;
}

.toc-nav-link {
  display: block;
  padding: 0.3rem 0;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  text-decoration: none;
  line-height: 1.45;
  border-left: 2px solid rgb(var(--tint-5));
  padding-left: 0.875rem;
  transition: color 0.12s, border-color 0.12s;
}

.toc-nav-link:hover {
  color: var(--color-text-muted);
  border-left-color: rgb(var(--tint-8));
}

.toc-nav-link.active {
  color: var(--color-accent);
  border-left-color: var(--color-accent);
  font-weight: 500;
}

.toc-nav-link.depth-3 {
  padding-left: 1.75rem;
  font-size: 0.75rem;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.pagination-prev,
.pagination-next {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  padding: 1rem 1.25rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-xs);
}

.pagination-next { text-align: right; align-items: flex-end; }
.pagination-prev { align-items: flex-start; }

.pagination-prev:hover,
.pagination-next:hover {
  border-color: var(--color-accent);
  background: var(--color-bg-subtle);
  box-shadow: var(--shadow-sm);
}

.pagination-label {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pagination-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  margin-left: var(--sidebar-width);
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--color-text-subtle);
  text-decoration: none;
  transition: color 0.12s;
}
.footer-links a:hover {
  color: var(--color-text-muted);
}

.footer-powered {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ── Utility ──────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Responsive ───────────────────────────────────────────── */

/* Hide TOC on medium screens */
@media (max-width: 1200px) {
  .toc { display: none; }
  .content-with-toc { max-width: var(--content-max-width); }
}

/* Collapse sidebar on tablet */
@media (max-width: 960px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 40;
    box-shadow: var(--shadow-md);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .page-content,
  .site-footer {
    margin-left: 0;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.4);
    z-index: 35;
    backdrop-filter: blur(2px);
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 960px) {
  .sidebar-overlay { display: none; }
  .sidebar-overlay.visible { display: block; }
}

/* Mobile */
@media (max-width: 640px) {
  .article {
    padding: 1.5rem 1.25rem 3rem;
  }

  .article--wide {
    padding: 1.5rem 1.25rem 3rem;
  }

  .page-title {
    font-size: 1.625rem;
  }

  .prose h2 { font-size: 1.25rem; }
  .prose h3 { font-size: 1.0625rem; }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .pagination {
    flex-direction: column;
  }

  .header-search {
    display: none;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .cta-box {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Menu toggle (mobile only) */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s;
}
.menu-toggle:hover {
  background: rgb(var(--tint-4));
}

@media (max-width: 960px) {
  .menu-toggle { display: flex; }
}

/* ── Header nav (dropdown) ───────────────────────────────── */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  padding: 0 1rem;
}

.header-nav-item {
  position: relative;
}

.header-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 34px;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.header-nav-btn:hover {
  background: rgb(var(--tint-3));
  color: var(--color-text);
}

.header-nav-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 260px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 0.5rem;
  padding-top: calc(0.5rem + 6px);
  z-index: 100;
}

.header-nav-dropdown:hover .header-nav-menu,
.header-nav-dropdown.open .header-nav-menu {
  display: block;
}

.header-nav-menu-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.12s;
}
.header-nav-menu-item:hover {
  background: var(--color-bg-subtle);
}
.header-nav-menu-item strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}
.header-nav-menu-item span {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}

@media (max-width: 960px) {
  .header-nav { display: none; }
}

/* ── Home page layout ─────────────────────────────────────── */
.page-content--home {
  margin-left: var(--sidebar-width);
  flex: 1;
}

.home-page {
  width: 100%;
}

/* Hero */
.home-hero {
  padding: 5rem 3rem 4rem;
  text-align: center;
  background: linear-gradient(135deg, rgb(var(--primary-3)) 0%, rgb(var(--tint-1)) 60%);
  border-bottom: 1px solid var(--color-border);
}
.home-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--color-text);
  max-width: 720px;
  margin: 0 auto 1.25rem;
}
.home-hero-sub {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}
.home-hero-ctas {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* CTA buttons */
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.cta-btn:hover { transform: translateY(-1px); }
.cta-btn--primary {
  background: var(--color-accent);
  color: #fff;
  border: 2px solid var(--color-accent);
}
.cta-btn--primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.cta-btn--outline {
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}
.cta-btn--outline:hover { background: rgb(var(--primary-3)); }
.cta-btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 2px solid var(--color-border);
}
.cta-btn--ghost:hover { background: var(--color-bg-subtle); color: var(--color-text); }

/* Trust bar */
.home-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  padding: 1.25rem 3rem;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8125rem;
}
.home-trust-label {
  color: var(--color-text-subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.6875rem;
}
.home-trust-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  align-items: center;
}
.home-trust-item {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.8125rem;
}

/* Problem section */
.home-problem {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 3rem;
  border-bottom: 1px solid var(--color-border);
  padding-left: 2rem;
  padding-right: 2rem;
}
.home-problem-col {
  padding: 3rem;
  border-right: 1px solid var(--color-border);
}
.home-problem-col:last-child { border-right: none; }
.home-problem-col h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  color: var(--color-text);
}
.home-problem-col p {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* How it works */
.home-how {
  padding: 4rem 3rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.home-how h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}
.home-how-sub {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
}
.home-how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}
.home-how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.home-how-step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-weight: 700;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-how-step h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}
.home-how-step p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
}

/* Audience split */
.home-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--color-border);
}
.home-split-col {
  padding: 3.5rem 3rem;
  border-right: 1px solid var(--color-border);
}
.home-split-col:last-child { border-right: none; background: var(--color-bg-subtle); }
.home-split-col h2 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
}
.home-split-col ul {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}
.home-split-col ul li {
  padding: 0.4rem 0;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  padding-left: 1.25rem;
  position: relative;
}
.home-split-col ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 700;
}

/* Case study spotlight */
.home-case-study {
  padding: 4rem 3rem;
  background: rgb(var(--primary-3));
  border-bottom: 1px solid rgb(var(--primary-6));
  text-align: center;
}
.home-case-study h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.75rem;
}
.home-case-study-quote {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
  font-style: italic;
}
.home-case-study-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.home-case-study-stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
}
.home-case-study-stat span {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Metrics bar */
.home-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--color-border);
}
.home-metric {
  padding: 2.5rem 2rem;
  text-align: center;
  border-right: 1px solid var(--color-border);
}
.home-metric:last-child { border-right: none; }
.home-metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
  display: block;
  margin-bottom: 0.375rem;
}
.home-metric-label {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Product cards */
.home-products {
  padding: 4rem 3rem;
  border-bottom: 1px solid var(--color-border);
}
.home-products h2 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: var(--color-text);
}
.home-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.home-product-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-bg);
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-xs);
}
.home-product-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
}
.home-product-icon { font-size: 1.5rem; }
.home-product-title { font-weight: 600; font-size: 0.9375rem; }
.home-product-desc { font-size: 0.8125rem; color: var(--color-text-subtle); line-height: 1.5; }
.home-product-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  background: rgb(var(--primary-3));
  border-radius: 4px;
  padding: 0.15em 0.5em;
  align-self: flex-start;
}

/* Competitor teaser */
.home-vs {
  padding: 4rem 3rem;
  background: var(--color-bg-subtle);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}
.home-vs h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--color-text); }
.home-vs p { font-size: 0.9375rem; color: var(--color-text-muted); max-width: 560px; margin: 0 auto 1.5rem; line-height: 1.65; }

/* Blog teaser */
.home-blog {
  padding: 4rem 3rem;
  border-bottom: 1px solid var(--color-border);
}
.home-blog h2 { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 2rem; color: var(--color-text); }
.home-blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}
.home-blog-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.home-blog-card:hover { border-color: var(--color-accent); box-shadow: var(--shadow-sm); }
.home-blog-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
}
.home-blog-title { font-weight: 600; font-size: 0.9375rem; line-height: 1.4; color: var(--color-text); }
.home-blog-desc { font-size: 0.8125rem; color: var(--color-text-subtle); line-height: 1.5; }

/* Final CTA */
.home-cta {
  padding: 5rem 3rem;
  text-align: center;
  background: linear-gradient(135deg, rgb(var(--primary-9)) 0%, rgb(var(--primary-10)) 100%);
}
.home-cta h2 { font-size: 1.875rem; font-weight: 800; color: #fff; margin-bottom: 0.75rem; }
.home-cta p { font-size: 1rem; color: rgba(255,255,255,0.85); margin-bottom: 2rem; }
.home-cta .cta-btn--primary { background: #fff; color: var(--color-accent); border-color: #fff; }
.home-cta .cta-btn--primary:hover { background: rgba(255,255,255,0.9); }
.home-cta .cta-btn--outline { border-color: rgba(255,255,255,0.6); color: #fff; }
.home-cta .cta-btn--outline:hover { background: rgba(255,255,255,0.15); }

/* ── Wide article (landing / use case / comparison pages) ── */
.article--wide {
  max-width: calc(var(--content-max-width) + var(--toc-width) + 3rem);
  padding: 3rem 2.5rem 4rem;
}

/* ── Footer trust bar ─────────────────────────────────────── */
.site-footer {
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-trust {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--color-text-subtle);
}
.footer-trust-sep { color: rgb(var(--tint-7)); }
.footer-copy { color: var(--color-text-subtle); font-size: 0.8125rem; }

/* ── Inline metric / callout boxes ───────────────────────── */
.metrics-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1.5rem 0;
}
.metric-box {
  flex: 1;
  min-width: 120px;
  padding: 1.25rem;
  background: rgb(var(--primary-3));
  border: 1px solid rgb(var(--primary-6));
  border-radius: var(--radius-lg);
  text-align: center;
}
.metric-box strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
  margin-bottom: 0.375rem;
}
.metric-box span {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cta-box {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cta-box p { margin: 0; font-weight: 500; color: var(--color-text); }

/* ── Responsive: home page ───────────────────────────────── */
@media (max-width: 960px) {
  .page-content--home { margin-left: 0; }
  .home-problem, .home-split { grid-template-columns: 1fr; }
  .home-problem-col { border-right: none; border-bottom: 1px solid var(--color-border); }
  .home-split-col { border-right: none; border-bottom: 1px solid var(--color-border); }
  .home-metrics { grid-template-columns: repeat(2, 1fr); }
  .home-metric { border-bottom: 1px solid var(--color-border); }
  .home-how-steps { grid-template-columns: 1fr; }
  .home-hero { padding: 3rem 1.5rem 2.5rem; }
  .home-hero h1 { font-size: 1.75rem; }
  .home-trust, .home-problem-col, .home-how,
  .home-split-col, .home-case-study, .home-products,
  .home-vs, .home-blog, .home-cta { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (max-width: 640px) {
  .home-metrics { grid-template-columns: 1fr 1fr; }
  .home-case-study-stats { gap: 1.5rem; }
}

/* ── Scrollbar (global) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgb(var(--tint-6));
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgb(var(--tint-8));
}

/* ── Syntax highlight tokens (minimal) ───────────────────── */
.prose pre .token-keyword    { color: #cf8ef4; }
.prose pre .token-string     { color: #9ece6a; }
.prose pre .token-comment    { color: rgb(var(--tint-9)); font-style: italic; }
.prose pre .token-number     { color: #ff9e64; }
.prose pre .token-function   { color: #7dcfff; }
.prose pre .token-operator   { color: #89ddff; }
.prose pre .token-punctuation{ color: #c0caf5; }
