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

:root {
  --bg-base: #0D1117;
  --bg-subtle: #161B22;
  --bg-muted: #1C2128;
  --bg-hover: rgba(255,255,255,0.04);
  --border-subtle: #30363D;
  --text-primary: #E6EDF3;
  --text-secondary: #C9D1D9;
  --text-muted: #8B949E;
  --primary: #2F81F7;
  --primary-hover: #58A6FF;
  --primary-subtle: rgba(47,129,247,0.12);
  --primary-bg: rgba(47,129,247,0.08);
  --success: #2EA043;
  --success-bg: rgba(46,160,67,0.08);
  --success-border: rgba(46,160,67,0.2);
  --success-text: #9bd0a1;
  --warning: #D29922;
  --warning-bg: rgba(210,153,34,0.08);
  --warning-border: rgba(210,153,34,0.2);
  --warning-text: #e0b891;
  --danger: #F85149;
  --danger-bg: rgba(248,81,73,0.08);
  --danger-border: rgba(248,81,73,0.2);
  --danger-text: #f8a8a1;
  --info-bg: rgba(47,129,247,0.08);
  --info-border: rgba(47,129,247,0.2);
  --info-text: #a8c8f7;
  --sidebar-width: 280px;
  --header-height: 64px;
  --content-max-width: 768px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

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

a { color: var(--primary-hover); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--text-primary); }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-height);
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}
.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.header-logo-icon svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2; }
.header-logo-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.header-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.header-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s;
}
.header-links a:hover { color: var(--text-primary); }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  margin-left: -0.5rem;
}
.menu-toggle svg { display: block; }

/* ── Layout ── */
.site-layout {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  padding: 0 2rem;
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  overflow-y: auto;
  padding: 1.5rem 0 2rem 0;
  margin-right: 3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.nav-group { margin-bottom: 0.25rem; }
.nav-group-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 1.25rem 0.75rem 0.5rem;
}
.nav-group:first-child .nav-group-title { padding-top: 0.25rem; }
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-link.active {
  background: var(--primary-subtle);
  color: var(--primary-hover);
  font-weight: 600;
  position: relative;
}
.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--primary);
  border-radius: 1px;
}
.nav-child { padding-left: 0.75rem; }
.nav-child .nav-link { font-size: 0.8125rem; padding: 0.3rem 0.75rem; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  min-width: 0;
  max-width: var(--content-max-width);
  padding: 2rem 0 4rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.page-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* ── Content Typography ── */
.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}
.content h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }

.content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}

.content p { margin: 0.75rem 0; }
.content p + p { margin-top: 0.5rem; }
.content strong { color: var(--text-primary); font-weight: 600; }

.content ul, .content ol { margin: 0.75rem 0; padding-left: 1.5rem; }
.content li { margin: 0.35rem 0; }
.content li::marker { color: var(--text-muted); }

/* ── Hint/Callout Boxes ── */
.hint {
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  gap: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.6;
}
.hint-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.hint-content { flex: 1; min-width: 0; }
.hint-content p { margin: 0.25rem 0; }
.hint-content p:first-child { margin-top: 0; }
.hint-content a { text-decoration: underline; text-underline-offset: 2px; }

.hint.hint-success, .hint.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}
.hint.hint-success .hint-icon, .hint.success .hint-icon { color: var(--success); }
.hint.hint-success a, .hint.success a { color: var(--success); }

.hint.hint-warning, .hint.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}
.hint.hint-warning .hint-icon, .hint.warning .hint-icon { color: var(--warning); }
.hint.hint-warning a, .hint.warning a { color: var(--warning); }

.hint.hint-danger, .hint.danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}
.hint.hint-danger .hint-icon, .hint.danger .hint-icon { color: var(--danger); }
.hint.hint-danger a, .hint.danger a { color: var(--danger); }

.hint.hint-info, .hint.info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}
.hint.hint-info .hint-icon, .hint.info .hint-icon { color: var(--primary); }
.hint.hint-info a, .hint.info a { color: var(--primary-hover); }

.hint.upgrade {
  background: var(--primary-bg);
  border: 1px solid rgba(47,129,247,0.25);
  color: #a8c8f7;
}
.hint.upgrade .hint-icon { color: var(--primary); }
.hint.upgrade a { color: var(--primary-hover); font-weight: 600; }

/* ── Code ── */
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
  background: rgba(110,118,129,0.2);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: #F0883E;
}

pre {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
}
pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: var(--text-secondary);
}

.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp,
.highlight .kr, .highlight .kt { color: #cba6f7; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb,
.highlight .sc, .highlight .sd, .highlight .sh { color: #a6e3a1; }
.highlight .nf, .highlight .nb, .highlight .nc { color: #89b4fa; }
.highlight .nv, .highlight .no, .highlight .na { color: #f9e2af; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs,
.highlight .cp { color: #6c7086; font-style: italic; }
.highlight .mi, .highlight .mf, .highlight .mh { color: #fab387; }
.highlight .o, .highlight .p { color: #89dceb; }
.highlight .nt { color: #f38ba8; }

/* ── Tables ── */
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 1rem 0;
}
.content thead { background: var(--bg-muted); }
.content th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.8125rem;
  border-bottom: 2px solid var(--border-subtle);
}
.content td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.content tr:last-child td { border-bottom: none; }
.content tr:hover { background: var(--bg-hover); }

/* ── Content Reference Cards ── */
.content-ref {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 0.75rem 0;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-secondary);
}
.content-ref:hover {
  border-color: var(--primary);
  color: var(--primary-hover);
}
.content-ref::after {
  content: '→';
  color: var(--text-muted);
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
  margin-left: 1rem;
}
.content-ref:hover::after {
  transform: translateX(3px);
  color: var(--primary-hover);
}

/* ── Page Navigation ── */
.page-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}
.page-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.2s;
}
.page-nav a:hover { border-color: var(--primary); }
.page-nav a .nav-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.page-nav a .nav-title { color: var(--text-primary); font-size: 0.95rem; line-height: 1.3; }
.page-nav a:hover .nav-title { color: var(--primary-hover); }
.page-nav a.next { text-align: right; }

/* ── Horizontal Rule ── */
.content hr { border: none; border-top: 1px solid var(--border-subtle); margin: 2rem 0; }

.content h2[id], .content h3[id], .content h4[id] {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

/* ── Search ── */
.search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  z-index: 200;
  margin-top: 4px;
}
.search-results.visible { display: block; }
.search-result-item {
  display: block;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-item .result-section { font-size: 0.6875rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.search-result-item .result-title { font-weight: 500; color: var(--text-primary); }
.search-no-results { padding: 16px; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 29;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    background: var(--bg-base);
    border-right: 1px solid var(--border-subtle);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding-top: calc(var(--header-height) + 1rem);
    margin-right: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .site-layout { padding: 0 1rem; }
  .header-inner { padding: 0 1rem; }
  .header-links { gap: 1rem; }
}

@media (max-width: 768px) {
  h1 { font-size: 1.65rem; }
  .content h2 { font-size: 1.3rem; }
  .content h3 { font-size: 1.1rem; }
  .header-links .hide-mobile { display: none; }
  .page-nav { flex-direction: column; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .header-logo-text { font-size: 0.9rem; }
}


/* Mobile header CTA visibility — Pricing (Buy) + Download + Support visible at 375px-414px */
/* Brandon priority fix 2026-05-18: 3-CTA mobile pattern, Main Site stays hidden via hide-mobile */
@media (max-width: 768px) {
    .header-logo-text { display: none; }
    .header-links { gap: 0.5rem; }
    .header-links a:not(.header-download-btn) { font-size: 0.78rem; padding: 0.25rem 0.4rem; }
    .header-links a.header-download-btn { font-size: 0.75rem; padding: 0.35rem 0.55rem; }
}
@media (max-width: 380px) {
    .header-links { gap: 0.35rem; }
    .header-links a:not(.header-download-btn) { font-size: 0.7rem; padding: 0.2rem 0.3rem; }
    .header-links a.header-download-btn { font-size: 0.7rem; padding: 0.3rem 0.45rem; }
}


/* ────────────────────────────────────────────────────────────────────────
   Mobile header — clean pattern (Brandon fix 2026-05-19)
   At ≤768px: ONLY hamburger + logo icon + ONE primary CTA visible.
   All other links (Main Site, Download Free, Support) live INSIDE the
   hamburger drawer, in a CTA section below the nav.
   ──────────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header-logo-text { display: none !important; }
    .header-links { gap: 0.5rem; }
    .header-links > a:not(.header-buy),
    .header-links > button:not(.header-buy) { display: none !important; }
    .header-links a.header-buy {
        display: inline-flex !important;
        align-items: center;
        padding: 0.4rem 0.85rem;
        background: var(--primary);
        color: #fff !important;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: var(--radius-md);
        white-space: nowrap;
        text-decoration: none;
    }
    .header-links a.header-buy:hover { background: var(--primary-hover); color: #fff !important; }
}

/* Drawer CTA section — appears INSIDE the sidebar drawer, below the nav */
.sidebar-cta { display: none; }
@media (max-width: 1024px) {
    .sidebar-cta {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 0.75rem 1.5rem;
        margin-top: 1.5rem;
        border-top: 1px solid var(--border-subtle);
    }
    .sidebar-cta-label {
        font-size: 0.6875rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-muted);
        padding: 0 0.25rem 0.5rem;
    }
    .sidebar-cta a, .sidebar-cta button {
        display: block;
        padding: 0.65rem 1rem;
        text-align: center;
        border-radius: var(--radius-md);
        font-size: 0.875rem;
        font-weight: 500;
        text-decoration: none;
        transition: all 0.15s;
        border: none;
        cursor: pointer;
        font-family: inherit;
        width: 100%;
    }
    .sidebar-cta .cta-primary { background: var(--primary); color: #fff; font-weight: 600; }
    .sidebar-cta .cta-primary:hover { background: var(--primary-hover); color: #fff; }
    .sidebar-cta .cta-secondary {
        background: var(--bg-subtle);
        color: var(--text-primary);
        border: 1px solid var(--border-subtle);
    }
    .sidebar-cta .cta-secondary:hover { border-color: var(--primary); color: var(--primary-hover); }
    .sidebar-cta .cta-tertiary { background: transparent; color: var(--text-muted); font-size: 0.8rem; }
    .sidebar-cta .cta-tertiary:hover { color: var(--text-primary); }
}


/* === Mobile header — single primary CTA, others hidden ============
 * Brandon priority fix 2026-05-19 (re-fix after empty-commit failure).
 * Hides every secondary header link/button on <=768px viewports;
 * preserves whichever Pricing anchor exists OR .header-buy, styled
 * as the primary CTA. Matches the working BIC/SPP pattern.
 * Targets href*="pricing" so no HTML changes are needed.
 * ================================================================ */
@media (max-width: 768px) {
  .header-logo-text { display: none !important; }
  .header-links { gap: 0.5rem; align-items: center; }
  .header-links > a,
  .header-links > button { display: none !important; }
  .header-links > a[href*="pricing"],
  .header-links > a.header-buy {
    display: inline-flex !important;
    align-items: center;
    padding: 0.4rem 0.85rem;
    background: var(--primary, #346ddb);
    color: #fff !important;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    text-decoration: none;
  }
  .header-links > a[href*="pricing"]:hover,
  .header-links > a.header-buy:hover {
    background: var(--primary-hover, #508bfc);
    color: #fff !important;
  }
}


/* gp-docs: page-header contextual menu */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.page-header-main {
    flex: 1;
    min-width: 0;
}
