/* Shared responsive sizing tokens. */
:root {
    --sdk-reading-max: clamp(680px, 56vw, 960px);
    --sdk-outline-width: clamp(220px, 16vw, 280px);
    --sdk-layout-gap: clamp(1rem, 2vw, 2rem);
    --sdk-content-pad: clamp(1rem, 2vw, 2.5rem);
    --sdk-outline-inset: 1rem;
    --sdk-outline-text-inset: .5rem;
    --sdk-outline-level-indent: .9rem;
}

/* Keep RTD's content area wide enough for the three-column reading layout. */
.wy-nav-content {
    width: 100%;
    max-width: min(1700px, 100%) !important;
    margin: 0;
    padding: clamp(1.25rem, 2vw, 1.618em) var(--sdk-content-pad);
    box-sizing: border-box;
    container-type: inline-size;
    container-name: sdk-content;
}

.rst-content .footnote,
.rst-content .footnotes {
    position: static !important;
    float: none !important;
    clear: both;
}

/* Keep sidebar typography compact and consistent across languages. */
.wy-nav-side .wy-menu,
.wy-nav-side .wy-menu a {
    font-size: 14px !important;
}

.wy-nav-side .wy-menu .toctree-l1 > a {
    font-size: 14px !important;
    font-weight: 600;
}

.wy-nav-side .wy-menu .toctree-l2 > a {
    font-size: 13px !important;
    font-weight: 500;
}

.wy-nav-side .wy-menu li[class*="toctree-l"]:not(.toctree-l1):not(.toctree-l2) > a {
    font-size: 12px !important;
    font-weight: 400;
}

.wy-nav-side .wy-menu-vertical li > a {
    line-height: 1.45;
}

/* Start the article directly after the global navigation. Any surplus desktop
   width stays to the right of the local outline instead of before the text. */
.sdk-reading-layout {
    display: grid;
    grid-template-columns: minmax(0, var(--sdk-reading-max)) minmax(220px, var(--sdk-outline-width));
    gap: var(--sdk-layout-gap);
    align-items: start;
    width: 100%;
    max-width: min(1700px, 100%);
    margin: 0;
    box-sizing: border-box;
}

@supports (container-type: inline-size) {
    .sdk-reading-layout {
        --sdk-reading-max: clamp(680px, 56cqi, 960px);
    }
}

.sdk-reading-main {
    grid-column: 1;
    min-width: 0;
    width: 100%;
    max-width: var(--sdk-reading-max);
    justify-self: stretch;
}

/* Establish a predictable reading rhythm instead of inheriting a mixture of
   browser and theme defaults for every document. */
.sdk-reading-main .rst-content h1,
.sdk-reading-main .rst-content h2,
.sdk-reading-main .rst-content h3,
.sdk-reading-main .rst-content h4,
.sdk-reading-main .rst-content h5,
.sdk-reading-main .rst-content h6 {
    text-wrap: balance;
}

.sdk-reading-main .rst-content h1 {
    margin: 0 0 1.5rem;
    line-height: 1.2;
}

.sdk-reading-main .rst-content h2 {
    margin: clamp(2rem, 4vw, 3rem) 0 .8rem;
    line-height: 1.3;
}

.sdk-reading-main .rst-content h3 {
    margin: clamp(1.5rem, 3vw, 2.25rem) 0 .6rem;
    line-height: 1.35;
}

.sdk-reading-main .rst-content p {
    line-height: 1.7;
    text-wrap: pretty;
}

.sdk-reading-main .rst-content li {
    line-height: 1.65;
}

.sdk-reading-layout--no-outline {
    grid-template-columns: minmax(0, var(--sdk-reading-max));
}

.sdk-reading-layout--no-outline .sdk-reading-main {
    grid-column: 1;
}

.sdk-page-outline {
    grid-column: 2;
    position: sticky;
    top: 1.618em;
    min-width: 0;
    max-height: calc(100vh - 3.236em);
    overflow-y: auto;
    padding: 1.25rem 0 1.25rem var(--sdk-outline-inset);
    border-left: 1px solid #e1e4e5;
}

.sdk-page-outline__title {
    margin: 0 0 .75em var(--sdk-outline-text-inset);
    color: #404040;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.sdk-page-outline ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sdk-page-outline li ul {
    padding-left: 0;
    margin-left: var(--sdk-outline-level-indent);
}

.sdk-page-outline__list > li > ul {
    padding-left: 0;
}

.sdk-page-outline__link--h2 {
    font-weight: 600;
}

.sdk-page-outline a {
    display: block;
    border-left: 2px solid transparent;
    padding: .3em var(--sdk-outline-text-inset);
    color: #6a737d;
    font-size: 13px;
    line-height: 1.45;
    text-decoration: none;
    overflow-wrap: anywhere;
}

/* The nested list supplies the level offset; keeping the link inset shared
   preserves one text baseline and moves the active rail with the h3 item. */
.sdk-page-outline a.sdk-page-outline__link--h3 {
    padding-left: var(--sdk-outline-text-inset);
    color: #7a858f;
    font-size: 12px;
}

/* Outline labels are generated from heading text and never inherit code
   highlighting or inline Markdown presentation. */
.sdk-page-outline code,
.sdk-page-outline tt,
.sdk-page-outline .pre,
.sdk-page-outline a * {
    background: transparent !important;
    border: 0 !important;
    color: inherit !important;
    font: inherit !important;
    padding: 0 !important;
}

.sdk-page-outline a:hover,
.sdk-page-outline a:focus {
    background-color: #f3f6f6;
    color: #2980b9;
}

.sdk-page-outline a:focus-visible {
    outline: 2px solid #2980b9;
    outline-offset: 2px;
}

.sdk-page-outline a.is-active {
    border-left-color: #2980b9;
    color: #1f6f9f;
    font-weight: 700;
}

.sdk-page-outline li.is-hidden {
    display: none;
}

.sdk-page-outline.is-empty {
    display: none;
}

.sdk-page-outline__fallback {
    display: none !important;
}

.rst-content h2,
.rst-content h3 {
    scroll-margin-top: 1.5rem;
}

/* On tablets and phones the outline follows the article, preserving all
   content without forcing a horizontal scroll. */
/* The two-column layout needs at least 680px for the article, 220px for the
   outline, and the responsive gap. Stack only below that combined minimum. */
@container sdk-content (max-width: 928px) {
    .sdk-reading-layout,
    .sdk-reading-layout--no-outline {
        display: block;
        max-width: none;
    }

    .sdk-reading-main {
        max-width: min(var(--sdk-reading-max), 100%);
        margin: 0 auto;
    }

    .sdk-page-outline {
        position: static;
        max-height: none;
        margin: 2rem auto 0;
        padding: 1.25rem 0 0;
        border-top: 1px solid #e1e4e5;
        border-left: 0;
        max-width: min(var(--sdk-reading-max), 100%);
    }

    .sdk-page-outline__title {
        margin-left: 0;
    }

}

@media screen and (max-width: 767.98px) {
    .sdk-reading-layout,
    .sdk-reading-layout--no-outline {
        display: block;
    }

    .sdk-reading-main {
        max-width: 100%;
        margin: 0;
    }

    .wy-nav-content {
        max-width: none !important;
        padding: 1.25rem var(--sdk-content-pad);
    }

    .sdk-page-outline {
        position: static;
        max-height: none;
        margin-top: 1.5rem;
        padding-top: 1.25rem;
        border-top: 1px solid #e1e4e5;
        border-left: 0;
        max-width: 100%;
    }

    .sdk-page-outline a {
        padding: .35rem .5rem;
    }
}

/* Keep utility controls aligned with the surrounding RTD typography. */
.wy-nav-side .docs-language-switch,
.wy-nav-side .docs-language-switch__option {
    font-size: 12px !important;
}

.wy-nav-side .docs-language-switch__option {
    font-weight: 600;
}

.wy-nav-side .wy-side-nav-search input[type="text"] {
    font-size: 14px !important;
}

.wy-nav-side .wy-side-nav-search .icon {
    font-size: 16px !important;
}

.wy-nav-side .caption {
    font-size: 14px !important;
    font-weight: 600;
}
