/* Theme
   Contrast ratios (WCAG):
   Light — text/bg ~14.6:1 (AAA), muted/bg ~7.1:1 (AAA), link/bg ~6.9:1 (AAA-ish)
   Dark  — text/bg ~17:1 (AAA), muted/bg ~7.8:1 (AAA), link/bg well above AA
*/
:root {
    --bg: #f7f8fa;       /* soft off-white, not stark white */
    --surface: #eef1f4;
    --text: #1c2128;
    --muted: #4c5560;
    --border: #d0d7de;
    --link: #0552b5;
    --accent: #e7f0fe;
    --quote: #edf4ff;
}
html[data-theme="dark"] {
    --bg: #0d1117;
    --surface: #161b22;
    --text: #e6edf3;
    --muted: #9da7b3;
    --border: #30363d;
    --link: #58a6ff;
    --accent: #1f2937;
    --quote: #18253a;
}
* {
    box-sizing: border-box;
}
html {
    color-scheme: light dark;
    scroll-behavior: smooth;
}
body {
    margin: 0;
    font:
        16px/1.7 system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    background: var(--bg);
    color: var(--text);
}
.avatar {
    display: block;
    width: 180px;
    height: 180px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.container {
    max-width: 760px;
    margin: auto;
    padding: 1.5rem;
}
.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
}
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
}
.nav-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.nav a {
    color: var(--muted);
    text-decoration: none;
}
.nav a:hover,
.nav a.active {
    color: var(--text);
}
.theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0.45rem 0.7rem;
    border-radius: 0.5rem;
    cursor: pointer;
}
.content {
    min-height: 70vh;
}
h1,
h2,
h3,
h4 {
    line-height: 1.3;
    margin: 1.75rem 0 0.75rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: var(--text);
}
h1 {
    font-size: 1.65rem;
    margin-top: 0;
}
h2 {
    font-size: 1.35rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
h3 {
    font-size: 1.15rem;
}
h4 {
    font-size: 1rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Linked headings (e.g. "#" anchor links) keep the heading's own
   color and never show an underline. */
h1 a,
h2 a,
h3 a,
h4 a {
    color: inherit;
    text-decoration: none;
}
h1 a:hover,
h2 a:hover,
h3 a:hover,
h4 a:hover {
    color: inherit;
    text-decoration: none;
    opacity: 0.75;
}
p,
ul,
ol,
table,
pre,
blockquote {
    margin: 1rem 0;
}
a {
    color: var(--link);
}
img {
    max-width: 100%;
    height: auto;
}
blockquote {
    margin-left: 0;
    padding: 0.2rem 1rem;
    border-left: 4px solid var(--link);
    background: var(--quote);
}
code {
    font:
        0.92em ui-monospace,
        SFMono-Regular,
        Consolas,
        monospace;
    background: var(--surface);
    padding: 0.15rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow-wrap: anywhere;
}
pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
pre code {
    background: none;
    border: 0;
    padding: 0;
    white-space: inherit;
}
table {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}
th,
td {
    border: 1px solid var(--border);
    padding: 0.6rem 0.8rem;
}
th {
    background: var(--surface);
}
hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}
.video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.social-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}
.social-row a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    text-decoration: none;
}
.social-row a:hover {
    background: var(--accent);
    color: var(--text);
}
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
    color: var(--text) !important;
    text-decoration: none;
    font-weight: 600;
}
.btn:hover {
    background: var(--accent);
}
.docs-list a {
    display: block;
    padding: 0.9rem 1rem;
    margin: 0.5rem 0;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
}
.docs-list a:hover {
    background: var(--accent);
}
:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

/* Table of contents — was previously (accidentally) nested inside
   @media print, so it never rendered on screen. Restored to normal scope. */
.toc-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.toc-toggle:hover {
    background: var(--accent);
}
.toc {
    margin: 0 0 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    background: var(--surface);
}
.toc strong {
    display: block;
    margin-bottom: 0.75rem;
}
.toc ul {
    margin: 0;
    padding-left: 1.25rem;
}
.toc li {
    margin: 0.35rem 0;
}
.toc a {
    color: var(--link);
    text-decoration: none;
}
.toc a:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        scroll-behavior: auto;
        transition: none !important;
    }
}
@media print {
    .nav,
    .theme-toggle,
    .social-row,
    .toc-toggle {
        display: none;
    }
    body {
        background: #fff;
        color: #000;
    }
    .container {
        max-width: none;
    }
    a {
        text-decoration: none;
        color: #000;
    }
}