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

/* ---- Masonry Grid ---- */
.posts-grid {
    position: relative;
    width: 100%;
}

.posts-grid .post-card {
    margin-bottom: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

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

/* ---- Cover Image ---- */
.post-card-cover {
    display: block;
    overflow: hidden;
    cursor: zoom-in;
    border-radius: 8px;
    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;
    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;
    -webkit-line-clamp: 1;
}

/* Mobile */
@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 ---- */
.posts-grid .post-card-text {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #eee;
}
.posts-grid .post-card-text .post-card-inner {
    padding: 0;
}

/* ---- Inline Video Player ---- */
.inline-video-wrap {
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    position: relative;
    aspect-ratio: 16 / 9;
}

.inline-video-wrap video {
    width: 100% !important;
    height: 100% !important;
    display: block;
    object-fit: contain;
}

.inline-video-wrap .video-js {
    width: 100% !important;
}

.inline-video-wrap .vjs-big-play-button {
    width: 64px;
    height: 64px;
    line-height: 64px;
    font-size: 2.4em;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    top: 50%;
    left: 50%;
    margin-top: -32px;
    margin-left: -32px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.inline-video-wrap .vjs-big-play-button:hover {
    background: rgba(0, 0, 0, 0.75);
    transform: scale(1.08);
}

.inline-video-wrap .vjs-control-bar {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
    height: 3em;
}

.video-card-title {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    background: #fff;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Lightbox (图片专用) ---- */
#lightbox {
    padding: 3rem 5rem;
}

#lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    /* responsive handled by JS layoutMasonry */
}

@media (max-width: 768px) {
    /* responsive handled by JS layoutMasonry */
    #lightbox { padding: 0.5rem; }
}
.container .page-gallery { max-width: 1600px; width: 100%; flex: 1; }
/* ---- Lazy Load Fade-in ---- */
.post-card-cover > img {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}

.post-card-cover > img.loaded {
    opacity: 1;
}
