/* Check Harbor Docs — docs.css */
:root {
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-muted: #272F42;
  --border: #475569;
  --fg: #F8FAFC;
  --fg-muted: #94A3B8;
  --accent: #22C55E;
  --accent-dim: rgba(34,197,94,0.12);
  --note: #3B82F6;
  --note-dim: rgba(59,130,246,0.12);
  --warning: #F59E0B;
  --warning-dim: rgba(245,158,11,0.12);
  --tip: #10B981;
  --tip-dim: rgba(16,185,129,0.12);
  --radius: 8px;
  --sidebar-width: 16rem;
  --toc-width: 14rem;
  --content-max: 48rem;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.7;
  min-height: 100vh;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 1rem;
  z-index: 9999;
  background: var(--accent);
  color: #000;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 1rem; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 0 1rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.75rem;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--fg);
  font-weight: 700;
  font-size: 1rem;
}
.logo-icon { color: var(--accent); display: flex; }
.logo-text { letter-spacing: -0.02em; }

/* Tab switcher */
.tab-switcher {
  display: flex;
  gap: 0;
  padding: 0 0.75rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.tab-switch-btn {
  flex: 1;
  padding: 0.4rem 0.5rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-radius: 0;
}
.tab-switch-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.tab-switch-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.tab-switch-btn:only-child { border-radius: var(--radius); }
.tab-switch-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.tab-switch-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sidebar-tab-content { display: none; }
.sidebar-tab-content.active { display: block; }

.sidebar-group { padding: 0 0.75rem 0.5rem; }
.sidebar-group-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  padding: 0.5rem 0.25rem 0.35rem;
}
.sidebar-links { list-style: none; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s;
  min-height: 44px;
}
.sidebar-link:hover { background: var(--surface-muted); color: var(--fg); }
.sidebar-link.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.sidebar-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sidebar-link-external svg { width: 14px; height: 14px; opacity: 0.7; }

/* ── Main content ────────────────────────────────────────────────────────── */
.main-content {
  overflow-x: hidden;
  min-height: 100vh;
  outline: none;
}
.content-wrapper {
  display: grid;
  grid-template-columns: minmax(0, var(--content-max)) var(--toc-width);
  gap: 2rem;
  max-width: calc(var(--content-max) + var(--toc-width) + 4rem);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  align-items: start;
}

/* ── Article content ─────────────────────────────────────────────────────── */
.content { min-width: 0; }
.content h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 0.75rem; }
.content h2 { font-size: 1.35rem; font-weight: 600; margin-top: 2.5rem; margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.content h3 { font-size: 1.1rem; font-weight: 600; margin-top: 2rem; margin-bottom: 0.75rem; }
.content h4 { font-size: 1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.content p { margin-bottom: 1rem; color: var(--fg); }
.content a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.content a:hover { opacity: 0.8; }
.content a:focus-visible { outline: 2px solid var(--accent); border-radius: 2px; }
.content ul, .content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.content li { margin-bottom: 0.35rem; }
.content strong { font-weight: 600; color: var(--fg); }
.content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.4em;
  color: var(--accent);
}

/* Code blocks */
.code-block {
  position: relative;
  margin: 1.25rem 0;
}
.content pre {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 0;
}
.content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.875rem;
  color: var(--fg);
  line-height: 1.6;
}
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}
.copy-btn:hover { background: var(--surface-muted); color: var(--fg); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

/* Tables */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.content th, .content td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
}
.content th {
  background: var(--surface-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}
.content tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Blockquotes */
.content blockquote {
  border-left: 3px solid var(--border);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: var(--fg-muted);
  font-style: italic;
}
.content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Card Group ──────────────────────────────────────────────────────────── */
.card-group {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}
.card-group-cols-1 { grid-template-columns: 1fr; }
.card-group-cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-group-cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-group-cols-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  transition: all 0.2s;
}
.card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-icon { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.card-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.25rem; }
.card-desc { color: var(--fg-muted); font-size: 0.875rem; line-height: 1.5; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.25rem 0;
}
.tab-buttons {
  display: flex;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-btn {
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  min-height: 44px;
}
.tab-btn:hover { color: var(--fg); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab-panels { padding: 1.25rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel > *:last-child { margin-bottom: 0 !important; }
.tab-panel .code-block:first-child, .tab-panel pre:first-child { margin-top: 0; }

/* ── Code group ──────────────────────────────────────────────────────────── */
.code-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.25rem 0;
}
.code-group .code-block { margin: 0; }
.code-group pre { border: none; border-radius: 0; border-top: 1px solid var(--border); }
.code-group .code-block:first-child pre { border-top: none; }

/* ── Callouts ────────────────────────────────────────────────────────────── */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border-left: 3px solid;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}
.callout-note { background: var(--note-dim); border-color: var(--note); }
.callout-info { background: var(--note-dim); border-color: var(--note); }
.callout-warning { background: var(--warning-dim); border-color: var(--warning); }
.callout-tip { background: var(--tip-dim); border-color: var(--tip); }
.callout-label {
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  padding-top: 0.1rem;
}
.callout-note .callout-label, .callout-info .callout-label { color: var(--note); }
.callout-warning .callout-label { color: var(--warning); }
.callout-tip .callout-label { color: var(--tip); }
.callout-content { flex: 1; }
.callout-content p:last-child { margin-bottom: 0; }

/* ── Accordions ──────────────────────────────────────────────────────────── */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 0;
  overflow: hidden;
}
.accordion-group .accordion + .accordion { margin-top: 0.5rem; }
.accordion-title {
  padding: 0.85rem 1.25rem;
  background: var(--surface-muted);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}
.accordion-title::-webkit-details-marker { display: none; }
.accordion-title::after {
  content: '+';
  font-size: 1.1rem;
  color: var(--fg-muted);
  transition: transform 0.2s;
}
.accordion[open] .accordion-title::after { content: '−'; }
.accordion-body {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}
.accordion-body > *:last-child { margin-bottom: 0; }

/* ── Param fields ────────────────────────────────────────────────────────── */
.param-field {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.param-field:last-child { border-bottom: none; }
.param-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.param-name {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}
.param-type {
  font-size: 0.75rem;
  background: rgba(34,197,94,0.1);
  color: var(--accent);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 4px;
  padding: 0.15em 0.5em;
  font-family: var(--mono);
}
.param-required {
  font-size: 0.7rem;
  background: rgba(239,68,68,0.1);
  color: #F87171;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 4px;
  padding: 0.15em 0.5em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.param-desc { font-size: 0.875rem; color: var(--fg-muted); line-height: 1.5; }

/* ── Steps ───────────────────────────────────────────────────────────────── */
.steps { margin: 1.5rem 0; }
.step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.step-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}
.step-title { font-weight: 600; font-size: 1rem; margin-bottom: 0.5rem; }
.step-content > *:last-child { margin-bottom: 0; }

/* ── ToC ─────────────────────────────────────────────────────────────────── */
.toc {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}
.toc-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}
.toc-list { list-style: none; }
.toc-item { margin-bottom: 0.35rem; }
.toc-level-3 { padding-left: 0.75rem; }
.toc-link {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
  display: block;
  padding: 0.1rem 0;
}
.toc-link:hover { color: var(--accent); }
.toc-link.active { color: var(--accent); font-weight: 500; }
.toc-link:focus-visible { outline: 2px solid var(--accent); border-radius: 2px; }

/* ── Hamburger / Mobile ──────────────────────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: all 0.2s;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 100;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar-overlay.open { display: block; }
  .hamburger { display: flex; }
  .main-content { padding-top: 4rem; }
  .content-wrapper {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 3rem;
  }
  .toc { display: none; }
  .card-group-cols-2, .card-group-cols-3, .card-group-cols-4 {
    grid-template-columns: 1fr;
  }
}
