/* =====================
   Gallery — 随拍画廊专用
   ===================== */

/* ---- Masonry Grid ---- */
.posts-grid {
    display: block;
    columns: 3;
    column-gap: 0.6rem;
}

.posts-grid .post-card {
    break-inside: avoid;
    margin-bottom: 0.6rem;
    background: transparent;
    border: none;
    border-radius: 0;
}

.posts-grid .post-card:not(:has(img)):not(:has(.post-card-inner)) {
    display: none;
}

/* ---- Cover Image ---- */
.post-card-cover {
    display: block;
    overflow: hidden;
    cursor: zoom-in;
    border-radius: var(--radius-lg);
    position: relative;
}

.post-card-cover img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

/* ---- Hover Overlay (Pinterest-style) ---- */
.post-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.post-card-cover:hover .post-card-overlay {
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 0.4rem 0;
    color: #fff;
    /* 4 方向 1px 黑色描边 + 柔光阴影,任何背景都清晰 */
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.85),
         1px -1px 0 rgba(0, 0, 0, 0.85),
        -1px  1px 0 rgba(0, 0, 0, 0.85),
         1px  1px 0 rgba(0, 0, 0, 0.85),
         0 2px 8px rgba(0, 0, 0, 0.45);
    /* 限制行数,长标题省略 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.overlay-excerpt {
    font-size: 0.82rem;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
    /* 摘要也加描边,深色背景清晰 */
    text-shadow:
        -1px -1px 0 rgba(0, 0, 0, 0.7),
         1px -1px 0 rgba(0, 0, 0, 0.7),
        -1px  1px 0 rgba(0, 0, 0, 0.7),
         1px  1px 0 rgba(0, 0, 0, 0.7);
    /* 限制行数,长摘要省略 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 纯图文章摘要:更克制,字号略小,半透明 */
.overlay-pure-image {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 0.25rem;
    /* 限制行数:1 行 */
    -webkit-line-clamp: 1;
}

/* 移动端:hover 不可用 → 直接显示浅色标题(永远不遮盖主图) */
@media (max-width: 768px) {
    .post-card-overlay {
        opacity: 1;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 60%);
        align-items: flex-end;
        justify-content: flex-end;
        padding: 0.6rem 0.8rem;
    }
    .overlay-title {
        font-size: 0.85rem;
        -webkit-line-clamp: 1;
    }
    .overlay-excerpt {
        display: none;       /* 移动端隐藏摘要(底部空间有限) */
    }
}

/* ---- Photo Count Badge ---- */
.photo-count {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 1;
    pointer-events: none;
    letter-spacing: 0.02em;
}

.post-card:hover .post-card-cover img {
    transform: scale(1.03);
}

/* ---- Text fallback for SP without images ---- */
.posts-grid .post-card-text {
    background: var(--card-bg, #fff);
    border-radius: var(--radius-lg);
    padding: 1rem;
    border: 1px solid var(--border-color, #eee);
}
.posts-grid .post-card-text .post-card-inner {
    padding: 0;
}

/* ---- Video card in gallery ---- */
.posts-grid .post-card-video .post-card-cover {
    position: relative;
    background: var(--card-bg, #f0f0f0);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background: rgba(0,0,0,0.03);
}
.play-icon {
    width: 56px;
    height: 56px;
    color: rgba(255,255,255,0.9);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    transition: transform 0.2s ease;
}
.post-card-video:hover .play-icon {
    transform: scale(1.15);
}
.posts-grid .post-card-video img {
    opacity: 0.7;
}

/* ---- Lightbox video ---- */
.lightbox-media {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: min(90vw, 1200px);
    max-height: 90vh;
}
.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-video {
    max-width: 90vw;
    max-height: 90vh;
    width: 100%;
    border-radius: 4px;
    background: #000;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .posts-grid { columns: 2; }
}

@media (max-width: 768px) {
    .posts-grid { columns: 1; }
}
