/* ===== Groundstone Labs Docs ===== */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --accent: #a78bfa;
  --bg: #fafafa;
  --bg-secondary: #f0f0f5;
  --bg-card: #ffffff;
  --bg-code: #f3f4f6;
  --bg-header: rgba(250, 250, 250, 0.8);
  --text: #1a1a2e;
  --text-secondary: #555568;
  --text-muted: #888898;
  --border: #e2e2ea;
  --border-light: #ededf2;
  --sidebar-bg: #ffffff;
  --sidebar-active: rgba(56, 189, 248, 0.08);
  --sidebar-hover: rgba(56, 189, 248, 0.05);
  --code-text: #1a1a2e;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-width: 260px;
  --toc-width: 220px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: #141430;
  --bg-code: #1a1a36;
  --bg-header: rgba(10, 10, 26, 0.85);
  --text: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6a6a82;
  --border: #2a2a44;
  --border-light: #1e1e38;
  --sidebar-bg: #0e0e22;
  --sidebar-active: rgba(56, 189, 248, 0.12);
  --sidebar-hover: rgba(56, 189, 248, 0.06);
  --code-text: #e0e0f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px rgba(56, 189, 248, 0.2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.7; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 100; overflow-y: auto;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 24px 20px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 8px; }
.sidebar-brand .brand-text h1 {
  font-size: 16px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text); line-height: 1.2;
}
.sidebar-brand .brand-text p {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-section {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); padding: 16px 12px 6px;
}
.sidebar-link {
  display: block; padding: 8px 12px; font-size: 14px;
  color: var(--text-secondary); text-decoration: none;
  border-radius: var(--radius-sm); transition: all var(--transition); margin: 1px 0;
}
.sidebar-link:hover { color: var(--text); background: var(--sidebar-hover); text-decoration: none; }
.sidebar-link.active { color: var(--primary); background: var(--sidebar-active); font-weight: 500; }
.sidebar-footer {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.sidebar-footer a { font-size: 12px; color: var(--text-muted); text-decoration: none; }
.sidebar-footer a:hover { color: var(--primary); }

/* Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-secondary); transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Mobile Header */
.mobile-header {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: 56px; background: var(--bg-header);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); z-index: 99;
  padding: 0 16px; align-items: center; justify-content: space-between;
}
.mobile-header .brand-row { display: flex; align-items: center; gap: 10px; }
.mobile-header .brand-row img { width: 28px; height: 28px; border-radius: 6px; }
.mobile-header h1 { font-size: 16px; font-weight: 600; }
.mobile-header h1 span { color: var(--primary); }
.hamburger {
  width: 40px; height: 40px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  cursor: pointer; font-size: 20px; color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 99;
}

/* Layout */
.layout { display: flex; margin-left: var(--sidebar-width); min-height: 100vh; }
.main {
  flex: 1; max-width: 860px; margin: 0 auto;
  padding: 48px 48px 80px; min-width: 0;
}

/* Right TOC */
.toc {
  width: var(--toc-width); flex-shrink: 0;
  position: sticky; top: 32px; align-self: flex-start;
  padding: 32px 16px 32px 0; max-height: calc(100vh - 64px); overflow-y: auto;
}
.toc-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 12px;
}
.toc a {
  display: block; font-size: 13px; color: var(--text-muted);
  text-decoration: none; padding: 4px 0 4px 12px;
  border-left: 2px solid var(--border); transition: all var(--transition); line-height: 1.5;
}
.toc a:hover { color: var(--primary); border-left-color: var(--primary); text-decoration: none; }

/* Breadcrumb */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 24px;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; color: var(--text);
}
h1 { font-size: 2rem; margin-bottom: 12px; }
h2 { font-size: 1.4rem; margin-top: 48px; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.1rem; margin-top: 32px; margin-bottom: 12px; }
p { margin-bottom: 16px; }
.lead { font-size: 1.125rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: 32px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
ul, ol { margin: 0 0 16px 24px; }
li { margin-bottom: 6px; }
code {
  font-family: 'Geist Mono', 'SF Mono', Consolas, monospace;
  font-size: 0.875em; background: var(--bg-code);
  padding: 2px 6px; border-radius: 4px; color: var(--primary-dark);
}
[data-theme="dark"] code { color: var(--primary); }
strong { font-weight: 600; }

/* Code Block */
.code-block {
  background: var(--bg-code); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 20px; overflow: hidden;
}
.code-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--border-light);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}
.copy-btn {
  font-family: 'Geist', sans-serif; font-size: 11px; font-weight: 500;
  padding: 3px 10px; border: 1px solid var(--border);
  border-radius: 4px; background: var(--bg-card);
  color: var(--text-secondary); cursor: pointer; transition: all var(--transition);
}
.copy-btn:hover { border-color: var(--primary); color: var(--primary); }
.copy-btn.copied { border-color: #10b981; color: #10b981; }
.code-block pre {
  padding: 16px; overflow-x: auto;
  font-family: 'Geist Mono', 'SF Mono', Consolas, monospace;
  font-size: 13px; line-height: 1.6; color: var(--code-text);
  margin: 0; white-space: pre; background: transparent;
}
.code-block pre code {
  background: transparent; padding: 0; border-radius: 0;
  color: inherit; font-size: inherit;
}

/* Callout */
.callout {
  padding: 16px 20px; border-radius: var(--radius);
  margin-bottom: 20px; font-size: 14px; border-left: 4px solid;
}
.callout-info { background: rgba(56, 189, 248, 0.06); border-left-color: var(--primary); }
.callout-tip { background: rgba(167, 139, 250, 0.06); border-left-color: var(--accent); }
.callout-warn { background: rgba(251, 191, 36, 0.06); border-left-color: #fbbf24; }

/* Endpoint */
.endpoint {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.endpoint-method {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: 12px; font-weight: 700; font-family: 'Geist Mono', monospace;
  letter-spacing: 0.04em; vertical-align: middle;
}
.method-get { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.method-post { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.method-put { background: rgba(251, 191, 36, 0.12); color: #f59e0b; }
.method-delete { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.endpoint-path {
  font-family: 'Geist Mono', monospace; font-size: 15px;
  font-weight: 500; color: var(--text); margin-left: 10px; vertical-align: middle;
}
.endpoint-desc { margin-top: 12px; color: var(--text-secondary); font-size: 14px; }

/* Param Table */
.param-table { width: 100%; border-collapse: collapse; margin: 12px 0 20px; font-size: 14px; }
.param-table th {
  text-align: left; padding: 8px 12px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
}
.param-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: top; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.badge-required { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.badge-optional { background: rgba(56, 189, 248, 0.1); color: #38bdf8; }

/* Cards */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: all var(--transition); text-decoration: none; color: var(--text); display: block;
}
.card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-1px); text-decoration: none; color: var(--text);
}
.card h3 { font-size: 15px; margin: 0 0 6px; }
.card p { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.card .card-icon { font-size: 24px; margin-bottom: 10px; display: block; }

/* Hero */
.hero { text-align: center; padding: 60px 0 48px; }
.hero h1 {
  font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em; margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero .tagline {
  font-size: 1.25rem; color: var(--text-secondary);
  max-width: 540px; margin: 0 auto 32px; line-height: 1.6;
}
.hero-cta {
  display: inline-block; padding: 12px 28px;
  background: var(--primary-dark); color: #fff !important;
  font-weight: 600; font-size: 15px; border-radius: var(--radius);
  text-decoration: none !important; transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}
.hero-cta:hover {
  background: var(--primary); color: #fff !important; text-decoration: none !important;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4); transform: translateY(-1px);
}

/* Tabs */
.tabs { margin-bottom: 24px; }
.tab-list {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border);
  list-style: none; margin: 0; padding: 0;
}
.tab-btn {
  padding: 8px 16px; font-family: 'Geist', sans-serif;
  font-size: 13px; font-weight: 500; background: transparent;
  border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer;
  transition: all var(--transition); white-space: nowrap; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; padding-top: 20px; }
.tab-panel.active { display: block; }

/* Steps */
.steps { counter-reset: step; margin-bottom: 32px; }
.step {
  position: relative; padding-left: 48px;
  margin-bottom: 28px; counter-increment: step;
}
.step::before {
  content: counter(step); position: absolute; left: 0; top: 2px;
  width: 32px; height: 32px; background: var(--primary); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.step h3 { margin-top: 0; margin-bottom: 6px; font-size: 16px; }
.step p { color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }

/* Footer */
.footer {
  border-top: 1px solid var(--border); padding: 32px 0;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--text-muted);
}
.footer a { color: var(--text-muted); text-decoration: none; }
.footer a:hover { color: var(--primary); }
.footer-links { display: flex; gap: 20px; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 12px; overflow: hidden;
}
.faq-question {
  width: 100%; text-align: left; padding: 16px 20px;
  background: var(--bg-card); border: none; font-family: 'Geist', sans-serif;
  font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  transition: background var(--transition);
}
.faq-question:hover { background: var(--sidebar-hover); }
.faq-question .faq-icon {
  font-size: 20px; font-weight: 300; color: var(--text-muted);
  transition: transform 0.2s ease; flex-shrink: 0; margin-left: 12px;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  display: none; padding: 0 20px 16px; font-size: 14px;
  color: var(--text-secondary); line-height: 1.7; background: var(--bg-card);
}
.faq-item.open .faq-answer { display: block; }

/* Quick grid (home) */
.quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin: 24px 0 32px;
}
.quick-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; text-decoration: none;
  color: var(--text); transition: all var(--transition); display: block;
}
.quick-card:hover {
  border-color: var(--primary); box-shadow: var(--shadow-md);
  transform: translateY(-2px); text-decoration: none; color: var(--text);
}
.quick-card .qc-icon { font-size: 28px; margin-bottom: 12px; display: block; }
.quick-card h3 { font-size: 15px; margin: 0 0 6px; }
.quick-card p { font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5; }

/* Responsive */
@media (max-width: 1140px) { .toc { display: none; } }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .mobile-header { display: flex; }
  .layout { margin-left: 0; }
  .main { padding: 72px 20px 60px; }
  .hero h1 { font-size: 1.8rem; }
  .hero .tagline { font-size: 1.05rem; }
  .footer { padding: 24px 0; }
  .tab-list { gap: 2px; }
  .tab-btn { padding: 6px 10px; font-size: 12px; }
  .quick-grid, .card-grid { grid-template-columns: 1fr; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::selection { background: rgba(56, 189, 248, 0.2); color: var(--text); }

@media print {
  .sidebar, .mobile-header, .toc, .theme-toggle, .copy-btn { display: none !important; }
  .layout { margin-left: 0; }
  .main { max-width: 100%; padding: 20px; }
}
