/* ==========================================================================
   Product detail — gallery, colour swatches, sizes, specification
   ==========================================================================
   Below 992px the gallery keeps its original stacked shape (thumbnails under
   the image, no zoom): the phone layout is deliberately left alone and every
   desktop-only rule is inside the media query at the foot of this file.
   ========================================================================== */

.pdp-gallery { display: flex; flex-direction: column; gap: 12px; }

/* The rail comes first in the DOM so that on wide screens it sits to the left
   of the image without reordering the markup. On a phone that would put the
   thumbnails above the photo, which is not where they were — so the order is
   flipped back here and reset inside the desktop media query. */
.pdp-rail  { order: 2; }
.pdp-stage { order: 1; }

.pdp-stage {
    position: relative;
    background: #f6f6f6;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pdp-stage-img {
    width: 100%;
    height: 100%;
    /* contain, not cover: feed photography is not a consistent aspect ratio
       and cropping a garment at the hem is worse than letterboxing it. */
    object-fit: contain;
    display: block;
    transition: transform .35s ease;
}

.pdp-badge {
    position: absolute;
    top: 12px; left: 12px;
    background: #c0392b;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    padding: 5px 10px;
    border-radius: 6px;
    z-index: 2;
}

.pdp-zoom-hint { display: none; }

.pdp-rail { display: flex; gap: 8px; flex-wrap: wrap; }

.pdp-thumb {
    width: 68px; height: 68px;
    padding: 0;
    border: 2px solid #e6e6e6;
    border-radius: 9px;
    background: #f6f6f6;
    overflow: hidden;
    cursor: pointer;
    flex: none;
    transition: border-color .18s ease, transform .18s ease;
}

.pdp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pdp-thumb:hover { border-color: #bdbdbd; }
.pdp-thumb.is-active { border-color: var(--stylo-accent, #c45a3c); }

/* ── Blocks shared by colour / size / details ─────────────────────────── */
.pdp-block { margin-bottom: 22px; }

.pdp-block-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.pdp-block-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #6b6b6b;
    margin: 0;
}

.pdp-block-value { font-size: 14px; font-weight: 600; color: #1a1a1a; }
.pdp-block-value.is-none { color: #b3261e; }

/* ── Colour swatches ──────────────────────────────────────────────────── */
.pdp-swatches { display: flex; flex-wrap: wrap; gap: 10px; }

.pdp-swatch {
    position: relative;
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: var(--sw, #ddd);
    /* The ring is drawn outside the colour so a white swatch is still visible
       and the selected state does not shrink the colour itself. */
    box-shadow: 0 0 0 1px rgba(0,0,0,.16), 0 0 0 3px transparent;
    transition: box-shadow .2s ease, transform .2s ease;
}

.pdp-swatch:hover { transform: translateY(-2px) scale(1.06); }

.pdp-swatch.is-active {
    box-shadow: 0 0 0 1px rgba(0,0,0,.16), 0 0 0 3px var(--stylo-accent, #c45a3c);
}

/* No hex from the feed means "multicoloured" — drawn as a wheel rather than
   guessed at with an arbitrary colour. */
.pdp-swatch.is-multi {
    background: conic-gradient(#e74c3c, #f1c40f, #2ecc71, #3498db, #9b59b6, #e74c3c);
}

.pdp-swatch.is-out { opacity: .4; cursor: not-allowed; }
.pdp-swatch.is-out::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to top left, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
    border-radius: 50%;
}
.pdp-swatch.is-out:hover { transform: none; }

/* ── Sizes ────────────────────────────────────────────────────────────── */
.pdp-sizes { display: flex; flex-wrap: wrap; gap: 8px; }

.pdp-size {
    min-width: 46px;
    padding: 9px 13px;
    border: 1.5px solid #e0e0e0;
    border-radius: 9px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 700;
    color: #1a1a1a;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.pdp-size:hover:not(:disabled) {
    border-color: var(--stylo-accent, #c45a3c);
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(196, 90, 60, .18);
}

.pdp-size[aria-pressed="true"] {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.pdp-size.is-out,
.pdp-size:disabled {
    color: #bdbdbd;
    background: #fafafa;
    border-color: #efefef;
    text-decoration: line-through;
    cursor: not-allowed;
}

/* ── Specification ────────────────────────────────────────────────────── */
.pdp-specs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: #ececec;
    border: 1px solid #ececec;
    border-radius: 10px;
    overflow: hidden;
    margin: 0;
}

.pdp-spec { background: #fff; padding: 11px 14px; }

/* An odd number of details left the last grid cell empty, showing the grey
   gap colour as a dead box. The final odd row spans both columns instead. */
.pdp-spec:last-child:nth-child(odd) { grid-column: 1 / -1; }

.pdp-spec dt {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8a8a8a;
    margin-bottom: 2px;
}

.pdp-spec dd { margin: 0; font-size: 14px; font-weight: 600; color: #1a1a1a; }

/* ==========================================================================
   Wide screens — vertical thumbnail rail beside the image, and hover zoom
   ========================================================================== */
@media (min-width: 992px) {

    .pdp-gallery { flex-direction: row; align-items: flex-start; gap: 14px; }
    .pdp-rail  { order: 0; }
    .pdp-stage { order: 0; }

    .pdp-rail {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 10px;
        width: 78px;
        flex: none;
        max-height: 560px;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .pdp-thumb { width: 78px; height: 92px; }

    .pdp-stage { flex: 1 1 auto; aspect-ratio: 4 / 5; cursor: zoom-in; }

    /* The zoom is a transform on the image with its origin following the
       pointer — no second full-size copy to download, and it stays sharp
       because the feed images are far larger than the frame. */
    .pdp-stage.is-zooming .pdp-stage-img {
        transform: scale(2.1);
        transition: transform .18s ease;
    }

    .pdp-zoom-hint {
        display: flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        bottom: 12px; right: 12px;
        background: rgba(0, 0, 0, .62);
        color: #fff;
        font-size: 11.5px;
        font-weight: 600;
        padding: 6px 11px;
        border-radius: 999px;
        pointer-events: none;
        opacity: 1;
        transition: opacity .2s ease;
        z-index: 2;
    }

    .pdp-stage.is-zooming .pdp-zoom-hint { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .pdp-stage-img, .pdp-swatch, .pdp-size, .pdp-thumb { transition: none; }
    .pdp-stage.is-zooming .pdp-stage-img { transform: none; }
}
