/* ==========================================================================
   WebPeel Documentation Styles
   Design: Clean, minimal, warm off-white — Linear/Stripe docs vibe
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --text: #09090B;
  --text-2: #52525B;
  --text-3: #71717A;
  --text-4: #A1A1AA;
  --accent: #8B5CF6;
  --accent-light: #EDE9FE;
  --border: #E4E4E7;
  --border-light: #F4F4F5;
  --green: #16A34A;
  --yellow: #EAB308;
  --red: #DC2626;
  --radius: 12px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--accent);
  color: #fff;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

img, svg {
  display: block;
  max-width: 100%;
}

/* ---------- Navigation ---------- */
.docs-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 56px;
  background: rgba(250, 250, 248, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.nav-logo svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  transition: color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-links a.active {
  color: var(--accent);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  letter-spacing: 0.01em;
}

.nav-btn-ghost {
  color: var(--text-2);
}

.nav-btn-ghost:hover {
  color: var(--text);
  background: var(--border-light);
}

.nav-links a.nav-btn-primary {
  background: #7C3AED;
  color: #FFFFFF;
  font-weight: 600;
}

.nav-links a.nav-btn-primary:hover {
  background: #6D28D9;
  color: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.25);
}

/* ---------- Mobile hamburger (injected by JS) ---------- */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.hamburger-btn:hover {
  background: var(--border-light);
  color: var(--text);
}

.hamburger-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------- Layout ---------- */
.docs-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - 56px);
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  min-width: 260px;
  position: sticky;
  top: 72px;
  align-self: flex-start;
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  padding: 24px 0 24px 0;
  padding-right: 24px;
  /* Subtle scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

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

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
  padding: 0 12px;
}

.sidebar-link {
  display: block;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-2);
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1.5;
}

.sidebar-link:hover {
  background: var(--border-light);
  color: var(--text);
}

.sidebar-link.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 500;
}

/* ---------- Content ---------- */
.docs-content {
  flex: 1;
  min-width: 0;
  max-width: 800px;
  padding: 32px 0 64px 48px;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 24px;
}

.breadcrumbs a {
  color: var(--text-3);
  transition: color 0.15s ease;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs span {
  user-select: none;
}

/* ---------- Typography ---------- */

/* Make the docs landing page more compact so content starts above the fold */
.docs-home .breadcrumbs {
  margin-bottom: 14px;
}

.docs-home .docs-content h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

.docs-home .lead {
  font-size: 16px;
  margin-bottom: 20px;
}

.docs-content h1 {
  font-family: 'Inter', sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  letter-spacing: -0.01em;
}

/* First h2 after h1 + lead shouldn't have top border */
.docs-content h1 + .lead + h2,
.docs-content h1 + h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 32px;
}

.docs-content h3 {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-top: 32px;
  margin-bottom: 12px;
}

.lead {
  font-size: 18px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 32px;
}

.docs-content p {
  margin-bottom: 16px;
  color: var(--text-2);
  line-height: 1.7;
}

.docs-content ol,
.docs-content ul {
  margin-left: 24px;
  margin-bottom: 16px;
  color: var(--text-2);
}

.docs-content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.docs-content strong {
  font-weight: 600;
  color: var(--text);
}

/* ---------- Links in content ---------- */
.docs-content a:not(.doc-card):not(.sidebar-link):not(.breadcrumbs a) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(139, 92, 246, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.docs-content a:not(.doc-card):not(.sidebar-link):not(.breadcrumbs a):hover {
  text-decoration-color: var(--accent);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  margin-top: 16px;
}

.tab-btn {
  padding: 10px 20px;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Tab Content ---------- */
.tab-content {
  display: none;
}

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

/* ---------- Code Blocks ---------- */
pre {
  background: #18181B;
  color: #D4D4D8;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Override Prism theme background */
pre[class*="language-"],
code[class*="language-"] {
  background: #18181B;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
}

/* Inline code (not inside pre) */
:not(pre) > code {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* Copy button for code blocks */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #A1A1AA;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

pre:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #E4E4E7;
}

.copy-btn.copied {
  color: var(--green);
  border-color: rgba(22, 163, 74, 0.3);
}

/* ---------- Card Grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.doc-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-decoration: none !important;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.06);
  border-color: var(--accent);
}

.doc-card-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.doc-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 0;
}

.doc-card p {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 0;
  line-height: 1.5;
}

/* ---------- Callout / Info Box ---------- */
.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
}

.callout-info {
  background: var(--accent-light);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.callout-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 13px;
}

.callout code {
  background: rgba(139, 92, 246, 0.15);
}

/* ---------- API Endpoint Badge ---------- */
.api-endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 16px 0;
}

.api-method {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.api-method-get {
  background: #DCFCE7;
  color: var(--green);
}

.api-method-post {
  background: #DBEAFE;
  color: #2563EB;
}

.api-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: var(--text);
}

/* ---------- Parameter Table ---------- */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.param-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--border-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}

.param-table thead th:first-child {
  border-radius: 6px 0 0 0;
}

.param-table thead th:last-child {
  border-radius: 0 6px 0 0;
}

.param-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  color: var(--text-2);
}

.param-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.param-type {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-3);
  background: var(--border-light);
  padding: 1px 6px;
  border-radius: 3px;
}

.param-required {
  color: var(--red);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
}

/* ---------- General Tables ---------- */
.docs-content table:not(.param-table) {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.docs-content table:not(.param-table) th {
  text-align: left;
  padding: 10px 12px;
  background: var(--border-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
}

.docs-content table:not(.param-table) td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
}

.docs-content table:not(.param-table) tr:last-child td {
  border-bottom: none;
}

/* ---------- Endpoint Card (spec classes — future-proof) ---------- */
.endpoint-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  background: var(--surface);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.method-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.method-badge.get {
  background: #DCFCE7;
  color: var(--green);
}

.method-badge.post {
  background: #DBEAFE;
  color: #2563EB;
}

.endpoint-path {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
}

/* ---------- Params Table (spec aliases) ---------- */
.params-table {
  width: 100%;
  border-collapse: collapse;
}

.params-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--border-light);
  font-size: 13px;
  font-weight: 600;
}

.params-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

/* ---------- Response Examples ---------- */
.response-example {
  margin-top: 16px;
}

.response-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}

/* ---------- Mobile Sidebar Overlay ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 89;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .nav-links {
    display: none;
  }

  .docs-layout {
    flex-direction: column;
    padding: 0 16px;
  }

  .sidebar {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 280px;
    max-height: none;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    z-index: 90;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    overflow-y: auto;
  }

  .sidebar.open {
    display: block;
  }

  .docs-content {
    padding: 24px 0 48px 0;
    max-width: 100%;
  }

  .docs-content h1 {
    font-size: 26px;
  }

  .docs-content h2 {
    font-size: 20px;
    margin-top: 36px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .api-endpoint {
    flex-wrap: wrap;
  }

  .api-path {
    font-size: 13px;
  }

  pre {
    font-size: 12px;
    padding: 12px;
    margin-left: -4px;
    margin-right: -4px;
  }

  .copy-btn {
    opacity: 1;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 13px;
  }

  .param-table,
  .params-table,
  .docs-content table:not(.param-table) {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 13px;
  }
}

/* Nav links visible again on tablet+ */
@media (min-width: 769px) {
  .hamburger-btn {
    display: none !important;
  }
}

/* ---------- Footer ---------- */
.docs-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 48px;
}

.docs-footer .footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.docs-footer .footer-left {
  font-size: 13px;
  color: var(--text-4);
}

.docs-footer .footer-links {
  display: flex;
  gap: 20px;
}

.docs-footer .footer-links a {
  font-size: 13px;
  color: var(--text-3);
}

.docs-footer .footer-links a:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .docs-footer .footer-inner {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  .docs-footer .footer-links {
    flex-direction: column;
    gap: 12px;
  }
}

/* ---------- Print ---------- */
@media print {
  .docs-nav,
  .sidebar,
  .hamburger-btn,
  .copy-btn {
    display: none !important;
  }

  .docs-content {
    padding: 0;
    max-width: 100%;
  }

  pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}
