﻿/* =========================================
   CSS CUSTOM PROPERTIES
   FIX: Centralised header height so scroll-padding,
   sticky positioning, and mobile sidebar all stay in sync.
   ========================================= */
:root {
    --header-height: 120px;
    --header-height-mobile: 60px;
    --sidebar-width: 280px;
    --toc-width: 280px;
}

/* --- Base styles --- */
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #30313d;
    background-color: #ffffff;
    line-height: 1.6;
    width: 100%;
}

html {
    /* FIX: Uses CSS variable so it stays in sync with the actual header height */
    scroll-padding-top: calc(var(--header-height) + 20px);
}

/* Apply Plus Jakarta Sans to headings for that "Stripe Brand" pop */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: -0.02em;
    font-weight: 700;
    color: #0a2540;
}

body > header {
    background: #ffffff;
    border-bottom: 1px solid #f1f4f8;
    padding: 1rem 2.5rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 9999;
    transform: translateZ(0);
}

.header-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.brand-tier {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

    .brand-tier h1 {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 800;
        letter-spacing: -0.03em;
        line-height: 1;
    }

.top-nav {
    display: flex;
    gap: 2rem;
    margin: 0;
}

    .top-nav a {
        text-decoration: none;
        color: #4f5b76;
        font-size: 14px;
        font-weight: 600;
        padding-bottom: 1rem;
        border-bottom: 2px solid transparent;
        transition: all 0.2s ease;
    }

        .top-nav a:hover {
            color: #0a2540;
        }

        .top-nav a.active {
            color: #635bff;
            border-bottom-color: #635bff;
        }

.layout {
    display: flex;
    align-items: stretch;
    gap: 4rem;
    max-width: none;
    margin: 0;
    padding-left: 0;
    padding-right: 2rem;
    min-height: calc(100vh - var(--header-height));
}

aside#sidebar {
    position: sticky;
    /* FIX: Uses CSS variable */
    top: var(--header-height);
    width: var(--sidebar-width);
    max-height: calc(100vh - var(--header-height));
    padding: 2rem 1rem;
    background: #ffffff;
    border-right: 1px solid #f1f4f8;
    overflow-y: auto;
    box-sizing: border-box;
    flex-shrink: 0;
    margin-left: 0;
    padding-left: 1.5rem;
}

/* --- Right Sidebar (Table of Contents) --- */
aside#toc {
    width: var(--toc-width);
    box-sizing: border-box;
    position: sticky;
    top: var(--header-height);
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 2rem 1.5rem;
    font-size: 13px;
    border-left: 1px solid #f1f4f8;
    display: none;
    flex-shrink: 0; /* FIX: Prevents TOC from compressing as a flex child */
}

/* Only show TOC on large screens */
@media (min-width: 1280px) {
    aside#toc {
        display: block;
    }
}

.toc-header {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 11px;
    color: #8898aa;
    margin-bottom: 1rem;
}

#toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#toc li {
    margin-bottom: 8px;
}

#toc a {
    text-decoration: none;
    color: #4f5b76;
    display: block;
    line-height: 1.4;
    transition: color 0.2s;
}

    #toc a:hover {
        color: #635bff;
    }

    #toc a.active {
        color: #635bff;
        font-weight: 600;
        border-left: 2px solid #635bff;
        padding-left: 10px;
        margin-left: -12px;
    }

/* Indent H3s slightly */
#toc .toc-h3 {
    padding-left: 12px;
    font-size: 12px;
    color: #697386;
}

main {
    flex: 1;
    padding: 1rem;
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Removed overflow-x: hidden from here */
}

/* Only clip overflow on standard pages, not API pages where sticky depends on it */
body:not(.page-api) main {
    overflow-x: hidden;
}

.markdown-body {
    flex: 1;
}

    .markdown-body img {
        max-width: 100%;
        height: auto;
        display: block;
    }


/* --- GHOST TOC (Prevents content shift) --- */
@media (min-width: 1280px) {
    .layout.no-toc::after {
        content: "";
        display: block;
        width: var(--toc-width);
        flex-shrink: 0;
    }
}

/* --- Modern "Accent Line" Callouts --- */
.callout {
    position: relative;
    margin: 2rem 0;
    padding: .5rem .5rem .5rem 3.5rem;
    background: transparent;
    border: none;
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 0;
    font-size: 0.95rem;
}

    .callout::before {
        content: '';
        position: absolute;
        top: .5rem;
        left: 1.25rem;
        width: 20px;
        height: 20px;
        background-size: contain;
        background-repeat: no-repeat;
        opacity: 0.9;
    }

.callout-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #0a2540;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

/* NOTE (Blue) */
.callout.note {
    border-left-color: #635bff;
}

    .callout.note::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23635bff'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
    }

/* WARNING (Amber) */
.callout.warning {
    border-left-color: #f5a623;
}

    .callout.warning::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f5a623'%3E%3Cpath d='M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z'/%3E%3C/svg%3E");
    }

/* ERROR (Red) */
.callout.error {
    border-left-color: #d14343;
}

    .callout.error::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23d14343'%3E%3Cpath d='M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z'/%3E%3C/svg%3E");
    }

/* SUCCESS/CHECK (Green) */
.callout.check {
    border-left-color: #007a5a;
}

    .callout.check::before {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23007a5a'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
    }

/* --- Stripe Sidebar Links & Tree --- */
#sidebar ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#sidebar li {
    margin: 1px 0;
}

#sidebar a {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    color: #4f5b76;
    padding: 5px 12px;
    border-radius: 0;
    border-left: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
    line-height: 1.4;
}

    #sidebar a:hover {
        color: #0a2540;
        background: transparent;
    }

    #sidebar a.active {
        color: #635bff;
        font-weight: 600;
        border-left-color: #635bff;
        background: transparent;
    }

/* Section Headers — plain uppercase labels, not links */
#sidebar .nav-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06rem;
    color: #8898aa;
    margin: 1.75rem 0 0.4rem 12px;
    display: block;
    cursor: default;
}

/* Nav item row */
#sidebar .nav-item {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

    #sidebar .nav-item a {
        flex-grow: 1;
        padding-left: 4px;
    }

#sidebar .toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    color: #aab7c4;
    user-select: none;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

    #sidebar .toggle svg {
        fill: currentColor;
    }

    #sidebar .toggle:hover {
        color: #635bff;
    }

#sidebar li.open > .nav-item > .toggle {
    transform: rotate(90deg); 
}

/* Nested lists — tighter indent, thinner line */
#sidebar li > ul {
    margin-left: 12px;
    border-left: 1px solid #e6ebf1;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 8px;
}

#sidebar li.open > ul {
    max-height: 2000px;
}

#sidebar li ul a {
    margin-left: 0;
    font-size: 13px;
}

#sidebar .toggle-placeholder {
    display: inline-flex;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: #666;
}

    .breadcrumbs a {
        color: #0074d9;
        text-decoration: none;
    }

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

    .breadcrumbs .sep {
        margin: 0 0.5rem;
        color: #999;
    }

    .breadcrumbs span {
        font-weight: 500;
    }

/* Titles and Slugs */
.result-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #222;
}

.result-url {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* Empty state / "See all" */
.sidebar-results p {
    padding: 12px;
    margin: 0;
    font-size: 0.85rem;
    color: #666;
}

.search-see-all {
    background: #fcfcfc;
    text-align: center;
    font-size: 0.8rem;
    border-top: 1px solid #eee;
}

.code-block {
    position: relative;
    margin: 2rem 0;
    background: #0d1117;
    border-radius: 8px;
    overflow: hidden;
    min-height: 50px;
    display: block;
}

.code-block-header {
    background: #161b22;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #30363d;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.code-block-lang {
    color: #8b949e;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05rem;
    font-family: sans-serif;
}

.shiki-wrapper pre {
    padding: 1.25rem;
    margin: 0;
    overflow-x: auto;
    /* FIX: Fira Code is now loaded; system monospace stack as fallback */
    font-family: 'Fira Code', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
}

/* --- Copy Button Styles --- */
.copy-button {
    position: absolute;
    top: 6px;
    right: 12px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

    .copy-button:hover {
        background: #30363d;
        color: #fff;
        border-color: #8b949e;
    }

    .copy-button.success {
        background: #238636;
        color: #fff;
        border-color: #2ea043;
    }

/* --- Hover Pill --- */
#nav-pill {
    position: absolute;
    left: 8px;
    right: 8px;
    background: #f6f9fc;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    pointer-events: none;
    opacity: 0;
    z-index: 0;
}

#sidebar a {
    position: relative;
    z-index: 5;
    flex-grow: 1;
}

.sidebar-product-title {
    padding: 0 12px;
    margin-bottom: 1.5rem;
    font-size: 18px;
    font-weight: 700;
    color: #0a2540;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* --- Launcher Grid --- */
.launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.launcher-card {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    background: #ffffff;
    border: 1px solid #e6ebf1;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

    .launcher-card:hover {
        border-color: #635bff;
        transform: translateY(-2px);
        box-shadow: 0 15px 35px -5px rgba(50,50,93,0.1), 0 5px 15px -5px rgba(0,0,0,0.08);
    }

.card-icon {
    font-size: 24px;
    margin-right: 1.25rem;
    background: #f6f9fc;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.card-content h3 {
    margin: 0 0 0.5rem 0;
    color: #0a2540;
    font-size: 18px;
}

.card-content p {
    margin: 0;
    color: #4f5b76;
    font-size: 14px;
    line-height: 1.5;
}

/* --- Header Layout --- */
.brand-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* --- Center Search Container --- */
#header-search {
    flex: 0 1 500px;
    display: flex;
    justify-content: center;
    cursor: pointer;
}

.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    display: flex;
    align-items: center;
}

#header-search input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    background: #f6f9fc;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 14px;
    color: #0a2540;
    transition: all 0.2s ease;
    outline: none;
    height: 40px;
    box-sizing: border-box;
    pointer-events: none; /* Clicks pass through to the parent div */
}

#header-search:focus-within input,
#header-search:focus input {
    background: #ffffff;
    border-color: #635bff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* FIX: Show focus ring on the search trigger for keyboard users */
#header-search:focus {
    outline: 2px solid #635bff;
    outline-offset: 2px;
    border-radius: 20px;
}

.search-icon {
    position: absolute;
    left: 14px;
    pointer-events: none;
    z-index: 10;
}

.search-hint {
    position: absolute;
    right: 12px;
    font-family: sans-serif;
    font-size: 12px;
    color: #8898aa;
    border: 1px solid #e6ebf1;
    border-radius: 4px;
    padding: 2px 6px;
    background: #fff;
    pointer-events: none;
}

.utility-tier {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    gap: 1.5rem;
}

/* ========================================= */
/* SEARCH MODAL                              */
/* ========================================= */

.search-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 37, 64, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    padding-top: 10vh;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.search-modal-container {
    display: block;
    position: relative;
    width: 100%;
    max-width: 700px;
    height: 600px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 50px 100px -20px rgba(50,50,93,0.25), 0 30px 60px -30px rgba(0,0,0,0.3);
    overflow: hidden;
}

.search-modal-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #f1f4f8;
    background: #fff;
    box-sizing: border-box;
}

.search-icon-large {
    margin-right: 12px;
}

#modal-search-input {
    flex: 1;
    border: none;
    font-size: 16px;
    color: #0a2540;
    outline: none;
    background: transparent;
    height: 100%;
}

.close-modal {
    background: #fff;
    border: 1px solid #e6ebf1;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    color: #8898aa;
    cursor: pointer;
}

#modal-search-results {
    display: block;
    height: 480px;
    overflow-y: auto;
    background: #fff;
    padding: 0;
    margin: 0;
}

.search-modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: #fcfcfc;
    border-top: 1px solid #f1f4f8;
    color: #8898aa;
    font-size: 11px;
    gap: 20px;
    box-sizing: border-box;
    z-index: 10;
}

    .search-modal-footer kbd {
        background: #fff;
        border: 1px solid #e6ebf1;
        border-radius: 3px;
        padding: 1px 4px;
        font-family: inherit;
    }

.search-result-item {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e3e8ee;
    text-decoration: none;
    background: #fff;
    box-sizing: border-box;
}

    .search-result-item:hover,
    .search-result-item:focus,
    .search-result-item.selected {
        background-color: #f7f9fc;
        border-left: 3px solid #019ada;
        padding-left: calc(1.5rem - 3px);
        outline: none;
    }

.search-result-title {
    color: #1a1f36;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: block;
}

.search-result-snippet {
    color: #697386;
    font-size: 0.85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.no-results {
    padding: 3rem;
    text-align: center;
    color: #8898aa;
}

/* ========================================= */
/* LOGO & BRAND STYLING                      */
/* ========================================= */

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #0a2540;
    gap: 6px;
}

.brand-logo {
    height: 42px;
    width: auto;
    display: block;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* FIX: Moved inline styles from base.html to CSS */
    margin-left: 2px;
    line-height: 1.2;
    transform: translateY(-1.5px);
}

.brand-name {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.02em;
    color: #0a2540;
}


.brand-suffix {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #03C99B;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* ========================================= */
/* DOCUMENTATION TABLES                      */
/* ========================================= */

table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid #e3e8ee;
    color: #0a2540;
    font-weight: 600;
    background-color: #f7f9fc;
    font-family: 'Inter', sans-serif;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #e3e8ee;
    color: #425466;
    vertical-align: top;
}

td code {
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace !important;
    background-color: rgb(244, 247, 250) !important;
    color: rgb(60, 66, 87) !important;
    border: 1px solid rgb(212, 222, 233) !important;
    font-weight: 400;
}

/* ========================================= */
/* MARKDOC TABS (Stripe Style)               */
/* ========================================= */

.markdoc-tabs {
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    margin: 2rem 0;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.tab-header {
    display: flex;
    background: #f7f9fc;
    border-bottom: 1px solid #e3e8ee;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: #4f5b76;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-right: 1px solid #e3e8ee;
    cursor: pointer;
    transition: all 0.2s;
}

    .tab-btn:last-child {
        border-right: none;
    }

    .tab-btn:hover {
        background: #f1f5f9;
        color: #0a2540;
    }

    .tab-btn.active {
        background: #fff;
        color: #635bff;
        border-bottom-color: #635bff;
    }

.tab-panels {
    padding: 1.5rem;
    background: #fff;
}

.tab-panel {
    display: none;
}

    .tab-panel.active {
        display: block;
        animation: fadeIn 0.2s ease-out;
    }

    .tab-panel .code-block {
        margin: 0;
    }

/* ========================================= */
/* HELP DROPDOWN                             */
/* ========================================= */

.dropdown-container {
    position: relative;
}

.dropdown-trigger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: #425466;
    padding: 8px 12px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    font-family: 'Inter', sans-serif;
}

    .dropdown-trigger:hover, .dropdown-trigger.active {
        color: #0a2540;
        background-color: rgba(0,0,0,0.04);
    }

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    width: 260px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(50,50,93,0.1), 0 5px 15px rgba(0,0,0,0.07);
    border: 1px solid #e3e8ee;
    margin-top: 8px;
    z-index: 1000;
    padding: 8px 0;
    animation: fadeIn 0.15s ease-out;
}

    .dropdown-menu.show {
        display: block;
    }

.dropdown-item {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #0a2540;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.1s, color 0.1s;
}

    .dropdown-item:hover {
        background-color: #f7f9fc;
        color: #635bff;
    }

.dropdown-header, .dropdown-icon, .item-title, .item-desc, .dropdown-divider {
    display: none;
}

/* ========================================= */
/* SUPPORT FORM                              */
/* ========================================= */

.contact-form-container {
    max-width: 600px;
}

.sf-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sf-form label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #0a2540;
    margin-bottom: 0.5rem;
}

.sf-form input[type="text"],
.sf-form select,
.sf-form textarea {
    padding: 10px 12px;
    border: 1px solid #e3e8ee;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: #425466;
    background: #fff;
    transition: all 0.2s;
}

    .sf-form input:focus,
    .sf-form select:focus,
    .sf-form textarea:focus {
        outline: none;
        border-color: #635bff;
        box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
    }

.sf-form textarea {
    resize: vertical;
}

.submit-btn {
    background-color: #635bff;
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    align-self: flex-start;
}

    .submit-btn:hover {
        background-color: #4b45e6;
    }

/* ========================================= */
/* FOOTER                                    */
/* ========================================= */

.site-footer {
    background-color: #ffffff;
    border-top: 1px solid #e3e8ee;
    color: #425466;
    padding: 4rem 2.5rem;
    width: 100%;
    box-sizing: border-box;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap; /* FIX: Wraps on smaller screens */
    gap: 2rem; /* FIX: Consistent gap when wrapped */
    max-width: 1200px;
    margin: 0 auto;
}

.footer-brand {
    max-width: 300px;
    margin-bottom: 2rem;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1f36;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.footer-brand .copyright {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #8898aa;
}

.footer-links {
    display: flex;
    flex-wrap: wrap; /* FIX: Link columns wrap too */
    gap: 2rem;
}

.footer-column h4 {
    color: #1a1f36;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.footer-column a {
    display: block;
    color: #425466;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s ease;
}

    .footer-column a:hover {
        color: #019ada;
        text-decoration: none;
    }

/* ========================================= */
/* STRIPE-STYLE PAGE HEADER                  */
/* ========================================= */

.doc-header {
    margin-top: 1rem;
    margin-bottom: 2rem;
    border: none;
}

.doc-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1a1f36;
    margin-bottom: 0.75rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
    border-bottom: none;
    padding-bottom: 0;
}

.doc-description {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #697386;
    max-width: 800px;
    margin: 0;
}

.doc-divider {
    height: 1px;
    background-color: #e3e8ee;
    margin-bottom: 2.5rem;
    width: 100%;
}

/* ========================================= */
/* API LAYOUT (Stripe Style)                 */
/* ========================================= */

.layout-api {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    max-width: 100%;
    width: 100%;
}

    .layout-api main {
        max-width: none;
        width: 100%;
        padding: 0;
    }

    .layout-api .markdown-body {
        max-width: none;
        width: 100%;
        padding: 0;
    }

    .layout-api article {
        max-width: none;
        width: 100%;
    }

.api-section {
    display: flex;
    flex-direction: row;
    width: 100%;
    border-bottom: 1px solid #e3e8ee;
}

.api-content {
    width: 50%;
    min-width: 0;
    padding: 3rem 2.5rem;
    background: #fff;
    border-right: 1px solid #e3e8ee;
    box-sizing: border-box;
}

.api-code-column {
    width: 50%;
    min-width: 0;
    padding: 3rem 2.5rem;
    background: #fff;
    border-left: 1px solid #e3e8ee;
    color: #3c4257;
    box-sizing: border-box;
}

    .api-code-column .code-block {
        background: #0d1117;
        border: 1px solid #30363d;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        margin-bottom: 2rem;
    }

    .api-code-column .code-block-header {
        background: rgba(255,255,255,0.05);
        border-bottom: 1px solid #30363d;
    }

    .api-code-column .shiki-wrapper {
        background: #fff;
    }

    /* --- Dual Theme API Blocks --- */
    .api-code-column .code-block-dark {
        background: #0d1117;
        border: 1px solid #30363d;
        color: #fff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

        .api-code-column .code-block-dark .code-block-header {
            background: rgba(255,255,255,0.05);
            border-bottom: 1px solid #30363d;
            color: rgba(255,255,255,0.7);
        }

    .api-code-column .code-block-light {
        background: #ffffff;
        border: 1px solid #e3e8ee;
        color: #3c4257;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        margin-top: 1.5rem;
    }

        .api-code-column .code-block-light .code-block-header {
            background: #f7f9fc;
            border-bottom: 1px solid #e3e8ee;
            color: #697386;
            font-weight: 600;
            font-size: 0.75rem;
            text-transform: uppercase;
        }

        .api-code-column .code-block-light pre.shiki {
            background-color: transparent;
        }

/* ========================================= */
/* HTTP METHOD BADGES                        */
/* ========================================= */

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: text-bottom;
    margin-right: 8px;
    margin-bottom: 4px;
}

    .badge.get {
        background-color: #e3f2fd;
        color: #0c57d0;
        border: 1px solid #bbdefb;
    }

    .badge.post {
        background-color: #e6fffa;
        color: #047481;
        border: 1px solid #b2f5ea;
    }

    .badge.put {
        background-color: #fffaf0;
        color: #9c4221;
        border: 1px solid #feebc8;
    }

    .badge.delete {
        background-color: #fff5f5;
        color: #c53030;
        border: 1px solid #fed7d7;
    }

/* ========================================= */
/* CODE NAV CONTAINER                        */
/* ========================================= */

.code-nav-container {
    display: flex;
    flex-direction: column;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.code-nav-header {
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #30363d;
    color: #8b949e;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05rem;
    font-family: sans-serif;
    text-transform: uppercase;
}

.code-nav-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #c9d1d9;
    text-decoration: none;
    /* FIX: Fira Code is now loaded */
    font-family: 'Fira Code', 'Menlo', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    border-bottom: 1px solid #21262d;
    transition: background 0.1s;
    width: 100%;
    box-sizing: border-box;
}

    .code-nav-item:last-child {
        border-bottom: none;
    }

    .code-nav-item:hover {
        background: rgba(255,255,255,0.1);
        color: #fff;
        text-decoration: none;
    }

    .code-nav-item .badge {
        margin-right: 12px;
        font-size: 0.7rem;
        padding: 2px 6px;
        min-width: 45px;
        text-align: center;
    }

/* ========================================= */
/* HOMEPAGE HERO                             */
/* ========================================= */

.home-hero-wrapper {
    position: relative;
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, #BED5F0 0%, #ffffff 100%);
    padding: 1rem 0 6rem 0;
    margin-bottom: 2rem;
    overflow: hidden;
    color: #3A4A66;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 0 !important;
}

/* Kill empty p tags anywhere inside the hero wrapper */
.home-hero-wrapper p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}


.hero-bg, .hero-overlay, #hero-particles {
    display: none;
}

.hero-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 0 20px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    color: #0B3885;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #3A4A66;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn-primary {
    background: #019ADA;
    color: #ffffff;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(1, 154, 218, 0.2);
}

    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(1, 154, 218, 0.3);
        background: #0188c1;
    }

.btn-secondary {
    background: transparent;
    border: 1px solid #0B3885;
    color: #0B3885;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

    .btn-secondary:hover {
        background: rgba(11, 56, 133, 0.05);
        color: #0B3885;
    }

/* ========================================= */
/* HOMEPAGE SPECIFIC OVERRIDES               */
/* ========================================= */

body.page-home #sidebar,
body.page-home #toc,
body.page-home .breadcrumbs {
    display: none;
}

body.page-home .layout {
    display: block;
    max-width: 100%;
    padding: 0;
    margin: 0;
}

body.page-home main {
    max-width: 100%;
    padding: 0;
    margin: 0;
}

body.page-home .home-hero-wrapper {
    margin-left: 0;
    transform: none;
    width: 100%;
}

/* Kill the leading empty p inside article on homepage */
body.page-home article > p:first-child {
    display: none !important;
    margin: 0 !important;
}

/* Kill any default margin on the article element itself */
body.page-home .markdown-body > article {
    margin: 0 !important;
    padding: 0 !important;
}

/* ========================================= */
/* SECTION CARDS                             */
/* ========================================= */
.section-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: auto;
    gap: 30px;
    max-width: 1000px;
    margin: -40px auto 60px auto;
    position: relative;
    z-index: 20;
    padding: 0 20px;
}

    .section-grid > * {
        box-sizing: border-box;
        margin: 0;
    }

/* 4 columns → 2 columns on medium screens */
@media (max-width: 1100px) {
    .section-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.section-card {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 3;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 12px;
    padding: 30px;
    transition: all 0.25s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    box-sizing: border-box;
    position: relative; /* FIX: Anchors the stretched link pseudo-element */
}

    .section-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 20px 40px rgba(0,0,0,0.08);
        border-color: #019ADA;
    }

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
    position: relative;
}

.card-icon-box {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

    .card-icon-box svg {
        width: 26px;
        height: 26px;
    }

.icon-dev {
    background: #e6f6fc;
    color: #019ADA;
}

.icon-api {
    background: #eef2ff;
    color: #6366f1;
}

.icon-ops {
    background: #ecfdf5;
    color: #10b981;
}

.icon-notes {
    background: #fff7ed;
    color: #f97316;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.card-main-link {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

    .card-main-link:hover {
        color: #019ADA;
    }

    /* FIX: Stretched link — covers the card making it fully clickable */
    .card-main-link::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 1;
        border-radius: 12px;
    }

.card-desc {
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

.card-links {
    border-top: 1px solid #f1f5f9;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: end;
    position: relative; /* FIX: Sits above the stretched link */
    z-index: 2;
}

.quick-link {
    font-size: 0.9rem;
    color: #019ADA;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

    .quick-link:hover {
        text-decoration: underline;
    }

    .quick-link svg {
        margin-left: 5px;
        width: 14px;
        height: 14px;
        transition: transform 0.2s;
    }

    .quick-link:hover svg {
        transform: translateX(3px);
    }

/* Single column on mobile */
@media (max-width: 768px) {
    .section-grid {
        grid-template-columns: 1fr;
    }

    .section-card {
        display: flex;
        flex-direction: column;
        grid-row: span 1;
    }

    .card-desc {
        flex-grow: 1;
        margin-bottom: 15px;
    }

    .card-links {
        align-self: auto;
        margin-top: auto;
    }
}

/* ========================================= */
/* SUB-LANDING GRID                          */
/* ========================================= */

.sub-landing-hero {
    padding: 2rem 0 3rem 0;
    max-width: 800px;
}

    .sub-landing-hero h1 {
        font-size: 2.5rem;
        font-weight: 800;
        letter-spacing: -0.02em;
        color: #0a2540;
        margin-bottom: 1rem;
    }

    .sub-landing-hero p {
        font-size: 1.25rem;
        color: #425466;
        line-height: 1.6;
    }

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 4rem;
}

    .resource-grid > p {
        display: none;
    }

.resource-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    padding: 24px;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    height: 100%;
    box-sizing: border-box;
}

    .resource-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        border-color: #cbd4db;
        border-top: 3px solid #635bff;
        padding-top: 21px;
    }

.resource-icon {
    width: 48px;
    height: 48px;
    background: #f7f9fc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #635bff;
}

    .resource-icon.blue {
        color: #019ADA;
        background: #e6f6fc;
    }

    .resource-icon.purple {
        color: #635bff;
        background: #f2f0ff;
    }

    .resource-icon.green {
        color: #2ea043;
        background: #e6ffed;
    }

    .resource-icon.orange {
        color: #f5a623;
        background: #fff8e6;
    }

    .resource-icon.teal {
        color: #0d9488;
        background: #f0fdfa;
    }

    .resource-icon.red {
        color: #d14343;
        background: #fce8e8;
    }

.resource-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0a2540;
    margin: 0 0 8px 0;
}

.resource-desc {
    font-size: 0.95rem;
    color: #4f5b76;
    margin: 0;
    line-height: 1.5;
}

.resource-arrow {
    margin-top: auto;
    padding-top: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #635bff;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

.resource-card:hover .resource-arrow {
    opacity: 1;
    transform: translateX(0);
}

.resource-grid br {
    display: none;
}

.resource-grid > *:not(a) {
    display: none;
}

/* ========================================= */
/* STRIPE-STYLE "HEADER + CELLS" LAYOUT      */
/* ========================================= */

.resource-group {
    margin-bottom: 3rem;
}

.resource-header-card {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #e3e8ee;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 24px;
    text-decoration: none;
    transition: background 0.2s ease;
}

    .resource-header-card:hover {
        background: #f7f9fc;
    }

        .resource-header-card:hover .resource-header-arrow {
            transform: translateX(4px);
            color: #019ADA;
        }

.resource-header-card.standalone {
    border-bottom: 1px solid #e3e8ee;
    border-radius: 8px;
}

.resource-header-content {
    flex: 1;
    margin-left: 16px;
}

.resource-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0a2540;
    margin: 0 0 4px 0;
}

.resource-header-desc {
    font-size: 1rem;
    color: #4f5b76;
    margin: 0;
    line-height: 1.5;
}

.resource-header-arrow {
    color: #8898aa;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.resource-sub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border: 1px solid #e3e8ee;
    border-top: 1px solid #e3e8ee;
    border-radius: 0 0 8px 8px;
    background: #ffffff;
    overflow: hidden;
}

.resource-sub-link {
    display: block;
    padding: 16px 20px;
    text-decoration: none;
    color: #4f5b76;
    font-weight: 500;
    font-size: 0.95rem;
    border-right: 1px solid #e3e8ee;
    transition: all 0.15s ease;
    background: #fff;
}

    .resource-sub-link:last-child {
        border-right: none;
    }

    .resource-sub-link:hover {
        color: #019ADA;
        background: #f6f9fc;
    }

.resource-sub-title {
    display: block;
    color: #0a2540;
    font-weight: 600;
    margin-bottom: 2px;
}

.resource-sub-desc {
    font-size: 0.85rem;
    color: #8898aa;
}

/* ========================================= */
/* SCALAR API REFERENCE OVERRIDES            */
/* ========================================= */

body.page-api .breadcrumbs,
body.page-api .doc-header,
body.page-api .doc-divider {
    display: none;
}

body.page-api .markdown-body {
    padding: 0;
}

body.page-api .layout {
    padding-right: 0;
}

.scalar-wrapper {
    width: 100%;
    min-height: calc(100vh - 64px);
    display: block;
}

body.page-api aside#sidebar {
    display: none;
}

/* FIX: Scoped to page-api only so non-Scalar API pages aren't affected */
body.page-api .layout-api {
    grid-template-columns: 1fr;
}

body.page-api .t-doc__sidebar {
    top: var(--header-height) !important;
    height: calc(100vh - var(--header-height)) !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scroll-padding-top: var(--header-height);
}

body.page-api .t-doc__sidebar .group\/item {
    scroll-margin-top: var(--header-height);
}

body.page-api .custom-scroll {
    overflow-y: visible !important;
}

/* ========================================= */
/* INLINE CODE STYLING                       */
/* ========================================= */

:not(pre) > code {
    font-family: 'Consolas', 'Menlo', 'Monaco', monospace;
    background-color: rgb(244, 247, 250);
    color: rgb(60, 66, 87);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    font-weight: 400;
    border: 1px solid rgb(212, 222, 233);
}

.code-block code,
.code-block .shiki-wrapper code {
    background-color: transparent;
    border: none;
    padding: 0;
    font-family: 'Fira Code', 'Menlo', 'Monaco', 'Consolas', monospace;
}

.code-block-dark code,
.code-block-dark .shiki-wrapper code {
    color: #e1e4e8;
}

/* ========================================= */
/* CHILDREN LIST (build.js tag)              */
/* FIX: Replaced inline styles with classes  */
/* ========================================= */

.children-list {
    margin-top: 30px;
}

.child-item {
    margin-bottom: 24px;
}

    .child-item h3 {
        margin-bottom: 8px;
    }

.child-item-link {
    text-decoration: none;
    color: #0f172a;
}

.child-item-desc {
    margin-top: 0;
    color: #475569;
    line-height: 1.5;
}

/* ========================================= */
/* MOBILE RESPONSIVENESS                     */
/* FIX: Consolidated all mobile breakpoints  */
/* ========================================= */

@media (max-width: 768px) {
    /* Header */
    header {
        padding: 1rem 1.5rem 0 1.5rem;
    }

    .top-nav {
        display: none;
    }

    .utility-tier {
        display: none;
    }

    #header-search {
        width: 100%;
        flex: 1;
        max-width: none;
    }

    /* Brand */
    .brand-logo {
        height: 36px;
    }

    .brand-name {
        font-size: 18px;
    }

    .brand-suffix {
        font-size: 11px;
    }

    /* Reveal hamburger */
    .mobile-menu-btn {
        display: block;
    }

    /* Layout */
    .layout {
        flex-direction: column;
        gap: 0;
    }

    /* Hide TOC */
    aside#toc {
        display: none;
    }

    /* Sidebar: hidden by default, toggled via JS */
    aside#sidebar {
        display: none;
        position: fixed;
        /* FIX: Uses CSS variable */
        top: var(--header-height-mobile);
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: calc(100vh - var(--header-height-mobile));
        z-index: 1500;
        border-right: none;
    }

        aside#sidebar.show {
            display: block;
        }

    /* Main content */
    main {
        padding: 1.5rem;
    }

    /* Grids */
    .launcher-grid {
        grid-template-columns: 1fr;
    }

    .section-grid > * {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .resource-sub-grid {
        grid-template-columns: 1fr;
    }

    .resource-sub-link {
        border-right: none;
        border-bottom: 1px solid #e3e8ee;
    }

        .resource-sub-link:last-child {
            border-bottom: none;
        }

    /* Footer */
    .footer-container {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .footer-links {
        gap: 2rem;
        flex-direction: column;
        flex-wrap: wrap;
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 1.5rem;
    }

    .form-group.half {
        width: 100%;
    }
}

/* API layout mobile */
@media (max-width: 1000px) {
    .layout-api {
        grid-template-columns: 1fr;
    }

    .api-section {
        flex-direction: column;
    }

    .api-content, .api-code-column {
        width: 100%;
        border-right: none;
    }
}

/* Mobile menu button — hidden on desktop */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #0a2540;
    padding: 0;
    margin-right: 12px;
}
