/* Work Section Styles */
.work {
    background-color: transparent;
    padding: 1rem 0;
    position: relative;
}

.work::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(245, 245, 245, 0.05);
    opacity: 0.05;
    z-index: 0;
}

.work .container {
    position: relative;
    z-index: 1;
}

.work h2 {
    text-align: center;
    margin-bottom: 3.5rem;
    color: var(--color-dark);
    position: relative;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.work h2::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(to right, var(--color-primary), #000);
    border-radius: 2px;
}

/* Video Gallery - Basic Styles */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.video-item {
    position: relative;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background-color: #000;
}

/* Remove black background from video items */
.video-item {
    background-color: transparent !important;
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ensure the overlay fills and centers its content */
.video-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    z-index: 2;
}

/* Make .video-info fill the overlay and serve as the positioning context */
.video-info {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Absolutely center the play icon within .video-info */
.video-info .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    color: #408278;
    font-size: 2.5rem;
    z-index: 3;
}

/* Video Modal Styles - Updated */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.video-modal.active {
    opacity: 1;
}

.video-modal .modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* Mobile-specific modal styles */
@media (max-width: 768px) {
    .video-modal {
        align-items: center;
        padding: 0;
    }
    
    .video-modal .modal-content {
        width: 95%;
        padding: 15px;
        border-radius: 8px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .video-modal video {
        max-height: 70vh;
    }
    
    .video-modal .close-modal {
        top: 5px;
        right: 5px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .video-modal .modal-content {
        width: 100%;
        padding: 10px;
    }
    
    .video-modal video {
        max-height: 70vh;
    }
}

@media (max-width: 480px) {
    .work {
        padding: 1rem 0;
        margin-top: 2rem;
    }
    
    .video-gallery {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
        max-width: 500px;
        margin-left: auto;
        margin-right: auto;
    }
    
    /* Reset the grid positioning for mobile */
    .video-gallery .video-item:nth-child(n) {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
    }
    
    .video-info h3 {
        font-size: 1.1rem;
    }
    
    .play-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

@media (max-width: 576px) {
    .video-gallery {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
        gap: 2rem;
    }
    
    .video-item {
        max-width: 100%;
        margin-bottom: 0;
        width: 100%;
    }
    
    .video-thumbnail {
        height: auto !important;
    }
    
    .video-info {
        padding: 1rem;
    }
    
    .video-info h3 {
        font-size: 1.2rem;
        margin-bottom: 0.3rem;
    }
    
    .video-info p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }
    
    .play-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    /* Fix modal display on mobile */
    .video-modal {
        padding: 0;
    }
    
    .video-modal .modal-content {
        width: 100%;
        max-width: 100%;
        height: auto;
        margin: 0;
        border-radius: 0;
    }
    
    .video-modal .close-modal {
        top: 10px;
        right: 10px;
        font-size: 1.8rem;
        background: rgba(0, 0, 0, 0.5);
        border-radius: 50%;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-modal video {
        height: auto;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
    }
}

@media (max-width: 1200px) {
    .video-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    .video-gallery .video-item:nth-child(4) {
        grid-column: 1 / span 1.5;
    }
    
    .video-gallery .video-item:nth-child(5) {
        grid-column: 2.5 / span 1.5;
    }
    
    .video-info h3 {
        font-size: 1.2rem;
    }
    
    .video-info p {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    
    .play-icon {
        width: 55px;
        height: 55px;
    }
}

@media (max-width: 992px) {
    .work {
        padding: 2rem 0;
    }
    
    .video-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .video-gallery .video-item:nth-child(4),
    .video-gallery .video-item:nth-child(5) {
        grid-column: auto;
    }
    
    .video-thumbnail {
        padding-bottom: 60%; /* Maintain wider aspect ratio */
    }
}
