/* ============================================================
   FORGE 2.0 Docs — style.css
   Fonts: Inter + JetBrains Mono (Google Fonts)
   Dark-mode only. Prism.js syntax highlighting.
   ============================================================ */

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

/* ── CSS Custom Properties ── */
:root {
  --color-bg:           #0D0D0D;
  --color-text:         #F5F0EB;
  --color-text-muted:   #94A3B8;
  --color-accent-start: #E8631A;
  --color-accent-end:   #F59E0B;
  --color-success:      #10B981;
  --color-code-bg:      #1A1A2E;
  --color-card:         #161616;
  --color-border:       #2A2A2A;
  --color-sidebar-bg:   #111111;
  --color-danger:       #EF4444;
  --color-info:         #3B82F6;
  --sidebar-width:      260px;
  --topbar-height:      56px;
  --font-base:          'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:          'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --radius:             8px;
  --radius-lg:          12px;
  --shadow-sm:          0 1px 3px rgba(0,0,0,.4);
  --shadow-md:          0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:          0 8px 32px rgba(0,0,0,.6);
  --transition:         0.2s ease;
  --gradient-accent:    linear-gradient(135deg, #E8631A, #F59E0B);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  font-family: var(--font-base);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: rgba(232, 99, 26, 0.35);
  color: #fff;
}

a {
  color: #F59E0B;
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #E8631A;
  text-decoration: underline;
}

/* ── Top Bar ── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(13,13,13,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  z-index: 100;
  border-bottom: 1px solid var(--color-border);
  gap: 1rem;
}

.topbar-logo {
  font-family: var(--font-base);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text);
  text-decoration: none;
  letter-spacing: -0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-logo:hover {
  text-decoration: none;
}

.topbar-logo .logo-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid var(--color-border);
  padding: 0.15em 0.55em;
  border-radius: 999px;
  white-space: nowrap;
}

.topbar-title {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
  white-space: nowrap;
}

.topbar-spacer {
  flex: 1;
}

.topbar-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.topbar-link:hover {
  color: #F59E0B;
  text-decoration: none;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: background var(--transition);
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.08);
}

.menu-toggle svg {
  display: block;
}

/* ── Layout ── */
.layout {
  display: flex;
  padding-top: var(--topbar-height);
  flex: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  min-height: calc(100vh - var(--topbar-height));
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 1.5rem 0 2rem;
  z-index: 90;
  transition: transform var(--transition);
  border-right: 1px solid var(--color-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 4px;
}

.sidebar-section {
  margin-bottom: 1.75rem;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(245,240,235,0.3);
  padding: 0 1.25rem 0.5rem;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  line-height: 1.4;
}

.sidebar-nav li a:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.04);
  border-left-color: rgba(232,99,26,0.5);
  text-decoration: none;
}

.sidebar-nav li a.active {
  color: #F59E0B;
  background: rgba(232,99,26,0.08);
  border-left-color: #E8631A;
  font-weight: 600;
}

.sidebar-nav li a .nav-icon {
  font-size: 0.95rem;
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
}

/* ── Main Content ── */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}

.content-wrapper {
  max-width: 880px;
  padding: 2.5rem 2.5rem 4rem;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumbs a:hover {
  color: #F59E0B;
  text-decoration: underline;
}

.breadcrumb-sep {
  color: rgba(148,163,184,0.3);
  user-select: none;
}

.breadcrumbs span:last-child {
  color: var(--color-text);
  font-weight: 500;
}

/* ── Typography ── */
.page-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.15;
  margin-bottom: 0.5rem;
  letter-spacing: -0.03em;
}

.page-title .accent-text {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  font-weight: 400;
  line-height: 1.6;
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 2.5rem 0 0.75rem;
  letter-spacing: -0.02em;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 2rem 0 0.6rem;
}

h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.5rem;
}

p {
  margin-bottom: 1rem;
  color: var(--color-text);
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

li {
  margin-bottom: 0.35rem;
  color: var(--color-text);
}

li strong {
  color: var(--color-text);
}

strong {
  font-weight: 600;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

/* ── Code & Pre (Prism.js integration) ── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(26, 26, 46, 0.7);
  color: #F59E0B;
  padding: 0.15em 0.45em;
  border-radius: 4px;
  border: 1px solid rgba(42,42,42,0.5);
}

pre {
  background: var(--color-code-bg);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  position: relative;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

pre code {
  background: none;
  color: #e2e8f0;
  padding: 0;
  border: none;
  font-size: 0.875rem;
  line-height: 1.65;
}

/* Prism.js overrides */
pre[class*="language-"],
code[class*="language-"] {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  color: #e2e8f0;
  text-shadow: none;
}

pre[class*="language-"] {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata { color: #6b7280; }
.token.punctuation { color: #94A3B8; }
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol { color: #F59E0B; }
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin { color: #10B981; }
.token.operator,
.token.entity,
.token.url,
.token.variable { color: #E8631A; }
.token.atrule,
.token.attr-value,
.token.keyword { color: #818CF8; }
.token.function,
.token.class-name { color: #F59E0B; }
.token.regex,
.token.important { color: #E8631A; }

.code-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0.6rem 1.5rem 0;
  background: var(--color-code-bg);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--color-border);
  border-bottom: none;
  display: block;
  margin-top: 1.25rem;
  margin-bottom: 0;
}

.code-label + pre,
.code-label + pre[class*="language-"] {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}

/* ── Callout Boxes ── */
.callout {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1.25rem 0;
  border-left: 4px solid transparent;
  font-size: 0.9rem;
  background: var(--color-card);
}

.callout-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.7;
}

.callout-body p:last-child {
  margin-bottom: 0;
}

.callout-info {
  border-left-color: var(--color-info);
  background: rgba(59, 130, 246, 0.06);
}

.callout-tip {
  border-left-color: var(--color-success);
  background: rgba(16, 185, 129, 0.06);
}

.callout-warn {
  border-left-color: #F59E0B;
  background: rgba(245, 158, 11, 0.06);
}

.callout-danger {
  border-left-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.06);
}

/* ── Quick Link Cards (Home) ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  text-decoration: none;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card:hover {
  border-color: rgba(232, 99, 26, 0.5);
  box-shadow: 0 0 24px rgba(232, 99, 26, 0.08);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text);
}

.card-desc {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ── Table ── */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--color-card);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  color: var(--color-text);
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

tbody tr {
  border-bottom: 1px solid var(--color-border);
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:nth-child(even) {
  background: rgba(255,255,255,0.02);
}

tbody tr:hover {
  background: rgba(232, 99, 26, 0.03);
}

tbody td {
  padding: 0.7rem 1rem;
  vertical-align: top;
  color: var(--color-text);
}

/* ── Badge / Tag ── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  vertical-align: middle;
  white-space: nowrap;
}

.badge-accent {
  background: rgba(232, 99, 26, 0.15);
  color: #F59E0B;
  border: 1px solid rgba(232, 99, 26, 0.3);
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.1);
  color: var(--color-text-muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ── Lane / API reference blocks ── */
.ref-block {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin: 1.25rem 0;
  overflow: hidden;
}

.ref-block-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.ref-block-id {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ref-block-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.ref-block-body {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
}

.ref-block-body p:last-child {
  margin-bottom: 0;
}

/* ── API Signature ── */
.api-sig {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--color-code-bg);
  color: #e2e8f0;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius);
  margin: 0.5rem 0 1rem;
  overflow-x: auto;
  border: 1px solid var(--color-border);
}

.api-sig .fn-name {
  color: #F59E0B;
  font-weight: 600;
}

.api-sig .param {
  color: #818CF8;
}

.api-sig .type {
  color: #10B981;
}

.api-sig .default {
  color: var(--color-text-muted);
}

.api-returns {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: -0.25rem;
  margin-bottom: 1rem;
}

/* ── Config Var rows ── */
.config-var {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.config-var:last-child {
  border-bottom: none;
}

.config-var-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: #F59E0B;
  background: rgba(245, 158, 11, 0.08);
  padding: 0.2em 0.55em;
  border-radius: 4px;
  border: 1px solid rgba(245, 158, 11, 0.15);
  white-space: nowrap;
  flex-shrink: 0;
}

.config-var-desc {
  font-size: 0.875rem;
  color: var(--color-text);
  flex: 1;
  min-width: 0;
}

.config-var-default {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  background: rgba(148, 163, 184, 0.08);
  padding: 0.15em 0.45em;
  border-radius: 4px;
}

/* ── Lane Flow Diagram ── */
.lane-flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow-x: auto;
}

.lane-flow-step {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35em 0.7em;
  border-radius: 6px;
  white-space: nowrap;
  background: rgba(232, 99, 26, 0.1);
  color: #F59E0B;
  border: 1px solid rgba(232, 99, 26, 0.25);
}

.lane-flow-step.loop {
  background: rgba(129, 140, 248, 0.1);
  color: #818CF8;
  border-color: rgba(129, 140, 248, 0.25);
}

.lane-flow-arrow {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  user-select: none;
}

/* ── Hero Section (Home page) ── */
.hero {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-success);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  padding: 0.3em 0.8em;
  border-radius: 999px;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
}

.hero p {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 640px;
  line-height: 1.65;
}

/* ── Feature Stats ── */
.stats-row {
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Footer ── */
.site-footer {
  background: var(--color-sidebar-bg);
  color: var(--color-text-muted);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  margin-left: var(--sidebar-width);
  border-top: 1px solid var(--color-border);
}

.site-footer a {
  color: var(--color-text-muted);
  transition: color var(--transition);
}

.site-footer a:hover {
  color: #F59E0B;
}

/* ── Before/After blocks ── */
.before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
}

.before-after-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.before-label { color: var(--color-danger); }
.after-label { color: var(--color-success); }

/* ── Step indicators ── */
.step-list {
  counter-reset: step-counter;
  list-style: none;
  padding-left: 0;
}

.step-list li {
  counter-increment: step-counter;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.5rem;
}

.step-list li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #0D0D0D;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Section anchor links ── */
h2[id], h3[id] {
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 89;
  }

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

  .main {
    margin-left: 0;
  }

  .content-wrapper {
    padding: 1.5rem 1.25rem 3rem;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

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

  .before-after {
    grid-template-columns: 1fr;
  }

  .stats-row {
    gap: 1.25rem;
  }

  .site-footer {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    display: none;
  }

  .topbar-version {
    display: none;
  }
}

/* ── Prism.js toolbar overrides ── */
div.code-toolbar > .toolbar {
  top: 0.5rem;
  right: 0.5rem;
}

div.code-toolbar > .toolbar .toolbar-item > button {
  background: rgba(255,255,255,0.08);
  color: var(--color-text-muted);
  font-size: 0.7rem;
  padding: 0.25em 0.5em;
  border-radius: 4px;
  box-shadow: none;
}
