/* ==========================================
   Gallery Grid & Buttons Styles (Updated)
   ========================================== */

.gallery-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    background-color: #f9f9f9;
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.masonry-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #f5f5f5;
}

@keyframes smoothFadeSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.masonry-item.new-item-fade {
    animation: smoothFadeSlide 0.5s ease forwards;
}

.masonry-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    border-radius: 4px;
}

.masonry-item:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Thumbnails can be reached with the keyboard (Tab), so show where the focus is */
.masonry-item:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

.gallery-actions-container[hidden],
.gallery-btn[hidden] {
    display: none;
}

.gallery-actions-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    margin-bottom: 10px;
    width: 100%;
}

.gallery-btn {
    background-color: #F1F1F1;
    color: #666666;
    border: none;
    padding: 12px 24px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gallery-btn:hover {
    background-color: #e2e2e2;
    transform: translateY(-1px);
}

.gallery-btn:active {
    transform: translateY(0);
}

.section-header-wrap2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: #333333;
    line-height: 1.35;
    letter-spacing: -0.5px;
    text-align: center;
    margin-bottom: 20px;
}

.section-header-wrap2 h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: #333333;
    line-height: 1.35;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.section-header-wrap2 p {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

/* Expand / collapse bar.
   This is now a real <button>, so the first three lines remove the default button look.
   It is the ONE place this bar is styled for the gallery page:
   the matching rules were removed from before-after.css, and the values below
   are what the two files used to add up to. */
.section-toggle-bar {
    appearance: none;
    border: 0;
    font: inherit;

    width: 100%;
    max-width: none;
    height: 35px;
    background-color: #f1f1f1;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin: 20px auto 25px auto;
    padding: 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

.section-toggle-bar:hover {
    background-color: #c2c0bc !important;
}

.section-toggle-bar:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

.section-toggle-bar .toggle-icon {
    font-size: 11px;
    color: #555555;
    background-color: transparent;
    padding: 2px 10px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transition: all 0.2s;
    pointer-events: none;
}

.section-toggle-bar:hover .toggle-icon {
    background-color: #c2c0bc !important;
    color: #ffffff !important;
	box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.section-toggle-bar.collapsed {
    opacity: 0.6;
}

/* ==========================================
   Collapsible Section (expand / collapse)
   These rules used to live in before-after.css, which meant the gallery's
   expand/collapse only worked while the before/after file was linked.
   They live here now, so the gallery works on its own.
   ========================================== */

.toggle-icon {
    font-size: 1.2rem;
    color: #333;
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(180deg);
}

.collapsible-content {
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease, visibility 0.3s;
    max-height: 5000px;
    opacity: 1;
    overflow: visible; /* so shadows and hovered thumbnails are not cut off */
}

/* If your toggle script adds an active/expanded class, ensure it opens fully */
.collapsible-content.expanded,
.collapsible-content:not(.collapsed) {
    max-height: none; /* Allows the container to grow as tall as the single-column list needs */
}

/* Hidden = collapsed AND removed from the Tab order and from screen readers.
   (!important on max-height wins over the "max-height: none" rule just above.) */
.collapsible-content.is-hidden {
    max-height: 0 !important;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    margin: 0 !important;
    padding: 0 !important;
}


/* ==========================================
   Responsive Adjustments for Buttons & Mobile
   ========================================== */

@media (max-width: 600px) {
    .gallery-actions-container {
        flex-direction: column;
        width: 100%;
    }

    .gallery-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 1024px), (pointer: coarse) {
    .gallery-section.fade-in,
    .fade-in {
        opacity: 1 !important;
        transform: none !important;
        visibility: visible !important;
        transition: none !important;
        animation: none !important;
    }
}