/* Gallery Navigation Improvements */

/* Modal click zones for desktop mouse navigation - improved */
.modal-click-zone {
    position: absolute;
    top: 0;
    height: 100%;
    width: 45%; /* Slightly wider click area */
    z-index: 15;
    cursor: pointer;
}

.modal-click-left {
    left: 0;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'><path d='M15 18l-6-6 6-6'/></svg>") 16 16, w-resize;
}

.modal-click-right {
    right: 0;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'><path d='M9 18l6-6-6-6'/></svg>") 16 16, e-resize;
}

/* Improve navigation buttons */
.modal-nav {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background-color: var(--karate-red) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 1.8rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 3000 !important;
    opacity: 0.9 !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.4) !important;
}

.modal-nav:hover {
    opacity: 1 !important;
    background-color: var(--karate-red) !important;
    transform: translateY(-50%) scale(1.15) !important;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5) !important;
}

.modal-nav.prev {
    left: 20px !important;
}

.modal-nav.next {
    right: 20px !important;
}

/* Improved close button */
.close-button {
    position: fixed !important;
    bottom: 30px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    color: #ffffff !important;
    font-size: 30px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    z-index: 3500 !important;
    background-color: var(--karate-red) !important;
    width: 45px !important;
    height: 45px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    transition: all 0.3s ease !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) !important;
}

.close-button:hover {
    transform: translateX(-50%) scale(1.1) !important;
    background-color: #a01830 !important;
}

/* Modal image - ensure it's below the navigation controls */
.modal-image {
    z-index: 5 !important;
}

/* Gallery modal - improved */
.gallery-modal {
    z-index: 2000 !important;
}

/* Direction indicators for modal navigation */
.direction-indicator {
    position: fixed;
    top: 50%;
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2200;
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.3s, width 0.3s, height 0.3s;
    border-radius: 50%;
    pointer-events: none;
}

.direction-indicator.active {
    opacity: 0.7;
    animation: pulse 0.5s ease-out;
}

.direction-indicator.prev {
    left: 20px;
}

.direction-indicator.next {
    right: 20px;
}

@keyframes pulse {
    0% {
        width: 60px;
        height: 60px;
        opacity: 0.7;
    }
    50% {
        width: 70px;
        height: 70px;
        opacity: 0.9;
    }
    100% {
        width: 60px;
        height: 60px;
        opacity: 0;
    }
}

/* Image slide effect */
.slide-left-enter {
    transform: translateX(-100%);
}

.slide-right-enter {
    transform: translateX(100%);
}

.slide-transition {
    transition: transform 0.3s ease-out;
}

/* Force all gallery images to be 3 per row on mobile */
@media (max-width: 767.98px) {
    #gallery .col-sm-12,
    #gallery .col-sm-6,
    #gallery .col-md-4 {
        width: 33.33% !important;
        float: left;
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
    
    /* Ensure consistent spacing - reduce space between gallery rows */
    .gallery-img {
        margin-bottom: 6px;
    }
    
    /* Reduce spacing between rows in gallery */
    #gallery .row.g-3 {
        row-gap: 6px !important;
        margin-left: -4px !important;
        margin-right: -4px !important;
    }
    
    /* Hide navigation arrows on mobile - use swipe instead */
    .modal-nav {
        display: none !important;
    }
    
    /* Enhance swipe areas */
    .modal-click-zone {
        width: 50% !important;
        opacity: 0 !important;
    }
}

/* Fix thumbnail cropping issues for important content (faces) */
.gallery-img {
    object-fit: cover;
    object-position: center 20%; /* Move focal point higher to prevent cutting off heads */
    height: 250px; /* Adjusted height to better show content */
    width: 100%;
}

/* Fix specific images with faces at the top - these need special attention */
/* 10th image */
img[src*="0-02-0a-8fa4203905f89666a4d35e9daa64f40d7f3bf6005e7d6c6bd1366d8a3a8f9b0a_c2304edaee6de70a.jpg"] {
    object-position: center 10%; /* Move focal point much higher for this specific image */
}

/* 17th image */
img[src*="0-02-0a-d26e49c2e2feee39a93e7be8b9f277fda4d6e8cb27938930bb0c297e064dd60c_e275760f307754b7.jpg"] {
    object-position: center 10%; /* Move focal point much higher for this specific image */
}

/* Other problematic images that need adjustment */
img[src*="0-02-0a-028d14568ffb2d8daef3da251d1252d15ac564ba8328918cfe59bfb90d92c136_4e4302c222333856.jpg"],
img[src*="0-02-0a-9f7d0217186488d2f0e1e4cf334d9f716b466af02152f7dda8987fb73bfa80cf_a070a4bcc269651f.jpg"],
img[src*="0-02-0a-db112f93fae769bd731ac23b02a2b23c74e51860f380f3280b0442ed6beef275_1ae32c8c5f794266.jpg"],
img[src*="0-02-0a-edc8f6bffb10d677bb4a455f1287c54c30fc9f2148ced8f71db922e14ebf7d0a_bf2dca05ff05beb1.jpg"] {
    object-position: center 15%; /* Move focal point higher for these images */
}

/* Specific fixes for desktop view */
@media (min-width: 768px) {
    .gallery-img {
        height: 280px; /* Slightly taller in desktop mode */
        object-position: center 20%; /* Consistent position for most images */
    }
    
    /* 10th image - desktop specific fix */
    img[src*="0-02-0a-8fa4203905f89666a4d35e9daa64f40d7f3bf6005e7d6c6bd1366d8a3a8f9b0a_c2304edaee6de70a.jpg"] {
        object-position: center 5%; /* Even higher focal point in desktop mode */
    }
    
    /* 17th image - desktop specific fix */
    img[src*="0-02-0a-d26e49c2e2feee39a93e7be8b9f277fda4d6e8cb27938930bb0c297e064dd60c_e275760f307754b7.jpg"] {
        object-position: center 5%; /* Even higher focal point in desktop mode */
    }
}

/* Improve the gallery container to ensure even spacing */
.gallery-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Make sure all images in the modal display properly */
.modal-image {
    max-height: 85vh;
    object-fit: contain;
}