@import "./variable.scss";

:lang(zh-CN),
html {
    quotes: "“" "”";
}

html {
    // scroll-behavior: smooth;
}

body {
    width: 100%;
    overflow-x: hidden;
    background: var(--semi-color-bg-0);
    font-size: 14px;
    -ms-text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    font-synthesis: none;
    -moz-font-feature-settings: "kern";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body[theme-mode="dark"] {

    .live-container .editor-outer .editor-container {
        background: rgba(255, 255, 255, .04);
    }
}

code,
pre {
    font-family: Inconsolata, monospace;
    background-color: var(--semi-color-fill-1);
    margin-left: 4px;
    margin-right: 4px;
    letter-spacing: -0.01em;
}

body[theme-mode="dark"] {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;

    .gatsby-side-nav-top {
        background: rgba(35, 36, 41, .75);
        border-color: transparent;
    }

    .side-nav {
        background: rgba(35, 36, 41, .55);
        border-color: transparent;
    }

    //   .semi-tooltip-wrapper {
    //     color: rgba(var(--semi-grey-0), 1);
    //     font-weight: bold;
    //   }
}

.side-nav {
    width: $nav-width;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    margin-top: 60px;
    background: rgba(255, 255, 255, .55);

    .semi-navigation {
        padding-right: 0;
    }

    .semi-navigation-sub .semi-navigation-item {
        height: 40px;
        color: var(--semi-color-text-1);
    }

    .semi-navigation-item-selected {
        color: var(--semi-color-primary) !important;
    }

    .semi-navigation-list-wrapper {

        .semi-navigation-list {
            padding-bottom: 30px;
        }

        &::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        &::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0);
        }

        &::-webkit-scrollbar-corner {
            background-color: rgba(0, 0, 0, 0);
        }

        &::-webkit-scrollbar-thumb {
            border-radius: 6px;
            background: transparent;
            transition: all 1s;
        }

        &:hover::-webkit-scrollbar-thumb {
            background: var(--semi-color-fill-2);
        }

        &::-webkit-scrollbar-thumb:hover {
            background: var(--semi-color-fill-1);
        }
    }

    @media screen and (max-width: $bp-mobile) {
        transform: translateX(100%);
        left: auto;
        position: fixed;
        top: 0;
        right: 0;
        border-left: 1px solid var(--semi-color-border);
        z-index: 100;
        backdrop-filter: saturate(20%) blur(20px);
        -webkit-backdrop-filter: saturate(20%) blur(20px);
        transition: transform .2s ease-in-out;

        &.show {
            transform: translateX(0);
        }
    }
}

.skip-to-content {
    width: 122px;
    padding: 12px;
    position: absolute;
    left: 30px;
    transform: translateY(-100%);   
    transition: transform 0.3s;
    background-color: #fff;
    font-size: 14px;
    border-radius: 3px;
    z-index: 9999;

    ol {
        margin-top: 0px;
        padding-left: 0px;
        list-style-type: none;
        list-style-position: outside;

        li {
            margin-top: 8px;
            line-height: 20px;
            color: var(--semi-color-primary);
        }
    }
}

.skip-to-content:focus-within {
    transform: translateY(0%);
    top: 12px;
    outline: 2px solid var( --semi-color-border);
}

.skip-to-content-link:focus {
    outline: 2px solid var(--semi-color-primary-light-active);
}

.content-area {
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    box-sizing: border-box;
    padding-left: $nav-width;
    min-height: 100vh;
    padding-top: 60px;

    @media screen and (max-width: $bp-mobile) {
        padding-left: 0;
    }

    [class*="footerMini8"] {
        margin-top: 0;
    }
}

.menu-action {
    display: none;

    @media screen and (max-width: $bp-mobile) {
        display: block;
    }
}

.article-wrapper {
    flex-grow: 1;
    flex-basis: 100%;
    padding-top: 24px;
    width: 80%;
    margin: 0 auto;
    max-width: 1160px;
    position: relative;
    left: -50px;

    .main-article {
        padding-top: 2 * $bf;

        @media screen and (max-width: $breakpoint) {
            grid-column-start: content-start;
            grid-column-end: toc-end;
        }

        @media screen and (max-width: $bp-mobile) {
            grid-column: full;
            grid-template-columns: [large-start] 24px [main-start] minmax(0, $max-paragraph-width) [main-end] 24px [large-end];
        }

        section.md {
            display: grid;
            grid-column: large;
            grid-template-columns: [main-start large-start] minmax(0, $max-paragraph-width) [main-end] 1fr [large-end];

            & > * {
                grid-column: large;
            }

            .full-palette,
            .image-large,
            .icons-list {
                grid-column: large;
            }

            @media screen and (max-width: $bp-mobile) {
                grid-template-columns: [large-start] 24px [main-start] minmax(0, $max-paragraph-width) [main-end] 24px [large-end];
            }
        }

        section.md:first-child h2.md {
            margin-top: $bf;
        }

        .semi-icons.md {
            color: var(--semi-color-text-2);
            margin: 0;
            position: relative;
            cursor: help;
            top: .12em;
        }

        p.md {
            font-size: $bf;
            line-height: 1.75;
            color: var(--semi-color-text-0);
            margin-top: 0;

            code {
                color: var(--semi-color-text-2);
            }
        }

        h2.md {
            color: var(--semi-color-text-0);
            font-size: $h2;
            margin-top: 4 * $bf;
            margin-bottom: 1.5 * $bf;
        }

        h3.md {
            color: var(--semi-color-text-0);
            font-size: $h3;
            margin-top: 2 * $bf;
            margin-bottom: 1.5 * $bf;
        }

        h2.md + h3.md {
            margin-top: $bf;
        }

        h4.md {
            color: var(--semi-color-text-0);
            font-size: $h4;
            margin-top: $bf;
            margin-bottom: $bf;
        }

        h5.md {
            color: var(--semi-color-text-0);
            font-size: $h5;
            margin-top: $bf;
            margin-bottom: $bf;
        }

        a.anchor {
            display: block;
            position: relative;
            top: -120px;
            height: 0;
            user-select: none;
            visibility: hidden;
        }

        [class^="image-"] {
            margin-bottom: 1.5 * $bf;
            box-shadow: 0 0 0 1px var(--semi-color-border);
            border-radius: 3px;
            overflow: hidden;
        }

        .image-large {
            grid-column: large;
        }

        .image-no-border {
            box-shadow: none;
        }

        div.image-no-border-large {
            box-shadow: none;
            grid-column: large;
        }

        .table-container {
            display: block;
            overflow-x: auto;
            width: 100%;
            @media screen and (max-width: $bp-mobile) {
                grid-column: large;
                border-width: .5px;
                // padding-left: 24px;
                padding-right: 16px;
                box-sizing: border-box;
                -webkit-mask: linear-gradient(270deg, rgba(0, 0, 0, 0) 0, #000 36px);
                mask: linear-gradient(270deg, rgba(0, 0, 0, 0) 0, #000 36px);
                -webkit-mask-position: right;

                table.md {
                    margin-right: 24px;
                }
            }
        }

        & > * {
            grid-column: main;
        }

        .text {
            vertical-align: middle;
        }

        .example-container {
            grid-column: large;
        }
    }

    .title-area {
        grid-row: title;
        grid-column-start: content-start;
        // grid-column-end: toc-end;
        //border-bottom: 1px solid var(--semi-color-border);
        //display: flex;
        justify-content: space-between;
    }

    .article-title {
        color: var(--semi-color-text-0);
        font-size: $h1;
        margin-bottom: $bf;
        margin-top: 1.5 * $bf;
    }

    .article-actions {
        @media screen and (max-width: $breakpoint) {
            display: none;
        }
        margin-top: 1.5 * $bf;

        a {
            text-decoration: none;
        }
    }

    .article-brief {
        color: var(--semi-color-text-2);
        font-size: $bf;
        line-height: 1.75;
        margin-bottom: 2 * $bf;
        max-width: $max-paragraph-width;
    }

    .article-tag {
        margin-top: $bf;
        margin-bottom: 0;
    }

    .article-tag + .article-title {
        margin-top: $bf;
    }

    .article-footer {
        margin-top: 8 * $bf;
        padding-top: 16px;
        padding-bottom: 16px;
        border-radius: 6px;
        background-color: var(--semi-color-fill-0);
    }
}

// 隐藏anchor时，文章宽度最大化，避免API参考部分出现积压
@media screen and (max-width: 1399px) {

    .article-wrapper {
        box-sizing: border-box;
        width: 100%;
        left: 0;
        padding-left: 24px;
        padding-right: 24px;
    }
}

.link-icon {
    vertical-align: middle;
    margin-top: -3px;
}

.spin-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-9px, -50%);
    width: 102px;
    height: 18px;
    z-index: 5;
}

$spCol: var(--semi-color-primary);

.home-content-area {
    height: calc(100vh - 60px);
    overflow: hidden;
    padding-top: 60px;
}

[theme-mode="dark"] {

    .color-block {

        &:hover {
            box-shadow: 0 0 0 3px rgba(10, 10, 10, 1);
        }
    }
}

:global {

    body {
        display: block;

        &::-webkit-scrollbar {
            width: 8px;
            height: 8px;
        }

        &::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0);
        }

        &::-webkit-scrollbar-corner {
            background-color: rgba(0, 0, 0, 0);
        }

        &::-webkit-scrollbar-thumb {
            border-radius: 6px;
            background: transparent;
            transition: all 1s;
        }

        &:hover::-webkit-scrollbar-thumb {
            background: var(--semi-color-fill-2);
        }

        &::-webkit-scrollbar-thumb:hover {
            background: var(--semi-color-fill-1);
        }
    }
}

@media (max-width: 1400px) {

    .pageAnchor {
        display: none;
    }
}


.reset-font-style {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    letter-spacing: unset;
    line-height: unset;
}