/* ── Custom Gallery — Frontend Styles ── */

/* ─── Album Grid ──────────────────────────────────────────── */

.cg-album-grid {
    display: grid;
    gap: 20px;
    margin: 24px 0;
}

.cg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cg-cols-4 { grid-template-columns: repeat(4, 1fr); }

.cg-album-card {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: transform .2s, box-shadow .2s;
    background: #fff;
}

.cg-album-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
}

.cg-album-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.cg-album-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #e5e5e5;
}

.cg-album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
}

.cg-album-card:hover .cg-album-thumb img {
    transform: scale(1.04);
}

.cg-no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #888;
}

.cg-album-title {
    padding: 10px 14px 12px;
}

.cg-album-title h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
}

/* ─── Pagination ─────────────────────────────────────────── */

.cg-pagination {
    margin: 24px 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.cg-pagination a,
.cg-pagination span {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    text-decoration: none;
    color: #333;
    background: #fff;
}

.cg-pagination .current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* ─── Single Album View ──────────────────────────────────── */

.cg-single-album {
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

.cg-album-header {
    margin-bottom: 20px;
}

.cg-back-link {
    font-size: 14px;
    text-decoration: none;
    color: #0073aa;
    display: inline-block;
    margin-bottom: 8px;
}

.cg-back-link:hover {
    text-decoration: underline;
}

.cg-album-heading {
    margin: 0;
    font-size: 22px;
}

.cg-image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
}

.cg-gallery-item {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
    background: #f0f0f0;
    aspect-ratio: 1;
    cursor: pointer;
}

.cg-lightbox-trigger {
    display: block;
    width: 100%;
    height: 100%;
}

.cg-lightbox-trigger img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease, filter .3s ease;
}

.cg-gallery-item:hover .cg-lightbox-trigger img {
    transform: scale(1.05);
    filter: brightness(.85);
}

.cg-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 12px;
    padding: 5px 8px;
    text-align: center;
    transform: translateY(100%);
    transition: transform .25s ease;
    line-height: 1.3;
}

.cg-gallery-item:hover .cg-caption {
    transform: translateY(0);
}

/* ─── Lightbox ───────────────────────────────────────────── */

.cg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    flex-direction: row;
}

.cg-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cg-lightbox-content img {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0,0,0,.6);
}

.cg-lb-caption {
    color: #e0e0e0;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
    line-height: 1.4;
    min-height: 20px;
}

.cg-lightbox-close,
.cg-lightbox-prev,
.cg-lightbox-next {
    background: rgba(255,255,255,.12);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}

.cg-lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border-radius: 50%;
    font-size: 22px;
    z-index: 2;
}

.cg-lightbox-prev,
.cg-lightbox-next {
    margin: 0 10px;
}

.cg-lightbox-close:hover,
.cg-lightbox-prev:hover,
.cg-lightbox-next:hover {
    background: rgba(255,255,255,.28);
}

/* ─── Utility Messages ───────────────────────────────────── */

.cg-no-albums,
.cg-no-images,
.cg-error {
    padding: 16px;
    background: #f8f8f8;
    border-left: 4px solid #ccc;
    border-radius: 3px;
    color: #555;
    font-size: 14px;
}

/* ─── Responsive ─────────────────────────────────────────── */

@media ( max-width: 768px ) {
    .cg-cols-3,
    .cg-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .cg-image-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cg-lightbox-prev,
    .cg-lightbox-next {
        margin: 0 4px;
    }
}

@media ( max-width: 480px ) {
    .cg-cols-2,
    .cg-cols-3,
    .cg-cols-4 {
        grid-template-columns: 1fr;
    }
}