/* The docs pages: the site's tokens and type, laid out for reading. A list of pages on the left, the page on a sheet
   of paper in the middle, and what is on it on the right. */

.docs-badge {
    padding: 2px 9px;
    border-radius: 6px;
    background: var(--tab-soft);
    color: var(--tab);
    font: 600 13px / 1.6 var(--f-mono);
}
.nav-links a[aria-current="page"] {
    color: var(--ink);
    background: var(--surface-2);
}

/* Code in the outline is a touch smaller than the links around it. */
.docs-toc code {
    font-size: 0.9em;
}

.docs {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr) 200px;
    gap: 36px;
    align-items: start;
    padding-block: 32px 72px;
}
.docs-menu {
    display: none;
}

/* ---- the list of pages ---- */
.docs-side {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}
.docs-nav {
    display: grid;
    gap: 2px;
    font-size: 15px;
}
.docs-nav a {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--ink-2);
    text-decoration: none;
}
.docs-nav a:hover {
    background: var(--surface-2);
    color: var(--ink);
}
.docs-nav a[aria-current="page"] {
    background: var(--tab-soft);
    color: var(--tab);
    font-weight: 600;
}
.dn-group {
    display: grid;
    gap: 2px;
    margin-top: 14px;
}
.dn-group p {
    margin: 0 0 2px;
    padding: 0 10px;
    color: var(--ink-3);
    font: 600 11.5px var(--f-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---- the page ---- */
.doc {
    min-width: 0;
    padding: clamp(22px, 4vw, 44px);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    font-size: 16.5px;
    line-height: 1.7;
}
.doc-crumb {
    margin-bottom: 10px;
    color: var(--ink-3);
    font: 500 13px var(--f-mono);
}
.doc-crumb a {
    color: inherit;
}
.doc h1 {
    font-size: clamp(2.1rem, 4.4vw, 3rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.025em;
}
.doc-lede {
    margin: 12px 0 8px;
    color: var(--ink-2);
    font-size: 19px;
    line-height: 1.5;
}
.doc h2,
.doc h3,
.doc h4 {
    position: relative;
    scroll-margin-top: 90px;
    letter-spacing: -0.01em;
}
.doc h2 {
    margin: 48px 0 12px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
}
.doc h3 {
    margin: 34px 0 8px;
    font-size: 21px;
    font-weight: 700;
}
.doc h4 {
    margin: 24px 0 6px;
    font-size: 17px;
}
.h-anchor {
    margin-left: 8px;
    color: var(--ink-3);
    font-weight: 400;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.doc :is(h2, h3, h4):hover .h-anchor,
.h-anchor:focus-visible {
    opacity: 1;
}
.doc p,
.doc li {
    max-width: 74ch;
}
.doc p {
    margin: 0 0 14px;
}
.doc ul,
.doc ol {
    margin: 0 0 16px;
    padding-left: 22px;
}
.doc li {
    margin: 4px 0;
}
.doc li > ul,
.doc li > ol {
    margin: 4px 0;
}
.doc a {
    color: var(--tab);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
/* Paths and commands in running text break anywhere rather than push the page sideways on a phone. */
.doc :not(pre) > code {
    overflow-wrap: anywhere;
}
.doc strong {
    color: var(--ink);
}
.doc blockquote {
    margin: 0 0 16px;
    padding: 4px 16px;
    border-left: 3px solid var(--tab);
    color: var(--ink-2);
}
.doc hr {
    margin: 32px 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.doc pre.code {
    position: relative;
    margin: 6px 0 18px;
    font-size: 13.5px;
    line-height: 1.6;
}
.doc pre.code code {
    font-size: inherit;
    white-space: pre;
}
.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 10px;
    border: 1px solid #3a3d43;
    border-radius: 8px;
    background: #24262a;
    color: var(--term-dim);
    font: 600 12px var(--f-body);
    cursor: pointer;
    opacity: 0;
    transition:
        opacity 0.15s,
        color 0.15s;
}
.doc pre.code:hover .code-copy,
.code-copy:focus-visible {
    opacity: 1;
}
.code-copy:hover,
.code-copy.copied {
    color: #fff;
}
.table-wrap {
    margin: 6px 0 20px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.doc table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.5;
}
.doc th,
.doc td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.doc th {
    background: var(--surface-2);
    font-weight: 600;
}
.doc tr:last-child td {
    border-bottom: 0;
}

/* ---- the docs home ---- */
.doc-intro table {
    margin-top: 4px;
}
.doc-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.doc .doc-card {
    display: grid;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
    transition:
        border-color 0.2s,
        translate 0.25s var(--spring),
        box-shadow 0.2s;
}
.doc .doc-card:hover {
    border-color: var(--tab);
    box-shadow: var(--shadow);
    translate: 0 -2px;
}
.doc-card b {
    font: 700 18px / 1.3 var(--f-display);
}
.doc-card b::after {
    content: " →";
    color: var(--tab);
}
.doc-card span {
    color: var(--ink-2);
    font-size: 14.5px;
    line-height: 1.5;
}

/* ---- previous and next ---- */
.doc-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.doc-pager a {
    display: grid;
    gap: 2px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
}
.doc-pager a:hover {
    border-color: var(--tab);
}
.doc-pager small {
    color: var(--ink-3);
    font-weight: 500;
    font-size: 12.5px;
}
.doc-pager .next {
    grid-column: 2;
    text-align: right;
}

/* ---- on this page ---- */
.docs-toc {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 84px);
    display: grid;
    gap: 2px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.4;
}
.docs-toc p {
    margin: 0 0 6px;
    color: var(--ink-3);
    font: 600 11.5px var(--f-mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.docs-toc a {
    display: block;
    padding: 4px 8px;
    border-left: 2px solid var(--line);
    color: var(--ink-2);
    text-decoration: none;
}
.docs-toc a.toc-3 {
    padding-left: 18px;
    font-size: 13px;
}
.docs-toc a:hover {
    color: var(--ink);
}
.docs-toc a.on {
    border-left-color: var(--tab);
    color: var(--tab);
    font-weight: 600;
}

/* ---- narrower screens: no outline, then the list of pages folds into a menu ---- */
@media (max-width: 1150px) {
    .docs {
        grid-template-columns: 200px minmax(0, 1fr);
    }
    .docs-toc {
        display: none;
    }
}
@media (max-width: 820px) {
    .docs {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding-top: 16px;
    }
    .docs-side {
        display: none;
    }
    .docs-menu {
        display: block;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
    }
    .docs-menu summary {
        padding: 11px 14px;
        font-weight: 600;
        cursor: pointer;
    }
    .docs-menu .docs-nav {
        padding: 0 8px 12px;
    }
    .doc-cards {
        grid-template-columns: minmax(0, 1fr);
    }
    .docs-badge {
        display: none;
    }
}
