/* ------------------------------------------------------------- */
/* CSS 变量定义 */
/* ------------------------------------------------------------- */

:root {
    /* 导航栏高度 */
    --nav-height: 0px;

    /* 以下变量需要在 ./js/QBLOG.js中设置 */

    /* 主色调 */
    /* --primary-color: #388bff; */

    /* 文字颜色 */
    /* --text-color: #FFFFFF; */
    /* --text-shadow-color: #204350; */
    /* --text-secondary-color: #a1a1a1; */

    /* 背景颜色 */
    /* --bg-color: linear-gradient(180deg, #101d21, #0c1a20, #15232a, #0c1518); */
    /* --hero-bg-color: #0b151a; */

    /* 毛玻璃背景 */
    /* --surface-color: rgba(0, 0, 0, 0.1); */
    /* --surface-border-color: rgba(0, 0, 0, 0.2); */

    /* 边框 */
    /* --border-color: #ffffff30; */

    /* 阴影 */
    /* --box-shadow: #00000020 0 0 10px 0px; */

    /* 分隔线 */
    /* --divider-color: rgba(255, 255, 255, 0.1); */

    /* 模糊效果 */
    /* --backdrop-blur: blur(0.5em); */
}

/* ------------------------------------------------------------- */
/* 动画定义 */
/* ------------------------------------------------------------- */

@keyframes showOverlayAnimation {
    to {
        opacity: 1;
    }
}

@keyframes hideOverlayAnimation {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes alertAnimation {
    0% {
        transform: translateX(110%) scale(0.8);
        opacity: 0;
    }

    15% {
        transform: translateX(-8%) scale(1.02);
        opacity: 1;
    }

    20% {
        transform: translateX(0) scale(1);
    }

    85% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    90% {
        transform: translateX(-5%) scale(0.98);
        opacity: 0.8;
    }

    100% {
        transform: translateX(110%) scale(0.9);
        opacity: 0;
    }
}

@keyframes showSidebarAnimation {
    from {
        transform: translateX(110%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes hideSidebarAnimation {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(110%);
    }
}

@keyframes floatAnimation {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(10px);
    }
}

@keyframes strokeAnimation {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes loadingRightAnimation {
    to {
        transform: translateX(100%);
    }
}

@keyframes loadingLeftAnimation {
    to {
        transform: translateX(-100%);
    }
}

/* ------------------------------------------------------------- */
/* 字体定义 */
/* ------------------------------------------------------------- */

@font-face {
    font-family: "Font Awesome 6 Free";
    src: url("../fonts/fontawesome-webfont.woff2");
}

@font-face {
    font-family: "This-July";
    src: url("../fonts/This-July.ttf");
}

@font-face {
    font-family: "阿里妈妈方圆体";
    src: url("../fonts/阿里妈妈方圆体.ttf");
}

@font-face {
    font-family: "得意黑";
    src: url("../fonts/得意黑.ttf");
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 200W.ttf");
    font-weight: 200;
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 300W.ttf");
    font-weight: 300;
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 400W.ttf");
    font-weight: 400;
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 500W.ttf");
    font-weight: 500;
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 600W.ttf");
    font-weight: 600;
}

@font-face {
    font-family: "江城圆体";
    src: url("../fonts/江城圆体/江城圆体 700W.ttf");
    font-weight: 700;
}

/* ------------------------------------------------------------- */
/* 全局样式 */
/* ------------------------------------------------------------- */

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;

    font-display: swap;
    font-family: "江城圆体", "阿里妈妈方圆体", sans-serif;
    letter-spacing: 0.1em;
}

*:not(.article-content pre):not(.article-content pre code)::-webkit-scrollbar {
    display: none;
}

*::selection {
    background-color: var(--primary-color);
}

/* ------------------------------------------------------------- */
/* 通用类 */
/* ------------------------------------------------------------- */

.glass {
    backdrop-filter: var(--backdrop-blur);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.nav-button {
    height: var(--nav-height);
    width: var(--nav-height);
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    font-size: 1.5em;
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    backdrop-filter: var(--backdrop-blur);
    background: var(--surface-color);
    display: grid;
    place-content: center;
    margin-left: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------- */
/* 交互元素样式 */
/* ------------------------------------------------------------- */

.btn-active:hover {
    box-shadow:
        0 6px 12px var(--box-shadow-color),
        0 2px 4px var(--box-shadow-color);
}

.btn-active:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 3px 6px var(--box-shadow-color),
        inset 0 -1px 3px var(--box-shadow-color);
    transition: all 0.05s cubic-bezier(0.4, 0, 0.2, 1);
}

#navbar li:hover,
#sidebar nav ul li:hover,
#context-menu li:hover,
.tag-item:hover {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    box-shadow:
        0 6px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1);
}

#navbar li:hover a {
    color: var(--primary-color);
}

.nav-button:hover,
#back-to-top:hover,
#sidebar-close:hover,
#sidebar-toggle:hover,
#theme-toggle:hover,
#card-list-box #card-list .card:hover,
.article-tag .tag:hover {
    box-shadow:
        0 6px 12px var(--box-shadow-color),
        0 2px 4px var(--box-shadow-color);
}

#back-to-top:active,
#sidebar-close:active,
#sidebar-toggle:active,
#theme-toggle:active,
#card-list-box #card-list .card:active,
#navbar li:active,
#sidebar nav ul li:active,
#context-menu li:active,
.tag-item:active {
    transform: translateY(2px);
    box-shadow:
        inset 0 3px 6px var(--box-shadow-color),
        inset 0 -1px 3px var(--box-shadow-color);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------- */
/* 基础元素样式 */
/* ------------------------------------------------------------- */

a {
    text-decoration: none;
    color: inherit;
}

body {
    color: var(--text-color);
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

p,
.hero-div-user-down-text {
    color: var(--text-secondary-color);
}

/* ------------------------------------------------------------- */
/* 弹窗样式 */
/* ------------------------------------------------------------- */

#alert {
    display: flex;
}

#alert-message {
    position: fixed;
    top: 8vh;
    right: 2vw;
    z-index: 10000;
    padding: 1rem;
    border-radius: 0.8rem;
    min-width: 14em;
    opacity: 0;
    transform: translateX(110%);
    backdrop-filter: var(--backdrop-blur);
}

/* ------------------------------------------------------------- */
/* 遮罩样式 */
/* ------------------------------------------------------------- */

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    opacity: 0;
    animation: showOverlayAnimation 0.5s forwards;
    display: none;
}

/* ------------------------------------------------------------- */
/* 侧边栏样式 */
/* ------------------------------------------------------------- */

#sidebar {
    position: fixed;
    display: none;
    flex-direction: column;
    align-items: center;
    background: var(--surface-color);
    backdrop-filter: var(--backdrop-blur);
    height: 100vh;
    width: 50vw;
    top: 0;
    right: 0;
    z-index: 100000;
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    border: 1px solid var(--border-color);
    border-radius: 1rem 0 0 1rem;
    padding-top: 5rem;
    container-type: inline-size;
    gap: 5%;
    overflow-y: auto;
}

#sidebar img {
    width: 50%;
    background: #FFF;
    border-radius: 50%;
    border: 1px solid #a1a1a1;
}

#sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 0.6rem;
}

#sidebar nav {
    display: flex;
    justify-content: center;
    width: 90%;
}

#sidebar nav ul {
    background: var(--surface-color);
    padding: 1rem;
    border-radius: 1rem;
    width: 90%;
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    display: grid;
    gap: 0.5rem;
}

#sidebar nav ul li {
    display: flex;
}

#sidebar nav ul li a {
    flex: 1;
}

/* ------------------------------------------------------------- */
/* 分隔线样式 */
/* ------------------------------------------------------------- */

.divider {
    background: var(--divider-color);
    backdrop-filter: var(--backdrop-blur);
    flex-shrink: 0;
}

/* ------------------------------------------------------------- */
/* 头部样式 */
/* ------------------------------------------------------------- */

header {
    display: flex;
    align-items: center;
    padding: 1rem;
    flex-wrap: nowrap;

    position: sticky;
    top: 0;
    z-index: 9999;
}

#navbar {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    backdrop-filter: var(--backdrop-blur);
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    flex: 1;
    overflow: auto;
    font-weight: bold;
    background: var(--surface-color);
}

#navbar h1 {
    font-family: "This-July";
    letter-spacing: 0.1em;
    font-size: 1.5em;
    padding-left: 0.5em;
}

#navbar .divider {
    height: calc(var(--nav-height) - 20px);
}

#navbar ul {
    display: flex;
    flex: 1;
    gap: 0.5rem;
}

nav li {
    list-style: none;
    user-select: none;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#navbar li a {
    color: var(--text-color);
    flex-shrink: 0;
    white-space: nowrap;
}

#navbar img {
    padding: 0.2em;
}

/* ------------------------------------------------------------- */
/* 卡片样式 */
/* ------------------------------------------------------------- */

.card {
    background: var(--surface-color);
    margin: 1rem;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    border: 1px solid var(--border-color);
    backdrop-filter: var(--backdrop-blur);
    overflow: auto;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-header {
    display: flex;
    align-items: center;
}

.card-header h1,
.card-header h2 {
    flex-grow: 1;

    font-family: "得意黑";
}

.card-header p {
    padding-right: 1em;
    font-size: 0.8em;
}

.card-content p {
    display: block;
    color: inherit;
    font-size: medium;
}

.card-footer {
    position: relative;
    align-items: center;
    gap: 0.5em;
    padding: 0.6em;
    display: flex;
}

.card-footer span {
    font-size: 0.8em;
    flex: 1;
}

.card-footer p {
    position: absolute;
    bottom: -1.5em;
    right: -1.3em;
    font-size: 0.6em;
}

.article-tag {
    display: flex;
    gap: 0.5rem;
}

.article-tag .tag {
    background: var(--surface-color);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--surface-border-color);
    color: var(--text-color);
    padding: 0.2rem 0.6rem;
    border-radius: 100rem;
    font-size: 0.8em;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------- */
/* 返回顶部按钮样式 */
/* ------------------------------------------------------------- */

#back-to-top {
    position: fixed;
    bottom: 3rem;
    right: 3rem;
    z-index: 999;
    padding: 1rem;
    border-radius: 50%;
    height: 50px;
    width: 50px;
    visibility: hidden;
    display: grid;
    place-content: center;
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ------------------------------------------------------------- */
/* 侧边栏切换按钮样式 */
/* ------------------------------------------------------------- */

#sidebar-toggle {
    display: none;
}

/* ------------------------------------------------------------- */
/* 用户信息样式 */
/* ------------------------------------------------------------- */

.user-info {
    display: grid;
    justify-items: center;
    gap: 1rem;
}

.user-info h1 {
    font-size: 10cqw;
}

/* ------------------------------------------------------------- */
/* 首页样式 */
/* ------------------------------------------------------------- */

#hero-div {
    display: flex;
    align-items: center;
    flex-direction: column;
    background: var(--hero-bg-color);
    height: calc(100dvh - (var(--nav-height) + 2rem));
}

.hero-div-content {
    width: 100%;
    padding: 1rem;
    flex: 1;
    container-type: inline-size;
    overflow: hidden;
}

.hero-div-content h1 {
    position: relative;
    font-family: "This-July";
    font-size: 12cqw;
    color: var(--text-color);
    text-shadow: 0.1em 0.12em 0 var(--text-shadow-color);
    letter-spacing: 0.15em;

    top: 50%;
    left: 50%;
    transform: translate(-25%, -50%);
}

.hero-div-content h1::after {
    content: "";
    height: 110%;
    width: 25%;
    border-radius: 0 0 0.3em 0;
    
    border-bottom: 14px solid var(--text-color);
    border-right: 14px solid var(--text-color);

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-80%, -20%);
}

.hero-div-content h1::before {
    content: "";
    height: 120%;
    width: 30%;
    border-radius: 0.3em 0 0 0;

    border-top: 14px dashed var(--text-color);
    border-left: 14px dashed var(--text-color);

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-180%, -65%);
}

.hero-div-user-down-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8em;
    animation: floatAnimation 1.5s infinite alternate;
    padding-bottom: 2.2rem;
}

.hero-div-user-down-text i {
    font-size: 1em;
}

/* ------------------------------------------------------------- */
/* 卡片列表样式 */
/* ------------------------------------------------------------- */

#card-list-box {
    display: flex;
    justify-content: center;

    border-top: 2px solid var(--divider-color);
}

#card-list-box #card-list {
    min-height: calc(100vh - (2.4em));
    width: 794px;
}

#card-list-box #card-list li {
    list-style: none;
}

/* ------------------------------------------------------------- */
/* 页脚样式 */
/* ------------------------------------------------------------- */

footer {
    display: flex;
    flex: 1;
    justify-content: center;
    align-items: flex-end;
    padding: 1em;
    font-size: 0.7em;
}

/* ------------------------------------------------------------- */
/* SVG Logo动画 */
/* ------------------------------------------------------------- */

.qingblog-loading-icon {
    stroke: var(--text-color);
    stroke-width: 20;
    stroke-linecap: round;

    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: strokeAnimation 1.2s ease-in-out forwards;
}

.qingblog-loading-icon-circle {
    stroke: var(--text-color);
    stroke-width: 20;
    stroke-linejoin: round;
    stroke-linecap: round;

    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: strokeAnimation 1.5s ease-in-out forwards;
}

/* ------------------------------------------------------------- */
/* Loading动画 */
/* ------------------------------------------------------------- */

.loading {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
}

.loading-div {
    flex: 1;
    background: var(--surface-color);
    backdrop-filter: var(--backdrop-blur);
}

body.light-theme .loading-div {
    background: rgba(255, 255, 255, 0.8);
}

.loading-icon {
    height: 100vh;
    width: 100vw;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
}

.loading-icon svg {
    height: 20vh;
    width: 20vw;
}

.loading-icon h4 {
    font-size: 1.5rem;
}

/* ------------------------------------------------------------- */
/* 右键菜单 */
/* ------------------------------------------------------------- */

/* 右键菜单容器 */
#context-menu {
    position: fixed;

    top: 50%;
    left: 50%;
    z-index: 99999999;

    background: var(--surface-color);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    user-select: none;
    transition: all 0.15s ease;
}

/* 显示状态 */
#context-menu.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* 菜单列表 */
#context-menu ul {
    padding: 0.5rem;
    display: grid;
    gap: 5px;
}

/* 菜单项 */
#context-menu li {
    list-style: none;
    padding: 8px 16px;
    color: var(--text-color);
    border-radius: 0.6rem;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 5rem;
    transition: 0.2s ease-in-out;
}

/* 分隔线 */
#context-menu li.divider {
    height: 1px;
    background: var(--divider-color);
    margin: 0.3rem;
    padding: 0;
    pointer-events: none;
}

/* 图标 */
#context-menu li i {
    width: 16px;
    text-align: center;
}

/* ------------------------------------------------------------- */
/* 标签页面标题 */
/* ------------------------------------------------------------- */

#title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: calc(var(--nav-height) - 1rem);
    text-align: center;
}

#title h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    text-shadow: 0 2px 4px var(--text-shadow-color);
    position: relative;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

#title h1::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    border-radius: 2px;
}

#title p {
    color: var(--text-secondary-color);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ------------------------------------------------------------- */
/* 标签云容器 */
/* ------------------------------------------------------------- */

#tags-container {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem 4rem;
    min-height: 50vh;
}

/* ------------------------------------------------------------- */
/* 标签云布局 */
/* ------------------------------------------------------------- */

.tag-cloud {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 150px));
    gap: 2rem;
    max-width: 794px;
    margin: 3rem;
    justify-content: center;
    list-style: none;
}

/* ------------------------------------------------------------- */
/* 单个标签项 */
/* ------------------------------------------------------------- */

.tag-item {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 150px;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: var(--surface-color);
    backdrop-filter: var(--backdrop-blur);
    border: 1px solid var(--border-color);
    border-radius: 100rem;
    color: var(--text-color);
    text-decoration: none;
    box-shadow: var(--box-shadow-color) 0 4px 20px 0px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tag-name {
    font-size: 1.2rem;
    font-weight: 500;
}

.tag-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: var(--surface-color);
    border-radius: 100rem;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ------------------------------------------------------------- */
/* 媒体查询 */
/* ------------------------------------------------------------- */

@media (max-width: 1024px) {
    #card-list-box #card-list {
        width: 100%;
    }

    #title h1 {
        font-size: 2rem;
    }

    .hero-div-content h1::after {
        border-bottom: 10px solid var(--text-color);
        border-right: 10px solid var(--text-color);
    }

    .hero-div-content h1::before {
        border-top: 10px dashed var(--text-color);
        border-left: 10px dashed var(--text-color);
    }
}

@media (max-width: 768px) {
    #sidebar-toggle {
        display: grid;
    }

    #navbar {
        justify-content: center;
    }

    #navbar .divider {
        display: none;
    }

    #navbar ul {
        display: none;
    }

    #title h1 {
        font-size: 1.8rem;
    }

    #title p {
        font-size: 0.9rem;
    }

    .tag-cloud {
        gap: 1rem;
        padding: 1rem;
    }

    .tag-item {
        padding: 0.6rem 1.2rem;
    }

    .tag-name {
        font-size: 1rem;
    }

    .hero-div-content h1::after {
        border-bottom: 5px solid var(--text-color);
        border-right: 5px solid var(--text-color);
    }

    .hero-div-content h1::before {
        border-top: 5px dashed var(--text-color);
        border-left: 5px dashed var(--text-color);
    }
}

/* ------------------------------------------------------------- */