/* ─── Reference Page ───────────────────────────────────── */
#reference-page {
  padding-top: 100px;
  padding-bottom: 80px;
  min-height: 100vh;
}

.ref-header {
  text-align: center;
  margin-bottom: 48px;
}

.ref-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 12px;
}

.ref-subtitle {
  color: #888;
  font-size: 1.1rem;
}

/* ─── Layout: Sidebar + Content ────────────────────────── */
.ref-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
}

/* ─── Sidebar TOC ──────────────────────────────────────── */
.ref-sidebar {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.ref-sidebar-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-left: 12px;
}

.toc-link {
  display: block;
  padding: 5px 12px;
  color: #777;
  font-size: 0.82rem;
  line-height: 1.5;
  border-left: 2px solid transparent;
  transition: all 0.2s;
  text-decoration: none;
}

.toc-link:hover {
  color: #ccc;
  opacity: 1;
}

.toc-link.toc-active {
  color: #00e5a0;
  border-left-color: #00e5a0;
  background: rgba(0,229,160,0.04);
}

.toc-link.toc-indent {
  padding-left: 24px;
  font-size: 0.78rem;
}

/* ─── Reference Content ───────────────────────────────── */
.ref-content {
  min-width: 0; /* Prevent grid blowout */
}

.ref-content h1 {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.ref-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 56px 0 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.ref-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 36px 0 12px;
}

.ref-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: #ccc;
  margin: 24px 0 8px;
}

.ref-anchor {
  color: #333;
  text-decoration: none;
  margin-right: 8px;
  font-weight: 400;
  transition: color 0.2s;
}

.ref-anchor:hover {
  color: #00e5a0;
  opacity: 1;
}

.ref-content p {
  color: #b0b0b0;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0 0 16px;
}

.ref-content strong {
  color: #ddd;
}

.ref-content a {
  color: #00e5a0;
}

.ref-content ul, .ref-content ol {
  color: #b0b0b0;
  margin: 0 0 16px;
  padding-left: 24px;
  font-size: 0.95rem;
  line-height: 1.7;
}

.ref-content li {
  margin-bottom: 4px;
}

.ref-content hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 48px 0;
}

/* ─── Code Blocks in Reference ─────────────────────────── */
.ref-content .code-block {
  margin: 16px 0 24px;
}

.ref-content .code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
}

.ref-content .code-block pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* Inline code in reference */
.ref-content code:not([class*="language-"]) {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: rgba(0,229,160,0.08);
  color: #00e5a0;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ─── Tables in Reference ──────────────────────────────── */
.ref-content .models-table-wrap {
  margin: 16px 0 24px;
  overflow-x: auto;
}

.ref-content .models-table {
  width: 100%;
  border-collapse: collapse;
  background: #111118;
  border-radius: 12px;
  overflow: hidden;
}

.ref-content .models-table th,
.ref-content .models-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.88rem;
}

.ref-content .models-table th {
  background: rgba(0,229,160,0.08);
  color: #00e5a0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.ref-content .models-table td {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #ccc;
}

.ref-content .models-table td code {
  font-size: 0.82rem;
}

/* ─── Blockquotes ──────────────────────────────────────── */
.ref-content blockquote {
  border-left: 3px solid #00e5a0;
  padding: 12px 20px;
  margin: 16px 0;
  background: rgba(0,229,160,0.04);
  border-radius: 0 8px 8px 0;
}

.ref-content blockquote p {
  margin: 0;
  color: #ccc;
}

/* ─── Loading State ────────────────────────────────────── */
.ref-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  color: #666;
  gap: 16px;
}

.ref-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0,229,160,0.2);
  border-top-color: #00e5a0;
  border-radius: 50%;
  animation: ref-spin 0.8s linear infinite;
}

@keyframes ref-spin {
  to { transform: rotate(360deg); }
}

/* ─── Nav Active State ─────────────────────────────────── */
.nav-active {
  color: #00e5a0 !important;
  font-weight: 600;
}

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .ref-layout {
    grid-template-columns: 1fr;
  }

  .ref-sidebar {
    position: static;
    max-height: none;
    display: none; /* Hide sidebar on mobile — too cluttered */
  }

  .ref-title {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  #reference-page {
    padding-top: 80px;
  }

  .ref-content h1 { font-size: 1.6rem; }
  .ref-content h2 { font-size: 1.3rem; margin-top: 40px; }
  .ref-content h3 { font-size: 1.1rem; }
}
