/* Gallery Page Styles */

/* Page Header */
.page-header {
    padding: 150px 0 80px;
    background: linear-gradient(135deg, #d4d2a7 0%, #f5f3e7 100%);
    text-align: center;
}

.page-header-content {
    max-width: 800px;
    margin: 0 auto;
}

.page-title {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 1rem;
    color: #5a5a47;
}

.page-subtitle {
    font-size: 1.3rem;
    color: #5a5a47;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.breadcrumb {
    font-size: 1rem;
    color: #6b6b58;
    letter-spacing: 1px;
}

.breadcrumb a {
    color: #4a4a37;
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: #5a5a47;
}

/* Gallery Section */
.gallery {
    padding: 80px 0;
    background-color: #a0a078;
}

.gallery-intro {
    text-align: center;
    margin-bottom: 4rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-description {
    font-size: 1.2rem;
    color: #5a5a47;
    line-height: 1.8;
}

/* Gallery Grid - Modern Dynamic Layout */
.gallery-grid {
    /* Default: Linear stacked layout for older pages or no-grid fallback */
    display: block;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Optional grid variant: 3-column grid where landscape items span full width (1x1) and portrait items occupy one column (1x3 block) */
.gallery-grid.grid-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 1200px;
    align-items: start;
}

.gallery-grid.grid-layout .gallery-item {
    width: auto; /* let grid control sizing */
    margin: 0;
}

.gallery-grid.grid-layout .gallery-item.landscape {
    grid-column: 1 / -1; /* span all 3 columns -> full width */
}

.gallery-grid.grid-layout .gallery-item.portrait {
    grid-column: auto; /* occupy a single column */
}

/* Portrait images: limit height so they don't render 'full-scale' and keep a tidy column look */
.gallery-grid.grid-layout .gallery-item.portrait img {
    width: 100%;
    height: 420px; /* fixed visual height for portrait thumbnails */
    object-fit: cover; /* fill the box while preserving aspect ratio */
    display: block;
}

/* Slightly smaller portrait boxes on small screens */
@media (max-width: 900px) {
    .gallery-grid.grid-layout .gallery-item.portrait img {
        height: 320px;
    }
}

@media (max-width: 600px) {
    /* stack grid on small screens and let portrait images scale naturally */
    .gallery-grid.grid-layout { grid-template-columns: 1fr; }
    .gallery-grid.grid-layout .gallery-item.portrait img {
        height: auto;
        object-fit: contain;
        max-width: 100%;
    }
}

/* Gallery Items */
.gallery-item {
    position: relative;
    background: #f5f3e7;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.28s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(90, 90, 71, 0.08);
    /* Linear layout specifics */
    width: 100%;
    margin-bottom: 1.25rem;
    /* Performance optimizations */
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(90, 90, 71, 0.25);
}

.gallery-item.tall,
.gallery-item.wide,
.gallery-item.featured {
    /* In linear layout these helpers just act as normal items */
    width: 100%;
    margin-bottom: 1.5rem;
}

.gallery-item.featured:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 45px rgba(90, 90, 71, 0.3);
}

.gallery-item .image-placeholder {
    width: 100%;
    height: auto;
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gallery-item img {
    width: 100%;
    height: auto; /* natural aspect preserved */
    object-fit: contain; /* avoid cropping */
    object-position: center;
    transition: transform 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Performance optimizations */
    transform: translateZ(0);
    will-change: transform;
}

.gallery-item:hover .image-placeholder {
    transform: scale(1.08);
}

.gallery-item:hover img {
    transform: scale(1.08);
}

/* Gallery Overlay - Enhanced */
.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(90, 90, 71, 0.9));
    color: #f5f3e7;
    padding: 24px 20px 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
}

.gallery-overlay h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    letter-spacing: 1px;
    font-weight: 600;
}

.gallery-overlay p {
    font-size: 0.9rem;
    color: #e6e6c7;
    line-height: 1.4;
    margin: 0;
}

/* Featured item overlay */
.gallery-item.featured .gallery-overlay {
    padding: 32px 24px 24px;
}

.gallery-item.featured .gallery-overlay h3 {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.gallery-item.featured .gallery-overlay p {
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gallery-grid { padding: 0 16px; max-width: 720px; }
}

@media (max-width: 768px) {
    .gallery-grid { padding: 0 12px; }
    
    .gallery-item.wide,
    .gallery-item.featured,
    .gallery-item.tall {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .gallery-item:hover {
        transform: translateY(-4px);
    }
    
    .gallery-overlay {
        padding: 16px 12px 12px;
    }
    
    .gallery-overlay h3 {
        font-size: 1rem;
    }
    
    .gallery-overlay p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid { padding: 0 10px; }
    
    .gallery-item.tall,
    .gallery-item.wide,
    .gallery-item.featured { width: 100%; margin-bottom: 0.8rem; }
}

/* Gallery CTA */
.gallery-cta {
    text-align: center;
    margin-top: 5rem;
    padding: 4rem 2rem;
    background: #f5f3e7;
    border-radius: 0;
}

.gallery-cta h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #5a5a47;
}

.gallery-cta p {
    font-size: 1.2rem;
    color: #5a5a47;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Related Services */
.related-services {
    padding: 80px 0;
    background-color: #d4d2a7;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.service-item {
    text-align: center;
    padding: 2rem;
    background: #f5f3e7;
    transition: background-color 0.3s ease;
}

.service-item:hover {
    background: #e6e6c7;
}

.service-item h3 {
    margin-bottom: 1rem;
}

.service-item h3 a {
    color: #5a5a47;
    text-decoration: none;
    font-size: 1.3rem;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.service-item h3 a:hover {
    color: #4a4a37;
}

.service-item p {
    color: #5a5a47;
    line-height: 1.6;
}

/* Lightbox Styles (for future implementation) */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(90, 90, 71, 0.95);
    z-index: 9999;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 1rem;
    user-select: none;
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* Responsive Design for Gallery */
@media (max-width: 768px) {
    .page-header {
        padding: 120px 1rem 60px;
    }
    
    .page-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        margin-bottom: 0.8rem;
        word-break: break-word;
    }
    
    .page-subtitle {
        font-size: clamp(0.9rem, 3.4vw, 1.05rem);
        margin-bottom: 1rem;
    }

    .breadcrumb {
        font-size: 0.9rem;
    }
    
    .gallery-intro {
        padding: 0 1rem;
        margin-bottom: 2.5rem;
    }

    .gallery-description {
        font-size: clamp(0.9rem, 3.4vw, 1.05rem);
        line-height: 1.6;
    }
    
    .gallery-grid { 
        padding: 0 1rem; 
        box-sizing: border-box;
    }
    
    .gallery-item {
        border-radius: 10px;
    }

    .gallery-item.tall,
    .gallery-item.wide { 
        width: 100%; 
        margin-bottom: 1rem; 
    }
    
    .gallery-overlay {
        position: relative;
        transform: translateY(0);
        background: rgba(90, 90, 71, 0.9);
        padding: 1.25rem;
        opacity: 1;
        backdrop-filter: blur(5px);
    }

    .gallery-overlay h3 {
        font-size: 1.2rem;
        margin-bottom: 0.4rem;
    }

    .gallery-overlay p {
        font-size: 0.88rem;
    }
    
    .gallery-cta {
        margin-top: 2.5rem;
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .gallery-cta h2 {
        font-size: clamp(1.5rem, 5vw, 1.8rem);
        margin-bottom: 0.8rem;
    }

    .gallery-cta p {
        font-size: clamp(0.88rem, 3.2vw, 1rem);
        margin-bottom: 1.8rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 0 1rem;
    }

    .service-item {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 100px 0.75rem 45px;
    }
    
    .page-title {
        font-size: clamp(1.5rem, 6.5vw, 1.9rem);
        letter-spacing: 1px;
        line-height: 1.2;
    }

    .page-subtitle {
        font-size: 0.88rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
        margin-top: 0.8rem;
    }
    
    .gallery-intro {
        padding: 0 0.5rem;
        margin-bottom: 1.8rem;
    }

    .gallery-description {
        font-size: 0.88rem;
        line-height: 1.5;
    }
    
    .gallery-grid { 
        padding: 0 0.5rem; 
    }

    .gallery-item {
        border-radius: 8px;
    }
    
    .gallery-overlay {
        padding: 1rem;
    }

    .gallery-overlay h3 {
        font-size: 1.05rem;
        margin-bottom: 0.25rem;
    }

    .gallery-overlay p {
        font-size: 0.78rem;
        line-height: 1.4;
    }
    
    .gallery-cta {
        padding: 1.8rem 0.5rem;
    }

    .gallery-cta h2 {
        font-size: 1.35rem;
        margin-bottom: 0.6rem;
    }

    .gallery-cta p {
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .btn {
        font-size: 0.88rem;
        padding: 0.8rem 1.4rem;
        width: 100%;
        max-width: 260px;
    }
    
    .services-grid {
        padding: 0 0.5rem;
    }

    .service-item {
        padding: 1rem;
    }

    .service-item h3 {
        font-size: 1.1rem;
    }

    .service-item p {
        font-size: 0.8rem;
    }

    /* Footer adjustments */
    .footer {
        padding: 2rem 0.5rem;
        text-align: center;
    }

    .footer-text {
        font-size: 0.8rem;
    }

    .footer-subtext {
        font-size: 0.7rem;
    }
}

/* Animation for gallery items — make visible by default so images show even if JS doesn't run */
.gallery-item {
    opacity: 1;
    transform: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-item.animate {
    /* optional subtle lift when JS applies .animate */
    opacity: 1;
    transform: translateY(0);
}

/* Loading animation */
.gallery-loading {
    text-align: center;
    padding: 4rem 0;
}

.gallery-loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #f5f3e7;
    border-top: 3px solid #5a5a47;
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure gallery items and images are visible by default (override other animation CSS) */
.gallery .gallery-item,
.gallery .gallery-item img {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    display: block !important;
}
