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

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

:root {
  --teal: #50B8A8;
  --teal-hover: #2BAD9E;
  --navy: #1A2E44;
  --text: #1A1A1A;
  --text-secondary: #6B7280;
  --bg: #FFFFFF;
  --sidebar-bg: #F8FAFB;
  --code-bg: #F6F8FA;
  --code-text: #24292F;
  --border: #E5E7EB;
  --table-stripe: #F9FAFB;
  --header-height: 60px;
  --sidebar-width: 260px;
}

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ── Header ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  border-bottom: 2px solid var(--teal);
}

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

.header-logo {
  height: 28px;
  width: auto;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #FFFFFF;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(80, 184, 168, 0.15);
  color: var(--teal);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.header-link:hover { color: #FFFFFF; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255, 255, 255, 0.7);
}

.hamburger:hover { color: #FFFFFF; }

.hamburger svg { display: block; }

/* ── Layout ── */
.layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.5rem 0;
  z-index: 50;
}

.nav-group { margin-bottom: 1.25rem; }

.nav-group-title {
  padding: 0 1.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.nav-link {
  display: block;
  padding: 0.375rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.03);
}

.nav-link.active {
  color: var(--teal);
  border-left-color: var(--teal);
  font-weight: 500;
  background: rgba(80, 184, 168, 0.06);
}

/* ── Content ── */
.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  max-width: calc(800px + 4rem);
  padding: 2rem;
}

.content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.content h1 + p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.content h2 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--navy);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

.content h2 .anchor, .content h3 .anchor {
  opacity: 0;
  color: var(--teal);
  text-decoration: none;
  margin-left: 0.375rem;
  font-weight: 400;
  transition: opacity 0.15s;
}

.content h2:hover .anchor, .content h3:hover .anchor { opacity: 1; }

.content p { margin-bottom: 1rem; }

.content a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}

.content a:hover { color: var(--teal-hover); text-decoration: underline; }

.content ul, .content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.content li { margin-bottom: 0.375rem; }

.content strong { font-weight: 600; }

.content > blockquote {
  border-left: 3px solid var(--teal);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(80, 184, 168, 0.05);
  border-radius: 0 6px 6px 0;
  color: var(--text-secondary);
}

.content > blockquote p { margin-bottom: 0; }

.content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Code blocks ── */
.content code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.content pre {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.content pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.6875rem;
  font-family: 'Inter', sans-serif;
  color: var(--text-secondary);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.content pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--code-bg); }
.copy-btn.copied { color: var(--teal); }

/* ── Tables ── */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.content thead th {
  background: var(--navy);
  color: #FFFFFF;
  font-weight: 600;
  text-align: left;
  padding: 0.625rem 0.75rem;
}

.content thead th:first-child { border-radius: 6px 0 0 0; }
.content thead th:last-child { border-radius: 0 6px 0 0; }

.content tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.content tbody tr:nth-child(even) { background: var(--table-stripe); }

/* ── Footer ── */
.footer {
  margin-left: var(--sidebar-width);
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.footer a { color: var(--teal); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Mobile overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .hamburger { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 50;
  }

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

  .sidebar.open + .sidebar-overlay { display: block; }

  .content { margin-left: 0; padding: 1.25rem; }
  .footer { margin-left: 0; }

  .content h1 { font-size: 1.5rem; }
  .content h2 { font-size: 1.125rem; }

  .header-right .header-link:not(:first-child) { display: none; }
}

@media (max-width: 480px) {
  .content pre { font-size: 0.75rem; padding: 0.75rem; }
  .content table { font-size: 0.8125rem; }
}
