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

:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-code: #f1f5f9;
  --header-h: 56px;
  --sidebar-w: 240px;
  --content-max-w: 720px;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #60a5fa;
    --primary-hover: #93bbfd;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --border: #1e293b;
    --bg: #0f172a;
    --bg-subtle: #1e293b;
    --bg-code: #1e293b;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Header ─────────────────────────────────────────── */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.docs-header .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-img { height: 40px; width: auto; }
.logo-text { font-weight: 700; }

.docs-header nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.docs-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.docs-header nav a:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.docs-header nav .nav-github {
  margin-left: 0.5rem;
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.docs-header nav .nav-github:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: transparent;
}

/* ─── Menu toggle (mobile) ───────────────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* ─── Layout ─────────────────────────────────────────── */
.docs-container {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────── */
.docs-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0.75rem;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.75rem;
}

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.375rem;
  padding-left: 0.625rem;
  letter-spacing: 0.06em;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-links li {
  margin-bottom: 1px;
}

.sidebar-links a {
  display: block;
  padding: 0.3rem 0.625rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 450;
  transition: color 0.15s, background 0.15s;
}

.sidebar-links a:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.sidebar-links a.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  font-weight: 550;
}

/* ─── Main content ───────────────────────────────────── */
.docs-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem 3rem;
  max-width: calc(var(--content-max-w) + var(--sidebar-w) + 6rem);
}

.docs-main h1 {
  font-size: 1.875rem;
  margin: 0 0 1.5rem 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.docs-main h2 {
  font-size: 1.375rem;
  margin: 2.5rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.docs-main h3 {
  font-size: 1.1rem;
  margin: 2rem 0 0.75rem 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.docs-main h4 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem 0;
  font-weight: 600;
}

.docs-main p {
  margin: 0 0 1rem 0;
}

.docs-main table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.docs-main th, .docs-main td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.docs-main th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.docs-main img { max-width: 100%; height: auto; }

.docs-main ul, .docs-main ol {
  margin: 0 0 1rem 0;
  padding-left: 1.5rem;
}

.docs-main li {
  margin-bottom: 0.25rem;
}

/* ─── Typography ─────────────────────────────────────── */
code {
  background: var(--bg-code);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8em;
  font-family: 'SF Mono', ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, monospace;
}

pre {
  background: #0d1117;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  border: 1px solid var(--border);
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── Info boxes ─────────────────────────────────────── */
.info-box {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  border-left: 3px solid;
  font-size: 0.9rem;
}

.info-box.note {
  background: color-mix(in srgb, var(--primary) 8%, var(--bg));
  border-color: var(--primary);
}

.info-box.warning {
  background: #fefce8;
  border-color: #eab308;
}

.info-box.tip {
  background: #f0fdf4;
  border-color: #22c55e;
}

@media (prefers-color-scheme: dark) {
  .info-box.warning { background: #1c1a00; border-color: #eab308; }
  .info-box.tip { background: #052e16; border-color: #22c55e; }
}

/* ─── Section list ───────────────────────────────────── */
ul.section-list {
  list-style: none;
  padding: 0;
}

ul.section-list li {
  margin-bottom: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

ul.section-list li:hover {
  border-color: var(--primary);
}

ul.section-list li a {
  font-weight: 500;
}

nav.pagination { margin: 1.5rem 0; }
nav.pagination .pagination-list { list-style: none; padding: 0; margin: 0; display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
nav.pagination a { display: inline-block; padding: 0.25rem 0.55rem; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); text-decoration: none; }
nav.pagination a:hover { color: var(--primary); border-color: var(--primary); }
.pagination-current span { display: inline-block; padding: 0.25rem 0.55rem; border-radius: 6px; border: 1px solid var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.pagination-disabled span { display: inline-block; padding: 0.25rem 0.55rem; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); opacity: 0.6; }

/* ─── Footer ─────────────────────────────────────────── */
.docs-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* ─── Landing page ───────────────────────────────────── */
.landing-hero {
  text-align: center;
  padding: 4rem 0 2.5rem;
}

.landing-hero .badge {
  display: inline-block;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
}

.landing-hero h1 {
  font-size: 2.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.landing-hero p {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.landing-cta {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.landing-cta a {
  display: inline-block;
  padding: 0.65rem 1.75rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.15s;
}

.landing-cta .btn-primary {
  background: var(--primary);
  color: #fff;
}

.landing-cta .btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

.landing-cta .btn-secondary {
  border: 1px solid var(--border);
  color: var(--text);
}

.landing-cta .btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

/* ─── Terminal demo ──────────────────────────────────── */
.landing-terminal {
  max-width: 640px;
  margin: 2.5rem auto;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #1e293b;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.65rem 1rem;
  background: #334155;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #eab308; }
.terminal-dot.green { background: #22c55e; }

.terminal-title {
  flex: 1;
  text-align: center;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 36px;
}

.terminal-body {
  padding: 0;
}

.terminal-body pre {
  background: #0d1117;
  border: none;
  margin: 0;
  padding: 1rem 1.25rem;
  font-size: 0.825rem;
  line-height: 1.7;
  color: #e2e8f0;
}

.terminal-body pre code {
  color: #e2e8f0;
}

.terminal-prompt {
  color: #22c55e;
  font-weight: 600;
  user-select: none;
}

.terminal-output {
  color: #94a3b8;
}

/* ─── Feature cards ──────────────────────────────────── */
.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin: 3rem 0;
}

.feature-card {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.feature-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--primary) 8%, transparent);
}

.feature-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.feature-card h3 {
  font-size: 0.95rem;
  margin: 0 0 0.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .docs-sidebar {
    display: none;
    position: fixed;
    z-index: 99;
    width: 260px;
    background: var(--bg);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  }

  .docs-sidebar.open { display: block; }

  .docs-main {
    margin-left: 0;
    padding: 1.5rem 1.25rem;
  }

  .menu-toggle { display: block; }

  .docs-header nav { gap: 0.125rem; }
  .docs-header nav a { font-size: 0.8rem; padding: 0.3rem 0.5rem; }

  .landing-hero { padding: 2rem 0 1.5rem; }
  .landing-hero h1 { font-size: 1.75rem; }
  .landing-hero p { font-size: 1rem; }

  .landing-terminal { margin: 1.5rem auto; }

  .landing-features { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .docs-header nav a:not(.nav-github) { display: none; }
  .menu-toggle { display: block; }
}
