/* 导航栏样式 */
.navbar {
    width: 100%;
    background-color: var(--color-background);  /* 确保有背景色 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 20px 60px;  /* 与页脚保持一致 */
    pointer-events: none;  /* 让整个导航栏默认不接收鼠标事件 */
    /* 确保导航栏始终固定 */
    position: fixed !important;
}

.nav-container {
    max-width: 1350px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.nav-left, .nav-right {
    display: flex;
    flex-direction: column;  /* 改为竖向排列 */
    align-items: flex-end;   
    gap: 8px;               /* 减小间距 */
}

/* 导航栏方块容器样式 */
.nav-box-container {
    display: flex;
    align-items: center;
    gap: 12px;  /* 方块和文字之间的间距 */
    pointer-events: auto;  /* 恢复链接的鼠标事件 */
}

/* 导航栏黑色方块样式 */
.nav-box {
    width: 12px;
    height: 12px;
    background-color: var(--color-text);
}

.nav-item {
    text-decoration: none;
    color: var(--color-text);
    font-family: "Roboto Mono", monospace;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.1;      /* 调整行高 */
    transition: color 0.05s ease;
    pointer-events: auto;  /* 恢复链接的鼠标事件 */
}

.nav-item:hover {
    color: white;
    background-color: black;
    transition: color 0.05s ease;
}

/* 确保导航栏右侧的链接也能接收鼠标事件 */
.nav-right {
    pointer-events: auto;
}

.footer {
    max-width: 1350px;
    width: 100%;
    margin: 0 auto;  /* 添加这行使 footer 内容居中 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: "Roboto Mono", monospace;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -2px;
}

/* 页脚包装器样式 */
.footer-wrapper {
    position: fixed;
    padding: 40px 60px;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--color-background);
    z-index: 1000;  /* 确保足够高的层级 */
    pointer-events: auto;  /* 确保可以接收鼠标事件 */
}

/* 其他页脚样式保持不变 */
.footer,
.footer p,
.copyright,
.footer-link {
    font-family: "Roboto Mono", monospace;
    font-weight: 600;
    font-size: 16px;
}

/* 页脚左侧容器样式 */
.footer-left {
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;  /* 确保可以接收鼠标事件 */
}

/* 页脚方块样式 */
.footer-box {
    width: 12px;
    height: 12px;
    background-color: var(--color-text);
    cursor: pointer;
    position: relative;  /* 添加相对定位 */
    z-index: 1;  /* 确保在邮箱文本之上 */
    pointer-events: auto;  /* 确保可以接收鼠标事件 */
}

.box-tooltip {
    position: fixed;
    bottom: 80px;
    left: 60px;
    font-size: 11px;
    font-family: "JetBrains Mono", monospace;
    white-space: pre-wrap; /* 允许文本换行 */
    max-width: calc(100vw - 120px); /* 设置最大宽度，留出左右边距 */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    font-weight: 400;
    color: var(--color-background);
    z-index: 1001;
}

@media screen and (max-width: 768px) {
    .box-tooltip {
        left: 20px;
        bottom: 60px;
        max-width: calc(100vw - 40px); /* 移动端左右边距更小 */
        text-align: left;
    }
}

/* 创建全屏遮罩 - 桌面端使用伪元素 */
.footer-box::before,
.copyright-text::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
}

/* 移动端使用的遮罩 */
.mobile-overlay {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    pointer-events: auto;
    cursor: pointer;
}

/* 显示遮罩时的状态 */
.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 在触摸设备上显示移动端遮罩 */
@media (hover: none) {
    .mobile-overlay {
        display: block;
    }
}

/* 桌面端hover效果 */
@media (hover: hover) {
    .footer-box:hover::before,
    .copyright-text:hover::before {
        opacity: 1;
        visibility: visible;
    }

    .footer-box:hover .box-tooltip,
    .copyright-text:hover .copyright-tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* 移动端点击效果 */
@media (hover: none) {
    .footer-box.active .box-tooltip,
    .copyright-text.active .copyright-tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* 版权信息样式 */
.copyright {
    text-align: right;
    pointer-events: auto;
}

.copyright-text {
    position: relative;
    cursor: default;
}

.copyright-tooltip, .box-tooltip {
    position: fixed;
    font-size: 14px;
    font-family: "JetBrains Mono", monospace;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    font-weight: 400;
    color: var(--color-background);
    z-index: 1001;
    white-space: pre-wrap; /* 允许文本换行 */
    max-width: calc(100vw - 120px); /* 设置最大宽度，留出左右边距 */
}

.copyright-tooltip {
    bottom: 80px;
    right: 60px;
    text-align: right;
}

.box-tooltip {
    bottom: 80px;
    left: 60px;
    text-align: left;
}

@media screen and (max-width: 768px) {
    .copyright-tooltip {
        right: 20px;
        bottom: 60px;
        max-width: calc(100vw - 40px); /* 移动端左右边距更小 */
    }
}

/* 打字机效果的容器 */
.typing-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 每行文字的基础样式 */
.typing-line {
    display: block;
    white-space: nowrap;
    width: 0;
    overflow: hidden;
}

/* 版权信息的打字效果 */
.copyright-text:hover .typing-line {
    animation: typing 2s steps(60, end) forwards,
               blink-caret .75s step-end infinite;
    border-right: 2px solid var(--color-background);
}

/* 左侧方块文本的打字效果 */
.footer-box:hover .typing-line {
    width: 0;
    border-right: 2px solid transparent;
}

/* 第一行的动画 */
.footer-box:hover .typing-line:nth-child(1) {
    animation: 
        typing 2s steps(60, end) forwards,
        showCaret 0s forwards,
        blink-caret .75s step-end 3 2s forwards,
        hideCaret 0s 3.25s forwards;
}

/* 第二行的动画 */
.footer-box:hover .typing-line:nth-child(2) {
    animation: 
        typing 2s steps(60, end) 3.25s forwards,
        showCaret 0s 3.25s forwards,
        blink-caret .75s step-end 3 5.25s forwards,
        hideCaret 0s 6.5s forwards;
}

/* 最后一行的动画 */
.footer-box:hover .typing-line:nth-child(3) {
    animation: 
        typing 2s steps(60, end) 6.5s forwards,
        showCaret 0s 6.5s forwards,
        blink-caret .75s step-end infinite 8.5s;
}

/* 显示光标的动画 */
@keyframes showCaret {
    to { border-right-color: var(--color-background); }
}

/* 隐藏光标的动画 */
@keyframes hideCaret {
    to { border-right-color: transparent; }
}

/* 打字机动画 */
@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* 光标闪烁动画 */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--color-background) }
}

/* 创建全屏遮罩 */
.copyright-text.active .copyright-tooltip {
    opacity: 1;
    visibility: visible;
}




/* 邮箱样式 */
.footer-email {
    font-family: "Roboto Mono", monospace;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-darkgrey);
    opacity: 0;
    transition: opacity 0.2s ease;
    visibility: hidden;
    pointer-events: none;  /* 防止邮箱文本影响方块的点击 */
}

/* 显示邮箱的状态 */
.footer-left.show-email .footer-email {
    opacity: 1;
    visibility: visible;
}

/* 添加移动端触摸支持 */
@media (hover: none) {
    .footer-box:active::before,
    .footer-box:active .box-tooltip,
    .copyright-text:active::before,
    .copyright-text:active .copyright-tooltip,
    .copyright-text:active .typing-line {
        opacity: 1;
        visibility: visible;
    }

    .footer-box:active .typing-line {
        animation-play-state: running;
    }
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
    .navbar {
        position: fixed;
        top: -30px;
        left: 0;
        right: 0;
        width: 100%;
        padding:  20px;
        margin: 0 auto;
        box-sizing: border-box;
        z-index: 1000;
        position: fixed !important;
    }p

    .nav-container {
        width: calc(100% - 40px);
        padding: 20px 0;
        margin: 0 auto;
        box-sizing: border-box;
        background-color: inherit;  /* 继承父元素的背景色 */
    }

    /* 在项目页面隐藏页脚 */
    .project-page .footer-wrapper {
        display: none;
    }


    /* 统一所有视图的页脚样式 */
    .footer {
        max-width: 1350px;
        width: 100%;
        margin: 0 auto;
        margin-bottom: 0%;
        padding: 0 8px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .footer-wrapper {
        padding: 40px 40px;
        padding-bottom: 4px;
    }

}