/* Album Gallery (OHA) v4.0 - Modern Photo Grid with Stacked Card Effect */
/* All styles scoped to .album-gallery-wrapper to prevent conflicts */

.album-gallery-wrapper {
    font-family: Arial, sans-serif;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 20px;
}

.album-gallery-wrapper .album-gallery-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Search box */
.album-gallery-wrapper .album-gallery-search {
    max-width: 420px;
    margin: 0 auto 2rem;
}

.album-gallery-wrapper .album-gallery-search-input {
    width: 100%;
    padding: 12px 18px;
    font-size: 15px;
    border: 1px solid #ddd;
    border-radius: 30px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.album-gallery-wrapper .album-gallery-search-input:focus {
    border-color: #764ba2;
    box-shadow: 0 2px 10px rgba(118, 75, 162, 0.25);
}

/* Grid Layout with CSS Variables for columns */
.album-gallery-wrapper .album-grid {
    display: grid;
    grid-template-columns: repeat(var(--columns, 3), 1fr);
    gap: 40px 30px;
    margin-top: 30px;
}

/* Album Item - Stacked Card Effect */
.album-gallery-wrapper .album-item {
    position: relative;
    text-align: center;
}

.album-gallery-wrapper .album-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

/* Stacked cards effect using pseudo-elements */
.album-gallery-wrapper .album-thumbnail:before,
.album-gallery-wrapper .album-thumbnail:after {
    content: '';
    position: absolute;
    width: 95%;
    height: 100%;
    background: #fff;
    border-radius: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: -1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.album-gallery-wrapper .album-thumbnail:before {
    top: -8px;
    transform: translateX(-50%) rotate(-2deg);
}

.album-gallery-wrapper .album-thumbnail:after {
    top: -4px;
    transform: translateX(-50%) rotate(1deg);
}

.album-gallery-wrapper .album-thumbnail:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.album-gallery-wrapper .album-thumbnail a.album-trigger {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.album-gallery-wrapper .album-thumbnail picture {
    display: block;
}

.album-gallery-wrapper .album-thumbnail img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.album-gallery-wrapper .album-thumbnail:hover img {
    transform: scale(1.05);
}

/* Overlay on hover */
.album-gallery-wrapper .album-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 8px;
}

.album-gallery-wrapper .album-thumbnail:hover .album-overlay,
.album-gallery-wrapper .album-thumbnail:focus-within .album-overlay {
    opacity: 1;
}

.album-gallery-wrapper .album-view-icon {
    display: block;
    margin: 0 auto 8px;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

.album-gallery-wrapper .album-count {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    display: block;
}

/* Loading spinner shown while an album's photos are being fetched */
.album-gallery-wrapper .album-loading-spinner {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: album-gallery-spin 0.8s linear infinite;
    z-index: 3;
}

.album-gallery-wrapper .album-thumbnail.is-loading .album-loading-spinner {
    display: block;
}

.album-gallery-wrapper .album-thumbnail.is-loading .album-overlay {
    opacity: 1;
}

@keyframes album-gallery-spin {
    to { transform: rotate(360deg); }
}

/* Album Name */
.album-gallery-wrapper .album-name {
    margin-top: 15px;
    margin-bottom: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

/* Optional album description (admin-set, shown only if filled in) */
.album-gallery-wrapper .album-description {
    margin: 6px 0 0;
    font-size: 14px;
    line-height: 1.5;
    color: #666;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Load more button */
.album-gallery-wrapper .album-gallery-load-more-wrap {
    text-align: center;
    margin-top: 40px;
}

.album-gallery-wrapper .album-gallery-load-more {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.album-gallery-wrapper .album-gallery-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(118, 75, 162, 0.4);
}

.album-gallery-wrapper .album-gallery-load-more:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.album-gallery-wrapper .album-gallery-empty-message {
    text-align: center;
    color: #777;
    font-size: 15px;
    margin-top: 30px;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .album-gallery-wrapper .album-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 30px 25px;
    }
}

@media screen and (max-width: 640px) {
    .album-gallery-wrapper {
        padding: 0 15px;
    }

    .album-gallery-wrapper .album-grid {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    .album-gallery-wrapper .album-gallery-title {
        font-size: 24px;
        margin-bottom: 1.5rem;
    }

    .album-gallery-wrapper .album-thumbnail img {
        height: 220px;
    }

    .album-gallery-wrapper .album-name {
        font-size: 16px;
    }

    .album-gallery-wrapper .album-description {
        font-size: 13px;
    }

    .album-gallery-wrapper .album-view-icon {
        width: 32px;
        height: 32px;
    }

    .album-gallery-wrapper .album-count {
        font-size: 14px;
    }

    /* Stacked-card pseudo elements add visual width that isn't needed on
       narrow single-column layouts and can cause tiny horizontal overflow. */
    .album-gallery-wrapper .album-thumbnail:before,
    .album-gallery-wrapper .album-thumbnail:after {
        width: 97%;
    }

    .album-gallery-wrapper .album-gallery-search-input,
    .album-gallery-wrapper .album-gallery-load-more {
        font-size: 16px; /* prevents iOS Safari auto-zoom-on-focus */
    }

    .album-gallery-wrapper .album-gallery-load-more {
        width: 100%;
        padding: 14px 0;
    }
}

@media screen and (max-width: 380px) {
    .album-gallery-wrapper .album-thumbnail img {
        height: 200px;
    }
}

/* GLightbox Customization */
.gslide-description {
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 20px;
    border-radius: 6px;
}

.gdesc-inner {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
}
