/* ── Reset & Base ── */

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

:root {
  --color-primary: #1a3a1a;
  --color-primary-light: #244d24;
  --color-primary-dark: #0f260f;
  --color-accent: #2d6a2d;
  --color-bg: #ffffff;
  --color-bg-alt: #f7f9f7;
  --color-bg-code: #1a1f2e;
  --color-text: #1f2937;
  --color-text-secondary: #6b7280;
  --color-text-light: #9ca3af;
  --color-border: #e5e7eb;
  --color-border-light: #f0f0f0;
  --color-success: #16a34a;
  --color-info: #2563eb;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --sidebar-width: 260px;
  --content-max-width: 860px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ── Sidebar ── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-primary);
  color: #fff;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.sidebar-logo a {
  color: #fff;
  text-decoration: none;
}

.sidebar-logo a:hover {
  color: #fff;
  text-decoration: none;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 20px 6px;
}

.sidebar-link {
  display: block;
  padding: 7px 20px 7px 28px;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.sidebar-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
}

.sidebar-link .badge {
  display: inline-block;
  font-size: 0.625rem;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.5);
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
}

/* ── Mobile nav toggle ── */

.nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-toggle:hover {
  background: var(--color-primary-light);
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

/* ── Main Content ── */

.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Typography ── */

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--color-primary);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-top: 56px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-primary);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 12px;
  color: var(--color-text);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--color-text);
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

p {
  margin-bottom: 16px;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 6px;
}

/* ── Code ── */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border-light);
  border-radius: 4px;
  padding: 2px 6px;
}

pre {
  background: var(--color-bg-code);
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  margin-bottom: 20px;
  line-height: 1.5;
  font-size: 0.8125rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #e2e8f0;
  font-size: inherit;
}

/* Syntax highlighting (minimal) */
.hl-keyword { color: #c792ea; }
.hl-string { color: #c3e88d; }
.hl-comment { color: #637777; font-style: italic; }
.hl-number { color: #f78c6c; }
.hl-property { color: #82aaff; }
.hl-function { color: #82aaff; }
.hl-const { color: #89ddff; }
.hl-type { color: #ffcb6b; }
.hl-param { color: #e2e8f0; }

/* ── Endpoint Blocks ── */

.endpoint {
  margin-top: 32px;
  margin-bottom: 40px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
}

.method-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.method-badge.post {
  background: #dcfce7;
  color: #15803d;
}

.method-badge.get {
  background: #dbeafe;
  color: #1d4ed8;
}

.method-badge.put {
  background: #fef3c7;
  color: #b45309;
}

.method-badge.delete {
  background: #fee2e2;
  color: #b91c1c;
}

.endpoint-path {
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text);
}

.endpoint-body {
  padding: 20px;
}

.endpoint-body > p:last-child {
  margin-bottom: 0;
}

/* ── Tables ── */

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--color-bg-alt);
}

th {
  text-align: left;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}

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

td code {
  font-size: 0.8125rem;
  white-space: nowrap;
}

.required {
  color: var(--color-danger);
  font-size: 0.75rem;
  font-weight: 600;
}

.optional {
  color: var(--color-text-light);
  font-size: 0.75rem;
}

/* ── Callouts ── */

.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  border-left: 4px solid;
}

.callout-info {
  background: #eff6ff;
  border-left-color: var(--color-info);
  color: #1e40af;
}

.callout-warning {
  background: #fffbeb;
  border-left-color: var(--color-warning);
  color: #92400e;
}

.callout-danger {
  background: #fef2f2;
  border-left-color: var(--color-danger);
  color: #991b1b;
}

.callout-success {
  background: #f0fdf4;
  border-left-color: var(--color-success);
  color: #166534;
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

/* ── Cards (landing page) ── */

.service-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.service-card {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 28px;
  transition: all 0.2s;
  background: var(--color-bg);
}

.service-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(26, 58, 26, 0.08);
  transform: translateY(-2px);
  text-decoration: none;
}

.service-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.service-card-desc {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.service-card-status {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.service-card-status.live {
  color: var(--color-success);
}

.service-card-status.coming-soon {
  color: var(--color-text-light);
}

/* ── Section links (on-page TOC) ── */

.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 40px;
}

.section-link {
  font-size: 0.8125rem;
  padding: 5px 12px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  color: var(--color-text-secondary);
  transition: all 0.15s;
}

.section-link:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  text-decoration: none;
}

/* ── Response status indicators ── */

.status-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8125rem;
}

.status-code.s2xx { color: var(--color-success); }
.status-code.s4xx { color: var(--color-warning); }
.status-code.s5xx { color: var(--color-danger); }

/* ── Landing hero ── */

.hero {
  padding: 20px 0 12px;
}

.hero h1 {
  font-size: 2.25rem;
}

/* ── Footer ── */

.page-footer {
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-light);
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .nav-toggle {
    display: block;
  }

  .nav-overlay.open {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .content {
    padding: 64px 20px 60px;
  }

  h1 {
    font-size: 1.625rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

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

  .endpoint-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  table {
    font-size: 0.8125rem;
  }

  th, td {
    padding: 8px 10px;
  }

  pre {
    padding: 16px;
    font-size: 0.75rem;
    border-radius: 6px;
  }
}

@media (max-width: 480px) {
  .content {
    padding: 56px 16px 48px;
  }

  pre {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }
}
