/* Quincer Docs - shared styles. Brand tokens mirror marketing-index.html. */

:root {
  --bg: #0a0a14;
  --bg-2: #0f0f1e;
  --bg-3: #14142a;
  --orange: #eb8424;
  --orange-light: #f5a447;
  --orange-soft: rgba(235, 132, 36, 0.12);
  --orange-border: rgba(235, 132, 36, 0.25);
  --text: #e5e7eb;
  --text-dim: #9ca3af;
  --text-faint: #6b7280;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --heading: #ffffff;
  --topbar-bg: rgba(10, 10, 20, 0.78);
  --panel-fill: rgba(255, 255, 255, 0.02);
  --panel-fill-strong: rgba(255, 255, 255, 0.04);
  --panel-fill-active: rgba(255, 255, 255, 0.06);
}

/* Light mode — triggered by <html class="light"> set via docs-theme.js
   so it matches the portal's ThemeProvider selection. Code blocks stay
   dark in both themes (design-system convention). */
html.light {
  --bg: #fbf7ef;
  --bg-2: #ffffff;
  --bg-3: #f2ede2;
  --text: #1a1a2e;
  --text-dim: #525272;
  --text-faint: #8686a5;
  --line: rgba(15, 15, 30, 0.08);
  --line-strong: rgba(15, 15, 30, 0.14);
  --heading: #0a0a14;
  --topbar-bg: rgba(251, 247, 239, 0.82);
  --panel-fill: rgba(15, 15, 30, 0.025);
  --panel-fill-strong: rgba(15, 15, 30, 0.05);
  --panel-fill-active: rgba(15, 15, 30, 0.08);
}

* { box-sizing: border-box; font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(235, 132, 36, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(235, 132, 36, 0.03), transparent 60%);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

code, pre, .mono { font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace; }

a { color: var(--orange-light); text-decoration: none; }
a:hover { color: var(--orange); text-decoration: underline; }

/* Layout */
.docs-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

/* Top bar */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  backdrop-filter: blur(12px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  grid-column: 1 / -1;
}
.docs-topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
}
.docs-topbar .brand:hover { color: var(--orange-light); text-decoration: none; }
.docs-topbar .brand img { width: 24px; height: 24px; }
.docs-topbar .badge-docs {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-light);
  background: var(--orange-soft);
  border: 1px solid var(--orange-border);
  border-radius: 4px;
  padding: 2px 8px;
}
.docs-topbar .spacer { flex: 1; }
.docs-topbar .top-link {
  font-size: 14px;
  color: var(--text-dim);
}
.docs-topbar .top-link:hover { color: var(--text); text-decoration: none; }
.docs-topbar .top-cta {
  font-size: 14px;
  font-weight: 600;
  color: #1a0f03;
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
  padding: 6px 14px;
  border-radius: 6px;
}
.docs-topbar .top-cta:hover { text-decoration: none; }
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* Sidebar */
.docs-sidebar {
  border-right: 1px solid var(--line);
  padding: 24px 16px 48px 24px;
  position: sticky;
  top: 58px;
  align-self: start;
  max-height: calc(100vh - 58px);
  overflow-y: auto;
}
.docs-sidebar .group {
  margin-bottom: 24px;
}
.docs-sidebar .group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 10px 8px;
  margin: 0;
}
.docs-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.docs-sidebar li a {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-dim);
  border-left: 2px solid transparent;
}
.docs-sidebar li a:hover {
  color: var(--text);
  background: var(--panel-fill);
  text-decoration: none;
}
.docs-sidebar li a.active {
  color: var(--orange-light);
  background: var(--orange-soft);
  border-left-color: var(--orange);
  font-weight: 600;
}

/* Content */
.docs-content {
  padding: 40px 48px 96px;
  max-width: 860px;
  min-width: 0;
}
.docs-content .eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-light);
  margin: 0 0 12px;
}
.docs-content h1 {
  font-size: 38px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--heading);
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}
.docs-content .lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 32px;
}
.docs-content h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--heading);
  margin: 48px 0 16px;
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
}
.docs-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  margin: 32px 0 12px;
  scroll-margin-top: 80px;
}
.docs-content h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.docs-content p { margin: 0 0 16px; }
.docs-content ul, .docs-content ol {
  margin: 0 0 16px;
  padding-left: 24px;
}
.docs-content li { margin-bottom: 6px; }
.docs-content li::marker { color: var(--text-faint); }
.docs-content strong { color: var(--heading); font-weight: 600; }
.docs-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 48px 0;
}

/* Inline code */
.docs-content code:not(pre code) {
  background: rgba(235, 132, 36, 0.08);
  color: var(--orange-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  border: 1px solid var(--orange-border);
}

/* Code blocks */
.docs-content pre {
  background: #07070f;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 16px 0 24px;
  color: #d4d4dc;
}
.docs-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
  font-size: inherit;
}
.code-block-wrap {
  position: relative;
}
.code-block-wrap .code-label {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-weight: 600;
  pointer-events: none;
}

/* Callouts */
.callout {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-fill);
  margin: 20px 0;
  font-size: 14px;
}
.callout .ico {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  margin-top: 2px;
}
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.callout.note { background: rgba(235, 132, 36, 0.06); border-color: var(--orange-border); }
.callout.note .ico { background: var(--orange); color: #1a0f03; }
.callout.warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.35); }
.callout.warn .ico { background: #f59e0b; color: #1a0f03; }
.callout.success { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.3); }
.callout.success .ico { background: #22c55e; color: #062a11; }
.callout.shopify { background: rgba(149, 191, 71, 0.1); border-color: rgba(149, 191, 71, 0.35); }
.callout.shopify .ico { background: #95bf47; color: #0b1c03; }

/* Cards / tiles */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 24px 0 32px;
}
.card {
  display: block;
  padding: 18px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-fill);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.card:hover {
  border-color: var(--orange-border);
  background: rgba(235, 132, 36, 0.04);
  text-decoration: none;
  transform: translateY(-2px);
}
.card .card-title {
  font-weight: 700;
  color: var(--heading);
  font-size: 15px;
  margin: 0 0 4px;
}
.card .card-desc {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0;
}

/* Tables */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.docs-content th, .docs-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.docs-content th {
  background: var(--panel-fill);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.docs-content tr:last-child td { border-bottom: none; }
.docs-content td code { white-space: nowrap; }

/* Steps (numbered instruction lists) */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 16px 0 24px;
}
.steps > li {
  position: relative;
  padding-left: 48px;
  margin-bottom: 20px;
  counter-increment: step;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--orange-soft);
  border: 1px solid var(--orange-border);
  color: var(--orange-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

/* Pills / kbd */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--orange-soft);
  border: 1px solid var(--orange-border);
  color: var(--orange-light);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill.neutral {
  background: var(--panel-fill-strong);
  border-color: var(--line-strong);
  color: var(--text-dim);
}
kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-fill-strong);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Prev/next footer */
.page-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.page-nav a {
  display: block;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-fill);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s;
}
.page-nav a:hover {
  border-color: var(--orange-border);
  background: rgba(235, 132, 36, 0.04);
  text-decoration: none;
}
.page-nav .dir {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  display: block;
  margin-bottom: 4px;
}
.page-nav .label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}
.page-nav a.next { text-align: right; }

/* Page footer */
.docs-foot {
  margin-top: 64px;
  padding: 32px 0;
  font-size: 13px;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
}
.docs-foot a { color: var(--text-dim); }
.docs-foot a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    top: 58px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--bg);
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: none;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding: 24px 20px 48px;
  }
  .docs-sidebar.open { transform: translateX(0); }
  .nav-toggle { display: inline-block; }
  .docs-content { padding: 28px 20px 72px; }
  .docs-content h1 { font-size: 30px; }
  .page-nav { grid-template-columns: 1fr; }
  .page-nav a.next { text-align: left; }
}

/* Search */
.docs-search {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin: 0 12px;
}
.docs-search input {
  width: 100%;
  padding: 7px 32px 7px 32px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel-fill-strong);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.docs-search input::placeholder { color: var(--text-faint); }
.docs-search input:focus {
  border-color: var(--orange-border);
  background: var(--panel-fill-active);
}
.docs-search .icon {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  color: var(--text-faint);
  width: 14px;
  height: 14px;
  pointer-events: none;
}
.docs-search .kbd {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  background: var(--panel-fill-strong);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
}
.docs-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 40;
  padding: 6px;
}
.docs-search-item {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.docs-search-item:hover,
.docs-search-item.active {
  background: rgba(235, 132, 36, 0.08);
  border-color: var(--orange-border);
  text-decoration: none;
  color: var(--text);
}
.docs-search-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.docs-search-meta {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.docs-search-snippet {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.docs-search-item mark {
  background: var(--orange-soft);
  color: var(--orange-light);
  padding: 0 1px;
  border-radius: 2px;
}
.docs-search-empty {
  padding: 16px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}
@media (max-width: 720px) {
  .docs-search { max-width: none; margin: 0 6px; }
  .docs-search .kbd { display: none; }
}
