/* article.css - 随笔列表页面样式（适配导航链接 + 随笔专属卡片流） */

/* 基础重置与全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: 100px;
}

/* 悬浮导航栏 - 链接样式 */
body > a:not([href^='/essay/']):not([href^='/article/']) {
    display: inline-block;
    position: fixed;
    top: 0;
    z-index: 1000;
    text-decoration: none;
    padding: 10px 6px;
    font-weight: 600;
    font-size: 0.75rem;
    color: #fff;
    background-color: rgba(52, 73, 94, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-align: center;
    backdrop-filter: blur(10px);
    height: 45px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 导航链接悬停效果 */
body > a:not([href^='/essay/']):not([href^='/article/']):hover {
    background-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* 为每个导航链接定位 */
body > a[href='/']:not([href^='/essay/']):not([href^='/article/']) {
    left: 0;
    width: 8%;
    min-width: 55px;
}

body > a[href='/publicShare']:not([href^='/essay/']):not([href^='/article/']) {
    left: 8%;
    width: 12%;
    min-width: 85px;
}

body > a[href='/article']:not([href^='/essay/']):not([href^='/article/']) {
    left: 20%;
    width: 8%;
    min-width: 60px;
    background-color: #3498db;
}

body > a[href='/chat']:not([href^='/essay/']):not([href^='/article/']) {
    left: 28%;
    width: 10%;
    min-width: 70px;
}

body > a[href='/tools']:not([href^='/essay/']):not([href^='/article/']) {
    left: 38%;
    width: 8%;
    min-width: 60px;
}

body > a[href='/login']:not([href^='/essay/']):not([href^='/article/']) {
    left: 46%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/signUp']:not([href^='/essay/']):not([href^='/article/']) {
    left: 53%;
    width: 7%;
    min-width: 55px;
}

body > a[href='/comment']:not([href^='/essay/']):not([href^='/article/']) {
    left: 60%;
    width: 12%;
    min-width: 85px;
}

/* xsx图片链接单独处理，固定在右上角（如果存在） */
body > a[href='/xsx'] {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1001;
    width: 55px;
    height: 45px;
    background: transparent;
    border: none;
    padding: 0;
    backdrop-filter: none;
}

/* 页面主标题 - 随笔专属 */
h1, .page-title {
    margin: 30px auto 40px;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 1px;
    padding-bottom: 15px;
    border-bottom: 3px solid #e67e22;
    max-width: 90%;
    text-align: center;
    position: relative;
}

/* 添加随笔图标到标题 */
h1::before, .page-title::before {
    content: "✍️ ";
    margin-right: 10px;
}

/* 随笔链接容器样式 (核心美化) */
body > a[href^='/essay/'] {
    display: block;
    width: 85%;
    max-width: 700px;
    margin: 20px auto;
    text-decoration: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
    color: #2c3e50;
    padding: 20px 30px;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    border-left: 5px solid #e67e22;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* 随笔链接悬停效果 */
body > a[href^='/essay/']:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(230, 126, 34, 0.25);
    border-left-color: #f39c12;
    color: #e67e22;
}

/* 随笔链接激活效果 */
body > a[href^='/essay/']:active {
    transform: translateY(0) scale(0.98);
}

/* 随笔链接图标 */
body > a[href^='/essay/']::before {
    content: "📝 ";
    margin-right: 10px;
    font-size: 1.2em;
}

/* 随笔链接添加装饰箭头 */
body > a[href^='/essay/']::after {
    content: "→";
    margin-left: 15px;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: inline-block;
}

body > a[href^='/essay/']:hover::after {
    opacity: 1;
    transform: translateX(5px);
}

/* 第一个随笔链接的上边距优化 */
body > a[href^='/essay/']:first-of-type {
    margin-top: 30px;
}

/* 空div的隐藏和装饰 */
div:empty {
    display: none;
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body {
        padding: 15px;
        padding-top: 100px;
    }
    
    /* 导航栏在小屏幕上垂直堆叠 */
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        position: fixed;
        display: block;
        width: 100% !important;
        left: 0 !important;
        top: auto;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.8rem;
        height: 36px;
        text-align: left;
        padding-left: 20px;
    }
    
    /* 为每个导航链接设置垂直位置 */
    body > a[href='/']:not([href^='/essay/']):not([href^='/article/']) { top: 0; }
    body > a[href='/publicShare']:not([href^='/essay/']):not([href^='/article/']) { top: 36px; }
    body > a[href='/article']:not([href^='/essay/']):not([href^='/article/']) { top: 72px; }
    body > a[href='/chat']:not([href^='/essay/']):not([href^='/article/']) { top: 108px; }
    body > a[href='/tools']:not([href^='/essay/']):not([href^='/article/']) { top: 144px; }
    body > a[href='/login']:not([href^='/essay/']):not([href^='/article/']) { top: 180px; }
    body > a[href='/signUp']:not([href^='/essay/']):not([href^='/article/']) { top: 216px; }
    body > a[href='/comment']:not([href^='/essay/']):not([href^='/article/']) { top: 252px; }
    
    /* xsx图片链接在移动端调整位置 */
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 45px;
        height: 36px;
    }
    
    h1, .page-title {
        margin-top: 290px;
        font-size: 2rem;
    }
    
    body > a[href^='/essay/'] {
        width: 95%;
        margin: 15px auto;
        padding: 16px 20px;
        font-size: 1.1rem;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        font-size: 0.7rem;
        padding: 10px 4px;
        height: 42px;
    }
    
    body > a[href='/publicShare']:not([href^='/essay/']):not([href^='/article/']),
    body > a[href='/comment']:not([href^='/essay/']):not([href^='/article/']) {
        font-size: 0.65rem;
    }
    
    h1, .page-title {
        font-size: 2.8rem;
    }
    
    body > a[href^='/essay/'] {
        width: 90%;
        font-size: 1.15rem;
        padding: 18px 25px;
    }
}

/* 桌面端优化 */
@media (min-width: 1025px) {
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        padding: 12px 8px;
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInFromLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromTop {
    0% { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

h1, .page-title {
    animation: fadeIn 0.8s ease-out;
}

body > a[href^='/essay/'] {
    animation: slideInFromLeft 0.6s ease-out;
}

body > a[href^='/essay/']:nth-child(odd) {
    animation-delay: 0.1s;
}

body > a[href^='/essay/']:nth-child(even) {
    animation-delay: 0.2s;
}

body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
    animation: slideInFromTop 0.5s ease-out;
}

/* 顶部装饰渐变条 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(to right, #e67e22, #f39c12, #e67e22, #d35400);
    z-index: 1002;
}

/* 添加页面背景装饰点 */
body {
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(230, 126, 34, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 90% 30%, rgba(243, 156, 18, 0.05) 0%, transparent 20%),
        radial-gradient(circle at 50% 80%, rgba(211, 84, 0, 0.05) 0%, transparent 20%);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 移动端导航栏完整适配 */
@media (max-width: 768px) {
    /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body {
        padding-top: 320px;
    }
    
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        position: fixed;
        display: flex;
        align-items: center;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 40px;
        padding: 0 15px;
        margin: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.85rem;
        font-weight: 500;
        text-align: left;
        background-color: rgba(52, 73, 94, 0.98);
        backdrop-filter: blur(10px);
        z-index: 1000;
        border-radius: 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    body > a[href='/']:not([href^='/essay/']) { top: 0; }
    body > a[href='/publicShare']:not([href^='/essay/']) { top: 40px; }
    body > a[href='/article']:not([href^='/essay/']) { top: 80px; }
    body > a[href='/chat']:not([href^='/essay/']) { top: 120px; }
    body > a[href='/tools']:not([href^='/essay/']) { top: 160px; }
    body > a[href='/login']:not([href^='/essay/']) { top: 200px; }
    body > a[href='/signUp']:not([href^='/essay/']) { top: 240px; }
    body > a[href='/comment']:not([href^='/essay/']) { top: 280px; }
    
    body > a[href='/xsx'] {
        position: fixed;
        top: 0;
        right: 0;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        z-index: 1001;
    }
    
    h1, .page-title {
        margin-top: 340px;
        font-size: 1.8rem;
    }
    
    body > a[href^='/essay/'] {
        width: 95%;
        margin: 15px auto;
        padding: 14px 18px;
        font-size: 1rem;
    }
    
    body {
        padding-top: calc(40px * 8);
    }
    
    h1, .page-title {
        margin-top: calc(40px * 8 + 30px);
    }
}

/* 超小屏幕 (≤480px) */
@media (max-width: 480px) {
    /* 移动端强制隐藏随笔链接 */
    body > a[href='/essay'] {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        height: 38px;
        font-size: 0.75rem;
        padding: 0 12px;
    }
    
    body > a[href='/'] { top: 0; }
    body > a[href='/publicShare'] { top: 38px; }
    body > a[href='/article'] { top: 76px; }
    body > a[href='/chat'] { top: 114px; }
    body > a[href='/tools'] { top: 152px; }
    body > a[href='/login'] { top: 190px; }
    body > a[href='/signUp'] { top: 228px; }
    body > a[href='/comment'] { top: 266px; }
    
    body {
        padding-top: calc(38px * 8);
    }
    
    h1, .page-title {
        margin-top: calc(38px * 8 + 40px);
        font-size: 1.5rem;
    }
    
    body > a[href='/xsx'] {
        width: 38px;
        height: 38px;
    }
    
    body > a[href^='/essay/'] {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
}

/* 移动端折叠/展开按钮样式 */
.nav-toggle-btn {
    display: none;
    position: fixed;
    top: 5px;
    left: 10px;
    z-index: 1002;
    width: 44px;
    height: 44px;
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.nav-toggle-btn:hover {
    background: #d35400;
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .nav-toggle-btn {
        display: block;
    }
}

@media (max-width: 480px) {
    .nav-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 24px;
        top: 3px;
        left: 8px;
    }
}

/* 移动端折叠功能 */
@media (max-width: 768px) {
    body > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        transform: translateX(0) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s;
    }
    
    body.nav-collapsed > a:not([href^='/essay/']):not([href^='/article/']):not([href='/xsx']) {
        transform: translateX(-100%) !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}

/* 随笔列表底部装饰 */
body > div:last-of-type {
    margin-bottom: 20px;
}

/* ========= 桌面端：鼠标放在"文章"上时在下方展开显示"随笔"链接 ========= */
@media (min-width: 769px) {
    /* 默认隐藏随笔导航项 */
    body > a[href='/essay'] {
        display: none !important;
        opacity: 0;
        visibility: hidden;
        position: fixed;
        top: 40px !important;  /* 关键：设置在文章链接的正下方 */
        left: 20%;
        width: 8%;
        min-width: 60px;
        background-color: rgba(52, 73, 94, 0.98);
        backdrop-filter: blur(12px);
        border-radius: 0 0 8px 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        height: 40px;
        line-height: 40px;
        padding: 0 6px;
        font-size: 0.75rem;
        text-align: center;
        z-index: 999;
        transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        transform: translateY(-10px);
        pointer-events: none;
    }
    
    /* 当鼠标悬浮在"文章"链接上时，显示"随笔"链接（由于文章在前，需要使用相邻兄弟选择器） */
    body > a[href='/article']:hover + a[href='/essay'],
    body > a[href='/article']:hover ~ a[href='/essay'] {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    
    /* 确保随笔链接在文章链接后面（HTML顺序：文章在随笔之前，所以+和~都能选中） */
    /* 注意：如果随笔链接被显示，它必须紧跟在文章链接后面才能用+选中，这里用~更保险 */
    
    /* 当鼠标移动到"随笔"链接上时，保持展开状态 */
    body > a[href='/essay']:hover {
        display: inline-block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
        background-color: #e67e22 !important;
    }
    
    /* 文章链接悬浮时改变背景色 */
    body > a[href='/article']:hover {
        background-color: #e67e22;
    }
    
    /* 随笔链接悬停效果 */
    body > a[href='/essay']:hover {
        background-color: #e67e22 !important;
        transform: translateY(2px);
    }
}

/* 动画 */
@keyframes essayDropdownIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
