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

/* Speed in China brand: dark navy + warm orange (speedinchinaplugin.com) */
:root {
    --bg-base: #0B1219;
    --bg-subtle: #0F1A26;
    --bg-muted: #162130;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-active: #2A1A10;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-default: rgba(255, 255, 255, 0.12);
    --text-primary: #E8ECF1;
    --text-secondary: #B8C2CC;
    --text-muted: #7A8A99;
    --primary: #E8713A;
    --primary-hover: #F09A5E;
    --primary-subtle: rgba(232, 113, 58, 0.12);
    --primary-bg: rgba(232, 113, 58, 0.06);
    --success: #34D399;
    --success-bg: rgba(52, 211, 153, 0.08);
    --success-border: rgba(52, 211, 153, 0.2);
    --success-text: #a7f3d0;
    --warning: #FBBF24;
    --warning-bg: rgba(251, 191, 36, 0.08);
    --warning-border: rgba(251, 191, 36, 0.2);
    --warning-text: #fde68a;
    --danger: #F87171;
    --danger-bg: rgba(248, 113, 113, 0.08);
    --danger-border: rgba(248, 113, 113, 0.2);
    --danger-text: #fca5a5;
    --info: #60A5FA;
    --info-bg: rgba(96, 165, 250, 0.08);
    --info-border: rgba(96, 165, 250, 0.2);
    --info-text: #93c5fd;
    --header-bg: #0F1A26;
    --sidebar-width: 280px;
    --header-height: 64px;
    --content-max-width: 800px;
    --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(11, 18, 25, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    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: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.header-logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.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);
}

.header-links a.header-download-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.85rem;
    background: var(--primary);
    color: #fff !important;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.header-download-btn:hover {
    background: var(--primary-hover);
    color: #fff;
}

.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: rgba(255, 255, 255, 0.5);
    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;
}

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

.page-header {
    margin-bottom: 2rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: var(--primary-hover);
}

.breadcrumb-sep {
    color: var(--text-muted);
    opacity: 0.4;
}

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;
}

/* ── 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-content ul,
.hint-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

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

.hint.success .hint-icon {
    color: var(--success);
}

.hint.success a {
    color: var(--success);
}

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

.hint.warning .hint-icon {
    color: var(--warning);
}

.hint.warning a {
    color: var(--warning);
}

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

.hint.danger .hint-icon {
    color: var(--danger);
}

.hint.danger a {
    color: var(--danger);
}

.hint.info {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--info-text);
}

.hint.info .hint-icon {
    color: var(--info);
}

.hint.info a {
    color: var(--info-text);
}

/* ── Code ── */
code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85em;
    background: var(--bg-muted);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

pre {
    background: var(--bg-subtle);
    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;
    border: none;
    padding: 0;
    font-size: inherit;
    color: var(--text-secondary);
}

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

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

thead {
    background: var(--bg-muted);
}

th {
    text-align: left;
    padding: 0.65rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-subtle);
}

td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

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

tr:hover {
    background: var(--bg-hover);
}

td strong {
    color: var(--text-primary);
}

/* ── Figures / Images ── */
figure {
    margin: 1.5rem 0;
    text-align: center;
}

figure img {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-style: italic;
}

.content img {
    max-width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

/* ── 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-title {
    font-size: 0.95rem;
}

.content-ref-arrow {
    color: var(--text-muted);
    transition: transform 0.2s, color 0.2s;
    flex-shrink: 0;
}

.content-ref:hover .content-ref-arrow {
    transform: translateX(3px);
    color: var(--primary-hover);
}

/* ── Page Navigation (Prev/Next) ── */
.page-nav {
    display: flex;
    gap: 0.75rem;
    margin-top: 3rem;
    padding-top: 1.5rem;
}

.page-nav-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    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-link:hover {
    border-color: var(--primary);
}

.page-nav-link .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.page-nav-link .title {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.3;
}

.page-nav-link:hover .title {
    color: var(--primary-hover);
}

.page-nav-link.prev {
    flex-direction: row;
}

.page-nav-link.next {
    justify-content: flex-end;
    text-align: right;
}

.page-nav-link .arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.75rem;
}

/* ── Numbered Steps ── */
.steps {
    counter-reset: step;
}

.step {
    counter-increment: step;
    position: relative;
    padding-left: 2.5rem;
    margin: 1.25rem 0;
}

.step::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    background: var(--primary-subtle);
    color: var(--primary-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

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

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

.heading-anchor {
    color: var(--text-muted);
    opacity: 0;
    margin-left: 0.35em;
    font-weight: 400;
    transition: opacity 0.15s;
    text-decoration: none;
}

h2:hover .heading-anchor,
h3:hover .heading-anchor,
h4:hover .heading-anchor {
    opacity: 1;
}

/* ── Feature Grid on index ── */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.feature-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: border-color 0.2s, transform 0.2s;
}

.feature-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

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

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem;
}

.feature-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── 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);
    }

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

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .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;
    }

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

@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 — 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;
}
