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

/* ── Reset & Base ──────────────────────────────────────── */

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  line-height: 1.7;
  color: #1a1a1a;
  background: #fff;
}

/* ── Layout ────────────────────────────────────────────── */

.site-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: #f7f7f8;
  border-right: 1px solid #e2e2e4;
  overflow-y: auto;
  padding: 1.6rem 0;
  z-index: 100;
  transition: transform 0.2s ease;
}

.main-area {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  max-width: 800px;
  width: 100%;
  padding: 2.5rem 2.5rem 4rem;
  margin: 0 auto;
  flex: 1;
}

/* ── Sidebar ───────────────────────────────────────────── */

.sidebar-logo {
  padding: 0 1.4rem 1.2rem;
  border-bottom: 1px solid #e2e2e4;
  margin-bottom: 1rem;
}

.sidebar-logo a {
  text-decoration: none;
  color: #1a1a1a;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.sidebar-logo .version {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #5a7a8a;
  background: #e8f0f3;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.sidebar nav {
  padding: 0 0.8rem;
}

.sidebar nav ul {
  list-style: none;
}

.sidebar nav > ul > li {
  margin-bottom: 0.15rem;
}

.sidebar nav a {
  display: block;
  padding: 0.35rem 0.6rem;
  text-decoration: none;
  color: #555;
  font-size: 0.85rem;
  font-weight: 400;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
  background: #eaeaec;
  color: #1a1a1a;
}

.sidebar nav a.active {
  background: #e0eef3;
  color: #2b7a91;
  font-weight: 600;
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #999;
  padding: 0.8rem 0.6rem 0.3rem;
}

/* ── API sidebar nav (collapsible) ──────────────────────── */

.api-nav {
  margin-bottom: 0.5rem;
}

.api-nav > li {
  margin-bottom: 0;
}

.api-nav-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.35rem 0.6rem;
  background: none;
  border: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: #333;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.api-nav-toggle::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #aaa;
  transition: transform 0.15s;
}

.api-nav-toggle.open::before {
  transform: rotate(90deg);
}

.api-nav-toggle:hover {
  background: #eaeaec;
  color: #1a1a1a;
}

.api-nav-sub {
  display: none;
  padding-left: 1.2rem;
  margin: 0;
}

.api-nav-sub.open {
  display: block;
}

.api-nav-sub li {
  margin-bottom: 0;
}

.api-nav-sub a {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  color: #777;
  font-weight: 400;
}

.api-nav-sub a:hover {
  color: #2b7a91;
  background: #eef6f8;
}

/* ── Hamburger (mobile) ────────────────────────────────── */

.hamburger {
  display: none;
  position: fixed;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 200;
  background: #f7f7f8;
  border: 1px solid #e2e2e4;
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  line-height: 1;
}

.hamburger svg {
  width: 20px;
  height: 20px;
  stroke: #1a1a1a;
}

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

/* ── Typography ────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  line-height: 1.3;
  color: #111;
}

h1 { font-size: 1.8rem; margin-bottom: 1rem; letter-spacing: -0.03em; }
h2 { font-size: 1.35rem; margin-top: 2.5rem; margin-bottom: 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px solid #e8e8ea; }
h3 { font-size: 1.05rem; margin-top: 1.8rem; margin-bottom: 0.5rem; }
h4 { font-size: 0.95rem; margin-top: 1.4rem; margin-bottom: 0.4rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: #2b7a91;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: #1d5c6e;
}

strong {
  font-weight: 600;
}

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

li {
  margin-bottom: 0.3rem;
}

hr {
  border: none;
  border-top: 1px solid #e8e8ea;
  margin: 2rem 0;
}

/* ── Badges ────────────────────────────────────────────── */

.badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #d0d0d4;
}

.badge-label {
  padding: 0.15rem 0.45rem;
  background: #f0f0f2;
  color: #666;
}

.badge-value {
  padding: 0.15rem 0.5rem;
  background: #e0eef3;
  color: #2b7a91;
}

/* ── Code (inline) ─────────────────────────────────────── */

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: #f3f3f5;
  border: 1px solid #e4e4e7;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: #c7254e;
}

/* ── Code Blocks ───────────────────────────────────────── */

.code-block {
  position: relative;
  margin-bottom: 1.2rem;
}

.code-block pre {
  background: #f7f7f8;
  border: 1px solid #e2e2e5;
  border-radius: 5px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.84rem;
}

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

.code-block .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: #fff;
  border: 1px solid #d8d8db;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #888;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.code-block:hover .copy-btn {
  opacity: 1;
}

.code-block .copy-btn:hover {
  background: #f0f0f2;
  color: #555;
}

.code-block .copy-btn.copied {
  color: #2b7a91;
}

/* ── Code block language label ─────────────────────────── */

.code-block pre::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.5rem;
  right: 3.5rem;
  font-size: 0.65rem;
  font-weight: 500;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Syntax highlighting (minimal) ─────────────────────── */

.tok-keyword { color: #7c3aed; }
.tok-string { color: #059669; }
.tok-comment { color: #9ca3af; font-style: italic; }
.tok-function { color: #2563eb; }
.tok-number { color: #d97706; }
.tok-builtin { color: #b45309; }
.tok-decorator { color: #7c3aed; }
.tok-class { color: #2563eb; font-weight: 600; }
.tok-operator { color: #666; }
.tok-param { color: #1a1a1a; }

/* ── API Reference cards ───────────────────────────────── */

.api-entry {
  margin-bottom: 2.2rem;
  border: 1px solid #e2e2e5;
  border-radius: 5px;
  overflow: hidden;
}

.api-entry-header {
  background: #f7f7f8;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #e2e2e5;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1a1a1a;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.api-entry-header .api-kind {
  font-size: 0.68rem;
  font-weight: 500;
  color: #fff;
  background: #2b7a91;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.api-entry-body {
  padding: 1rem;
}

.api-entry-body p {
  font-size: 0.9rem;
}

.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
  font-size: 0.82rem;
}

.param-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  background: #f7f7f8;
  border-bottom: 2px solid #e2e2e5;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}

.param-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.param-table td code {
  font-size: 0.82em;
}

.return-type {
  font-size: 0.85rem;
  margin: 0.5rem 0;
}

.return-type strong {
  color: #666;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Search modal ──────────────────────────────────────── */

.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 1.4rem 1rem;
  padding: 0.4rem 0.7rem;
  background: #fff;
  border: 1px solid #d8d8db;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #999;
  cursor: pointer;
  transition: border-color 0.15s;
}

.search-trigger:hover {
  border-color: #bbb;
}

.search-trigger kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  background: #f0f0f2;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.05rem 0.35rem;
  color: #999;
}

.search-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
}

.search-modal-overlay.open {
  display: flex;
}

.search-modal {
  background: #fff;
  border-radius: 8px;
  width: 520px;
  max-width: 90vw;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}

.search-modal input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  padding: 0.9rem 1.1rem;
  border: none;
  border-bottom: 1px solid #e8e8ea;
  outline: none;
  color: #1a1a1a;
  background: transparent;
}

.search-modal input::placeholder {
  color: #bbb;
}

.search-results {
  overflow-y: auto;
  padding: 0.5rem;
}

.search-results a {
  display: block;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  color: #333;
  font-size: 0.85rem;
  border-radius: 4px;
}

.search-results a:hover,
.search-results a.focused {
  background: #e0eef3;
  color: #2b7a91;
}

.search-results .search-section {
  font-size: 0.68rem;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 0.4rem;
}

.search-no-results {
  padding: 1.5rem;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
}

/* ── Tables (general) ──────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid #e8e8ea;
}

th {
  font-weight: 600;
  font-size: 0.8rem;
  color: #666;
}

/* ── Blockquote / Note ─────────────────────────────────── */

blockquote, .note {
  border-left: 3px solid #2b7a91;
  background: #f3f9fb;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
  color: #333;
}

.note-title {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2b7a91;
  margin-bottom: 0.3rem;
}

/* ── Footer ────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid #e8e8ea;
  padding: 1.5rem 2.5rem;
  font-size: 0.78rem;
  color: #999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-footer a {
  color: #2b7a91;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ── Install block ─────────────────────────────────────── */

.install-block {
  background: #1a1a2e;
  color: #e0e0e0;
  border-radius: 5px;
  padding: 0.9rem 1.2rem;
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.install-block .prompt {
  color: #6ee7b7;
  user-select: none;
}

.install-block code {
  background: none;
  border: none;
  color: #e0e0e0;
  padding: 0;
  font-size: inherit;
}

.install-block .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: #aaa;
  cursor: pointer;
}

.install-block .copy-btn:hover {
  background: rgba(255,255,255,0.18);
  color: #ddd;
}

/* ── Changelog ─────────────────────────────────────────── */

.changelog-entry {
  margin-bottom: 2rem;
}

.changelog-entry h3 {
  margin-top: 0;
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
}

.changelog-date {
  font-size: 0.78rem;
  font-weight: 400;
  color: #999;
}

/* ── Mobile ────────────────────────────────────────────── */

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

  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .main-area {
    margin-left: 0;
  }

  .content {
    padding: 3.5rem 1.2rem 3rem;
  }

  .site-footer {
    padding: 1.2rem;
    flex-direction: column;
    text-align: center;
  }

  .search-trigger kbd {
    display: none;
  }
}
