/* Page Header */
.page-header {
    background: linear-gradient(rgba(139, 0, 0, 0.8), rgba(139, 0, 0, 0.8));
    color: var(--light);
    padding: 120px 0 80px;
    text-align: center;
    margin-top: 70px;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--light);
}

.page-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Gallery Filters */
.gallery-filters {
    padding: 40px 0;
    background-color: var(--gray);
    position: sticky;
    top: 70px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.gallery-filters .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: 25px;
    color: var(--dark);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary);
    color: var(--light);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.search-box {
    position: relative;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--dark);
}

/* Gallery Grid */
.gallery-grid {
    padding: 60px 0;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
    justify-items: center;
    align-items: stretch;
    width: 100%;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0;
    line-height: 0;
}

.gallery-item {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    height: 300px;
    line-height: 0;
    font-size: 0;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.gallery-image {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
    display: block;
}

.gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
    opacity: 1 !important;
}

.gallery-item:hover .gallery-image img {
    transform: scale(1.1);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(transparent, rgba(139, 0, 0, 0.8));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 25px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: initial;
    line-height: normal;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info h3 {
    color: var(--light);
    margin-bottom: 8px;
    font-size: 1.3rem;
    line-height: 1.4;
}

.gallery-info p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.view-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--secondary);
    border: none;
    border-radius: 50%;
    color: var(--dark);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

.gallery-item:hover .view-btn {
    opacity: 1;
    transform: scale(1);
}

.view-btn:hover {
    background: var(--light);
    transform: scale(1.1);
}

/* Load More Button */
.load-more-container {
    text-align: center;
}

.load-more-btn {
    padding: 15px 30px;
    background: var(--primary);
    color: var(--light);
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.load-more-btn:hover {
    background: var(--secondary);
    color: var(--dark);
    transform: translateY(-3px);
}

/* Lightbox Modal */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.lightbox-nav:hover {
    background: var(--primary);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-image-container {
    display: flex;
    flex-direction: column;
}

.lightbox-image-container img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.lightbox-info {
    padding: 25px;
    background: var(--light);
}

.lightbox-info h3 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.lightbox-info p {
    color: var(--dark);
    line-height: 1.6;
}

/* Video Gallery */
.video-gallery {
    padding: 80px 0;
    background-color: var(--gray);
}

.video-gallery h2 {
    text-align: center;
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 50px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    color: var(--dark);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

/* Enhanced Video Gallery Styles */
.video-item {
    position: relative;
    background: var(--light);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.video-item:hover {
    transform: translateY(-10px);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    /* Force 16:9 aspect ratio */
    overflow: hidden;
    background: #000;
    /* Black background for letterboxing */
}

.video-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* This will crop the video to fit 16:9 */
    transition: transform 0.3s ease;
}

/* Alternative: Use contain to show full video without cropping (with letterboxing) */
.video-thumbnail video.contain-video {
    object-fit: contain;
    background: #000;
    /* Black bars for letterboxing */
}

.video-item:hover .video-thumbnail video {
    transform: scale(1.05);
}

.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(139, 0, 0, 0.9);
    border: none;
    border-radius: 50%;
    color: var(--light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.video-play-btn:hover {
    background: var(--primary);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.video-play-btn.playing {
    display: none;
}

.video-info {
    padding: 25px;
}

.video-info h4 {
    color: var(--primary);
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.video-info p {
    color: var(--dark);
    line-height: 1.6;
}

/* Video loading state */
.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
    z-index: 1;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.video-thumbnail.loading .video-loading {
    display: block;
}

.video-thumbnail.loading .video-play-btn {
    display: none;
}

/* Video grid layout */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

/* Ensure all video containers maintain 16:9 */
.video-gallery .video-thumbnail {
    aspect-ratio: 16/9;
}

/* Remove any existing video styles that might conflict */
.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* or 'contain' based on your preference */
}

/* Gallery Testimonials */
.gallery-testimonials {
    padding: 80px 0;
}

.gallery-testimonials h2 {
    text-align: center;
    color: var(--primary);
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.testimonial-carousel {
    position: relative;
    max-width: 800px;
    margin: 0 auto 40px;
    overflow: hidden;
}

.testimonial-slide {
    display: none;
    animation: fadeIn 0.5s ease;
}

.testimonial-slide.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.testimonial-content {
    display: flex;
    align-items: center;
    gap: 40px;
    background: var(--light);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.testimonial-text {
    flex: 1;
}

.testimonial-text p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    font-style: italic;
    color: var(--dark);
}

.client-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.client-info span {
    color: var(--dark);
    opacity: 0.8;
    font-size: 0.9rem;
}

.testimonial-image {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid var(--secondary);
}

.testimonial-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.testimonial-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.testimonial-prev,
.testimonial-next {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: var(--light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.testimonial-prev:hover,
.testimonial-next:hover {
    background: var(--secondary);
    color: var(--dark);
    transform: scale(1.1);
}

.testimonial-dots {
    display: flex;
    gap: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    background: #ddd;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

.dot.active {
    background: var(--primary);
}

/* CTA Section */
.cta {
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(rgba(139, 0, 0, 0.8), rgba(139, 0, 0, 0.8));
    color: var(--light);
}

.cta h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.cta p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.cta-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--light);
}

.btn-secondary:hover {
    background: var(--secondary);
    color: var(--dark);
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        padding: 100px 0 60px;
    }

    .page-header h1 {
        font-size: 2.2rem;
    }

    .gallery-filters .container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        justify-content: center;
    }

    .search-box {
        min-width: auto;
    }

    .gallery-container {
        grid-template-columns: 1fr;
    }

    .lightbox-content {
        max-width: 95%;
        max-height: 95%;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .testimonial-content {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }

    .cta-buttons .btn {
        width: 200px;
    }
}

/* Loading Animation */
.gallery-item {
    opacity: 1;
    width: 100%;
    max-width: 400px;
    display: block !important;
    transform: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item[style*="display: none"] {
    display: none !important;
}

/* Add to style.css */
/* Critical Above-the-Fold CSS */
.hero,
header {
    will-change: transform;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* Font loading optimization */
body {
    font-display: swap;
}

/* Reduce CLS (Cumulative Layout Shift) */
.service-card,
.gallery-item,
.testimonial {
    aspect-ratio: 1/1;
}

/* Image optimization */
img[loading="lazy"] {
    opacity: 1;
    transition: transform 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}