/* ==========================================================================
   Ken Pond Creative Photography - Gallery CSS
   Pixieset-style photo gallery with lightbox
   HIGHLY SCOPED - explicit values, no inherit, no variables
   ========================================================================== */

/* ===== EXPLICIT RESETS FOR GALLERY PAGES ===== */
.gallery-page,
.galleries-page {
    display: block;
    box-sizing: border-box;
    width: 100%;
}

.gallery-page img,
.galleries-page img {
    border-radius: 0;
    border: none;
}

/* ===== Gallery Header ===== */
.gallery-page .gallery-header,
.galleries-page .gallery-header {
    text-align: center;
    padding: 3rem 1rem 2.5rem;
    max-width: 900px;
    margin: 0 auto;
    background: transparent;
    border: none;
    border-radius: 0;
}

.gallery-page .gallery-header .gallery-logo,
.galleries-page .gallery-header .gallery-logo {
    width: 220px;
    height: auto;
    max-height: none;
    margin: 0 auto 1rem auto;
    display: block;
    border: none;
    border-radius: 0;
    background: transparent;
    object-fit: contain;
    aspect-ratio: auto;
}

.gallery-page .gallery-header .gallery-subtitle,
.galleries-page .gallery-header .gallery-subtitle {
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #666;
    margin: 0 0 1.5rem 0;
    padding: 0;
    border: none;
    background: transparent;
}

.gallery-page .gallery-header .gallery-title,
.galleries-page .gallery-header .gallery-title {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
    padding: 0;
    color: #000;
    border: none;
    background: transparent;
}

.gallery-page .gallery-header .gallery-date,
.galleries-page .gallery-header .gallery-date {
    font-family: 'Manrope', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
    margin-top: 0.5rem;
    padding: 0;
    border: none;
    background: transparent;
}

/* ===== Gallery Archive (selection page) ===== */
.galleries-page .galleries-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
    border: none;
    background: transparent;
}

.galleries-page .gallery-card {
    text-align: center;
    text-decoration: none;
    color: #000;
    display: block;
    border: none;
    background: transparent;
    border-radius: 0;
}

.galleries-page .gallery-card .gallery-card-image {
    aspect-ratio: 1;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #f0f0f0;
    border: none;
    border-radius: 0;
}

.galleries-page .gallery-card .gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border: none;
    border-radius: 0;
}

.galleries-page .gallery-card:hover .gallery-card-image img {
    transform: scale(1.03);
}

.galleries-page .gallery-card .gallery-card-title {
    font-family: 'Manrope', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 0.25rem 0;
    padding: 0;
    color: #000;
    border: none;
    background: transparent;
}

.galleries-page .gallery-card .gallery-card-date {
    font-family: 'Manrope', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* ===== Photo Grid - TRUE MASONRY Layout ===== */
.gallery-page .gallery-grid {
    column-count: 4;
    column-gap: 4px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    display: block;
}

.gallery-page .gallery-grid .gallery-item {
    position: relative;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 4px 0;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    background: #1a1a1a;
    border: none;
    border-radius: 0;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: unset;
}

.gallery-page .gallery-grid .gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.2s ease;
    border: none;
    border-radius: 0;
    object-fit: unset;
    aspect-ratio: unset;
    max-width: 100%;
}

.gallery-page .gallery-grid .gallery-item:hover img {
    opacity: 0.9;
}

/* Download icon overlay */
.gallery-page .gallery-grid .gallery-item .download-icon {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
    text-decoration: none;
    border: none;
    border-radius: 0;
    padding: 0;
}

.gallery-page .gallery-grid .gallery-item:hover .download-icon {
    opacity: 1;
}

.gallery-page .gallery-grid .gallery-item .download-icon svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

.gallery-page .gallery-grid .gallery-item .download-icon:hover {
    background: rgba(0,0,0,0.8);
}

/* ===== Lightbox ===== */
.kpd-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.97);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: none;
    border-radius: 0;
}

.kpd-lightbox.active {
    display: flex;
}

.kpd-lightbox .kpd-lightbox-image {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border: none;
    border-radius: 0;
}

.kpd-lightbox .kpd-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    z-index: 10;
    padding: 0;
}

.kpd-lightbox .kpd-lightbox-close svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.kpd-lightbox .kpd-lightbox-close:hover svg {
    opacity: 1;
}

/* Navigation arrows */
.kpd-lightbox .kpd-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 80px;
    background: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding: 0;
}

.kpd-lightbox .kpd-lightbox-nav svg {
    width: 36px;
    height: 36px;
    fill: #fff;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.kpd-lightbox .kpd-lightbox-nav:hover svg {
    opacity: 1;
}

.kpd-lightbox .kpd-lightbox-prev {
    left: 20px;
}

.kpd-lightbox .kpd-lightbox-next {
    right: 20px;
}

/* Download button in lightbox */
.kpd-lightbox .kpd-lightbox-download {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 0;
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
}

.kpd-lightbox .kpd-lightbox-download:hover {
    background: #e0e0e0;
}

.kpd-lightbox .kpd-lightbox-download svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Photo counter */
.kpd-lightbox .kpd-lightbox-counter {
    position: absolute;
    bottom: 25px;
    left: 20px;
    color: #fff;
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    opacity: 0.7;
    border: none;
    background: transparent;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS (matching TriUU: 1200px, 960px, 782px)
   ========================================================================== */

@media (max-width: 1200px) {
    .galleries-page .galleries-grid {
        gap: 24px;
        padding: 0 1.5rem;
    }
    .gallery-page .gallery-grid {
        column-count: 3;
    }
    .gallery-page .gallery-header .gallery-logo,
    .galleries-page .gallery-header .gallery-logo {
        width: 200px;
    }
}

@media (max-width: 960px) {
    .galleries-page .galleries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 0 1.25rem;
    }
    .gallery-page .gallery-grid {
        column-count: 3;
        column-gap: 3px;
    }
    .gallery-page .gallery-grid .gallery-item {
        margin-bottom: 3px;
    }
    .gallery-page .gallery-header,
    .galleries-page .gallery-header {
        padding: 2.5rem 1rem 2rem;
    }
    .gallery-page .gallery-header .gallery-logo,
    .galleries-page .gallery-header .gallery-logo {
        width: 180px;
    }
    .gallery-page .gallery-header .gallery-title,
    .galleries-page .gallery-header .gallery-title {
        font-size: 1.35rem;
    }
    .gallery-page .gallery-header .gallery-subtitle,
    .galleries-page .gallery-header .gallery-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1.25rem;
    }
    .galleries-page .gallery-card .gallery-card-title {
        font-size: 0.85rem;
    }
    .galleries-page .gallery-card .gallery-card-date {
        font-size: 0.7rem;
    }
}

@media (max-width: 782px) {
    .galleries-page .galleries-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 1rem;
    }
    .galleries-page .gallery-card .gallery-card-image {
        aspect-ratio: 1;
    }
    .gallery-page .gallery-grid {
        column-count: 2;
        column-gap: 3px;
    }
    .gallery-page .gallery-grid .gallery-item {
        margin-bottom: 3px;
    }
    .gallery-page .gallery-header,
    .galleries-page .gallery-header {
        padding: 2rem 1rem 1.5rem;
    }
    .gallery-page .gallery-header .gallery-logo,
    .galleries-page .gallery-header .gallery-logo {
        width: 160px;
    }
    .gallery-page .gallery-header .gallery-title,
    .galleries-page .gallery-header .gallery-title {
        font-size: 1.2rem;
        letter-spacing: 0.06em;
    }
    .gallery-page .gallery-header .gallery-subtitle,
    .galleries-page .gallery-header .gallery-subtitle {
        font-size: 0.75rem;
        letter-spacing: 0.12em;
        margin-bottom: 1rem;
    }
    .gallery-page .gallery-header .gallery-date,
    .galleries-page .gallery-header .gallery-date {
        font-size: 0.7rem;
    }
    .gallery-page .gallery-grid .gallery-item .download-icon {
        width: 28px;
        height: 28px;
        opacity: 0.9;
    }
    .gallery-page .gallery-grid .gallery-item .download-icon svg {
        width: 14px;
        height: 14px;
    }
    .kpd-lightbox .kpd-lightbox-nav {
        width: 40px;
    }
    .kpd-lightbox .kpd-lightbox-nav svg {
        width: 28px;
        height: 28px;
    }
    .kpd-lightbox .kpd-lightbox-prev {
        left: 8px;
    }
    .kpd-lightbox .kpd-lightbox-next {
        right: 8px;
    }
    .kpd-lightbox .kpd-lightbox-download {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    .kpd-lightbox .kpd-lightbox-counter {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .galleries-page .galleries-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 0.75rem;
    }
    .galleries-page .gallery-card .gallery-card-image {
        aspect-ratio: 4/3;
    }
    .gallery-page .gallery-grid {
        column-count: 2;
        column-gap: 2px;
    }
    .gallery-page .gallery-grid .gallery-item {
        margin-bottom: 2px;
    }
    .gallery-page .gallery-header,
    .galleries-page .gallery-header {
        padding: 1.5rem 0.75rem 1.25rem;
    }
    .gallery-page .gallery-header .gallery-logo,
    .galleries-page .gallery-header .gallery-logo {
        width: 140px;
        margin-bottom: 0.75rem;
    }
    .gallery-page .gallery-header .gallery-title,
    .galleries-page .gallery-header .gallery-title {
        font-size: 1.1rem;
    }
    .gallery-page .gallery-header .gallery-subtitle,
    .galleries-page .gallery-header .gallery-subtitle {
        font-size: 0.7rem;
        margin-bottom: 0.75rem;
    }
    .kpd-lightbox .kpd-lightbox-close {
        top: 12px;
        right: 12px;
    }
    .kpd-lightbox .kpd-lightbox-close svg {
        width: 24px;
        height: 24px;
    }
    .kpd-lightbox .kpd-lightbox-download {
        bottom: 12px;
        right: 12px;
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    .kpd-lightbox .kpd-lightbox-counter {
        bottom: 16px;
        left: 12px;
        font-size: 0.75rem;
    }
}
