/* Main wrapper for the gallery toggle */
.gallery-toggle-wrapper {
    margin: 2.5em 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* The clickable button */
.gallery-toggle-button {
    display: flex
;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 15px 20px;
    font-family: 'Prompt', sans-serif;
    font-size: 1.2em;
    font-weight: 600;
    color: #ffffff;
    background-color: #0065cb;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.25s ease-in-out;
    gap: 15px;
}

/* INVERTED hover effect */
.gallery-toggle-button:hover {
    color: #0065cb;
    background-color: #ffffff;
    border-color: #0065cb;
}

/* The content area that slides down */
.gallery-toggle-content {
    background-color: #ffffff;
    padding: 25px 15px; /* Added more space for the gallery */
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out;
}

.gallery-toggle-content.is-closed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
}

/* --- FORCEFUL OVERRIDE FOR ENVIRA GALLERY LAYOUT --- */

/* 1. Target the main gallery container and force it to be a Flexbox grid */
.gallery-toggle-content .envira-gallery-public {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important; /* This is the key for centering */
    gap: 15px !important; /* Consistent spacing between all images */
    height: auto !important; /* Override inline height */
}

/* 2. Reset every single gallery item to work within our new Flexbox grid */
.gallery-toggle-content .envira-gallery-item {
    /* These !important rules are ESSENTIAL to override Envira's inline JavaScript styles */
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    opacity: 1 !important;
    margin: 0 !important;
    padding: 0 !important;

    /* Define how items should grow and shrink */
    flex: 1 1 220px; /* Base size of 220px, but can grow/shrink */
    max-width: 280px; /* Prevents images from getting too large */
    
    /* Optional: Add a nice border */
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

/* 3. Ensure the image itself and its link are displayed correctly and are not cropped */
.gallery-toggle-content .envira-gallery-item a,
.gallery-toggle-content .envira-gallery-item img {
    width: 100% !important;
    height: auto !important; /* CRUCIAL: This preserves the aspect ratio and prevents cropping */
    display: block !important;
    margin: 0 !important;
}

/* 4. Hide the Envira caption that can interfere with the layout */
.gallery-toggle-content .envira-gallery-item .caption {
    display: none !important;
}


/* The '+' and '-' icon styling */
.gallery-toggle-icon {
    position: relative;
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease-in-out;
    flex-shrink: 0;
}

.gallery-toggle-icon::before,
.gallery-toggle-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background-color: currentColor;
    transform: translate(-50%, -50%);
}

.gallery-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

.gallery-toggle-button[aria-expanded="true"] .gallery-toggle-icon {
    transform: rotate(180deg);
}

.gallery-toggle-button[aria-expanded="true"] .gallery-toggle-icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}