/*
 * ─── THE PRODUCT GALLERY ─────────────────────────────────────────────────────
 *
 * The shop has ONE gallery. It is rendered by as_product_gallery_enabled() in
 * inc/product-page-signs.php and it is on every single-product page — signs,
 * boards, banners, stands and stickers alike.
 *
 * It lives in its own file because it is used by two routes with different
 * stylesheets. It was route-sign-product.css's until 2026-10-07, which is why
 * the sticker route was still on WooCommerce's stock FlexSlider gallery: the
 * component was not reachable from there, so that route restyled Woo's instead
 * and lost a specificity fight it could not win — the thumbnails rendered at
 * 30px, which is 25% of their grid track, Woo's `width` beating the theme's.
 *
 * Route-specific behaviour does NOT belong here. The banner route's sticky
 * column, the deluxe caption size, and the phone layout that dissolves the
 * gallery to reorder it against the facts strip all stay in
 * route-sign-product.css, because each of them names another component. What
 * is here is the gallery itself and nothing that knows what it sits beside.
 *
 * Loaded before both route stylesheets, so either can override it.
 */

.as-sgnp-gallery { display: flex; flex-direction: column; gap: var(--space-6); }

/*
 * A square frame with the photograph shown whole inside it. The frame is square
 * so the column height does not change between a 1:2.35 banner stand and a 4:3
 * sandwich board; `contain` is what keeps the product in the picture — see the
 * note in inc/product-page-signs.php.
 */
.as-sgnp-gallery__main {
    aspect-ratio: 1;
    background: center/contain no-repeat;
    border-radius: var(--radius-lg);
}

/*
 * Five across, one row, at every width — see the cap in product-page-signs.php.
 * `minmax(0, 1fr)` rather than `1fr` because a grid track's default minimum is
 * its content, so on a phone the images would refuse to shrink past their own
 * size and push the row wider than the column holding it.
 */
.as-sgnp-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-2-5);
}

.as-sgnp-gallery__thumb {
    aspect-ratio: 1;
    background: var(--color-surface-alt, #e4e4e4) center/contain no-repeat;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    transition: border-color .15s;
}
.as-sgnp-gallery__thumb:hover { border-color: rgba(45,56,75,.25); }
.as-sgnp-gallery__thumb.is-active { border-color: var(--color-accent, #1AB0E0); }

/* A short label under each thumbnail — the attachment's alt text, so it is
   written where images are managed and shown only when somebody wrote one. */
.as-sgnp-gallery__thumbwrap { display: flex; flex-direction: column; gap: var(--space-1-5); min-width: 0; }
.as-sgnp-gallery__cap {
    font-size: var(--text-label); font-weight: 700; color: var(--color-text-muted, #555b68);
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

@media (max-width: 560px) {
    /*
     * A square photograph is 367px of a 780px screen. Capping the height keeps
     * the product perfectly legible — it is `contain`, so nothing crops — and
     * buys back 87 of them.
     */
    .as-sgnp-gallery__main {
        aspect-ratio: auto;
        height: 280px;
    }

    /*
     * The captions go. At five across on a phone each one is under 60px wide,
     * so "Junction Public Market" renders as "Junction …" — a word and an
     * ellipsis under a picture that already says it. They cost 22px of the row
     * and tell nobody anything. The alt text stays, so the caption is still
     * there for a screen reader; it is the printed line that goes.
     */
    .as-sgnp-gallery__cap { display: none; }
}

/* The smallest phones need another 40px; the photograph is `contain`, so it
   loses height and not a pixel of the product. */
@media (max-width: 420px) {
    .as-sgnp-gallery__main { height: 240px; }
}
