/* ========================================
   Common Styles - r2wind.cn Clone
   Main Color: #5d9743
   ======================================== */

/* CSS Variables */
:root {
    /* Primary Color Palette */
    --primary-color: #5d9743;
    --primary-light: #7ab85e;
    --primary-dark: #4a7a35;
    --primary-lighter: #e8f5e3;
    --primary-bg: #f0f7ed;
    
    /* Secondary Colors */
    --secondary-color: #6c757d;
    --accent-color: #e67e22;
    
    /* Text Colors */
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --text-light: #ffffff;
    
    /* Background Colors */
    --bg-body: #f5f5f5;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-footer: #2c3e50;
    --bg-sidebar: #ffffff;
    
    /* Border Colors */
    --border-color: #e8e8e8;
    --border-light: #f0f0f0;
    
    /* Shadow */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    /* Typography */
    --font-family: "LXGW WenKai GB", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-size-base: 14px;
    --font-size-sm: 12px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
    
    /* Layout */
    --header-height: 64px;
    --sidebar-width: 360px;
    --content-max-width: 1500px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Page Load Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== 自定义滚动条（全站统一，呼应绿色主题，取代浏览器默认灰条） =====
   轨道近乎隐形，滑块为绿色渐变胶囊；悬停时变深、略粗，给出反馈。
   用 * 覆盖所有可滚动容器；面试题三栏等已有更具体的 ::-webkit-scrollbar
   规则（特异性更高）会优先，故不被此处影响。 */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}

*::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background-image: linear-gradient(180deg, var(--primary-light), var(--primary-color));
    background-clip: padding-box;          /* 渐变只填内区，配合透明 border 收成细胶囊 */
    border: 3px solid transparent;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(93, 151, 67, 0.10);
    transition: border-width 0.2s ease;
}

*::-webkit-scrollbar-thumb:hover {
    background-image: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border-width: 2px;                     /* 悬停略粗，触感反馈 */
}

*::-webkit-scrollbar-thumb:active {
    background-image: linear-gradient(180deg, var(--primary-dark), var(--primary-dark));
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

html {
    font-size: var(--font-size-base);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-body);
    background-image: url('../img/bg.avif');
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out forwards;
}

/* Staggered Animation Delay */
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }
.animate-delay-7 { animation-delay: 0.7s; }
.animate-delay-8 { animation-delay: 0.8s; }

/* Initial state for animated elements - only hide when JS is ready */
.js-ready .animate-on-load {
    opacity: 0;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Smooth transitions for all interactive elements */
a, button, input, textarea {
    transition: all var(--transition-normal);
}

/* Card hover effects */
.card {
    transition: all var(--transition-normal);
}

/* Widget hover effects */
.widget {
    transition: all var(--transition-normal);
}

.widget:hover {
    box-shadow: var(--shadow-md);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* Container */
.container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ========================================
   Header / Navigation
   ======================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
    border-bottom: 0;
    box-shadow: 0 5px 6px -5px rgba(133, 133, 133, 0.6);
    z-index: 1000;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 5px 6px -5px rgba(133, 133, 133, 0.6);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ============================================================
   Logo「代码川」v4 - 品牌质感抛光版
   ------------------------------------------------------------
   「细腻」的方向：
   - 容器：多层渐变 + 顶部亮边 + 内边描边，每个 transition 单独计时
   - 文字：三色阶流光渐变 + 上边缘 highlight + 三层 drop-shadow
   - 下划线：笔锋式收口，两端 fade 透明模拟签名笔锋
   - 图片：始终挂载双层 drop-shadow（环境光 + 神光），更立体
   - 时间曲线：统一用 cubic-bezier(0.22, 1, 0.36, 1) 让所有过场一个节奏

   「增强」的方向：
   - 入场：模糊半径 6→8，letter-spacing 0.18→0.06，y 位移 +12
   - hover：三层 drop-shadow 由弱到强；旋转时长缩到 0.75s 更冲
   - 容器：hover 时 135° 渐变强度 +50%
   - 下划线：宽度从容器边界精确贴边，光带更醒目
   ============================================================ */
.logo {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    color: var(--primary-color);
    /* 胶囊容器：上下 8px，左右 14px 更多呼吸空间 */
    padding: 8px 16px 10px 10px;
    margin: -8px -16px -10px -10px;
    border-radius: 16px;
    position: relative;
    isolation: isolate;                                    /* 建立层叠上下文，避免伪元素与其他元素重叠 */
    transition:
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === 层 1：磨砂玻璃底（常驻可见） === */
.logo::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg,
                                rgba(93, 151, 67, 0.06) 0%,
                                rgba(122, 184, 94, 0.13) 50%,
                                rgba(93, 151, 67, 0.06) 100%);
    border: 1px solid rgba(93, 151, 67, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.55),    /* 顶部高光（玻璃反光的关键）*/
        inset 0 -1px 0 rgba(93, 151, 67, 0.08);     /* 底部内阴影（增强层次）*/
    pointer-events: none;
    z-index: -1;
    transition:
        background 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === 层 2："写就" 下划线 === */
.logo::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 16px;
    right: 16px;
    height: 2px;
    /* 笔锋感：两端透明，中段亮，再回到 var(--primary-color) */
    background: linear-gradient(90deg,
                                transparent 0%,
                                var(--primary-color) 22%,
                                var(--primary-light) 50%,
                                var(--primary-color) 78%,
                                transparent 100%);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: center;
    opacity: 0;
    transition:
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease;
    pointer-events: none;
}

.logo:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px rgba(93, 151, 67, 0.22),                 /* 主阴影：远、大、柔和 */
        0 2px 6px rgba(93, 151, 67, 0.14);                  /* 辅阴影：近、小、紧实 */
}

.logo:hover::before {
    background: linear-gradient(135deg,
                                rgba(93, 151, 67, 0.14) 0%,
                                rgba(122, 184, 94, 0.24) 50%,
                                rgba(93, 151, 67, 0.12) 100%);
    border-color: rgba(93, 151, 67, 0.22);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -1px 0 rgba(93, 151, 67, 0.15);
}

.logo:hover::after {
    transform: scaleX(1);
    opacity: 0.95;
}

/* === 文字 === */
.logo-text {
    display: inline-block;
    color: var(--primary-color);                  /* fallback for old browsers */
    font-size: 28px;
    -webkit-text-stroke: 1px var(--primary-color);
    line-height: 1;
    letter-spacing: 0.06em;
    font-family: "KaiTi", "楷体",
                 "FangSong", "STFangsong", "仿宋",
                 "Songti SC", "STSong", "SimSun", serif;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 三色阶流光渐变：浅→主→深，制造内部光照效果 */
    background: linear-gradient(180deg,
                                #7ab85e 0%,                          /* 顶：亮绿，模拟光源 */
                                var(--primary-color) 50%,            /* 中：品牌绿 */
                                var(--primary-dark) 100%);           /* 底：深绿，模拟接地阴影 */
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    /* 顶部内描边描出的高光：让字有"金属质感" */
    filter:
        drop-shadow(0 1px 0 rgba(255, 255, 255, 0.35))
        drop-shadow(0 2px 4px rgba(93, 151, 67, 0.18));
    transition:
        filter 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        -webkit-text-stroke-color 0.45s ease;
    /* === 入场：清晰浮现 + 字距收紧 === */
    animation: logoTextIn 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes logoTextIn {
    0% {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(8px);
        letter-spacing: 0.2em;
    }
    50%  { opacity: 1; filter: blur(0); }
    100% {
        transform: translateY(0);
        filter: blur(0);
        letter-spacing: 0.06em;
    }
}

.logo:hover .logo-text {
    -webkit-text-stroke-color: var(--primary-dark);
    /* 三层发光：近、远、环境，制造立体光圈 */
    filter:
        drop-shadow(0 0 4px rgba(93, 151, 67, 0.55))
        drop-shadow(0 2px 10px rgba(93, 151, 67, 0.4))
        drop-shadow(0 6px 22px rgba(93, 151, 67, 0.22));
}

/* === 图片 === */
.logo-image {
    width: 30px;
    height: 30px;
    flex: none;
    object-fit: contain;
    transform-origin: 50% 50%;
    /* 常驻双层阴影：底面 + 神光，让毛笔"川"字始终有立体感 */
    filter:
        drop-shadow(0 2px 4px rgba(93, 151, 67, 0.32))
        drop-shadow(0 0 6px rgba(93, 151, 67, 0.18));
    transition: filter 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    animation:
        /* 印章入场：转 -90° 像被"啪"地盖下来 */
        logoImageIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both,
        /* 常驻呼吸光晕：位置不动，只让光影轻轻明暗 */
        logoBreathe 4.5s ease-in-out 1.1s infinite;
}

@keyframes logoImageIn {
    0%   { opacity: 0; transform: scale(0.4) rotate(-90deg); }
    50%  { opacity: 1; transform: scale(1.15) rotate(20deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* 呼吸光晕：川字固定在原位，只让印章光影缓缓明暗起伏 */
@keyframes logoBreathe {
    0%, 100% {
        filter:
            drop-shadow(0 2px 4px rgba(93, 151, 67, 0.32))
            drop-shadow(0 0 6px rgba(93, 151, 67, 0.18));
    }
    50% {
        filter:
            drop-shadow(0 3px 8px rgba(93, 151, 67, 0.48))
            drop-shadow(0 0 14px rgba(93, 151, 67, 0.36));
    }
}

.logo:hover .logo-image {
    /* 旋转 + 三层光圈 */
    animation: logoSpin 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    filter:
        drop-shadow(0 6px 14px rgba(93, 151, 67, 0.55))
        drop-shadow(0 0 12px rgba(93, 151, 67, 0.38))
        drop-shadow(0 0 24px rgba(93, 151, 67, 0.2));
}

@keyframes logoSpin {
    from { transform: rotate(0)      scale(1);    }
    to   { transform: rotate(360deg) scale(1.15); }
}

/* 防止 logo 子元素被 .js-ready .reveal 覆盖隐藏 */
.js-ready .logo-text,
.js-ready .logo-image {
    opacity: 1;
}

/* 不支持 background-clip:text 的浏览器回退到纯色 */
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    .logo-text {
        background: none;
        -webkit-text-fill-color: currentColor;
        color: var(--primary-color);
    }
}

/* 减弱动效偏好：保留入场淡入，去除所有常驻动画 */
@media (prefers-reduced-motion: reduce) {
    .logo-image { animation: logoImageIn 0.6s ease-out 0.15s both; }
    .logo-text  { animation: logoTextIn 0.6s ease-out both; }
    .logo:hover .logo-image,
    .logo:hover .logo-text,
    .logo:hover::after {
        animation: none !important;
        transform: none !important;
    }
}

/* Navigation Menu */
.nav-menu {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 4px;
    height: 100%;
    flex-shrink: 0;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    position: relative;
    line-height: 1;
    letter-spacing: 0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: max-content;
    transition: color 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

button.nav-link {
    border: 0;
    background: none;
    /* 不能用 font: inherit：font 简写会重置 .nav-link 已定义的
       font-size / font-weight / line-height，导致推荐、速查两个 button
       比其余 a 标签导航更细、更浅。这里只继承字体族，其余与 nav-link 保持一致。 */
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--text-primary);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    color: currentColor;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    vertical-align: middle;
    border-radius: 6px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.submenu-arrow {
    width: 10px;
    height: 10px;
    margin-left: 2px;
    opacity: 0.55;
    fill: currentColor;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    flex-shrink: 0;
}

.nav-link::after {
    display: none;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background-color: var(--primary-bg);
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    transform: scale(1.18) rotate(-6deg);
    background-color: rgba(93, 151, 67, 0.12);
}

.nav-link:hover .submenu-arrow,
.nav-link.active .submenu-arrow {
    opacity: 1;
}

/* 下拉菜单触发按钮的"激活指示点" */
.has-submenu > .nav-link::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translateX(-50%) scale(0);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.has-submenu > .nav-link:hover::before,
.has-submenu.open > .nav-link::before {
    transform: translateX(-50%) scale(1);
}

.submenu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 220px;
    padding: 8px;
    margin: 0;
    list-style: none;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 1100;
}

.submenu::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 50%;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    border-left: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 3px;
    transform: translateX(-50%) rotate(45deg);
}

/* 与触发按钮之间的"桥接区"，防止 hover 时下拉菜单消失 */
.submenu::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.submenu li {
    position: relative;
    list-style: none;
}

.submenu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    white-space: nowrap;
    position: relative;
    transition: color 0.2s ease, background-color 0.2s ease, padding-left 0.2s ease;
}

/* hover 时左侧出现的"色块指示器" */
.submenu a::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-light));
    border-radius: 0 2px 2px 0;
    transform: translateY(-50%);
    transition: height 0.2s ease;
}

.submenu a:hover {
    color: var(--primary-color);
    background-color: var(--primary-bg);
    padding-left: 22px;
}

.submenu a:hover::before {
    height: 60%;
}

.has-submenu:hover .submenu,
.has-submenu:focus-within .submenu,
.has-submenu.open .submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.has-submenu:hover .submenu-arrow,
.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition-normal);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   Main Layout
   ======================================== */
.main {
    margin-top: var(--header-height);
    padding: var(--spacing-xl) 0;
    min-height: calc(100vh - var(--header-height) - 200px);
}

.main-wrapper {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--spacing-xl);
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.content {
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--spacing-xl));
    height: fit-content;
}

/* ========================================
   Card Styles
   ======================================== */
.card {
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    background: rgba(255, 255, 255, 0.8);
}

/* Page panel content container (archives / links 等单栏页面) */
.content-page {
    align-self: start;
    padding: 50px 40px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
    .content-page {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .content-page {
        padding: 36px 14px;
    }
}

/* ========================================
   Sidebar Widgets
   ======================================== */
.widget {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    overflow: hidden;
}

.widget:hover {
    background: rgba(255, 255, 255, 0.95);
}

.widget-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
}

.widget-content {
    padding: var(--spacing-md);
}

/* Latest Articles Widget */
.latest-articles {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.latest-article-item {
    display: flex;
    gap: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px dashed var(--border-light);
}

.latest-article-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.latest-article-item img {
    width: 60px;
    height: 45px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.latest-article-item h4 {
    display: -webkit-box;
    margin-bottom: 2px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 1.4;
    transition: color var(--transition-fast);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.latest-article-item:hover h4 {
    color: var(--primary-color);
}

.latest-article-item span {
    color: var(--text-muted);
    font-size: 11px;
}

/* ===== Friend Links Widget ===== */
.friend-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 白底胶囊：默认克制，hover 时实色填充 + 上浮 + 箭头滑入，给出"会跳走"的反馈 */
.friend-link-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 6px 13px;
    border-radius: 999px;
    border: 1px solid rgba(93, 151, 67, 0.22);
    background: #ffffff;
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(93, 151, 67, 0.05);
    transition:
        background 0.28s ease,
        color 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease,
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.friend-link-item:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(93, 151, 67, 0.28);
}

.friend-link-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* hover 时从右侧滑入的外链箭头 */
.friend-link-item::after {
    content: '\2197';
    font-size: 11px;
    line-height: 1;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateX(-3px);
    transition:
        max-width 0.28s ease,
        opacity 0.2s ease,
        margin 0.28s ease,
        transform 0.28s ease;
}

.friend-link-item:hover::after {
    max-width: 14px;
    opacity: 0.92;
    margin-left: 5px;
    transform: translateX(0);
}

/* Author Widget */
.author-widget {
    text-align: center;
    padding: var(--spacing-lg);
}

/* 头像 = 两层结构：外层 .author-avatar 是「印泥圆盘」（带圆角），
   内层 .author-avatar-img 是「印章 logo」（无圆角 → 绝不被裁切）。
   这样无论 logo 笔画如何外扩，都不会再被 border-radius 削角。 */
.author-avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 104px;
    height: 104px;
    margin: 0 auto var(--spacing-md);
    border-radius: var(--radius-full);
    border: 3px solid var(--primary-lighter);
    overflow: visible;                                  /* 关键：不裁内层 img */
    /* 印泥圆盘：白心 → 浅绿边 */
    background:
        radial-gradient(circle at 50% 42%,
            #ffffff 0%,
            rgba(255, 255, 255, 0.96) 52%,
            var(--primary-lighter) 100%);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.9),     /* 顶部高光，玻璃质感 */
        inset 0 -3px 8px rgba(93, 151, 67, 0.10),     /* 底部内阴影，托住印章 */
        0 6px 16px rgba(93, 151, 67, 0.14);           /* 外投影，浮起 */
    transition:
        box-shadow 0.4s ease,
        border-color 0.4s ease,
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 内层印章：方形完整显示，无 border-radius 故绝不裁切 */
.author-avatar-img {
    width: 74px;
    height: 74px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 3px rgba(93, 151, 67, 0.18));
    transition:
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.4s ease;
}

.author-name {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.author-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.author-stats {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-light);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* Site Info Widget */
.site-info-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    font-size: var(--font-size-sm);
}

.site-info-label {
    color: var(--text-muted);
}

.site-info-value {
    color: var(--primary-color);
    font-weight: 500;
}

/* ========================================
   Footer
   ======================================== */
.footer {
    position: relative;
    background-image: url('../img/bg.avif');
    background-position: center bottom;
    background-size: cover;
    background-attachment: scroll;
    color: rgba(255, 255, 255, 0.82);
    padding: 0;
    margin-top: var(--spacing-xl);
    border-top: 0;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
}

.footer-content {
    position: relative;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.footer-copyright,
.footer-records {
    margin: 0;
    font-size: 14px;
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.82);
}

.framework-info {
    display: block;
}

.footer a {
    color: rgba(255, 255, 255, 0.82);
    transition: color 0.3s ease-in-out;
}

.footer a:hover {
    color: var(--primary-light);
}

.footer-records {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-separator {
    margin: 0 4px;
    color: rgba(255, 255, 255, 0.65);
}

.gaba-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gaba-link img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: sub;
}

/* ========================================
   Back to Top Button
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    color: var(--text-light);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
    z-index: 999;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* ========================================
   Pagination
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
}

.pagination-item,
.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    background: var(--bg-card);
    transition: all var(--transition-fast);
}

.pagination-item:hover,
.pagination-btn:hover {
    background: var(--primary-lighter);
    color: var(--primary-color);
}

.pagination-item.active {
    background: var(--primary-color);
    color: var(--text-light);
}

.pagination-btn {
    padding: 0 var(--spacing-md);
}

.pagination-ellipsis {
    cursor: default;
}

.pagination-ellipsis:hover {
    background: var(--bg-card);
    color: var(--text-secondary);
    transform: none;
}

/* ========================================
   Responsive Design
   ======================================== */

/* Tablet */
@media (max-width: 1199px) {
    :root {
        --sidebar-width: 320px;
    }

    .main-wrapper {
        gap: var(--spacing-lg);
    }
}

/* Mobile Landscape */
@media (max-width: 991px) {
    .main-wrapper {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }
    
    .widget {
        margin-bottom: 0;
    }
    
    .author-widget {
        grid-column: 1 / -1;
    }
}

/* Mobile Portrait */
@media (max-width: 767px) {
    :root {
        --header-height: 52px;
    }
    
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        align-items: stretch;
        background: #ffffff;
        flex-direction: column;
        padding: 0 var(--spacing-md);
        gap: 0;
        box-shadow: var(--shadow-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-item {
        display: block;
        width: 100%;
    }

    .nav-link {
        padding: 14px var(--spacing-md);
        border-bottom: 1px solid var(--border-light);
        width: 100%;
        border-radius: 0;
    }

    .nav-link::after {
        display: none;
    }

    .submenu {
        position: static;
        min-width: 0;
        max-height: 0;
        padding: 0;
        background: rgba(93, 151, 67, 0.05);
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .submenu::before {
        display: none;
    }

    .has-submenu:hover .submenu,
    .has-submenu:focus-within .submenu {
        max-height: 0;
    }

    .has-submenu.open .submenu {
        max-height: 560px;
    }

    .submenu a {
        padding: 11px 16px 11px 48px;
        border-bottom: 1px solid var(--border-light);
        border-radius: 0;
        transform: none !important;
    }

    .submenu a:hover {
        transform: none !important;
    }

    .submenu-arrow {
        margin-left: auto;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        grid-template-columns: 1fr;
    }
    
    .logo-text {
        font-size: 22px;                       /* 16→22，可读性优先 */
        letter-spacing: 0.04em;                /* 收一些，避免在窄屏超出 */
    }
    
    .logo-image {
        width: 24px;
        height: 24px;
        /* 移动端为了省电 + 流畅，关闭常驻漂浮动画 */
        animation: logoImageIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
    }
    
    .logo {
        padding: 4px 10px 6px 6px;             /* 比桌面更紧凑 */
        margin: -4px -10px -6px -6px;
    }
    
    /* 移动端不用 cursor（小屏大多数是触摸），关掉 hover 的旋转和下划线 */
    @media (hover: hover) {
        .logo:hover .logo-image { animation: logoSpin 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
        .logo:hover::after      { transform: scaleX(1); opacity: 0.9; }
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* Small Mobile */
@media (max-width: 479px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .main-wrapper {
        padding: 0 var(--spacing-sm);
    }

    .header-inner {
        padding: 0 var(--spacing-sm);
    }
    
    /* 极小屏再降一档，字距再收紧 */
    .logo-text {
        font-size: 20px;
        letter-spacing: 0.03em;
    }
    
    .logo-image {
        width: 22px;
        height: 22px;
    }
    
    .logo {
        padding: 3px 8px 5px 5px;
        margin: -3px -8px -5px -5px;
    }
}

/* ========================================
   Special Effects (加载 / 过渡 / 悬浮 / 滚动)
   ======================================== */

/* ---- 顶部加载进度条 ---- */
.page-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-color), #8fc972);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(93, 151, 67, 0.6);
    transition: width 0.35s ease, opacity 0.4s ease;
    pointer-events: none;
}

.page-progress.done {
    opacity: 0;
}

/* ---- 滚动渐入效果 ---- */
.js-ready .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.js-ready .reveal.reveal-left {
    transform: translateX(-26px);
}

.js-ready .reveal.reveal-right {
    transform: translateX(26px);
}

.js-ready .reveal.reveal-zoom {
    transform: scale(0.94);
}

.js-ready .reveal.visible {
    opacity: 1;
    transform: none;
}

/* ---- 导航链接下划线展开动画 ---- */
.nav-link::after {
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- 头像悬浮：圆盘点亮 + 内层印章旋转 ---- */
.author-avatar:hover {
    transform: scale(1.04);                            /* 圆盘只微缩放，不旋转 */
    border-color: var(--primary-light);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.95),
        0 0 0 6px rgba(93, 151, 67, 0.16),
        0 0 22px rgba(93, 151, 67, 0.35),
        0 8px 22px rgba(93, 151, 67, 0.22);
}

/* 旋转交给内层印章：圆盘静止，里面的「川」字转一圈，像盖章落定 */
.author-avatar:hover .author-avatar-img {
    transform: rotate(360deg) scale(1.06);
    filter: drop-shadow(0 3px 6px rgba(93, 151, 67, 0.32));
}

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.author-name {
    animation: floatY 3.2s ease-in-out infinite;
}

/* ---- 小部件悬浮抬升 ---- */
.widget {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
}

.widget:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* 小部件标题左侧色条悬浮伸长 */
.widget-title::before {
    transition: height var(--transition-normal);
}

.widget:hover .widget-title::before {
    height: 24px;
}

/* ---- 分页按钮悬浮 ---- */
.pagination-item,
.pagination-btn {
    transition: all var(--transition-fast);
}

.pagination-item:hover,
.pagination-btn:hover {
    transform: translateY(-2px);
}

/* ---- 返回顶部按钮呼吸 ---- */
.back-to-top.visible {
    animation: floatY 2.6s ease-in-out infinite;
}

/* ---- 页脚链接下划线渐变 ---- */
.footer a {
    position: relative;
}

.footer a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width var(--transition-normal);
}

.footer a:hover::after {
    width: 100%;
}

/* ---- 图片加载淡入 ---- */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

img[loading="lazy"].img-loaded,
.no-js img[loading="lazy"] {
    opacity: 1;
}

/* ---- 尊重用户减弱动画偏好 ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .js-ready .reveal {
        opacity: 1;
        transform: none;
    }
}
