@import '../../../styles/variables';
@import '../../../styles/mixins';

.dc-doc-page {
    position: relative;
    @include text-size(body-2);
    width: 1440px;

    $block: &;

    &__aside {
        position: fixed;
        top: calc(var(--dc-header-height, #{$headerHeight}) + var(--dc-subheader-height));

        padding-top: 24px;
        width: 176px;

        @include text-size(body-1);

        @media screen and (min-width: 1280px) {
            & {
                width: 200px;
            }
        }
    }

    &__main {
        padding: 20px 36px 24px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        min-height: calc(
            100vh - var(--dc-header-height, #{$headerHeight}) - var(--dc-subheader-height)
        );
    }

    &__loader-wrapper {
        background: var(--yc-color-base-background);
        padding-top: calc((100vh - var(--dc-header-height, #{$headerHeight})) / 2);
        display: flex;
        justify-content: center;
        position: absolute;
        width: 100%;
        top: 0;
        z-index: 101;
        height: 100%;
    }

    &__controls {
        display: flex;
        top: var(--dc-header-height, #{$headerHeight});
        align-items: center;
        height: 40px;
        z-index: 102;
        position: absolute;
        right: 7px;

        & > .dc-controls {
            position: fixed;
            top: calc(6px + var(--dc-header-height, #{$headerHeight}));

            @media (max-width: map-get($screenBreakpoints, 'md') - 1) {
                position: static;
            }
        }

        @media (min-width: map-get($screenBreakpoints, 'md')) {
            &_vertical {
                top: calc(6px + var(--dc-header-height, #{$headerHeight}));
                justify-content: center;
                height: auto;
                width: 36px;
                position: absolute;
                right: 0;
            }
        }
    }

    &__body {
        &_text-size {
            &_s.yfm {
                @include text-size(body-1);

                --dc-code-font-size: 12px;
                --dc-code-line-height: 18px;

                --dc-code-short-font-size: 12px;
                --dc-code-short-line-height: 14px;
                --dc-code-short-padding: 1px 2px;
            }

            &_m.yfm {
                @include text-size(body-2);

                --dc-code-font-size: 14px;
                --dc-code-line-height: 20px;

                --dc-code-short-font-size: 14px;
                --dc-code-short-line-height: 16px;
                --dc-code-short-padding: 1px 4px;
            }

            &_l.yfm {
                @include text-size(body-3);

                --dc-code-font-size: 16px;
                --dc-code-line-height: 24px;

                --dc-code-short-font-size: 16px;
                --dc-code-short-line-height: 20px;
                --dc-code-short-padding: 1px 6px;
            }
        }
    }

    &__breadcrumbs {
        height: 40px;
        display: flex;
        align-items: center;
        padding: 0 36px;
    }

    &__feedback {
        margin-top: 84px;
    }

    &__title {
        margin-bottom: 8px;

        @include text-size(display-2);
    }

    &__content {
        flex: 1;
        margin-bottom: 50px;
    }

    &__content-mini-toc {
        display: none;
        margin-bottom: 20px;
    }

    &__search-bar {
        background: var(--yc-color-base-background);
        width: 100%;
        height: 40px;
        position: sticky;
        top: calc(var(--dc-header-height, #{$headerHeight}) + 6px);
        z-index: 101;
        padding: 0 36px;

        @media (max-width: map-get($screenBreakpoints, 'md') - 1) {
            padding: 0 10px;
        }
    }

    &__search-bar + &__breadcrumbs {
        margin-top: 12px;
    }

    &_full-screen {
        --dc-header-height: 0px;

        & #{$block}__breadcrumbs {
            padding: 0 24px;
        }

        #{$block}__main,
        & .dc-nav-toc-panel__content {
            padding-left: 64px;
            padding-right: 64px;
        }
    }

    &_regular-page-width {
        width: 1280px;
    }

    &#{&}_single-page &__header-container {
        position: relative;
        padding-right: 200px;
    }

    &#{&}_full-screen#{&}_regular-page-width {
        max-width: 736px;

        #{$block}__main {
            padding-left: 0;
            padding-right: 0;
        }

        #{$block}__breadcrumbs {
            padding: 0;
        }

        & .dc-nav-toc-panel__content {
            max-width: 736px;
            padding: 0;
        }
    }

    @media (max-width: map-get($screenBreakpoints, 'md') - 1) {
        &__main {
            padding: 0 20px;
        }

        &__breadcrumbs {
            padding: 0 20px;
        }

        &__content-mini-toc {
            display: block;
        }

        &__toc-nav-panel {
            padding-bottom: 50px;
        }

        &__controls {
            padding-left: 20px;

            position: static;
        }
    }

    &__separator {
        margin: 0 5px 32px 0;
        align-self: center;
    }

    &__page-contributors {
        display: flex;
    }

    @media screen and (max-width: 1440px) {
        &:not(&_regular-page-width) {
            width: 100%;
        }
    }

    @media screen and (max-width: 1136px) {
        &_regular-page-width {
            width: 100%;
        }
    }

    @media screen and (min-width: 1024px) {
        &#{&}_full-screen#{&}_regular-page-width &__controls_vertical {
            right: -36px;
        }
    }
    /* stylelint-disable declaration-no-important */
    @media screen and (max-width: 1280px) {
        &_full-screen &__main,
        &_full-screen .dc-nav-toc-panel__content {
            padding-left: 40px !important;
            padding-right: 40px !important;
        }
        &_full-screen &__breadcrumbs {
            padding-left: 24px !important;
            padding-right: 24px !important;
        }
    }
    /* stylelint-enable declaration-no-important */
}
