
/*
 * Copyright (c) Baidu, Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * @file markdown mobile 独有的样式
 */

@import '../base.less';

.@{prefix}-markdown {
    @{markdownsdk} {
        table::-webkit-scrollbar {
            .cos-hidden();
        }

        pre code::-webkit-scrollbar {
            .cos-hidden();
        }
    }
}

.cos-ios {
    .@{prefix}-markdown {
        @{markdownsdk} {
            table {
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: none;
            }
            ul>li::before {
                top: 12px;
            }
        }
    }
}

.cos-android.font-size-3,
.cos-android.font-size-4 {
    .@{prefix}-markdown {
        @{markdownsdk} {
            ul>li::before {
                top: 15px;
            }
        }
    }
}

.@{prefix}-markdown .marklang .marklang-link[type=agent]:after {
    .font-size-0 & {
        --size-scale: 0.86;
    }

    .font-size-1 & {
        --size-scale: 1;
    }

    .font-size-2 & {
        --size-scale: 1.06;
    }

    .font-size-3 & {
        --size-scale: 1.21;
    }

    .font-size-4 & {
        --size-scale: 1.21;
    }
}


@{dark-selectors} {
    .@{prefix}-markdown-mask {
        .cos-hidden();
    }
    .@{prefix}-markdown {
        &-search-more {
            background-image: url(https://gips1.baidu.com/it/u=3625973829,440351408&fm=3028&app=3028&f=PNG&fmt=auto&q=100&size=f18_4);
        }
    }
}



/**
* 由于安卓夜间模式下token设置的#303030颜色被内核修改了
* 导致分割线颜色偏黑，无法辨识，因此需要这里覆盖深色模式下的颜色
*/
@media (prefers-color-scheme: dark) {
    @{t7-kernel-selectors} {
        .@{prefix}-markdown {
            &-mask {
                .cos-hidden();
            }

            @{markdownsdk} {
                .cosd-markdown-table {
                    color-scheme: dark;
                    // cosmic-token-disable-next-line
                    border-color: #303030;
                    // cosmic-token-disable-next-line
                    color: rgba(255, 255, 255, .5);
                    tr th {
                        // cosmic-token-disable-next-line
                        color: rgba(255, 255, 255, .5);
                    }
                }
                hr:after {
                    color-scheme: dark;
                    // cosmic-token-disable-next-line
                    background-color: #303030;
                }

                ul>li::before {
                    color-scheme: dark;
                    // cosmic-token-disable-next-line
                    background-color: rgba(255, 255, 255, .8);
                }
            }

            &-search-more {
                color-scheme: dark;
                // cosmic-token-disable-next-line
                color: #666;
                background-image: url(https://gips1.baidu.com/it/u=3625973829,440351408&fm=3028&app=3028&f=PNG&fmt=auto&q=100&size=f18_4);
            }
        }

        // 兼容夜间模式下不显示的问题
        .@{prefix}-markdown .marklang .marklang-link[type=agent]:after {
            color-scheme: dark;
            box-shadow: inset 0 0 0 1px #fff6;
        }
    }
}
