/* Portfolio Modal Styles */

.ehs-portfolio-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ehs-portfolio-modal[aria-hidden="false"],
.ehs-portfolio-modal[style*="display: flex"] {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ehs-portfolio-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ehs-portfolio-modal__content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Allow clicks to pass through to overlay */
}

.ehs-portfolio-modal__header {
    display: none;
}

.ehs-portfolio-modal__title {
    display: none;
}

.ehs-portfolio-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: auto; /* Re-enable pointer events for this button */
}

.ehs-portfolio-modal__close:hover,
.ehs-portfolio-modal__close:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    outline: none;
}

.ehs-portfolio-modal__close svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ehs-portfolio-modal__image-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    pointer-events: auto; /* Re-enable pointer events for this container */
}

.ehs-portfolio-modal__image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ehs-portfolio-modal__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    z-index: 10;
    pointer-events: auto; /* Re-enable pointer events for navigation */
}

.ehs-portfolio-modal__nav:hover,
.ehs-portfolio-modal__nav:focus {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
    outline: none;
}

.ehs-portfolio-modal__nav--prev {
    left: 30px;
}

.ehs-portfolio-modal__nav--next {
    right: 30px;
}

.ehs-portfolio-modal__nav svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.ehs-portfolio-modal__counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    font-size: 0.875rem;
    color: white;
    font-weight: 500;
    margin: 0;
}

.ehs-portfolio-modal__current {
    color: var(--ehs-color-primary);
    font-weight: 600;
}

/* Portfolio Gallery Images */
.ehs-portfolio-gallery__main-image,
.ehs-portfolio-gallery__thumbnail img {
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ehs-portfolio-gallery__main-image:hover,
.ehs-portfolio-gallery__thumbnail img:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.ehs-portfolio-gallery__more {
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.ehs-portfolio-gallery__more:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Portfolio section image buttons */
.ehs-portfolio__image-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ehs-portfolio__image-btn:hover,
.ehs-portfolio__image-btn:focus {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    outline: 2px solid var(--ehs-color-primary);
    outline-offset: 2px;
}

.ehs-portfolio__image-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ehs-portfolio__image-btn:hover img {
    transform: scale(1.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
   
    
    .ehs-portfolio-modal__content {
        max-width: 95vw;
        max-height: 80vh;
    }
    
    .ehs-portfolio-modal__close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    .ehs-portfolio-modal__close svg {
        width: 20px;
        height: 20px;
    }
    
    .ehs-portfolio-modal__image {
        max-height: 65vh;
    }
    
    .ehs-portfolio-modal__nav {
        width: 44px;
        height: 44px;
    }
    
    .ehs-portfolio-modal__nav--prev {
        left: 15px;
    }
    
    .ehs-portfolio-modal__nav--next {
        right: 15px;
    }
    
    .ehs-portfolio-modal__nav svg {
        width: 20px;
        height: 20px;
    }
    
    .ehs-portfolio-modal__counter {
        bottom: 20px;
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    
    .ehs-portfolio-modal__content {
        max-width: 98vw;
        max-height: 75vh;
    }
    
    .ehs-portfolio-modal__close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .ehs-portfolio-modal__close svg {
        width: 18px;
        height: 18px;
    }
    
    .ehs-portfolio-modal__image {
        max-height: 60vh;
    }
    
    .ehs-portfolio-modal__nav {
        width: 40px;
        height: 40px;
    }
    
    .ehs-portfolio-modal__nav--prev {
        left: 10px;
    }
    
    .ehs-portfolio-modal__nav--next {
        right: 10px;
    }
    
    .ehs-portfolio-modal__nav svg {
        width: 18px;
        height: 18px;
    }
    
    .ehs-portfolio-modal__counter {
        bottom: 15px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .ehs-portfolio-modal,
    .ehs-portfolio-modal__nav,
    .ehs-portfolio__image-btn,
    .ehs-portfolio__image-btn img {
        transition: none;
    }
}