/* ========================================
   全局公共样式 - 浅云小站
   包含：基础重置、导航栏（自动隐藏）、侧边栏、遮罩层、页脚
   所有页面共享
   ======================================== */

/* ========== 基础重置 ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    overflow-x: hidden;
    padding-top: 0;
    background: linear-gradient(to bottom, #222, #3091BB);
    color: #fff;
    min-height: 100vh;
}

/* ========== 跳转链接 ========== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #fff;
    color: #222;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* ========== 顶部导航栏（自动隐藏） ========== */
.top-menu {
    background-color: rgba(34, 34, 34, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1002;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    transform: translateY(0);
}

/* 向下滚动时隐藏导航栏 */
.top-menu.hidden {
    transform: translateY(-100%);
}

.menu-item {
    flex: 1;
    display: flex;
    justify-content: center;
}

.menu-item--left {
    justify-content: flex-start;
    padding-left: 20px;
}

.menu-item--right {
    justify-content: flex-end;
    padding-right: 20px;
}

.top-menu img {
    height: 40px;
    width: 40px;
    cursor: pointer;
}

.logo-link {
    display: inline-block;
    line-height: 0;
}

.logo-link:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ========== 导航按钮重置 ========== */
.menu-toggle-wrapper,
.user-icon-wrapper {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.menu-toggle-wrapper:focus-visible,
.user-icon-wrapper:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: 4px;
    border-radius: 4px;
}

/* ========== 图片切换（深色/浅色） ========== */
.img-dark {
    display: block;
}

.img-light {
    display: none;
}

.top-menu.scrolled {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.top-menu.scrolled .img-dark {
    display: none;
}

.top-menu.scrolled .img-light {
    display: block;
}

/* ========== 侧边导航栏 ========== */
.sidebar {
    height: 100vh;
    width: 250px;
    background-color: rgba(34, 34, 34, 0.98);
    position: fixed;
    top: 0;
    left: -250px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
    z-index: 1003;
    overflow-y: auto;
    will-change: transform;
    backface-visibility: hidden;
}

.sidebar.active {
    transform: translateX(250px);
}

.sidebar ul {
    list-style-type: none;
    padding: 80px 0 20px;
    margin: 0;
}

.sidebar ul li {
    border-bottom: 1px solid #444;
    transition: background-color 0.3s, color 0.3s ease;
}

.sidebar ul li a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s ease;
}

.sidebar ul li a:hover,
.sidebar ul li a:focus-visible {
    background-color: #444;
    outline: none;
}

.sidebar ul li a:focus-visible {
    outline: 2px solid #4da6ff;
    outline-offset: -2px;
}

/* 导航变亮时侧边栏也跟着变亮 */
.top-menu.scrolled ~ .sidebar {
    background-color: rgba(255, 255, 255, 0.98);
}

.top-menu.scrolled ~ .sidebar ul li {
    border-bottom-color: #eee;
}

.top-menu.scrolled ~ .sidebar ul li a {
    color: black;
}

.top-menu.scrolled ~ .sidebar ul li a:hover,
.top-menu.scrolled ~ .sidebar ul li a:focus-visible {
    background-color: #f5f5f5;
}

/* ========== 主内容区域 ========== */
.main-content {
    padding: 0;
    position: relative;
}

/* ========== 模糊遮罩层 ========== */
.blur-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (min-width: 768px) {
    .blur-overlay {
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
}

.blur-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== 页脚 ========== */
.site-footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* ========== 减少动画 ========== */
@media (prefers-reduced-motion: reduce) {
    .sidebar {
        transition: none;
    }
    .top-menu {
        transition: none;
    }
}

/* ========== 打印样式 ========== */
@media print {
    body {
        background: #fff;
        color: #000;
        padding-top: 0;
    }

    .top-menu,
    .sidebar,
    .blur-overlay {
        display: none;
    }
}