/* Gallery Section */
.gallery {
    padding: 20px; /* Increased padding for better spacing */
    max-width: 1080px; /* Increased max-width for more items */
    margin: 0 auto;
    text-align: left;
}

.gallery h2 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 30px;
    margin: 95px 0 40px;
    letter-spacing: 2px;
    position: relative;
    text-align: center; /* Center the title */
    font-weight: normal; 
}

.gallery h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 2px;
    background: var(--accent-color);
    margin: 10px auto 0;
}

/* Grid Layout */
.grid {
    display: grid;
    gap: 30px;
    padding: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Responsive grid */
    
}

/* Gallery Item */
.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Start invisible */
    transform: translateY(20px); /* Start slightly lower */
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.gallery-item.visible {
    opacity: 1; /* Fade in */
    transform: translateY(0); /* Move to original position */
}

.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Image Wrapper */
.image-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-wrapper img {
    max-width: auto;
    max-height: 650px; /* Set a max height for uniformity */
    display: block;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.image-wrapper img:hover {
    transform: scale(1.1); /* Slight zoom on hover */
}

/* Artwork Info */
.artwork-info {
    margin-top: 10px;
    text-align: center;
    color: var(--text-color);
    font-size: 0.91rem;
    font-weight: normal;
}
.artwork-info h3 {
    font-weight: normal; /* ou 300, 200, etc. pour plus fin */
    font-size: 1rem;
    text-transform: none; /* pour ne pas être en majuscules */
}
.modal-nav-button {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    padding: 10px;
    cursor: pointer;
    z-index: 10;
}

.modal-nav-button:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Left button */
#modal_prev {
    left: 10px;
}

/* Right button */
#modal_next {
    right: 10px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
    -webkit-touch-callout: none; /* iOS Safari */  
    -webkit-user-select: none;   /* Safari */  
    -khtml-user-select: none;    /* Konqueror HTML */  
    -moz-user-select: none;      /* Firefox */  
    -ms-user-select: none;       /* Internet Explorer/Edge */  
    user-select: none;           /* Non-prefixed version */  
    touch-action: none;          /* Prevent default touch actions */
}

/* Modal Image Container */
.modal-image-container {
    position: relative;
    width: 100%;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-image-container img {
    max-width: 150%;
    max-height: 110vh;
    object-fit: contain;
    cursor: crosshair;
}

/* Modal Content */
.modal-content {
    background: #fff;
    border-radius: 10px;
    max-width: 90%;
    max-height: 90%;
    padding: 20px;
    position: relative;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 10px;
    object-fit: contain;
}

.modal-content .text {
    margin-top: 20px;
    font-size: 1.2rem;
    color: var(--text-color);
    line-height: 1.6;
    text-align: center;
    font-weight: 300; 
}

/* Modal Close Button */
.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px; /* Slightly larger for easier clicking */
    height: 30px;
    cursor: pointer;
    font-size: 1rem; /* Adjusted font size */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    z-index: 1001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Zoom Preview */
.zoom-preview {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 2px solid #ccc;
    background-repeat: no-repeat;
    background-color: white;
    display: none;
    z-index: 1100;
    pointer-events: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.zoom-preview img {
    position: absolute;
    width: auto;
    height: auto;
    min-width: 100%;
    min-height: 100%;
    transform: scale(2); /* Zoom level */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* For tablets or smaller screens */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns */
    }
}

/* For mobile screens */
@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr; /* 1 column */
    }
}