/* Design tokens */
:root {
    color-scheme: light dark;

    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-muted: #eef2f8;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #5b6577;
    --heading: #0b1324;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --accent-soft: #e6eefe;
    --success-soft: #e8f7ef;
    --success: #15803d;
    --warning-soft: #fff7e0;
    --warning: #b45309;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --inline-code-bg: #eef2f8;
    --header-bg: rgb(255 255 255 / 0.82);
    --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
    --shadow-md: 0 1px 3px rgb(15 23 42 / 0.06), 0 8px 24px rgb(15 23 42 / 0.08);
    --radius: 14px;

    --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "Cascadia Code", "Cascadia Mono", "JetBrains Mono", Consolas, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #111a2e;
        --surface-muted: #18233b;
        --border: #23304a;
        --text: #dbe3ef;
        --text-muted: #94a3b8;
        --heading: #f1f5f9;
        --accent: #60a5fa;
        --accent-strong: #93c5fd;
        --accent-soft: rgb(96 165 250 / 0.14);
        --success-soft: rgb(34 197 94 / 0.12);
        --success: #4ade80;
        --warning-soft: rgb(245 158 11 / 0.12);
        --warning: #fbbf24;
        --code-bg: #070c18;
        --code-text: #e2e8f0;
        --inline-code-bg: #1c2840;
        --header-bg: rgb(11 17 32 / 0.8);
        --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3);
        --shadow-md: 0 1px 3px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
    }
}

/* Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 5rem;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    color: var(--accent-strong);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 100%;
    max-width: 1440px;
    margin-inline: auto;
    padding-inline: 1.5rem;
}

@media (max-width: 720px) {
    .container {
        padding-inline: 1rem;
    }
}

/* Article typography */
/* The column width comes from the page grid in MainLayout; this caps the line length on medium screens. */
.prose {
    max-width: 56rem;
}

.prose h1,
.prose h2,
.prose h3 {
    font-family: var(--font-display);
    color: var(--heading);
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.prose h1 {
    font-size: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
    font-weight: 800;
    margin: 0 0 1.5rem;
}

.prose h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 3rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.prose h3 {
    font-size: 1.2rem;
    font-weight: 650;
    margin: 2rem 0 0.5rem;
}

.prose p {
    margin: 0 0 1.15rem;
}

.prose ul,
.prose ol {
    margin: 0 0 1.25rem;
    padding-left: 1.4rem;
}

.prose li {
    margin-bottom: 0.45rem;
}

.prose li::marker {
    color: var(--accent);
}

.prose strong {
    color: var(--heading);
    font-weight: 650;
}

.prose > :first-child {
    margin-top: 0;
}

/* Callouts */
.intro {
    position: relative;
    margin: 0 0 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: 1.125rem;
    color: var(--text);
}

.intro::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: var(--radius) 0 0 var(--radius);
    background: linear-gradient(180deg, #38bdf8, var(--accent));
}

.prose .intro h2 {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    font-size: 1.3rem;
}

.intro > :last-child,
.infobox > :last-child,
.example > :last-child,
.feature-box > :last-child {
    margin-bottom: 0;
}

.infobox {
    margin: 1.5rem 0 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: var(--radius);
}

.infobox > strong:first-child {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--accent-strong);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.example {
    margin: 1.25rem 0 1.75rem;
    padding: 1.1rem 1.4rem;
    background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
    border-radius: var(--radius);
}

.feature-box {
    margin: 1.25rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}

.feature-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.prose .feature-box h3 {
    margin-top: 0;
    color: var(--accent-strong);
}

.highlight {
    padding: 1rem 1.25rem;
    background: var(--warning-soft);
    border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
    border-radius: var(--radius);
}

/* Code */
code {
    font-family: var(--font-mono);
    /* Show code as typed: no ligatures turning -> or <> into arrows */
    font-variant-ligatures: none;
    font-size: 0.875em;
    padding: 0.15em 0.4em;
    background: var(--inline-code-bg);
    border-radius: 6px;
}

pre {
    margin: 1.25rem 0 1.75rem;
    padding: 1.25rem 1.5rem;
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    line-height: 1.65;
    overflow-x: auto;
    tab-size: 4;
}

pre code {
    padding: 0;
    background: none;
    border-radius: 0;
    font-size: inherit;
    color: inherit;
}

/* Code examples written as <code> with <br> line breaks */
.example > code {
    display: block;
    margin-top: 0.5rem;
    padding: 1rem 1.25rem;
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
}

/* Tables */
.prose table {
    width: 100%;
    margin: 1.5rem 0 2rem;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

.prose th,
.prose td {
    padding: 0.7rem 1rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.prose th {
    background: var(--surface-muted);
    color: var(--heading);
    font-weight: 650;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
}

.prose tr:last-child td {
    border-bottom: 0;
}

.prose tbody tr:hover td {
    background: var(--accent-soft);
}

@media (max-width: 720px) {
    .prose table {
        display: block;
        overflow-x: auto;
    }
}

/* Utilities */
.text-danger {
    color: #dc2626;
}

/* Hub pages (e.g. /sqlserver) have no table of contents: let the content use that column too.
   Global because :has() looks into a child component; the selector outranks the scoped grid in MainLayout. */
.prose:has(.guide-hub) {
    max-width: none;
}

@media (min-width: 1280px) {
    main .page-grid:has(.guide-hub) {
        grid-template-columns: 15rem minmax(0, 1fr);
        grid-template-areas: "nav main";
    }

    main .page-grid:has(.guide-hub) .toc {
        display: none;
    }
}
