/* ==========================================================================
   Homepage product cards = the shop page's cards (ARKAN-438)

   Every homepage product section (New Arrivals, Best Sellers, Trending Now,
   On Sale, Sale, Brand, Explore by Category, Complete the Look, Featured Edit /
   The Edit, Explore Men and the "+ Add Section" grids) draws the shop
   (collection) page's card — js/products.js renderProductCard(), the markup of
   template-collection.php renderProducts(). The card rules below are the shop
   page's own (template-collection.php <style>, ARKAN-409 / ARKAN-411), scoped
   to the homepage card (.qs-home-card) instead of #product-grid.

   The grids lose their lines and box (the beige 1px gaps, outline and rounded
   frame). Spacing, from the ticket's picture (1440px wide): cards 24px apart,
   rows 56px apart, the photos and text level with the section's title and its
   VIEW MORE button (no side padding in the card); the New Arrivals panel keeps
   32px inside it. Under 1024px (two cards across) the shop page's phone
   spacing: 14px between the cards, 40px between the rows.
   ========================================================================== */

/* --------------------------------------------------------------------------
   The grids: no lines, no box
   -------------------------------------------------------------------------- */
.page-homepage .products-container,
.page-homepage .featured-edit-grid,
.page-homepage .explore-men-grid,
.page-homepage .ctl-frame,
.page-homepage .ctl-grid {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    border-radius: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
}

.page-homepage .products-container,
.page-homepage .featured-edit-grid,
.page-homepage .explore-men-grid,
.page-homepage .ctl-grid {
    column-gap: 24px !important;
    row-gap: 56px !important;
}

/* Explore Men: the grid sits inside the section's frame, beside the slider
   panel: 32px in, as the panel's own text */
.page-homepage .explore-men-grid {
    padding: 32px !important;
}

/* New Arrivals: the white panel under its heading keeps 32px inside it (its
   foot is white on white, so the cards end the section as the other rows do) */
.page-homepage .new-arriaval-products-container .products-container {
    background: #FFFFFF !important;
    padding: 32px 32px 0 !important;
}

@media (min-width: 1024px) {
    /* Rows as tall as the cards (the old fixed 578px rows left the cards
       stretched); the big card spans both */
    .page-homepage .new-arriaval-products-container .products-container.jsx-2630333056 {
        grid-template-rows: auto auto;
    }
}

@media (max-width: 1023px) {
    .page-homepage .products-container,
    .page-homepage .featured-edit-grid,
    .page-homepage .explore-men-grid,
    .page-homepage .ctl-grid {
        column-gap: 14px !important;
        row-gap: 40px !important;
    }

    .page-homepage .products-container {
        grid-template-rows: auto !important;
    }

    .page-homepage .new-arriaval-products-container .products-container {
        padding: 16px 16px 0 !important;
    }

    .page-homepage .explore-men-grid {
        padding: 16px !important;
    }
}

/* The grid cell: only places the card (no white box, no padding) */
.page-homepage .product-card-wrapper:has(> .product-card.qs-home-card),
.page-homepage .featured-edit-grid > *,
.page-homepage .explore-men-grid > *,
.page-homepage .ctl-grid > * {
    display: flex;
    background: transparent !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    min-width: 0;
    overflow: visible !important;
}

/* --------------------------------------------------------------------------
   The card (template-collection.php, ARKAN-411): a 32px top row (label +
   heart), 16px, the square photo box, 16px, then name / price / colours 4px
   apart, pushed to the card's bottom. Phones (under 768px): no top row, a
   taller photo box (165 x 230), 8px to the text, 2px apart.
   -------------------------------------------------------------------------- */
.page-homepage .product-card.qs-home-card {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-align: left;
    position: relative;
    background: #fff;
    text-decoration: none;
    color: inherit;
    padding: 48px 0 0;
    gap: 0;
    min-width: 0;
    border: 0;
}

html[dir="rtl"] .page-homepage .product-card.qs-home-card {
    text-align: right;
}

/* The photo box: square, white; the "+" sits in its bottom corner */
.page-homepage .qs-home-card .product-card-image-wrap {
    position: relative;
    width: 100%;
    align-self: stretch;
    aspect-ratio: 1 / 1;
    margin-bottom: 16px;
    background: var(--qs-product-image-bg, #FFFFFF);
}

/* Fills the box (the colour swiper slides inside it) ... */
.page-homepage .qs-home-card .product-card-image-wrap > .product-card-image {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* ... and the photo is 72% x 72% of the box, centred, never cropped */
.page-homepage .qs-home-card .product-card-image-wrap > .product-card-image img {
    position: absolute;
    top: 14%;
    left: 14%;
    width: 72%;
    height: 72%;
    max-width: none;
    margin: 0;
    object-fit: contain;
}

.page-homepage .qs-home-card .product-card-brand {
    display: none;
}

/* Name: Inter 15/20, one line, "…" when longer */
.page-homepage .qs-home-card .product-card-title {
    align-self: stretch;
    margin: auto 0 0;
    min-height: 0;
    font-family: var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    font-size: 15px !important;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0;
    color: #1A1A1A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Price: Inter 15/20 grey; on sale bold red + the old price 13px struck, 8px apart */
.page-homepage .qs-home-card .product-card-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
    height: 20px;
    margin: 4px 0 0;
    font-family: var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    font-size: 15px !important;
    font-weight: 400;
    line-height: 20px;
    letter-spacing: 0;
    color: #5E5E5E;
    white-space: nowrap;
}

.page-homepage .qs-home-card .product-card-price > .price,
.page-homepage .qs-home-card .product-card-price > .price.has-discount {
    font-size: 15px !important;
}

.page-homepage .qs-home-card .product-card-price:has(> .compare-price) {
    flex-wrap: nowrap;
    column-gap: 8px;
}

.page-homepage .qs-home-card .product-card-price > .price.has-discount {
    color: #C8102E !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
}

.page-homepage .qs-home-card .product-card-price > .compare-price {
    color: #6B6B6B !important;
    font-size: 13px !important;
    letter-spacing: 0 !important;
}

/* Colours 4px under the price; a card with no colours keeps the row's
   height, so names and prices line up */
.page-homepage .qs-home-card > .color-swatches {
    margin-top: 4px;
}

.page-homepage .qs-home-card:not(:has(> .color-swatches)) > .product-card-price {
    margin-bottom: 25px;
}

/* --------------------------------------------------------------------------
   Colour circles (ARKAN-409): 10px, 8px apart, left-aligned; 3px in so the
   ring fits (the shown colour's ring is collection-colour-swiper.css)
   -------------------------------------------------------------------------- */
.page-homepage .qs-home-card .color-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin: 0;
    padding: 8px 0 3px 3px;
    align-self: flex-start;
}

.page-homepage .qs-home-card .color-swatch {
    width: 10px;
    height: 10px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.page-homepage .qs-home-card .color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Sold-out colour: struck through, as on the product page (still swaps the photo) */
.page-homepage .qs-home-card .color-swatch.unavailable {
    opacity: 0.4;
}

.page-homepage .qs-home-card .color-swatch.unavailable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: #999;
    transform: rotate(-45deg);
}

/* Light colours: a grey edge so they show on white */
.page-homepage .qs-home-card .color-swatch[data-color="white"],
.page-homepage .qs-home-card .color-swatch[data-color="cream"],
.page-homepage .qs-home-card .color-swatch[data-color="ivory"],
.page-homepage .qs-home-card .color-swatch[data-color="beige"],
.page-homepage .qs-home-card .color-swatch[data-color="nude"] {
    border-color: #CFCFCF;
}

/* "+N": phones show the first 7 colours only */
.page-homepage .qs-home-card .color-swatches-more {
    display: none;
    font-size: 11px;
    line-height: 8px;
    color: #6B6B6B;
}

/* --------------------------------------------------------------------------
   Top row (ARKAN-411): the card's label (NEW, SOLD OUT, Best Seller, a
   Settings → Badges badge, or the ON SALE bubble) at the start and the
   wishlist heart at the end, in the 32px row above the photo box. Text
   labels: Inter 12/16 600, 0.16em, 2px bar, 8px in; the bubble keeps its
   ARKAN-379 look. shopify-integration.css places labels with !important
   under 1024px, so the places here are too.
   -------------------------------------------------------------------------- */
.page-homepage .qs-home-card > .new-badge,
.page-homepage .qs-home-card > .best-seller-badge,
.page-homepage .qs-home-card > .sale-badge,
.page-homepage .qs-home-card > .sold-out-badge,
.page-homepage .qs-home-card > .low-stock-badge,
.page-homepage .qs-home-card > .qs-custom-badge {
    top: 16px;
    left: 0 !important;
    right: auto !important;
    transform: translateY(-50%);
}

html[dir="rtl"] .page-homepage .qs-home-card > .new-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .best-seller-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .sale-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .sold-out-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .low-stock-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .qs-custom-badge {
    left: auto !important;
    right: 0 !important;
}

.page-homepage .qs-home-card > .new-badge,
.page-homepage .qs-home-card > .best-seller-badge,
.page-homepage .qs-home-card > .sold-out-badge,
.page-homepage .qs-home-card > .low-stock-badge,
.page-homepage .qs-home-card > .qs-custom-badge {
    padding: 0 0 0 8px !important;
    border-left-width: 2px;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.16em;
}

.page-homepage .qs-home-card > .new-badge,
.page-homepage .qs-home-card > .best-seller-badge,
.page-homepage .qs-home-card > .low-stock-badge {
    font-family: var(--qs-font-body, 'Inter', 'IBM Plex Sans Arabic', sans-serif);
    font-weight: 600;
}

html[dir="rtl"] .page-homepage .qs-home-card > .new-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .best-seller-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .sold-out-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .low-stock-badge,
html[dir="rtl"] .page-homepage .qs-home-card > .qs-custom-badge {
    padding: 0 8px 0 0 !important;
    border-right-width: 2px;
}

/* A long Settings → Badges label stops with … before the heart */
.page-homepage .qs-home-card > .qs-custom-badge {
    max-width: calc(100% - 52px);
}

/* Heart: 32px white circle, 1px #EEEEEE edge, 18px icon, at the row's end */
.page-homepage .qs-home-card > .wishlist-heart {
    top: 0;
    right: 0;
    left: auto;
    width: 32px;
    height: 32px;
    box-sizing: border-box;
    border: 1px solid #EEEEEE;
    background: #FFFFFF;
    box-shadow: none;
}

html[dir="rtl"] .page-homepage .qs-home-card > .wishlist-heart {
    right: auto;
    left: 0;
}

.page-homepage .qs-home-card > .wishlist-heart svg {
    width: 18px;
    height: 18px;
}

.page-homepage .qs-home-card > .wishlist-heart:not(.active) svg {
    stroke: #1A1A1A;
}

/* --------------------------------------------------------------------------
   Phones (under 768px), as the shop page's phone card
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    .page-homepage .product-card.qs-home-card {
        padding: 0;
    }

    .page-homepage .qs-home-card .product-card-image-wrap {
        aspect-ratio: 165 / 230;
        margin-bottom: 8px;
    }

    /* The photo 120px high in the 230px box, at most 88% wide */
    .page-homepage .qs-home-card .product-card-image-wrap > .product-card-image img {
        top: 23.913%;
        left: 6%;
        width: 88%;
        height: 52.174%;
    }

    .page-homepage .qs-home-card .product-card-title {
        font-size: 13px !important;
        line-height: 18px;
    }

    .page-homepage .qs-home-card .product-card-price {
        gap: 6px;
        height: 18px;
        margin-top: 2px;
        font-size: 13px !important;
        line-height: 18px;
    }

    .page-homepage .qs-home-card .product-card-price > .price,
    .page-homepage .qs-home-card .product-card-price > .price.has-discount {
        font-size: 13px !important;
    }

    .page-homepage .qs-home-card .product-card-price:has(> .compare-price) {
        column-gap: 6px;
    }

    .page-homepage .qs-home-card .product-card-price > .compare-price {
        font-size: 11px !important;
    }

    .page-homepage .qs-home-card > .color-swatches {
        margin-top: 2px;
    }

    .page-homepage .qs-home-card:not(:has(> .color-swatches)) > .product-card-price {
        margin-bottom: 19px;
    }

    .page-homepage .qs-home-card .color-swatches {
        gap: 6px;
        padding-top: 6px;
    }

    .page-homepage .qs-home-card .color-swatch {
        width: 8px;
        height: 8px;
    }

    .page-homepage .qs-home-card .color-swatches .color-swatch:nth-child(n+8) {
        display: none;
    }

    .page-homepage .qs-home-card .color-swatches-more {
        display: inline;
    }

    /* No top row: the label 6px down at the photo box's start (10/14, 6px
       in) and the heart (30px circle, 16px icon) in its top corner, with a
       44px tap area */
    .page-homepage .qs-home-card > .new-badge,
    .page-homepage .qs-home-card > .best-seller-badge,
    .page-homepage .qs-home-card > .sale-badge,
    .page-homepage .qs-home-card > .sold-out-badge,
    .page-homepage .qs-home-card > .low-stock-badge,
    .page-homepage .qs-home-card > .qs-custom-badge {
        top: 6px;
        left: 0 !important;
        transform: none;
    }

    html[dir="rtl"] .page-homepage .qs-home-card > .new-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .best-seller-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .sale-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .sold-out-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .low-stock-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .qs-custom-badge {
        left: auto !important;
        right: 0 !important;
    }

    .page-homepage .qs-home-card > .new-badge,
    .page-homepage .qs-home-card > .best-seller-badge,
    .page-homepage .qs-home-card > .sold-out-badge,
    .page-homepage .qs-home-card > .low-stock-badge,
    .page-homepage .qs-home-card > .qs-custom-badge {
        padding: 0 0 0 6px !important;
        font-size: 10px;
        line-height: 14px;
    }

    html[dir="rtl"] .page-homepage .qs-home-card > .new-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .best-seller-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .sold-out-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .low-stock-badge,
    html[dir="rtl"] .page-homepage .qs-home-card > .qs-custom-badge {
        padding: 0 6px 0 0 !important;
    }

    .page-homepage .qs-home-card > .qs-custom-badge {
        max-width: calc(100% - 44px);
    }

    .page-homepage .qs-home-card > .wishlist-heart {
        top: 1px;
        right: 1px;
        width: 30px;
        height: 30px;
    }

    html[dir="rtl"] .page-homepage .qs-home-card > .wishlist-heart {
        right: auto;
        left: 1px;
    }

    .page-homepage .qs-home-card > .wishlist-heart::after {
        content: "";
        position: absolute;
        inset: -7px;
    }

    .page-homepage .qs-home-card > .wishlist-heart svg {
        width: 16px;
        height: 16px;
    }
}

/* --------------------------------------------------------------------------
   Cards in a cell of fixed height, on desktop: the New Arrivals big card
   (two rows tall) and Featured Edit / The Edit (its 2 x 2 grid ends level
   with the section's photo, featured-edit.css). The photo box takes the
   height the text leaves; the photo inside it is still whole.
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
    .page-homepage .new-arriaval-products-container .products-container > [style*="grid-area:a"] .qs-home-card .product-card-image-wrap,
    .page-homepage .featured-edit-grid .qs-home-card .product-card-image-wrap {
        aspect-ratio: auto;
        flex: 1 1 0;
        min-height: 0;
    }

    .page-homepage .featured-edit-grid > * {
        min-height: 0;
    }
}

/* --------------------------------------------------------------------------
   Complete the Look (grid): the section's tick box joins the card's top
   row, just before the heart, at the heart's size (32px; 30px on phones)
   -------------------------------------------------------------------------- */
.page-homepage .ctl-grid > .ctl-cell {
    position: relative;
}

.page-homepage .ctl-cell > .ctl-check {
    top: 0;
    inset-inline-end: 40px;
    width: 32px;
    height: 32px;
}

.page-homepage .ctl-cell .ctl-check-box {
    width: 32px;
    height: 32px;
}

@media (max-width: 767px) {
    .page-homepage .ctl-cell > .ctl-check {
        top: 1px;
        inset-inline-end: 37px;
        width: 30px;
        height: 30px;
    }

    .page-homepage .ctl-cell .ctl-check-box {
        width: 30px;
        height: 30px;
    }
}
