/**
 * 甜蜜相册瀑布流样式
 *
 * @package Brave_Love
 */

/* ==================== 年份筛选 ==================== */
.gallery-year-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: var(--page-stack-gap);
    padding: 0;
}

.gallery-year-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--page-chip-min-height);
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--editorial-border-subtle);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: var(--page-chip-font-size);
    font-weight: 500;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(255, 81, 98, 0.06);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-year-item:hover {
    background: rgba(255, 81, 98, 0.06);
    border-color: rgba(255, 81, 98, 0.26);
    color: var(--primary-color);
    box-shadow: 0 8px 18px rgba(255, 81, 98, 0.08);
    transform: translateY(-1px);
}

.gallery-year-item.active {
    background: linear-gradient(135deg, var(--primary-color), #ff6b7a);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 22px rgba(255, 81, 98, 0.2);
}

/* ==================== 瀑布流布局 ==================== */
.gallery-waterfall {
    column-count: 1;
    column-gap: 1rem;
    padding: 0;
}

@media (min-width: 640px) {
    .gallery-waterfall {
        column-count: 2;
    }
}

@media (min-width: 980px) {
    .gallery-waterfall {
        column-count: 3;
    }
}

/* ==================== 照片卡片 ==================== */
.gallery-item {
    break-inside: avoid;
    margin-bottom: var(--page-stack-gap-tight);
    position: relative;
    border-radius: var(--page-card-radius);
    overflow: hidden;
    box-shadow: var(--page-card-shadow);
    background: var(--card-bg);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--page-card-shadow-hover);
}

.gallery-item-link {
    display: block;
    position: relative;
    text-decoration: none;
}

.gallery-item-img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.5s ease;
}

.gallery-item:hover .gallery-item-img {
    transform: scale(1.03);
}

/* 宽高比特殊处理 */
.gallery-item.tall .gallery-item-img {
    aspect-ratio: 3/4;
    object-fit: cover;
}

.gallery-item.wide .gallery-item-img {
    aspect-ratio: 16/9;
    object-fit: cover;
}

/* ==================== 悬停信息层 ==================== */
.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2rem 1rem 1rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    font-size: 0.8rem;
}

.gallery-item-date {
    font-weight: 500;
}

.gallery-item-location {
    opacity: 0.9;
}

.gallery-item-mood {
    font-size: 1rem;
    margin-left: auto;
}

/* ==================== 空状态 ==================== */
.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    border: 1px solid rgba(255, 81, 98, 0.08);
    border-radius: var(--page-card-radius);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--page-card-shadow);
}

.gallery-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.gallery-empty-title {
    font-size: 1.12rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.gallery-empty-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-empty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: 1px solid rgba(255, 81, 98, 0.18);
    background: var(--editorial-surface-active);
    color: var(--primary-color);
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    box-shadow:
        0 10px 22px rgba(255, 81, 98, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-empty-btn:hover {
    border-color: rgba(255, 81, 98, 0.24);
    background: linear-gradient(180deg, rgba(255, 229, 235, 1), rgba(255, 242, 245, 1));
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow:
        0 12px 24px rgba(255, 81, 98, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* ==================== 分页 ==================== */
.gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.22rem;
    padding: 0;
}

.gallery-waterfall + .gallery-pagination {
    margin-top: 0.96rem;
}

/* ==================== PhotoSwipe 自定义样式 ==================== */
.pswp__custom-info {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    max-width: 90%;
    width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
}

.pswp__custom-info.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.pswp-info-content {
    text-align: center;
}

.pswp-info-date {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.pswp-info-location,
.pswp-info-mood {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0.5rem;
}

.pswp-info-summary {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.pswp-info-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 81, 98, 0.18);
    background: var(--editorial-surface-active);
    color: var(--primary-color);
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow:
        0 10px 22px rgba(255, 81, 98, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.pswp-info-link:hover {
    border-color: rgba(255, 81, 98, 0.24);
    background: linear-gradient(180deg, rgba(255, 229, 235, 1), rgba(255, 242, 245, 1));
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow:
        0 12px 24px rgba(255, 81, 98, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

/* 暗黑模式适配 */

        html[data-theme="dark"] .gallery-year-item {
        background: var(--editorial-surface-muted);
        border-color: var(--editorial-border-subtle);
        color: #c1bac6;
        box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
    }

        html[data-theme="dark"] .gallery-year-item:hover {
        background: var(--editorial-accent-wash);
        border-color: rgba(255, 81, 98, 0.32);
        color: #ff8f9b;
    }

        html[data-theme="dark"] .gallery-year-item.active {
        color: #fff;
        box-shadow: 0 10px 22px rgba(255, 81, 98, 0.24);
    }

        html[data-theme="dark"] .gallery-empty {
        background: #1e1e1e;
        border-color: var(--editorial-border-subtle);
        box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
    }

        html[data-theme="dark"] .gallery-empty-title {
        color: #f3f3f3;
    }

        html[data-theme="dark"] .gallery-empty-desc {
        color: #a8a1ad;
    }

        html[data-theme="dark"] .gallery-empty-btn,
    html[data-theme="dark"] .pswp-info-link {
        background: var(--editorial-surface-active);
        border-color: var(--editorial-border-strong);
        color: #ffe5ea;
        box-shadow:
            0 12px 24px rgba(0, 0, 0, 0.24),
            inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }

        html[data-theme="dark"] .gallery-empty-btn:hover,
    html[data-theme="dark"] .pswp-info-link:hover {
        border-color: rgba(255, 143, 155, 0.28);
        color: #ffeef1;
    }

        html[data-theme="dark"] .pswp__custom-info {
        background: rgba(40, 40, 40, 0.95);
    }
    
        html[data-theme="dark"] .pswp-info-date {
        color: #fff;
    }
    
        html[data-theme="dark"] .pswp-info-summary {
        color: #ddd;
    }


/* 移动端适配 */
@media (max-width: 576px) {
    .gallery-waterfall + .gallery-pagination {
        margin-top: 0.9rem;
    }

    .pswp__custom-info {
        bottom: 70px;
        width: calc(100% - 2rem);
        padding: 1rem;
    }
    
    .pswp-info-date {
        font-size: 1rem;
    }
    
    .pswp-info-summary {
        max-height: 60px;
        -webkit-line-clamp: 2;
    }
}

/* ==================== 加载动画 ==================== */
.gallery-loading {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.gallery-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: gallery-spin 1s linear infinite;
}

@keyframes gallery-spin {
    to {
        transform: rotate(360deg);
    }
}
