/* ==========================================================================
   Shop product grid (Artemis)

   The product listing grid shared by /shop/products, every category page and
   /favourites. Same .am-* design language as the home sections
   (public/project/css/shop-sections.css) — CSS Grid inside a Bootstrap
   .container, so width tracks the .container steps in custom.css.

   Paired with:
     resources/views/project/shop/generic/products.blade.php
     resources/views/project/shop/generic/product-tiles.blade.php
     resources/views/project/shop/product/includes/product-tile.blade.php

   NOTE: the tile image is the ProductVariantViewer composite — a fixed-px
   stack scaled to the cell by window.scaleProductViewers() in the shop layout.
   Its wrapper (.viewer-responsive) is styled in eshop/css/custom.css; the grid
   only gives it a square, full-width cell to scale into. Anything that appends
   tiles must call window.scaleProductViewers() afterwards.
   ========================================================================== */

/* ------------------------------------------------------------ Grid ------- */

.am-prod-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 30px 22px;
    margin: 0 0 6px;
}

/* --------------------------------------------------------- Product card -- */

.am-prod-card,
.am-prod-card:visited {
    position: relative;
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.am-prod-card:hover,
.am-prod-card:focus {
    color: inherit;
    text-decoration: none;
}

/* Media ------------------------------------------------------------------ */

.am-prod-card__media {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f6;
    transition: box-shadow .2s ease;
}

.am-prod-card:hover .am-prod-card__media {
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

/* The viewer composite is absolutely positioned by custom.css — this just
   centres the square it scales into. */
.am-prod-card__media .viewer-responsive {
    height: 100%;
}

.am-prod-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 4px 9px;
    border-radius: 4px;
    background: var(--artemis-red, #ff325a);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .5px;
    text-transform: uppercase;
}

/* Body ------------------------------------------------------------------- */

.am-prod-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding-top: 11px;
}

.am-prod-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    /* Two lines reserved so cards stay aligned whatever the name length */
    min-height: 2.8em;
    overflow: hidden;
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.4;
    color: #111113;
}

.am-prod-card:hover .am-prod-card__name {
    color: var(--artemis-red, #ff325a);
}

.am-prod-card__price {
    margin-top: 4px;
    font-size: 13.5px;
    font-weight: 600;
    color: #4d4d50;
}

/* Always rendered, even when empty, so on-sale and full-price cards match */
.am-prod-card__note {
    min-height: 1.35em;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--artemis-red, #ff325a);
}

/* CTA — a span, not a link: the whole card is already one anchor */
.am-prod-card__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-top: 10px;
    border: 1px solid #c9c9cd;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #111113;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.am-prod-card:hover .am-prod-card__cta,
.am-prod-card:focus .am-prod-card__cta {
    border-color: #111113;
    background: #111113;
    color: #fff;
}

/* Keyboard focus must be visible — hover styling alone is not enough */
.am-prod-card:focus-visible {
    outline: 2px solid var(--artemis-red, #ff325a);
    outline-offset: 4px;
    border-radius: 12px;
}

/* -------------------------------------------------- Empty / loading ------ */

.am-prod-empty {
    padding: 60px 0 70px;
    text-align: center;
    color: #6f6f71;
}

.am-prod-empty__title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 700;
    color: #111113;
}

.am-prod-empty__body {
    margin: 0;
    font-size: 14px;
}

.am-prod-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 30px 0;
    font-size: 13.5px;
    color: #99999c;
}

.am-prod-loader[hidden] {
    display: none;
}

/* --------------------------------------------------- Page furniture ------ */

/* Heading used by pages that own a grid but no collection header */
.am-prod-head {
    margin: 28px 0 22px;
    text-align: center;
}

.am-prod-head__title {
    margin: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: #111113;
}

.am-prod-head__count {
    margin: 6px 0 0;
    font-size: 13px;
    color: #6f6f71;
}

/* Parent link + sub-category chips on a category page */

.am-subcat {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0 4px;
}

.am-subcat__chip,
.am-subcat__chip:visited {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border: 1px solid #dcdcdf;
    border-radius: 999px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #111113;
    text-decoration: none;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.am-subcat__chip:hover,
.am-subcat__chip:focus {
    border-color: #111113;
    background: #111113;
    color: #fff;
    text-decoration: none;
}

/* The "up to parent" chip reads as a step back, not a sibling */
.am-subcat__chip--up {
    background: #f4f4f6;
    border-color: #f4f4f6;
    color: #4d4d50;
}

.am-prod-pager {
    margin-top: 26px;
    text-align: center;
}

.am-prod-pager .pagination {
    margin: 0;
}

/* --------------------------------------------------- Breakpoints --------- */

/* .container widens past 1400px (custom.css) — take a fifth column with it */
@media (min-width: 1400px) {
    .am-prod-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .am-prod-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 26px 18px;
    }

    .am-prod-head {
        margin: 22px 0 18px;
    }

    .am-prod-head__title {
        font-size: 24px;
    }

    .am-subcat {
        margin: 18px 0 4px;
    }

    .am-subcat__chip {
        padding: 6px 13px;
        font-size: 12.5px;
    }
}

@media (max-width: 575px) {
    .am-prod-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 12px;
    }

    .am-prod-card__name {
        font-size: 12.5px;
    }

    .am-prod-card__price {
        font-size: 12.5px;
    }

    .am-prod-card__cta {
        height: 32px;
        font-size: 12px;
    }

    .am-prod-head__title {
        font-size: 20px;
    }
}
