/* ConnorModuleSuite — Gallery Grid
 * Uses CSS grid for the column container; JS distributes images into
 * .connor-gallery__col divs in row-major order for correct reading order.
 * Falls back to a single-column flat list if JS hasn't run yet. */

.connor-gallery {
    display: grid;
    grid-template-columns: repeat(var(--cgms-cols, 3), 1fr);
    gap: var(--cgms-gap, 12px);
}

/* Before JS runs, flat <a> tags stack in a single column */
.connor-gallery > a {
    display: block;
    line-height: 0;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

/* After JS distributes into columns */
.connor-gallery__col {
    display: flex;
    flex-direction: column;
    gap: var(--cgms-gap, 12px);
}

.connor-gallery__col a {
    display: block;
    line-height: 0;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

.connor-gallery img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.connor-gallery a:hover img {
    transform: scale(1.03);
}

/* A controlled three-card carousel for PPC landing pages. */
.connor-gallery-slider {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.connor-gallery--slider {
    display: block;
    overflow: hidden;
    min-width: 0;
}

.connor-gallery--slider .connor-gallery__track {
    display: flex;
    gap: var(--cgms-gap, 12px);
    transition: transform 0.4s ease;
    will-change: transform;
}

/* --cgms-per-view defaults to 3, so existing sliders are unchanged. A
   fractional value (e.g. 2.6) cuts the last card for a scroll affordance. */
.connor-gallery--slider .connor-gallery__track > a {
    display: block;
    flex: 0 0 calc((100% - (2 * var(--cgms-gap, 12px))) / var(--cgms-per-view, 3));
    overflow: hidden;
    border-radius: 10px;
    line-height: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.connor-gallery--slider .connor-gallery__track > a img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.connor-gallery__nav {
    display: flex;
    width: 40px !important;
    height: 40px !important;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid rgba(0, 0, 0, 0.42) !important;
    border-radius: 50% !important;
    background: #fff !important;
    background-image: none !important;
    color: #222 !important;
    cursor: pointer;
    line-height: 0 !important;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.connor-gallery__nav svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.connor-gallery__nav:disabled {
    cursor: default;
    opacity: 0.3;
}

.connor-gallery__nav:hover,
.connor-gallery__nav:focus:not(:disabled) {
    background: #222 !important;
    color: #fff !important;
    transform: scale(1.06);
}

@media (max-width: 1024px) {
    .connor-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .connor-gallery--slider .connor-gallery__track > a {
        flex-basis: calc((100% - var(--cgms-gap, 12px)) / 2);
    }
}

@media (max-width: 480px) {
    .connor-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .connor-gallery-slider {
        grid-template-columns: 34px minmax(0, 1fr) 34px;
        gap: 6px;
    }

    .connor-gallery--slider .connor-gallery__track > a {
        flex-basis: 100%;
    }

    .connor-gallery__nav {
        width: 32px !important;
        height: 32px !important;
    }
}
