/* ============================================================================
   product-groups.css — "الأشكال المتوفرة" swatch switcher on the PDP.

   Loaded LAST on product pages (enqueued after pdp.css), so it authoritatively
   owns the switcher look. Desktop and mobile are tuned SEPARATELY:
     • Desktop (>=981px): roomy wrapping grid of large rounded thumbs.
     • Mobile  (<=980px): a horizontal snap-scroll strip that never breaks layout.
   Brand tokens come from :root (burgundy #171717 / gold / cream).
   ============================================================================ */

.drah-pgroup {
    --pg-gold: #b48a3c;
    --pg-burgundy: #171717;
    margin: 14px 0;
    direction: rtl;
}

/* ---- header: centered title flanked by symmetric gold hairlines ---- */
.drah-pgroup-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 13px;
}

.drah-pgroup-title {
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: .01em;
    color: var(--pg-burgundy);
    white-space: nowrap;
    text-align: center;
}

.drah-pgroup-head::before,
.drah-pgroup-head::after {
    content: "";
    flex: 0 1 64px;
    height: 1px;
    background: linear-gradient(90deg, rgba(180, 138, 60, 0), rgba(180, 138, 60, .5));
}

.drah-pgroup-head::after {
    background: linear-gradient(90deg, rgba(180, 138, 60, .5), rgba(180, 138, 60, 0));
}

/* ---- swatch base (shared) ---- */
.drah-pgroup-swatch {
    display: block;
    text-align: center;
    color: var(--pg-burgundy);
    -webkit-tap-highlight-color: transparent;
}

.drah-pgroup-swatch-img {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(17,17,17, .07);
    transition: transform .25s ease, box-shadow .25s ease;
}

.drah-pgroup-swatch-img img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    transition: transform .5s ease;
}

.drah-pgroup-swatch.is-active .drah-pgroup-swatch-img {
    box-shadow: 0 0 0 2px var(--pg-gold), 0 10px 26px rgba(17,17,17, .16);
}

/* label under a swatch (only rendered when a custom colour/shape label exists) */
.drah-pgroup-swatch-label {
    display: block;
    margin-top: 9px;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.3;
    color: #6b4a2f;
}

.drah-pgroup-swatch.is-active .drah-pgroup-swatch-label {
    color: var(--pg-gold);
    font-weight: 800;
}

/* ============================ DESKTOP (>=981px) ============================ */
@media (min-width: 981px) {
    .drah-pgroup-swatches {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        padding: 5px 3px;          /* room so the active gold ring is never clipped */
    }

    .drah-pgroup-swatch {
        width: 96px;
    }

    .drah-pgroup-swatch:hover .drah-pgroup-swatch-img {
        transform: translateY(-4px);
        box-shadow: 0 16px 34px rgba(17,17,17, .18);
    }

    .drah-pgroup-swatch:hover .drah-pgroup-swatch-img img {
        transform: scale(1.06);
    }

    /* image-only (no labels): a touch larger and airier */
    .drah-pgroup.no-labels .drah-pgroup-swatch {
        width: 104px;
    }
}

/* ============================ MOBILE (<=980px) ============================ */
@media (max-width: 980px) {
    .drah-pgroup {
        margin: 12px 0;
    }

    .drah-pgroup-head {
        margin-bottom: 9px;
    }

    .drah-pgroup-title {
        font-size: .96rem;
    }

    /* horizontal snap-scroll strip — never wraps, never pushes layout width.
       Vertical padding gives the active gold ring + shadow room so the
       overflow-x scroller doesn't clip it. */
    .drah-pgroup-swatches {
        display: flex;
        flex-wrap: nowrap;
        justify-content: safe center;
        gap: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding: 5px 5px 9px;
        margin: 0 -5px;
        scrollbar-width: none;
    }

    .drah-pgroup-swatches::-webkit-scrollbar {
        display: none;
    }

    .drah-pgroup-swatch {
        flex: 0 0 auto;
        width: 72px;
        scroll-snap-align: start;
    }

    .drah-pgroup-swatch-img {
        border-radius: 14px;
    }

    .drah-pgroup-swatch:active .drah-pgroup-swatch-img {
        transform: scale(.97);
    }

    .drah-pgroup-swatch-label {
        margin-top: 7px;
        font-size: .74rem;
        max-width: 72px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
