/* ==============================================
   Vehium Docs — docs.vehium.com
   GitHub-inspired palette, system font, clean
   ============================================== */

/* ---- Design Tokens: Dark (GitHub dark) ---- */
:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-alt: #010409;
  --bg-card: #161b22;
  --surface: #161b22;
  --surface-strong: #21262d;
  --border: #30363d;
  --border-hover: #484f58;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --text-dim: #7d8590;
  --accent: #4493f8;
  --accent-hover: #58a6ff;
  --accent-2: #3fb950;
  --accent-3: #bc8cff;
  --accent-soft: rgba(56, 139, 253, 0.15);
  --code-bg: #151b23;
  --code-border: #30363d;
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 160ms;
  --dur-mid: 280ms;
  --nav-height: 64px;
  --sidebar-width: 280px;
  --toc-width: 220px;
  --content-max: 760px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* ---- Light (GitHub light) ---- */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --bg-card: #ffffff;
  --surface: #f6f8fa;
  --surface-strong: #eaeef2;
  --border: #d1d9e0;
  --border-hover: #afb8c1;
  --text: #1f2328;
  --text-muted: #59636e;
  --text-dim: #818b98;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --accent-2: #1a7f37;
  --accent-3: #8250df;
  --accent-soft: rgba(9, 105, 218, 0.1);
  --code-bg: #f6f8fa;
  --code-border: #d1d9e0;
  --shadow-soft: 0 8px 24px rgba(31, 35, 40, 0.08);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-padding-top: calc(var(--nav-height) + 16px); }
body { font-family: var(--font-sans); font-size: 16px; line-height: 1.6; color: var(--text); background: var(--bg); overflow-x: hidden; transition: background var(--dur-mid) var(--ease), color var(--dur-mid) var(--ease); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-sans); font-weight: 600; line-height: 1.25; color: var(--text); }

/* ---- Top nav ---- */
.topnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 24px;
  transition: background var(--dur-mid) var(--ease), border-color var(--dur-mid) var(--ease);
}

.topnav-inner { max-width: 1400px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-weight: 600; font-size: 16px; color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 6px; }
.brand .tag { font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid transparent; }

.topnav-links { display: flex; align-items: center; gap: 4px; margin-left: 20px; }
.topnav-links a { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text-muted); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.topnav-links a:hover, .topnav-links a.active { color: var(--text); background: var(--surface); }

.topnav-spacer { flex: 1; }

.topnav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.icon-btn:hover { border-color: var(--border-hover); background: var(--surface); }
.icon-btn svg { width: 16px; height: 16px; }

.nav-toggle { display: none; }

/* ---- Main layout ---- */
.docs-layout {
  max-width: 1400px; margin: 0 auto; padding: var(--nav-height) 0 0;
  display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--toc-width); gap: 40px;
}

/* ---- Sidebar ---- */
.sidebar {
  position: sticky; top: var(--nav-height); height: calc(100vh - var(--nav-height));
  padding: 28px 0 32px 24px; overflow-y: auto; border-right: 1px solid var(--border);
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sidebar h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 18px 12px 6px; }
.sidebar h3:first-child { margin-top: 0; }
.sidebar ul { list-style: none; }
.sidebar li { margin: 0; }
.sidebar a { display: block; padding: 6px 12px; margin: 1px 0; border-radius: var(--radius-sm); font-size: 14px; color: var(--text-muted); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.sidebar a:hover { color: var(--text); background: var(--surface); }
.sidebar a.active { color: var(--accent); background: var(--accent-soft); font-weight: 500; }

/* ---- Content ---- */
.content { padding: 36px 0 96px; max-width: var(--content-max); width: 100%; min-width: 0; }
.breadcrumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.breadcrumbs a { color: var(--text-muted); transition: color var(--dur-fast) var(--ease); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-dim); }

.content h1 { font-size: 32px; margin-bottom: 12px; font-weight: 600; letter-spacing: -0.01em; }
.content h1 + .lead { font-size: 17px; color: var(--text-muted); margin-bottom: 36px; line-height: 1.6; }
.content h2 { font-size: 22px; margin: 40px 0 12px; padding-top: 8px; font-weight: 600; letter-spacing: -0.005em; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.content h3 { font-size: 17px; margin: 26px 0 10px; font-weight: 600; }
.content h4 { font-size: 15px; margin: 20px 0 8px; font-weight: 600; }
.content p { margin-bottom: 14px; color: var(--text); }
.content p code, .content li code, .content td code, .content th code { background: var(--code-bg); border: 1px solid var(--code-border); padding: 1px 6px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.88em; color: var(--text); }
.content a { color: var(--accent); }
.content a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
.content ul, .content ol { margin: 0 0 16px 24px; }
.content li { margin-bottom: 4px; }
.content strong { color: var(--text); font-weight: 600; }
.content em { color: var(--text); }

.content pre { background: var(--code-bg); border: 1px solid var(--code-border); border-radius: var(--radius-md); padding: 14px 16px; overflow-x: auto; margin-bottom: 16px; font-family: var(--font-mono); font-size: 13.5px; line-height: 1.55; }
.content pre code { background: transparent; border: none; padding: 0; color: var(--text); font-size: inherit; }

/* ---- Tables ---- */
.content table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 12px 0 20px; font-size: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.content th, .content td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.content th { font-weight: 600; color: var(--text); background: var(--surface); font-size: 13px; text-transform: none; letter-spacing: 0; }
html[data-theme="dark"] .content tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }
html[data-theme="light"] .content tbody tr:nth-child(even) td { background: #fafbfc; }
.content tr:last-child td { border-bottom: none; }

/* ---- Callouts ---- */
.callout { border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius-md); padding: 14px 18px; margin: 16px 0 20px; }
.callout-title { font-weight: 600; color: var(--accent); margin-bottom: 4px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.callout-info { border-left-color: var(--accent); }
.callout-info .callout-title { color: var(--accent); }
.callout-tip { border-left-color: var(--accent-2); }
.callout-tip .callout-title { color: var(--accent-2); }
.callout-warning { border-left-color: #d29922; }
.callout-warning .callout-title { color: #d29922; }
.callout-danger { border-left-color: #f85149; }
.callout-danger .callout-title { color: #f85149; }
.callout p { font-size: 14.5px; line-height: 1.55; }
.callout p:last-child { margin-bottom: 0; }

/* ---- Numbered Steps (1-2-3) ---- */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 20px 0 28px; }
.step { counter-increment: step; position: relative; padding: 0 0 22px 48px; margin-left: 14px; border-left: 2px solid var(--border); }
.step:last-child { border-left-color: transparent; padding-bottom: 4px; }
.step::before {
  content: counter(step);
  position: absolute; left: -15px; top: -4px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12.5px; font-weight: 600;
  color: var(--accent);
  letter-spacing: 0;
}
.step h3, .step .step-title { margin: -2px 0 6px; font-size: 16px; font-weight: 600; }
.step p { font-size: 15px; color: var(--text-muted); line-height: 1.55; margin-bottom: 6px; }
.step p:last-child { margin-bottom: 0; }
.step ul, .step ol { margin: 6px 0 0 20px; }
.step li { font-size: 14.5px; color: var(--text-muted); }
.step code { background: var(--code-bg); border: 1px solid var(--code-border); padding: 1px 6px; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: 0.88em; color: var(--text); }
.step a { color: var(--accent); }
.step a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---- Cards grid (for hub pages) ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 8px 0 28px; }
.doc-card { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); transition: border-color var(--dur-fast) var(--ease); color: var(--text); }
.doc-card:hover { border-color: var(--border-hover); }
.doc-card h3 { font-size: 15px; margin-bottom: 4px; color: var(--text); font-weight: 600; }
.doc-card p { font-size: 13.5px; color: var(--text-muted); margin-bottom: 0; line-height: 1.5; }

/* ---- App-pick tiles (landing page) ---- */
.app-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin: 28px 0; }
.app-tile { display: block; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-card); transition: border-color var(--dur-fast) var(--ease); color: var(--text); }
.app-tile:hover { border-color: var(--border-hover); }
.app-tile .tile-kicker { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.app-tile h2 { font-size: 20px; margin-bottom: 6px; font-weight: 600; border-bottom: none; padding: 0; }
.app-tile p { color: var(--text-muted); margin-bottom: 14px; font-size: 14.5px; line-height: 1.55; }
.app-tile .tile-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--accent); }

/* ---- Pager (prev / next) ---- */
.pager { display: flex; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { flex: 1; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); transition: border-color var(--dur-fast) var(--ease); }
.pager a:hover { border-color: var(--border-hover); }
.pager .label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.pager .title { font-weight: 600; color: var(--text); font-size: 14.5px; }
.pager .next { text-align: right; }

/* ---- Table of contents ---- */
.toc {
  position: sticky; top: var(--nav-height); height: calc(100vh - var(--nav-height));
  padding: 40px 16px 32px 0; overflow-y: auto; font-size: 13px;
}
.toc h4 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 10px; }
.toc ul { list-style: none; }
.toc li { margin-bottom: 3px; }
.toc a { display: block; padding: 3px 0; color: var(--text-muted); transition: color var(--dur-fast) var(--ease); line-height: 1.45; }
.toc a:hover, .toc a.active { color: var(--accent); }
.toc ul ul { margin-left: 10px; border-left: 1px solid var(--border); padding-left: 10px; }

/* ---- Search box ---- */
.search-box { position: relative; min-width: 220px; }
.search-box input { width: 100%; padding: 6px 12px 6px 34px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; font-family: inherit; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); height: 32px; }
.search-box input:focus { outline: none; border-color: var(--accent); background: var(--bg); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input::placeholder { color: var(--text-dim); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-dim); pointer-events: none; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); max-height: 400px; overflow-y: auto; z-index: 50; }
.search-results:empty { display: none; }
.search-results a { display: block; padding: 9px 12px; font-size: 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--surface); color: var(--accent); }
.search-results .hit-path { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- Footer ---- */
.docs-footer { border-top: 1px solid var(--border); padding: 24px 24px; margin-top: 48px; }
.docs-footer-inner { max-width: 1400px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-muted); }
.docs-footer a { color: var(--text-muted); }
.docs-footer a:hover { color: var(--accent); }
.docs-footer .fl-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---- Mobile ---- */
@media (max-width: 1100px) {
  .toc { display: none; }
  .docs-layout { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); gap: 28px; }
}
@media (max-width: 820px) {
  :root { --sidebar-width: 260px; }
  .topnav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .docs-layout { grid-template-columns: 1fr; gap: 0; }
  .sidebar { position: fixed; top: var(--nav-height); left: 0; bottom: 0; width: 84%; max-width: 320px; background: var(--bg); z-index: 50; transform: translateX(-100%); transition: transform var(--dur-mid) var(--ease); border-right: 1px solid var(--border); padding: 24px 20px; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after { content: ''; position: fixed; inset: var(--nav-height) 0 0 0; background: rgba(0, 0, 0, 0.6); z-index: 40; }
  .content { padding: 24px 20px 80px; }
  .content h1 { font-size: 26px; }
  .content h2 { font-size: 19px; }
  .search-box { display: none; }
  .step { padding-left: 44px; }
}

/* ---- Prefer reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Theme icons ---- */
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }
html[data-theme="light"] .icon-sun { display: block; }
html[data-theme="light"] .icon-moon { display: none; }
