/*
 * The docs' own stylesheet. Hand-written rather than a theme, for the same
 * reason the package ships its assets directly: no build step, nothing to
 * regenerate, and the accent is the explorer's own rather than a theme's.
 */

:root {
    /* The package's accent, as an rgb triple — most uses are translucent tints. */
    --accent: 0, 122, 255;
    --accent-text: #0b5ed7;
    --accent-solid: #007aff;

    --bg: #ffffff;
    --bg-soft: #f7f8fa;
    --bg-code: #f5f6f8;
    --text: #1c2024;
    --text-soft: #5b6572;
    --text-faint: #8a929c;
    --border: #e4e7eb;
    --border-soft: #eef0f3;

    --sidebar-w: 17rem;
    --toc-w: 14rem;
    --topbar-h: 3.5rem;
    --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        --accent: 10, 132, 255;
        --accent-text: #7fb6ff;
        --accent-solid: #0a84ff;

        --bg: #16181c;
        --bg-soft: #1b1e23;
        --bg-code: #1f2329;
        --text: #e6e9ed;
        --text-soft: #a3abb6;
        --text-faint: #7b8492;
        --border: #2c3138;
        --border-soft: #24282e;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 1rem); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 400 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    height: var(--topbar-h);
    padding: 0 1.25rem;
    background: rgba(var(--accent), 0.03);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
    .topbar { background: rgba(0, 0, 0, 0.35); }
}

.topbar__title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.topbar__title:hover { text-decoration: none; }
.topbar__mark { font-size: 1.15rem; }

.topbar__links {
    margin-left: auto;
    display: flex;
    gap: 1.1rem;
    font-size: 0.85rem;
}
.topbar__links a { color: var(--text-soft); }

/* Menu button: a label for the hidden checkbox, so the sidebar opens on mobile
   with no script at all. */
.nav-toggle { display: none; }
.nav-button { display: none; }

.nav-button span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 3px 0;
    border-radius: 2px;
    background: var(--text-soft);
}

.scrim { display: none; }

/* ----------------------------------------------------------------- shell */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
    align-items: start;
    max-width: 92rem;
    margin: 0 auto;
}

/* --------------------------------------------------------------- sidebar */

.sidebar {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 1.75rem 1rem 3rem 1.25rem;
    border-right: 1px solid var(--border-soft);
}

.sidebar__section {
    margin: 1.5rem 0 0.4rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.sidebar__section:first-child { margin-top: 0; }

.sidebar__list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sidebar__list a {
    display: block;
    padding: 0.32rem 0.55rem;
    border-radius: 6px;
    color: var(--text-soft);
    font-size: 0.885rem;
    line-height: 1.4;
}
.sidebar__list a:hover {
    background: var(--bg-soft);
    color: var(--text);
    text-decoration: none;
}
.sidebar__list a.is-current {
    background: rgba(var(--accent), 0.12);
    color: var(--accent-text);
    font-weight: 600;
}

/* ------------------------------------------------------------------- toc */

.toc {
    position: sticky;
    top: var(--topbar-h);
    max-height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    padding: 2.25rem 1.25rem 3rem 0.5rem;
    font-size: 0.82rem;
}
.toc:empty { padding: 0; }

.toc__label {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.toc ul { margin: 0; padding: 0; list-style: none; }
.toc a {
    display: block;
    padding: 0.2rem 0 0.2rem 0.7rem;
    border-left: 2px solid var(--border);
    color: var(--text-soft);
    line-height: 1.4;
}
.toc a:hover { color: var(--text); text-decoration: none; }
.toc a.is-current {
    border-left-color: var(--accent-solid);
    color: var(--accent-text);
}
.toc__h3 a { padding-left: 1.4rem; font-size: 0.78rem; }

/* ------------------------------------------------------------------ main */

.main {
    min-width: 0;
    padding: 2.25rem 2.5rem 4rem;
}

.prose { max-width: var(--measure); }

.prose > h1:first-child { margin-top: 0; }

.prose h1 {
    margin: 0 0 1.1rem;
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.prose h2 {
    margin: 2.75rem 0 0.9rem;
    padding-top: 1.4rem;
    border-top: 1px solid var(--border-soft);
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.015em;
}

.prose h3 {
    margin: 2rem 0 0.7rem;
    font-size: 1.06rem;
    font-weight: 650;
}

.prose h4 {
    margin: 1.6rem 0 0.5rem;
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--text-soft);
}

.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose li { margin: 0.3rem 0; }
.prose li > ul, .prose li > ol { margin: 0.35rem 0 0.35rem; }

.prose strong { font-weight: 650; }

.prose hr {
    margin: 2.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* Inline code and blocks */

.prose code {
    padding: 0.12em 0.35em;
    border-radius: 4px;
    background: var(--bg-code);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.855em;
}

.prose pre {
    margin: 0 0 1.25rem;
    padding: 0.95rem 1.1rem;
    overflow-x: auto;
    background: var(--bg-code);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    line-height: 1.55;
}
.prose pre code {
    padding: 0;
    background: none;
    font-size: 0.83rem;
}

.prose blockquote {
    margin: 0 0 1.25rem;
    padding: 0.1rem 0 0.1rem 1rem;
    border-left: 3px solid rgba(var(--accent), 0.4);
    color: var(--text-soft);
}
.prose blockquote > :last-child { margin-bottom: 0; }

/* Tables scroll inside their own box rather than widening the page. */

.prose .table-scroll { overflow-x: auto; margin: 0 0 1.25rem; }

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.885rem;
}
.prose th, .prose td {
    padding: 0.55rem 0.8rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-soft);
}
.prose th {
    font-weight: 650;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border);
}
.prose tbody tr:last-child td { border-bottom: 0; }

/* Screenshots.
 *
 * A border rather than a shadow: the explorer's own chrome is pale, so on a
 * white page a shadowless screenshot has no edge and bleeds into the prose.
 * The border is what says where the application stops. */

.prose img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 0 1.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* Badges are inline images and must keep none of the above. */
.badges img,
.badges p img {
    display: inline-block;
    margin: 0;
    border: 0;
    border-radius: 0;
}

/* A caption is the italic line the image is followed by. */
.prose img + em,
.prose p > img + em {
    display: block;
    margin: -0.9rem 0 1.35rem;
    font-size: 0.82rem;
    font-style: normal;
    color: var(--text-faint);
}

/* Cards on the overview page */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.85rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}
.cards li { margin: 0; }
.cards a {
    display: block;
    height: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: inherit;
}
.cards a:hover {
    border-color: rgba(var(--accent), 0.5);
    background: rgba(var(--accent), 0.04);
    text-decoration: none;
}
.cards strong { display: block; margin-bottom: 0.15rem; color: var(--accent-text); }
.cards span { font-size: 0.85rem; color: var(--text-soft); }

.badges { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.5rem; }
.badges img { display: block; }

/* ----------------------------------------------------------------- pager */

.pager {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--measure);
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.pager__link {
    display: block;
    max-width: 48%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: inherit;
}
.pager__link:hover {
    border-color: rgba(var(--accent), 0.5);
    text-decoration: none;
}
.pager__link--next { margin-left: auto; text-align: right; }

.pager__dir {
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.pager__title { display: block; font-weight: 600; font-size: 0.9rem; color: var(--accent-text); }

.foot {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--measure);
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-faint);
}
.foot a { color: var(--text-soft); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
    .shell { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
    .toc { display: none; }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .main { padding: 1.75rem 1.25rem 3rem; }
    .nav-button { display: block; cursor: pointer; }

    .sidebar {
        position: fixed;
        top: var(--topbar-h);
        left: 0;
        z-index: 25;
        width: min(20rem, 84vw);
        height: calc(100vh - var(--topbar-h));
        background: var(--bg);
        border-right: 1px solid var(--border);
        transform: translateX(-102%);
        transition: transform 0.18s ease;
    }

    #nav-toggle:checked ~ .shell .sidebar { transform: none; }

    #nav-toggle:checked ~ .scrim {
        display: block;
        position: fixed;
        inset: var(--topbar-h) 0 0;
        z-index: 20;
        background: rgba(0, 0, 0, 0.35);
    }

    .pager { flex-direction: column; }
    .pager__link, .pager__link--next { max-width: none; margin: 0; text-align: left; }
}

/* --------------------------------------------------- syntax highlighting */

.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #8a929c; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #a626a4; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sr { color: #2e8b45; }
.highlight .nf, .highlight .fm { color: #4078f2; }
.highlight .nc, .highlight .nn { color: #c18401; }
.highlight .nv, .highlight .vi, .highlight .vg { color: #d1503a; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh { color: #986801; }
.highlight .o, .highlight .ow, .highlight .p { color: #7b8492; }
.highlight .nb, .highlight .bp { color: #0184bc; }
.highlight .err { color: #d1503a; }

@media (prefers-color-scheme: dark) {
    .highlight .c, .highlight .c1, .highlight .cm, .highlight .cs { color: #6f7783; }
    .highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #d18ce0; }
    .highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sr { color: #7ec98f; }
    .highlight .nf, .highlight .fm { color: #79b8ff; }
    .highlight .nc, .highlight .nn { color: #e2c08d; }
    .highlight .nv, .highlight .vi, .highlight .vg { color: #ff9e80; }
    .highlight .m, .highlight .mi, .highlight .mf, .highlight .mh { color: #e5c07b; }
    .highlight .o, .highlight .ow, .highlight .p { color: #98a0ac; }
    .highlight .nb, .highlight .bp { color: #56b6c2; }
}
