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

/* ══════════════════════════════════════════
   DAPI PAGE — Custom Styles
   Inherits site vars from styles.css
   ══════════════════════════════════════════ */

:root {
  --dapi-get: #10b981;
  --dapi-get-bg: rgba(16, 185, 129, 0.12);
  --dapi-post: #8b5cf6;
  --dapi-post-bg: rgba(139, 92, 246, 0.12);
  --dapi-delete: #ef4444;
  --dapi-delete-bg: rgba(239, 68, 68, 0.12);
  --dapi-accent: #06b6d4;
  --mono: 'Space Mono', monospace;
  --heading: 'Syne', sans-serif;
  --sidebar-w: 260px;
}

/* ── HERO ── */
.dapi-hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 22% 60px;
  position: relative;
  overflow: hidden;
}

.dapi-hero-content {
  position: relative;
  text-align: center;
  max-width: 760px;
}

.dapi-title {
  font-family: var(--heading);
  font-size: clamp(3.5rem, 8vw, 7rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, rgba(181, 238, 172, 0.9) 0%, rgba(20, 212, 6, 0.9) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.dapi-title-sub {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  margin-bottom: 32px;
  text-transform: uppercase;
}

.dapi-hero-desc {
  font-size: 1.1rem;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 520px;
  margin: 0 auto 40px;
}

.dapi-hero-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.dapi-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.dapi-meta-item span {
  color: #fff;
}

.dapi-meta-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

.dapi-hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 40px;
  flex-wrap: wrap;
}

.btn-dapi-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-indigo);
  color: white;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn-dapi-primary:hover {
  background: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(139, 92, 246, 0.4);
}

.btn-dapi-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.05);
  color: white;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s ease;
}

.btn-dapi-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

/* ── SCROLL INDICATOR ── */
.scroll-hint {
  position: absolute;
  bottom: 36px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  animation: fadeInUp 1s 1s both;
}

.scroll-arrow {
  width: 24px;
  height: 36px;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  position: relative;
  transition: opacity 0.4s ease;
  opacity: 1;
}

.scroll-text {
  transition: opacity 0.4s ease;
  opacity: 1;
}

.scroll-arrow::after {
  content: '';
  position: absolute;
  width: 4px;
  height: 8px;
  background: white;
  border-radius: 2px;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollDot 2s infinite;
}

@keyframes scrollDot {
  0% { transform: translateX(-50%) translateY(0); opacity: 1; }
  100% { transform: translateX(-50%) translateY(12px); opacity: 0; }
}



/* ── MAIN LAYOUT ── */
.dapi-layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 40px 120px;
  gap: 40px;
  position: relative;
}

/* ── SIDEBAR ── */
.dapi-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  height: fit-content;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.3) transparent;
}

.dapi-sidebar::-webkit-scrollbar { width: 3px; }
.dapi-sidebar::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 3px; }

.sidebar-section {
  margin-bottom: 28px;
}

.sidebar-section-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding: 0 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.05);
}

.sidebar-link.active {
  color: #fff;
  background: rgba(139,92,246,0.15);
}

.sidebar-method {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.method-get { background: var(--dapi-get-bg); color: var(--dapi-get); }
.method-post { background: var(--dapi-post-bg); color: var(--dapi-post); }
.method-del { background: var(--dapi-delete-bg); color: var(--dapi-delete); }

/* ── CONTENT ── */
.dapi-content {
  flex: 1;
  min-width: 0;
}

/* ── SECTION HEADERS ── */
section {
  padding: 0px !important;
}

.dapi-section {
  margin-bottom: 80px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.section-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  flex-shrink: 0;
}

.section-title {
  font-family: var(--heading);
  font-size: 1.6rem;
  font-weight: 700;
}

.section-desc {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 680px;
}

/* ── DIVIDER ── */
.dapi-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  margin: 56px 0;
}

/* ── INTRO BLOCKS ── */
.dapi-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

.dapi-intro-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  padding: 24px;
}

.dapi-intro-card h3 {
  font-family: var(--heading);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}

.dapi-intro-card p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── ENDPOINT CARDS ── */
.endpoint-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
  transition: border-color 0.2s ease;
}

.endpoint-card:hover {
  border-color: rgba(255,255,255,0.12);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 24px;
  cursor: pointer;
  user-select: none;
}

.endpoint-header:hover {
  background: rgba(255,255,255,0.02);
}

.method-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  letter-spacing: 0.08em;
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.method-badge.get { background: var(--dapi-get-bg); color: var(--dapi-get); border: 1px solid rgba(16,185,129,0.25); }
.method-badge.post { background: var(--dapi-post-bg); color: var(--dapi-post); border: 1px solid rgba(139,92,246,0.25); }
.method-badge.delete { background: var(--dapi-delete-bg); color: var(--dapi-delete); border: 1px solid rgba(239,68,68,0.25); }

.endpoint-path {
  font-family: var(--mono);
  font-size: 0.88rem;
  color: #fff;
  flex: 1;
}

.endpoint-path .path-param {
  color: var(--dapi-accent);
}

.endpoint-summary {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-left: auto;
  white-space: nowrap;
}

.endpoint-chevron {
  color: var(--text-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.endpoint-card.open .endpoint-chevron {
  transform: rotate(180deg);
}

.endpoint-body {
  display: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 24px;
}

.endpoint-card.open .endpoint-body {
  display: block;
}

/* ── TABS ── */
.endpoint-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 24px;
  width: fit-content;
}

.endpoint-tab {
  padding: 7px 16px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-main);
}

.endpoint-tab.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

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

/* ── DOC TABLE ── */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 16px;
  overflow-x: scroll;
  display: block;
}

.doc-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.doc-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
  color: var(--text-dim);
}

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

.doc-table td:first-child {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--dapi-accent);
  width: 180px;
}

.doc-table td:nth-child(2) {
  width: 80px;
}

.param-type {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: rgba(255,255,255,0.06);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
}

.param-required {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--dapi-delete);
  background: rgba(239,68,68,0.1);
  padding: 1px 5px;
  border-radius: 3px;
}

.param-optional {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ── CODE BLOCK ── */
.code-block {
  background: #0a0a0f;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-block-lang {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.copy-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--mono);
}

.copy-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}

.code-block pre {
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  color: #e2e8f0;
}

.code-block pre .kw { color: #c084fc; }
.code-block pre .str { color: #86efac; }
.code-block pre .num { color: #fcd34d; }
.code-block pre .key { color: #7dd3fc; }
.code-block pre .cmt { color: #6b7280; font-style: italic; }
.code-block pre .url { color: #f9a8d4; }

/* ── RESPONSE EXAMPLE ── */
.response-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}

.status-200 { background: rgba(16,185,129,0.15); color: var(--dapi-get); }
.status-400 { background: rgba(251,191,36,0.15); color: #fbbf24; }
.status-403 { background: rgba(239,68,68,0.15); color: var(--dapi-delete); }
.status-429 { background: rgba(249,115,22,0.15); color: #f97316; }
.status-500 { background: rgba(239,68,68,0.15); color: var(--dapi-delete); }

/* ── INFO CALLOUT ── */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.84rem;
  line-height: 1.6;
}

.callout-info {
  background: rgba(6,182,212,0.08);
  border-left: 3px solid var(--dapi-accent);
  color: #a5f3fc;
}

.callout-warn {
  background: rgba(251,191,36,0.08);
  border-left: 3px solid #fbbf24;
  color: #fef3c7;
}

.callout-danger {
  background: rgba(239,68,68,0.08);
  border-left: 3px solid var(--dapi-delete);
  color: #fca5a5;
}

.callout-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── RATE LIMIT TABLE ── */
.rate-limit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.rate-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 20px;
}

.rate-card h4 {
  font-family: var(--heading);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #fff;
}

.rate-card p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.rate-val {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dapi-accent);
}

.rate-unit {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

/* ── PERMISSIONS ── */
.perms-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.perm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  font-size: 0.82rem;
}

.perm-badge {
  font-family: var(--mono);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}

.perm-read { background: rgba(16,185,129,0.15); color: var(--dapi-get); }
.perm-write { background: rgba(139,92,246,0.15); color: var(--dapi-post); }
.perm-admin { background: rgba(239,68,68,0.15); color: var(--dapi-delete); }

/* ── ANCHOR OFFSETS ── */
.dapi-anchor {
  scroll-margin-top: 120px;
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeInUp 0.5s ease both; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  .dapi-hero { padding: 120px 8% 60px; }
  .dapi-stats { padding: 0 8% 80px; grid-template-columns: repeat(2, 1fr); }
  .dapi-layout { padding: 0 24px 120px; }
  .dapi-sidebar { display: none; }
}

@media (max-width: 768px) {
  .dapi-hero { padding: 120px 5% 40px; }
  .dapi-stats { padding: 0 5% 60px; grid-template-columns: 1fr 1fr; }
  .dapi-layout { padding: 0 16px 80px; }
  .dapi-intro-grid { grid-template-columns: 1fr; }
  .rate-limit-grid { grid-template-columns: 1fr; }
  .perms-grid { grid-template-columns: 1fr; }
  .endpoint-summary { display: none; }

  .scroll-hint { display: none; }
  .dapi-title { margin-top: 10rem; }
  .dapi-hero-meta { flex-direction: column; align-items: center; gap: .5rem; }
  .dapi-hero-cta { margin-bottom: 5rem; }
}