/* ==========================================================================
   全局核心变量与基础重置
   ========================================================================== */
   :root {
    --primary-color: #2c3e50;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    line-height: 1.8;
}

/* ==========================================================================
   全局统一导航栏与智能搜索框 
   ========================================================================== */
.site-header {
    background: var(--card-bg);
    padding: 15px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.site-logo {
    text-decoration: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: bold;
}

.search-form {
    display: flex;
    align-items: center;
    background: #f1f3f5;
    border-radius: 30px;
    overflow: hidden;
    padding: 3px 5px;
    transition: all 0.3s;
}

.search-form:focus-within {
    background: #fff;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.search-form input {
    border: none;
    background: transparent;
    padding: 8px 15px;
    outline: none;
    font-size: 0.95rem;
    width: 180px;
    color: var(--text-color);
    transition: width 0.3s;
}

.search-form input:focus {
    width: 220px;
}

.search-form button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: opacity 0.2s;
    flex-shrink: 0;         
    white-space: nowrap;    
}

.search-form button:hover {
    opacity: 0.8;
}

/* ==========================================================================
   列表页样式 (首页/标签页/Coser聚合页)
   ========================================================================== */
.page-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    color: #444;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0,0,0,0.1);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4; /* 📸 竖向人像海报比例 */
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.card-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.card-meta {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.coser-badge {
    background: #eee;
    padding: 3px 8px;
    border-radius: 4px;
    color: #555;
}

.empty-state {
    text-align: center;
    color: #888;
    grid-column: 1 / -1;
    padding: 50px;
    font-size: 1.1rem;
}

/* ==========================================================================
   极简通用分页控件
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding-bottom: 60px;
}

.page-btn {
    padding: 8px 24px;
    background: var(--card-bg);
    border: 1px solid #ddd;
    border-radius: 30px;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    transition: all 0.2s;
}

.page-btn:hover:not(.disabled) {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.page-btn.disabled {
    color: #bbb;
    cursor: not-allowed;
    background: transparent;
    border-color: #eee;
}

.page-info {
    color: #666;
    font-size: 0.95rem;
    font-weight: bold;
}

/* ==========================================================================
   图文详情页专属样式 (双栏布局)
   ========================================================================== */
.layout-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 60px;
}

.post-container {
    flex: 1; 
    min-width: 0; 
    padding: 30px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px); /* 防止侧栏拉伸页面，开启内部滚动 */
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: #e2e8f0;
    border-radius: 4px;
}

.sidebar-title {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid #f1f3f5;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

/* ==========================================================================
   侧栏推荐小卡片 (竖向大图视觉版)
   ========================================================================== */
.recommend-card {
    display: flex;
    flex-direction: column; 
    gap: 10px; 
    margin-bottom: 25px; 
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, opacity 0.2s;
}

.recommend-card:hover {
    transform: translateY(-4px); 
    opacity: 0.85;
}

.recommend-card img {
    width: 100%; 
    aspect-ratio: 3 / 4; /* 📸 侧栏同样改为竖向人像比例 */
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05); 
}

.rec-info {
    display: block; 
    padding: 0 4px; 
}

.rec-info h4 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--primary-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.empty-rec {
    font-size: 0.9rem;
    color: #999;
    text-align: center;
    padding: 20px 0;
}

/* ==========================================================================
   图文正文排版
   ========================================================================== */
.post-header {
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.post-header h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 15px;
    line-height: 1.3;
}

.post-meta {
    color: #888;
    font-size: 0.95rem;
    line-height: 1.6;
}

.coser-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    border-bottom: 2px dashed rgba(44, 62, 80, 0.3);
    transition: all 0.2s ease;
    padding-bottom: 2px;
    display: inline-block; /* 防止超长名字被截断换行 */
    white-space: nowrap; 
}

.coser-link:hover {
    border-bottom-color: var(--primary-color);
    opacity: 0.8;
}

.post-content {
    font-size: 1.1rem;
    color: #444;
}

.post-text {
    margin-top: 40px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.post-text p {
    margin: 0;
    line-height: 1.8;
}

.post-content figure {
    margin: 5px 0;
    padding: 5px;
    background: var(--bg-color);
    border-radius: 12px;
    text-align: center;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    cursor: zoom-in;
}

.post-content figcaption {
    margin-top: 12px;
    font-size: 0.95rem;
    color: #666;
    font-style: italic;
}

.post-footer {
    margin-top: 50px;
    padding-top: 20px;
    text-align: center;
    border-top: 1px solid #eee;
}

.tag {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    margin: 5px;
    transition: opacity 0.2s;
}

.tag:hover {
    opacity: 0.8;
}

/* ==========================================================================
   404 错误页面专属样式
   ========================================================================== */
.error-container {
    max-width: 800px;
    margin: 100px auto;
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.error-code {
    font-size: 6rem;
    font-weight: 900;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
    letter-spacing: -2px;
}

.error-message {
    font-size: 1.2rem;
    color: #666;
    margin: 20px 0 40px;
}

.home-btn {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    text-decoration: none;
    padding: 12px 32px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(44, 62, 80, 0.2);
}

/* ==========================================================================
   全屏图片放大镜 (Lightbox) 样式
   ========================================================================== */
#lightbox {
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); 
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.3s ease; 
    backdrop-filter: blur(5px); 
}

#lightbox.active {
    opacity: 1;
    pointer-events: auto;
    cursor: zoom-out; 
}

#lightbox img {
    max-width: 90%;
    max-height: 90vh; 
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    cursor: grab; 
    touch-action: none; 
}

#lightbox img:active {
    cursor: grabbing;
}

/* ==========================================================================
   移动端响应式高级媒体查询
   ========================================================================== */
@media (max-width: 900px) {
    .header-inner {
        flex-direction: column;
        justify-content: center;
    }
    .search-form {
        width: 100%;
        box-sizing: border-box;
    }
    .search-form input {
        width: 100%;
        flex-grow: 1;
    }
    .search-form input:focus {
        width: 100%; 
    }
    
    .layout-wrapper {
        flex-direction: column;
    }
    .post-container {
        padding: 20px 5px; 
    }
    .sidebar {
        width: 100%;
        position: static; 
        box-sizing: border-box;
    }
}