/* Justified gallery layout — CSS flexbox + JS enhancement */

.justified-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Hidden gallery — used for podium lightbox triggers */
.justified-gallery--hidden {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

/* Prevent last row from stretching */
.justified-gallery::after {
    content: '';
    flex-grow: 999999;
}

.justified-gallery__item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
}

.justified-gallery__item img {
    height: 250px;
    object-fit: cover;
    width: 100%;
    display: block;
    transition: transform 0.3s ease;
}

.justified-gallery__item:hover img {
    transform: scale(1.03);
}

/* Focal zoom: image rendered at natural pixel size (2× rendition)
   inside the smaller container → ~2× zoom on the zone of interest.
   object-position centres the view on the focal point. */
.justified-gallery__item--focal img {
    object-fit: none;
}

/* Compact variant (profile pages) */
.justified-gallery--compact .justified-gallery__item img {
    height: 180px;
}

/* JS-enhanced: heights are set inline, override default */
.justified-gallery--enhanced .justified-gallery__item img {
    height: 100%;
}

/* Caption hidden in grid, read by PhotoSwipe */
.pswp-caption-content {
    display: none;
}

/* Overlay on hover */
.gallery-overlay {
    position: absolute;
    z-index: 2;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 10px 8px;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    box-sizing: border-box;
}

.justified-gallery__item:hover .gallery-overlay {
    opacity: 1;
    pointer-events: auto;
}

.gallery-overlay__info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.3;
}

.gallery-overlay__info strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-overlay__info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.85;
    font-size: 0.78rem;
}

.gallery-overlay__actions {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
}

button.gallery-overlay__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 14px;
    font-weight: normal;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

button.gallery-overlay__btn:hover {
    background: rgba(255, 255, 255, 0.35);
    text-decoration: none;
    transform: none;
}

.gallery-overlay__btn--like.liked {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.25);
}

button.gallery-overlay__btn--comment {
    position: relative;
    overflow: visible;
}

.gallery-overlay__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    pointer-events: none;
}

.gallery-overlay__badge--unread {
    background: #e74c3c;
}

/* Maximize button in PhotoSwipe toolbar */
.pswp__button--maximize {
    width: 50px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pswp__button--maximize svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* Fullscreen button in PhotoSwipe toolbar */
.pswp__button--fullscreen {
    width: 50px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pswp__button--fullscreen svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .justified-gallery__item img {
        height: 150px;
    }
    .justified-gallery--compact .justified-gallery__item img {
        height: 130px;
    }
}

@media (max-width: 480px) {
    .justified-gallery__item img {
        height: 120px;
    }
    .justified-gallery--compact .justified-gallery__item img {
        height: 100px;
    }
}
