/* SparkCMS Docs — inspired by claude.com/docs, stripe.com/docs, linear.app/docs */

:root {
  --ink: 15 23 42;
  --ink-soft: 71 85 105;
  --ink-mute: 148 163 184;
  --bg: 255 255 255;
  --bg-soft: 248 250 252;
  --bg-code: 15 23 42;
  --border: 226 232 240;
  --brand: 249 115 22;
  --brand-soft: 254 215 170;
  --accent: 236 72 153;
}

html.dark {
  --ink: 241 245 249;
  --ink-soft: 203 213 225;
  --ink-mute: 100 116 139;
  --bg: 10 14 28;
  --bg-soft: 15 23 42;
  --bg-code: 2 6 23;
  --border: 30 41 59;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: rgb(var(--bg));
  color: rgb(var(--ink));
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: rgb(var(--brand)); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ========== LAYOUT ========== */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (min-width: 1280px) {
  .docs-layout { grid-template-columns: 260px 1fr 220px; }
}

@media (max-width: 1023px) {
  .docs-layout { grid-template-columns: 1fr; }
}

/* ========== TOP BAR ========== */
.docs-topbar {
  position: sticky; top: 0; z-index: 50;
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgb(var(--bg) / .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--border));
}
.docs-topbar__brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: rgb(var(--ink)); font-weight: 700; font-size: 16px;
  text-decoration: none;
}
.docs-topbar__brand:hover { text-decoration: none; }
.docs-topbar__brand-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #F97316, #EC4899);
  color: white;
}
.docs-topbar__brand-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgb(var(--brand) / .14); color: rgb(var(--brand));
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.docs-topbar__nav {
  display: flex; align-items: center; gap: 8px;
}
.docs-topbar__link {
  color: rgb(var(--ink-soft));
  padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  text-decoration: none;
}
.docs-topbar__link:hover { background: rgb(var(--bg-soft)); color: rgb(var(--ink)); text-decoration: none; }
.docs-topbar__link.is-active { color: rgb(var(--brand)); font-weight: 600; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid rgb(var(--border));
  background: rgb(var(--bg-soft)); color: rgb(var(--ink-soft));
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .15s;
}
.theme-toggle:hover { background: rgb(var(--brand) / .1); color: rgb(var(--brand)); }
html.dark .theme-toggle .icon-sun { display: block; }
html.dark .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }

/* ========== SIDEBAR ========== */
.docs-sidebar {
  position: sticky; top: 64px; align-self: start;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 24px 16px 32px 24px;
  border-right: 1px solid rgb(var(--border));
  background: rgb(var(--bg));
}
@media (max-width: 1023px) {
  .docs-sidebar {
    position: fixed; top: 60px; left: 0; width: 280px; z-index: 40;
    transform: translateX(-100%); transition: transform .2s ease;
    background: rgb(var(--bg)); box-shadow: 0 20px 40px -10px rgba(0,0,0,.15);
    height: calc(100vh - 60px);
  }
  .docs-sidebar.is-open { transform: translateX(0); }
}
.docs-sidebar__group { margin-bottom: 22px; }
.docs-sidebar__group-title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: rgb(var(--ink-mute));
  padding: 0 12px 8px;
}
.docs-sidebar__link {
  display: block;
  padding: 6px 12px;
  border-radius: 7px;
  color: rgb(var(--ink-soft));
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}
.docs-sidebar__link:hover { background: rgb(var(--bg-soft)); color: rgb(var(--ink)); text-decoration: none; }
.docs-sidebar__link.is-active {
  background: rgb(var(--brand) / .1);
  color: rgb(var(--brand));
  font-weight: 600;
}

/* mobile toggle */
.sidebar-toggle {
  display: none;
  background: transparent; border: 0; padding: 8px; cursor: pointer;
  color: rgb(var(--ink));
}
@media (max-width: 1023px) {
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }
}

/* ========== MAIN CONTENT ========== */
.docs-main {
  padding: 40px 48px 80px;
  min-width: 0;
}
@media (max-width: 767px) { .docs-main { padding: 28px 20px 60px; } }

.docs-breadcrumb {
  font-size: 13px; color: rgb(var(--ink-mute));
  margin-bottom: 12px;
}
.docs-breadcrumb a { color: rgb(var(--ink-soft)); }
.docs-breadcrumb .sep { opacity: .5; margin: 0 6px; }

.docs-main h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
  color: rgb(var(--ink));
}
.docs-main h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 56px 0 14px;
  padding-top: 14px;
  color: rgb(var(--ink));
  scroll-margin-top: 80px;
}
.docs-main h3 {
  font-size: 18px; font-weight: 700;
  margin: 32px 0 10px;
  color: rgb(var(--ink));
  scroll-margin-top: 80px;
}
.docs-main p {
  margin: 0 0 18px;
  color: rgb(var(--ink-soft));
  max-width: 72ch;
}
.docs-main ul, .docs-main ol {
  margin: 0 0 18px; padding-left: 22px;
  color: rgb(var(--ink-soft)); max-width: 72ch;
}
.docs-main li { margin-bottom: 6px; }
.docs-main strong { color: rgb(var(--ink)); font-weight: 600; }

.docs-lead {
  font-size: 17px;
  line-height: 1.6;
  color: rgb(var(--ink-soft));
  margin-bottom: 24px;
  max-width: 72ch;
}

/* Inline code */
.docs-main code {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  background: rgb(var(--bg-soft));
  border: 1px solid rgb(var(--border));
  padding: 2px 6px;
  border-radius: 5px;
  color: rgb(var(--accent));
}

/* Block code */
.docs-main pre {
  background: rgb(var(--bg-code));
  color: #e2e8f0;
  padding: 18px 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid rgb(var(--border));
}
.docs-main pre code {
  background: transparent; border: 0; padding: 0;
  color: inherit; font-size: inherit;
}

/* Callout */
.docs-callout {
  display: grid; grid-template-columns: 20px 1fr; gap: 14px;
  padding: 16px 20px;
  background: rgb(var(--bg-soft));
  border: 1px solid rgb(var(--border));
  border-left: 3px solid rgb(var(--brand));
  border-radius: 10px;
  margin: 0 0 22px;
  max-width: 72ch;
}
.docs-callout--info { border-left-color: #3B82F6; }
.docs-callout--warn { border-left-color: #F59E0B; }
.docs-callout--success { border-left-color: #10B981; }
.docs-callout__icon { width: 20px; height: 20px; color: rgb(var(--brand)); }
.docs-callout--info .docs-callout__icon { color: #3B82F6; }
.docs-callout--warn .docs-callout__icon { color: #F59E0B; }
.docs-callout--success .docs-callout__icon { color: #10B981; }
.docs-callout p:last-child { margin-bottom: 0; }

/* Card grid */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 0 0 28px;
}
.docs-card {
  display: block;
  padding: 22px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--bg));
  border-radius: 14px;
  color: inherit; text-decoration: none;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.docs-card:hover {
  transform: translateY(-2px);
  border-color: rgb(var(--brand) / .4);
  box-shadow: 0 10px 28px -12px rgba(249, 115, 22, .15);
  text-decoration: none;
}
.docs-card__icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgb(var(--brand) / .12); color: rgb(var(--brand));
  margin-bottom: 12px;
}
.docs-card__title {
  font-size: 15px; font-weight: 700; margin: 0 0 4px;
  color: rgb(var(--ink));
}
.docs-card__desc {
  font-size: 13.5px; color: rgb(var(--ink-soft)); margin: 0;
  line-height: 1.5;
}

/* ========== TOC (right) ========== */
.docs-toc {
  position: sticky; top: 64px; align-self: start;
  height: calc(100vh - 64px); overflow-y: auto;
  padding: 32px 20px 32px 12px;
  font-size: 13px;
}
@media (max-width: 1279px) { .docs-toc { display: none; } }
.docs-toc__title {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: rgb(var(--ink-mute));
  margin: 0 0 12px; padding-left: 12px;
}
.docs-toc__link {
  display: block; padding: 4px 12px;
  color: rgb(var(--ink-soft));
  border-left: 2px solid transparent;
  line-height: 1.4; margin-bottom: 2px;
  text-decoration: none;
}
.docs-toc__link--h3 { padding-left: 26px; font-size: 12.5px; }
.docs-toc__link:hover { color: rgb(var(--ink)); text-decoration: none; }
.docs-toc__link.is-active {
  color: rgb(var(--brand));
  border-left-color: rgb(var(--brand));
  font-weight: 600;
}

/* ========== PAGE NAV (prev/next) ========== */
.docs-pagenav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 60px; padding-top: 28px;
  border-top: 1px solid rgb(var(--border));
}
@media (max-width: 640px) { .docs-pagenav { grid-template-columns: 1fr; } }
.docs-pagenav__item {
  padding: 16px 20px;
  border: 1px solid rgb(var(--border));
  border-radius: 12px;
  color: inherit; text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.docs-pagenav__item:hover {
  border-color: rgb(var(--brand) / .4);
  transform: translateY(-1px);
  text-decoration: none;
}
.docs-pagenav__label {
  font-size: 12px; color: rgb(var(--ink-mute));
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 4px;
}
.docs-pagenav__title {
  font-size: 15px; font-weight: 700; color: rgb(var(--ink));
}
.docs-pagenav__item--next { text-align: right; }

/* ========== FOOTER (docs) ========== */
.docs-footer {
  grid-column: 1 / -1;
  padding: 28px 40px;
  border-top: 1px solid rgb(var(--border));
  font-size: 12.5px; color: rgb(var(--ink-mute));
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: space-between; align-items: center;
}
.docs-footer a { color: rgb(var(--ink-soft)); }

/* ========== UTILITIES ========== */
.soon-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 999px;
  background: rgb(var(--brand) / .14); color: rgb(var(--brand));
  margin-left: 8px;
}
.soon-pill::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: rgb(var(--brand));
  animation: soon-pulse 1.5s ease-in-out infinite;
}
@keyframes soon-pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

.price-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  background: rgb(16, 185, 129, .14); color: rgb(5, 150, 105);
  margin-left: 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
html.dark .price-pill { color: rgb(52, 211, 153); }

kbd {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid rgb(var(--border));
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgb(var(--bg-soft));
  color: rgb(var(--ink));
}
