/* ── Shared image defaults ─────────────────────────────────── */

.layout-hero-side img,
.layout-hero-top img,
.layout-full-image img,
.layout-image-gallery img,
.layout-image-text img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* ── Image fit classes ────────────────────────────────────── */

.image-fit-cover img { object-fit: cover; }
.image-fit-contain img { object-fit: contain; }
.image-fit-fill img { object-fit: fill; }
.image-fit-none img { object-fit: none; }
.image-fit-scale-down img { object-fit: scale-down; }

/* ── Image position classes ───────────────────────────────── */

.image-position-center img { object-position: center; }
.image-position-top img { object-position: top; }
.image-position-bottom img { object-position: bottom; }
.image-position-left img { object-position: left; }
.image-position-right img { object-position: right; }
.image-position-top-left img { object-position: top left; }
.image-position-top-right img { object-position: top right; }
.image-position-bottom-left img { object-position: bottom left; }
.image-position-bottom-right img { object-position: bottom right; }

/* ── Product Grid Layout ──────────────────────────────────── */

.layout-product-grid {
    /* Container class for custom CSS targeting */
}

/* ── Hero Side Layout ─────────────────────────────────────── */

.layout-hero-side {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 2px;
    align-items: stretch;
}

.layout-hero-side--right {
    grid-template-columns: 2fr 3fr;
}

.layout-hero-side--right .layout-hero-side__image {
    order: 2;
}

.layout-hero-side--right .layout-hero-side__products {
    order: 1;
}

.layout-hero-side__image {
    border-radius: 8px;
    overflow: hidden;
}

/* Hero image should match the height of the products grid */
.layout-hero-side__image img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* Compact product cards inside hero-side layouts */
.layout-hero-side .product-card-image {
    height: 270px;
}

.layout-hero-side__products .mud-grid {
    height: 100%;
}

.layout-hero-side .product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.layout-hero-side .product-card-content {
    padding: 6px !important;
    gap: 2px;
}

.layout-hero-side .price-wholesale {
    font-size: 1rem;
}

.layout-hero-side .size-grid td {
    font-size: 0.6rem;
    padding: 1px 4px;
    min-width: 20px;
}

.layout-hero-side .pack-colour {
    font-size: 0.7rem;
}

/* ── Hero Top Layout ──────────────────────────────────────── */

.layout-hero-top__banner {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.layout-hero-top__banner img {
    max-height: 400px;
    object-fit: cover;
}

.layout-hero-top__banner--text {
    padding: 16px 24px;
    background: #f5f5f5;
}

/* ── Full Image Layout ────────────────────────────────────── */

.layout-full-image {
    border-radius: 8px;
    overflow: hidden;
}

.layout-full-image img {
    max-height: 600px;
}

/* ── Image Gallery Layout ─────────────────────────────────── */

.layout-image-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.layout-image-gallery--count-2 {
    grid-template-columns: repeat(2, 1fr);
}

.layout-image-gallery--count-4 {
    grid-template-columns: repeat(2, 1fr);
}

.layout-image-gallery__item {
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

/* ── Image + Text Layout ──────────────────────────────────── */

.layout-image-text {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: center;
}

.layout-image-text__image {
    border-radius: 8px;
    overflow: hidden;
}

.layout-image-text__image img {
    max-height: 400px;
}

.layout-image-text__text {
    padding: 16px;
}

/* ── Fallback Layout ──────────────────────────────────────── */

.layout-fallback {
    /* Container class for custom CSS targeting */
}

/* ── Tablet (600–959px) ───────────────────────────────────── */

@media (max-width: 959px) {
    .layout-hero-side {
        grid-template-columns: 1fr 1fr;
        gap: 2px;
    }

    .layout-hero-side .product-card-image {
        height: 200px;
    }

    .layout-hero-top__banner img {
        max-height: 300px;
    }

    .layout-full-image img {
        max-height: 400px;
    }

    .layout-image-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .layout-image-text__image img {
        max-height: 300px;
    }
}

/* ── Mobile (< 600px) ─────────────────────────────────────── */

@media (max-width: 599px) {
    .layout-hero-side {
        grid-template-columns: 1fr;
        gap: 2px;
        align-items: start;
    }

    .layout-hero-side--right .layout-hero-side__image,
    .layout-hero-side--right .layout-hero-side__products {
        order: unset;
    }

    .layout-hero-side__image {
        max-height: 400px;
    }

    .layout-hero-side .product-card-image {
        height: auto;
    }

    .layout-hero-top__banner {
        margin-bottom: 8px;
    }

    .layout-hero-top__banner img {
        max-height: 200px;
    }

    .layout-hero-top__banner--text {
        padding: 12px 16px;
    }

    .layout-full-image img {
        max-height: 250px;
    }

    .layout-image-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .layout-image-gallery__item {
        aspect-ratio: 1;
    }

    .layout-image-text {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .layout-image-text__image img {
        max-height: 200px;
    }

    .layout-image-text__text {
        padding: 8px;
    }
}
