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

:root {
    --bg: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: #1e293b;
    --bg-code: #0d1117;
    --bg-code-inline: #1e293b;
    --border: #334155;
    --border-subtle: #1e293b;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --accent: #0ea5e9;
    --accent-end: #14b8a6;
    --accent-text: #67e8f9;
    --link: #38bdf8;
    --link-hover: #67e8f9;
    --success: #22c55e;
    --warning: #eab308;
    --nav-height: 3.5rem;
    --sidebar-w: 15rem;
    --content-max: 52rem;
    --font-sans:
        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    --font-mono:
        "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 1.5rem);
}
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

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

/* ===== Top Nav ===== */
.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}
.topnav__inner {
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topnav__logo {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topnav__links {
    display: flex;
    gap: 1.25rem;
    align-items: center;
}
.topnav__links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}
.topnav__links a:hover,
.topnav__links a.active {
    color: var(--text);
}
.topnav__links a.active {
    color: var(--accent-text);
}

/* mobile menu toggle */
.topnav__menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}
.topnav__menu-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ===== Layout ===== */
.layout {
    display: flex;
    margin-top: var(--nav-height);
    min-height: calc(100vh - var(--nav-height));
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    padding: 1.5rem 1rem 2rem 1.5rem;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--bg);
}
.sidebar__title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}
.sidebar a {
    display: block;
    padding: 0.3rem 0.5rem;
    margin: 0.1rem 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-radius: 4px;
    transition:
        background 0.15s,
        color 0.15s;
}
.sidebar a:hover {
    background: var(--bg-surface);
    color: var(--text);
}
.sidebar a.active {
    color: var(--accent-text);
    background: rgba(14, 165, 233, 0.1);
}
.sidebar__group {
    margin-top: 1rem;
}
.sidebar__group-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    padding: 0.25rem 0.5rem;
}

/* ===== Main Content ===== */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2.5rem 2rem 4rem;
    max-width: calc(var(--content-max) + 4rem);
}

/* ===== Typography ===== */
.main h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    line-height: 1.2;
}
.main h2 {
    font-size: 1.4rem;
    font-weight: 650;
    color: var(--text);
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.main h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}
.main h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}
.main p {
    margin-bottom: 0.85rem;
}
.main ul,
.main ol {
    margin-bottom: 0.85rem;
    padding-left: 1.5rem;
}
.main li {
    margin-bottom: 0.3rem;
}
.main li::marker {
    color: var(--text-dim);
}

.lead {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ===== Inline Code ===== */
code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--bg-code-inline);
    padding: 0.15em 0.35em;
    border-radius: 4px;
    color: var(--accent-text);
}

/* ===== Code Blocks ===== */
pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    line-height: 1.55;
}
pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
    color: var(--text);
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    background: var(--bg-surface);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}
tr:last-child td {
    border-bottom: none;
}
tbody tr:hover {
    background: rgba(30, 41, 59, 0.5);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card__title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.card__desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ===== Callouts ===== */
.callout {
    border-left: 3px solid var(--accent);
    background: rgba(14, 165, 233, 0.06);
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.callout--warn {
    border-left-color: var(--warning);
    background: rgba(234, 179, 8, 0.06);
}
.callout--success {
    border-left-color: var(--success);
    background: rgba(34, 197, 94, 0.06);
}
.callout strong {
    color: var(--text);
}

/* ===== Badge ===== */
.badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    background: rgba(14, 165, 233, 0.15);
    color: var(--accent-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== Provider Card ===== */
.provider-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s;
}
.provider-card:hover {
    border-color: var(--accent);
}
.provider-card__name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}
.provider-card__env {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-text);
    margin-bottom: 0.35rem;
}
.provider-card__desc {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.provider-card__auth-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* ===== Footer ===== */
.page-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .sidebar {
        display: none;
    }
    .sidebar.open {
        display: block;
        position: fixed;
        z-index: 90;
        width: 100%;
        left: 0;
        background: var(--bg);
        border-right: none;
        padding: 1rem;
    }
    .main {
        margin-left: 0;
        padding: 1.5rem 1rem 3rem;
    }
    .topnav__menu-btn {
        display: block;
    }
    .topnav__links {
        display: none;
    }
    .topnav__links.open {
        display: flex;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .main h1 {
        font-size: 1.5rem;
    }
    .main h2 {
        font-size: 1.15rem;
    }
    pre {
        font-size: 0.78rem;
        padding: 0.75rem;
    }
    table {
        font-size: 0.8rem;
    }
    th,
    td {
        padding: 0.4rem 0.5rem;
    }
}
