/* ==========================================================
   CartPinger Docs — Layout + Prose styles
   Depends on the main styles.css for design tokens.
   ========================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr 220px;
  gap: 48px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 96px;
}

@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 220px 1fr; }
  .docs-toc { display: none; }
}
@media (max-width: 720px) {
  .docs-layout { grid-template-columns: 1fr; gap: 16px; padding: 16px 16px 64px; }
  .docs-sidebar { position: static !important; padding: 0 !important; border-right: 0 !important; height: auto !important; overflow: visible !important; }
  .docs-sidebar nav { display: flex; gap: 8px; flex-wrap: wrap; }
  .docs-sidebar h4 { display: none; }
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 12px 24px 0;
  border-right: 1px solid var(--border);
}
.docs-sidebar .brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--text-1);
  margin-bottom: 28px;
}
.docs-sidebar .brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--wa); display: inline-flex; align-items: center; justify-content: center;
  color: #04220f; font-weight: 700;
}
.docs-sidebar h4 {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3); font-weight: 500;
  margin: 24px 0 8px;
}
.docs-sidebar nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  transition: background 160ms, color 160ms;
}
.docs-sidebar nav a:hover { background: var(--surface-1); color: var(--text-1); }
.docs-sidebar nav a.active {
  background: var(--wa-soft);
  color: var(--wa);
  font-weight: 500;
}
.docs-sidebar .back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-3);
  margin-top: 28px;
}
.docs-sidebar .back-link:hover { color: var(--text-1); }

/* Main content */
.docs-main { min-width: 0; padding-top: 24px; }
.docs-main h1 {
  font-size: clamp(32px, 4.4vw, 44px);
  line-height: 1.1; letter-spacing: -0.025em; font-weight: 600;
  margin: 0 0 12px;
}
.docs-main h2 {
  font-size: 26px;
  line-height: 1.2; letter-spacing: -0.015em; font-weight: 600;
  margin: 56px 0 16px;
  padding-top: 8px;
  scroll-margin-top: 24px;
}
.docs-main h3 {
  font-size: 18px; font-weight: 600;
  margin: 32px 0 10px;
  scroll-margin-top: 24px;
}
.docs-main .lede { margin: 0 0 32px; color: var(--text-2); font-size: 18px; line-height: 1.55; }
.docs-main p { line-height: 1.7; color: var(--text-2); margin: 0 0 14px; }
.docs-main p strong { color: var(--text-1); font-weight: 600; }
.docs-main ul, .docs-main ol { padding-left: 22px; line-height: 1.75; color: var(--text-2); }
.docs-main li { margin: 4px 0; }
.docs-main a { color: var(--wa); text-decoration: underline; text-underline-offset: 3px; }
.docs-main a:hover { color: #2bdc6e; }
.docs-main code {
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-1);
}

/* TOC */
.docs-toc {
  position: sticky; top: 24px; align-self: start;
  padding-top: 24px;
  font-size: 13px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.docs-toc h5 {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3); font-weight: 500;
  margin: 0 0 12px;
}
.docs-toc a {
  display: block; padding: 4px 0;
  color: var(--text-3);
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-left: -2px;
  transition: color 160ms, border-color 160ms;
}
.docs-toc a:hover, .docs-toc a.active { color: var(--text-1); border-left-color: var(--wa); }

/* Hero */
.docs-hero {
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.docs-hero .eyebrow { display: block; margin-bottom: 12px; }
.docs-hero .meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-3);
  margin-top: 20px;
}
.docs-hero .meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Video embed */
.docs-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-1);
  margin: 24px 0 8px;
}
.docs-video iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}

/* Step blocks */
.docs-steps { counter-reset: docstep; margin: 24px 0; }
.docs-step {
  position: relative;
  padding: 20px 20px 20px 64px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.docs-step::before {
  counter-increment: docstep;
  content: counter(docstep);
  position: absolute; left: 20px; top: 20px;
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--wa-soft);
  border: 1px solid var(--wa-border);
  color: var(--wa);
  font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.docs-step h3 { margin: 0 0 8px; }
.docs-step p:last-child { margin-bottom: 0; }

/* Callouts */
.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--wa);
  background: var(--surface-1);
  padding: 14px 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-size: 14px;
}
.callout.warn { border-left-color: var(--coral); }
.callout.info { border-left-color: var(--cyan); }
.callout p { color: var(--text-2); margin: 0; }
.callout strong { color: var(--text-1); }

/* Template card */
.tpl-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0 32px;
}
.tpl-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tpl-name {
  font-family: "Geist Mono", monospace;
  font-size: 15px; font-weight: 600;
  color: var(--text-1);
}
.tpl-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.tpl-badge.marketing { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); color: #fca5a5; }
.tpl-badge.utility { background: rgba(6,182,212,0.1); border-color: rgba(6,182,212,0.3); color: #67e8f9; }
.tpl-badge.free { background: var(--wa-soft); border-color: var(--wa-border); color: var(--wa); }
.tpl-badge.pro { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3); color: #c4b5fd; }

.tpl-langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 14px; }
.tpl-lang {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  position: relative;
}
.tpl-lang-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-3); font-weight: 500; margin-bottom: 6px;
}
.tpl-lang pre {
  margin: 0; font-family: "Geist Mono", monospace; font-size: 13px;
  line-height: 1.55; white-space: pre-wrap; color: var(--text-1);
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 11px;
  padding: 3px 8px; border-radius: 6px; cursor: pointer;
  transition: all 160ms;
}
.copy-btn:hover { background: var(--wa-soft); color: var(--wa); border-color: var(--wa-border); }
.copy-btn.copied { background: var(--wa); color: #04220f; border-color: var(--wa); }

.tpl-vars { font-size: 13px; color: var(--text-3); margin-top: 12px; line-height: 1.6; }
.tpl-vars code { font-size: 12px; }

/* FAQ */
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 10px;
  background: var(--surface-1);
}
.faq-item summary {
  cursor: pointer; font-weight: 600; color: var(--text-1);
  list-style: none; position: relative; padding-right: 28px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 0; top: -2px;
  font-size: 20px; color: var(--text-3); transition: transform 200ms;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .a { margin-top: 12px; color: var(--text-2); line-height: 1.7; }
.faq-item .a p { margin: 0 0 10px; }
.faq-item .a p:last-child { margin-bottom: 0; }

/* Final CTA */
.docs-cta {
  margin-top: 64px;
  padding: 32px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--wa-soft), rgba(6,182,212,0.06));
  border: 1px solid var(--wa-border);
  text-align: center;
}
.docs-cta h3 { margin: 0 0 8px; }
.docs-cta p { margin: 0 0 20px; color: var(--text-2); }
.docs-cta .ctas { display: inline-flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.docs-cta .btn-primary { background: var(--wa); color: #04220f !important; font-weight: 600; }
