.doc-toc__links {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.doc-search {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0 0 18px;
}

.doc-search[hidden],
.doc-search__results[hidden],
.doc-toc__toggle,
.doc-toc__toggle[hidden] {
    display: none;
}

.doc-search__label {
    font-family: var(--font-display);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--slate);
}

.doc-search__input {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-body);
    font-size: 0.92rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--slate-line);
    border-radius: var(--r-sm);
    padding: 8px 10px;
}

.doc-search__input::placeholder {
    color: var(--slate-soft);
}

.doc-search__input:focus {
    outline: 2px solid var(--poppy);
    outline-offset: 1px;
    border-color: transparent;
}

.doc-search__status {
    margin: 0;
    font-size: 0.8rem;
    color: var(--slate);
}

.doc-search__status:empty {
    display: none;
}

.doc-search__results {
    list-style: none;
    margin: 0;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 55vh;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--slate-line);
    border-radius: var(--r-sm);
}

.doc-toc .doc-search__hit {
    display: block;
    padding: 8px 10px;
    color: var(--ink);
    text-decoration: none;
    border-radius: var(--r-sm);
}

.doc-toc .doc-search__hit:hover,
.doc-toc .doc-search__hit:focus-visible,
.doc-toc .doc-search__hit.is-highlighted {
    background: var(--cream-warm);
    color: var(--ink);
}

.doc-toc .doc-search__hit:focus-visible {
    outline: 2px solid var(--poppy);
    outline-offset: -2px;
}

.doc-search__title {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.35;
}

.doc-search__snippet {
    display: block;
    margin-top: 2px;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--slate);
    overflow-wrap: anywhere;
}

.doc-search__snippet mark {
    background: var(--poppy-soft);
    color: var(--ink);
    border-radius: 2px;
    padding: 0 1px;
}

.doc-body .doc-endpoint__title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.doc-body h3[id],
.doc-body h4[id] {
    scroll-margin-top: 96px;
}

@media (max-width: 1023px) {
    main.doc-shell {
        display: block;
    }

    main.doc-shell .doc-toc.is-enhanced {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px 10px;
        position: sticky;
        top: 72px;
        z-index: 40;
        max-height: none;
        overflow: visible;
        margin: 0 -24px 28px;
        padding: 10px 24px;
        border-top: 0;
        border-bottom: 1px solid var(--slate-line);
        background: var(--cream);
    }

    main.doc-shell .doc-toc.is-enhanced .doc-search {
        flex: 1 1 200px;
        margin: 0;
    }

    main.doc-shell .doc-toc.is-enhanced .doc-search__label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }

    main.doc-shell .doc-toc.is-enhanced .doc-toc__toggle:not([hidden]) {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex: 0 0 auto;
        font-family: var(--font-body);
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--ink);
        background: var(--white);
        border: 1px solid var(--slate-line);
        border-radius: var(--r-sm);
        padding: 8px 12px;
        cursor: pointer;
    }

    main.doc-shell .doc-toc.is-enhanced .doc-toc__toggle::after {
        content: "";
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 5px solid currentColor;
        transition: transform 160ms ease;
    }

    main.doc-shell .doc-toc.is-enhanced .doc-toc__toggle[aria-expanded="true"]::after {
        transform: rotate(180deg);
    }

    main.doc-shell .doc-toc.is-enhanced .doc-toc__links {
        display: none;
        flex: 1 1 100%;
        max-height: 60vh;
        overflow-y: auto;
        padding: 8px 0 4px;
        border-top: 1px solid var(--slate-line);
    }

    main.doc-shell .doc-toc.is-enhanced.is-open .doc-toc__links {
        display: flex;
    }

    main.doc-shell .doc-body h2,
    main.doc-shell .doc-body h3[id],
    main.doc-shell .doc-body h4[id],
    main.doc-shell .doc-endpoint {
        scroll-margin-top: 150px;
    }
}
