/* 
CLEAN GALLERY SYSTEM - FRESH START
Unified experience for index.html and clientstories.html
Requirements: Original aspect ratios, centered images, visible captions, cover image inclusion
*/

/* ===== GALLERY GRID LAYOUT ===== */
.unified-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== MODERN GALLERY CARDS - NO WHITE BOX DESIGN ===== */
.unified-gallery-card {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: none; /* No background - just the image */
}

.unified-gallery-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
}

/* ===== LANDSCAPE IMAGE CONTAINERS ===== */
.gallery-card-image-container {
    position: relative;
    width: 100%;
    height: 280px; /* Fallback for browsers without aspect-ratio support */
    aspect-ratio: 16/10; /* Landscape aspect ratio for album covers */
    overflow: hidden;
    background: #f8fafc;
}

.gallery-card-image {
    width: 100% !important;
    height: 100% !important; /* Fill the container */
    display: block !important;
    transition: transform 0.3s ease;
    object-fit: cover !important; /* Cover the entire container */
    object-position: center !important;
}

.unified-gallery-card:hover .gallery-card-image {
    transform: scale(1.05);
}

/* ===== TITLE OVERLAY AT BOTTOM OF IMAGE ===== */
.gallery-card-title-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    color: white;
    padding: 2rem 1.5rem 1.5rem;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gallery-card-title-overlay h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: white;
    line-height: 1.3;
}

.gallery-card-title-overlay .meta {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    color: rgba(255,255,255,0.9);
}

/* ===== FULL DESCRIPTION OVERLAY ON HOVER ===== */
.gallery-card-description-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0,0,0,0.8), rgba(0,0,0,0.6));
    color: white;
    padding: 1.5rem 1.5rem 2rem; /* Less top padding, more bottom */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    box-sizing: border-box; /* Ensure padding is included in height calculation */
}

.unified-gallery-card:hover .gallery-card-description-overlay {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.unified-gallery-card:hover .gallery-card-title-overlay {
    opacity: 0;
    transform: translateY(20px);
}

.gallery-card-description-overlay h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem; /* Slightly smaller for better fit */
    font-weight: 700;
    margin: 0 0 0.75rem 0; /* Reduced margin, removed top margin */
    color: white;
    line-height: 1.2; /* Tighter line height */
}

.gallery-card-description-overlay p {
    line-height: 1.5; /* Slightly tighter line height */
    font-size: 1rem; /* Slightly smaller text */
    margin: 0; /* Remove bottom margin */
    max-width: 95%; /* Use more of the available width */
    flex: 1; /* Allow text to use available space */
    display: flex;
    align-items: center; /* Center the text vertically within its space */
}

/* Meta removed from description overlay - only in title overlay */

/* ===== REMOVE OLD ELEMENTS ===== */
.gallery-card-content,
.gallery-card-title,
.gallery-card-excerpt,
.gallery-card-meta,
.gallery-card-view-btn {
    display: none !important; /* Remove all old white box elements */
}

/* ===== GALLERY MODAL - CLEAN & MODERN ===== */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.gallery-modal.active {
    display: flex;
}

.gallery-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(20, 20, 30, 0.85));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.gallery-modal__container {
    position: relative;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh; /* Ensure it fits on screen */
    min-height: 400px; /* Reduced minimum height */
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 1;
    display: flex;
    flex-direction: column;
    margin: 5vh auto; /* More top margin to ensure visibility */
    top: 0; /* Anchor to prevent overflow */
}

/* ===== MODAL HEADER - FIXED LAYOUT ===== */
.gallery-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    min-height: 70px; /* Ensure minimum height */
    flex-shrink: 0; /* Prevent shrinking */
}

.gallery-modal__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
    flex: 1;
    padding-right: 1rem; /* Give space for close button */
    line-height: 1.3;
    max-width: calc(100% - 60px); /* Ensure space for close button */
}

.gallery-modal__close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 44px; /* Increased for better touch target */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0; /* Prevent shrinking */
    margin-left: auto; /* Push to right */
}

.gallery-modal__close:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.1);
}

/* ===== MODAL CONTENT - IMAGE DISPLAY ===== */
.gallery-modal__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
}

.gallery-carousel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1rem; /* Reduced from 2rem to save space */
}

.carousel__track-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.carousel__track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    align-items: center;
    height: 100%;
}

.carousel__slide {
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.carousel__slide img {
    max-width: 100% !important;
    max-height: 50vh !important; /* Reduced from 60vh to leave more room for header */
    height: auto !important;
    width: auto !important;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    object-fit: contain !important; /* PRESERVE ORIGINAL ASPECT RATIO - CENTER IMAGES */
    object-position: center !important;
    display: block !important;
}

/* ===== NAVIGATION ARROWS ===== */
.carousel__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.carousel__nav:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.carousel__nav--prev {
    left: 2rem;
}

.carousel__nav--next {
    right: 2rem;
}

/* ===== MODAL INFO SECTION - VISIBLE CAPTIONS ===== */
.gallery-modal__info {
    background: white;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.gallery-modal__image-details {
    flex: 1;
}

.gallery-modal__image-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0 0 0.5rem 0;
}

.gallery-modal__image-description {
    font-size: 1rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.gallery-modal__nav-counter {
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* ===== THUMBNAIL NAVIGATION ===== */
.gallery-modal__thumbnails {
    background: rgba(255, 255, 255, 0.95);
    padding: 1rem 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    overflow-y: hidden;
}

.thumbnail-strip {
    display: flex;
    gap: 0.75rem;
    padding-bottom: 0.5rem;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: #f1f5f9;
}

.thumbnail-item.active {
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.thumbnail-item:hover {
    transform: scale(1.05);
    border-color: #94a3b8;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .unified-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
        padding: 1rem 0;
    }
    
    .gallery-card-image-container {
        height: 220px; /* Fallback for mobile */
        aspect-ratio: 16/10; /* Maintain landscape ratio on mobile */
    }
    
    .gallery-card-title-overlay h3 {
        font-size: 1.2rem; /* Smaller title on mobile */
    }
    
    .gallery-card-description-overlay {
        padding: 1rem 1rem 1.5rem; /* Even less padding on mobile */
    }
    
    .gallery-card-description-overlay h3 {
        font-size: 1.3rem; /* Smaller description title on mobile */
        margin-bottom: 0.5rem; /* Less spacing on mobile */
    }
    
    .gallery-card-description-overlay p {
        font-size: 0.9rem; /* Smaller text on mobile */
        line-height: 1.4; /* Tighter line height on mobile */
    }
    
    .gallery-modal__container {
        width: 98%;
        max-height: 95vh;
        border-radius: 12px;
        margin: 2.5vh auto; /* Less margin on mobile */
    }
    
    .gallery-modal__header {
        padding: 1rem 1.5rem;
        min-height: 60px; /* Smaller on mobile */
    }
    
    .gallery-carousel {
        padding: 0.5rem; /* Even less padding on mobile */
    }
    
    .carousel__slide img {
        max-height: 40vh; /* Smaller images on mobile to show header */
        border-radius: 8px;
    }
    
    .carousel__nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .carousel__nav--prev {
        left: 0.5rem;
    }
    
    .carousel__nav--next {
        right: 0.5rem;
    }
    
    .gallery-modal__info {
        padding: 1rem 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .gallery-modal__nav-counter {
        align-self: flex-end;
    }
    
    .gallery-modal__thumbnails {
        padding: 0.75rem 1.5rem;
    }
    
    .thumbnail-item {
        width: 60px;
        height: 45px;
    }
}

/* Additional styles for very small laptop screens */
@media (max-height: 700px) {
    .gallery-modal__container {
        max-height: 85vh;
        margin: 7.5vh auto; /* Ensure header is visible */
    }
    
    .carousel__slide img {
        max-height: 35vh; /* Even smaller images on short screens */
    }
    
    .gallery-carousel {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .unified-gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.75rem 0;
    }
    
    .gallery-card-image-container {
        height: 200px; /* Fallback for very small screens */
        aspect-ratio: 4/3; /* Slightly more square on very small screens for better mobile experience */
    }
    
    .gallery-card-title-overlay h3 {
        font-size: 1.1rem; /* Even smaller title */
    }
    
    .gallery-card-title-overlay .meta {
        font-size: 0.8rem;
    }
    
    .gallery-card-description-overlay {
        padding: 0.75rem 1rem 1.25rem; /* Minimal padding on very small screens */
    }
    
    .gallery-card-description-overlay h3 {
        font-size: 1.2rem; /* Even smaller on very small screens */
        margin-bottom: 0.4rem; /* Minimal spacing */
    }
    
    .gallery-card-description-overlay p {
        font-size: 0.85rem; /* Smaller text */
        line-height: 1.3; /* Very tight line height */
    }
}

/* ===== LOADING STATES ===== */
.gallery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: #64748b;
    font-size: 1.1rem;
}

.gallery-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #64748b;
}

.gallery-empty h3 {
    color: #374151;
    margin-bottom: 1rem;
}

/* ===== ANIMATION ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.unified-gallery-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.unified-gallery-card:nth-child(1) { animation-delay: 0.1s; }
.unified-gallery-card:nth-child(2) { animation-delay: 0.2s; }
.unified-gallery-card:nth-child(3) { animation-delay: 0.3s; }
.unified-gallery-card:nth-child(4) { animation-delay: 0.4s; }
.unified-gallery-card:nth-child(5) { animation-delay: 0.5s; }
.unified-gallery-card:nth-child(6) { animation-delay: 0.6s; } 