/* P2.1-C.2 — Product detail redesign (mobile-first).
   Consumes existing Kickoff tokens: --ink, --paper, --rule, --radius,
   --serif, --sans, --mono, --product-accent. No hardcoded brand colours. */

.sd { padding-bottom: clamp(48px, 6vw, 96px); }
.sd .cat-crumbs { margin-bottom: clamp(14px, 2vw, 24px); }

/* ---- layout ---------------------------------------------------------- */
.pd {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(20px, 3vw, 40px);
    align-items: start;
    margin-bottom: clamp(40px, 5vw, 72px);
}
@media (min-width: 920px) {
    .pd {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
        gap: clamp(36px, 4vw, 64px);
    }
    .pd-gallery { position: sticky; top: var(--hz-sticky-top, 96px); }
}

/* ---- gallery --------------------------------------------------------- */
.pd-gallery { min-width: 0; }
.pd-gallery__stage {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--rule);
    box-shadow: 0 1px 0 0 var(--product-accent, transparent) inset,
                0 14px 32px -22px rgba(23, 18, 15, 0.18);
}
.pd-gallery__track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.pd-gallery__track::-webkit-scrollbar { display: none; }
.pd-gallery__slide {
    flex: 0 0 100%;
    margin: 0;
    scroll-snap-align: center;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper);
}
.pd-gallery__img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
/* nav arrows — visible on hover-capable (desktop) devices */
.pd-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 42px; height: 42px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: rgba(253, 250, 242, 0.92);
    color: var(--ink);
    font-size: 22px; line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center; justify-content: center;
    transition: background-color .18s ease, transform .18s ease;
}
.pd-gallery__nav:hover { background: var(--paper); }
.pd-gallery__nav--prev { left: 12px; }
.pd-gallery__nav--next { right: 12px; }
@media (hover: hover) and (min-width: 920px) {
    .pd-gallery__nav { display: flex; }
}
.pd-gallery__counter {
    position: absolute;
    bottom: 12px; right: 12px;
    z-index: 3;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(23, 18, 15, 0.72);
    color: #fff;
    font-family: var(--mono);
    font-size: 11px; font-weight: 700;
    letter-spacing: .06em;
    font-variant-numeric: tabular-nums;
}
@media (min-width: 920px) { .pd-gallery__counter { display: none; } }

.pd-gallery__thumbsbar {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
}
@media (min-width: 920px) { .pd-gallery__thumbsbar { display: flex; } }
.pd-gallery__thumbnav {
    flex: 0 0 auto;
    width: 30px; height: 64px;
    border: 1px solid var(--rule);
    border-radius: calc(var(--radius) * 0.6);
    background: var(--paper);
    color: var(--ink);
    font-size: 18px; line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background-color .15s ease, opacity .15s ease;
}
.pd-gallery__thumbnav:hover { background: rgba(23, 18, 15, .04); }
.pd-gallery__thumbnav:disabled { opacity: .3; cursor: default; }
.pd-gallery__thumbs {
    display: flex;
    flex-wrap: nowrap;              /* single line, never a mosaic */
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    flex: 1 1 auto;
    min-width: 0;
    scroll-snap-type: x proximity;
}
.pd-gallery__thumbs::-webkit-scrollbar { display: none; }
.pd-gallery__thumb {
    flex: 0 0 auto;
    width: 64px; height: 64px;
    padding: 0;
    border-radius: calc(var(--radius) * 0.75);
    border: 1px solid var(--rule);
    background: var(--paper);
    cursor: pointer;
    overflow: hidden;
    opacity: .62;
    scroll-snap-align: center;
    position: relative;
    transition: opacity .18s ease, border-color .18s ease;
}
.pd-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-gallery__thumb:hover { opacity: .9; }
.pd-gallery__thumb:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pd-gallery__thumb.is-active {
    opacity: 1;
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
}
/* non-colour cue for the active thumb (a11y) */
.pd-gallery__thumb.is-active::after {
    content: "";
    position: absolute;
    left: 50%; bottom: 4px;
    width: 16px; height: 3px;
    transform: translateX(-50%);
    background: var(--ink);
    border-radius: 2px;
}
.pd-gallery .cat-pill-moment { top: 14px; left: 14px; }

/* ---- info column ----------------------------------------------------- */
.pd-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pd-eyebrow {
    font-family: var(--mono);
    font-size: 11px; font-weight: 700;
    letter-spacing: .16em; text-transform: uppercase;
    color: var(--ink-soft, rgba(23, 18, 15, .55));
}
.pd-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(24px, 3.2vw, 38px);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--ink);
    overflow-wrap: break-word;
}
.pd-price {
    display: flex; align-items: baseline; gap: 8px;
    flex-wrap: wrap;
    margin: 2px 0 4px;
}
.pd-price__from {
    font-family: var(--mono);
    font-size: 12px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--ink-soft, rgba(23, 18, 15, .55));
}
.pd-price__now {
    font-family: var(--mono);
    font-size: clamp(22px, 2.4vw, 28px);
    font-weight: 800;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.pd-price__was {
    font-family: var(--mono);
    font-size: 15px;
    color: var(--ink-soft, rgba(23, 18, 15, .5));
    text-decoration: line-through;
}

/* buy */
.pd-buy { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 2px; }
.pd-stock {
    font-family: var(--mono);
    font-size: 12px; letter-spacing: .04em;
    color: var(--ink-soft, rgba(23, 18, 15, .6));
    margin: 0;
}
.pd-stock--soon a { color: var(--ink); }
.pd-unavailable {
    padding: 14px 16px;
    background: rgba(23, 18, 15, .04);
    border-left: 3px solid var(--product-accent, var(--ink));
    border-radius: var(--radius);
}
.pd-unavailable__title { margin: 0 0 4px; font-weight: 700; }
.pd-unavailable__body { margin: 0; font-size: .92em; color: var(--ink-soft, rgba(23,18,15,.6)); }

/* variants */
.pd-variants { display: flex; flex-direction: column; gap: 14px; }
.pd-variants__group { border: 0; margin: 0; padding: 0; }
.pd-variants__label {
    display: block;
    font-family: var(--mono);
    font-size: 11px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-soft, rgba(23, 18, 15, .6));
    margin: 0 0 8px;
}
.pd-variants__options { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-variants__opt {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    cursor: pointer;
    background: var(--paper);
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
    user-select: none;
}
.pd-variants__opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.pd-variants__opt:hover { border-color: var(--ink); }
.pd-variants__opt:has(input:checked) {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
    background: rgba(23, 18, 15, .04);
}
.pd-variants__opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.pd-variants__opt.is-unavailable {
    opacity: .4;
    cursor: not-allowed;
    text-decoration: line-through;
}
.pd-variants__swatch {
    width: 18px; height: 18px; border-radius: 999px;
    border: 1px solid var(--rule);
}
.pd-variants__lab { font-family: var(--sans); font-size: 14px; }
.pd-variants__select {
    width: 100%;
    min-height: 48px;
    padding: 10px 14px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--paper);
    font-family: var(--sans); font-size: 15px;
    color: var(--ink);
}
.pd-variants__error {
    font-size: 13px;
    color: #b91c1c;
    margin: 4px 0 0;
}

/* description */
.pd-desc {
    margin-top: 10px;
    padding-top: 18px;
    border-top: 1px solid var(--rule);
}
.pd-desc__title {
    font-family: var(--mono);
    font-size: 12px; font-weight: 700;
    letter-spacing: .14em; text-transform: uppercase;
    color: var(--ink-soft, rgba(23, 18, 15, .6));
    margin: 0 0 10px;
}
.pd-desc__text {
    font-family: var(--sans);
    font-size: 15px; line-height: 1.7;
    color: var(--ink);
    margin: 0;
    white-space: pre-line;
}
.pd-desc__toggle {
    margin-top: 10px;
    background: none; border: 0; padding: 0;
    font-family: var(--mono); font-size: 12px; font-weight: 700;
    letter-spacing: .06em; color: var(--ink); cursor: pointer;
}

/* ---- mobile sticky CTA ---------------------------------------------- */
.pd-sticky {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(253, 250, 242, 0.97);
    border-top: 1px solid var(--rule);
    box-shadow: 0 -8px 24px -18px rgba(23, 18, 15, 0.4);
    backdrop-filter: blur(10px);
}
.pd-sticky__price {
    display: flex; flex-direction: column; line-height: 1.1;
    flex: 0 0 auto;
}
.pd-sticky__price .pd-price__from { font-size: 10px; }
.pd-sticky__price .pd-price__was { font-size: 11px; }
.pd-sticky__price .pd-price__now { font-size: 18px; }
.pd-sticky__add {
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    border: none;
    border-radius: var(--radius);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--sans);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background-color .15s ease, transform .15s ease;
}
.pd-sticky__add:hover { transform: translateY(-1px); }
.pd-sticky__add:disabled { background: var(--rule); color: var(--ink-soft, rgba(23,18,15,.5)); cursor: not-allowed; }
.pd-sticky__add.needs-variant { animation: pd-shake .4s; }
@keyframes pd-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
@media (min-width: 920px) { .pd-sticky { display: none; } }
/* keep content clear of the fixed bar on mobile */
@media (max-width: 919px) {
    /* The fixed sticky bar sits above the footer (a body-level sibling), so
       reserve space on the footer itself when a product sticky bar exists. */
    body:has(.pd-sticky) .cat-foot { padding-bottom: 96px; }
    /* CTA readability: stack the pick group above a full-width commit so the
       "Ajouter au panier" label is never truncated on phones. */
    .pd-buy .qty-stepper--lg .qty-stepper-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .pd-buy .qty-stepper--lg .qty-stepper-pick { align-self: flex-start; }
    .pd-buy .qty-stepper--lg .qty-stepper-commit { width: 100%; }
    .pd-buy .qty-stepper--lg .qty-stepper-in-cart { display: none; }
}

/* related — reuse existing spacing */
.sd-related { margin-top: clamp(32px, 4vw, 56px); }
.sd-related-head { margin-bottom: clamp(16px, 2vw, 24px); }
.sd-related-title { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 32px); margin: 4px 0 0; }

/* ============================================================
   ARTICLE (= ProductVariant) — selected-article card + gallery
   pastille. Business/UX layer only; no DB/model impact.
   ============================================================ */
.pd-article {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 14px 0 4px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, .1);
    border-radius: 14px;
    background: rgba(0, 0, 0, .02);
}
.pd-article__media {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, .05);
}
.pd-article__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .2s ease;
}
.pd-article__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.pd-article__eyebrow {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
}
.pd-article__label {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.25;
}
.pd-article__price {
    font-weight: 600;
    color: var(--product-accent, #111);
}
.pd-article__avail {
    font-size: 13px;
    opacity: .8;
}
.pd-article__avail.is-instock { color: #1b7f3b; opacity: 1; }
.pd-article__avail.is-unavailable { color: #b3261e; opacity: 1; }

/* Gallery pastille — only on images explicitly linked to an Article. */
.pd-gallery__slide { position: relative; }
.pd-gallery__article-pill {
    position: absolute;
    left: 10px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: calc(100% - 20px);
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(17, 17, 17, .82);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    backdrop-filter: blur(6px);
    pointer-events: none;
}
.pd-gallery__article-pill-lab {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pd-gallery__article-pill-more {
    font-style: normal;
    opacity: .8;
    font-size: 11px;
}

/* Article fiche (CJ 1↔1): subtitle + sibling-variants row. */
.pd-article-sub {
    margin: 2px 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--product-accent, #1F1B16);
    opacity: .92;
}
.pd-siblings { margin: 22px 0 6px; }
.pd-siblings__summary {
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .01em;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 12px;
    background: rgba(0, 0, 0, .02);
    display: flex;
    align-items: center;
    gap: 8px;
}
.pd-siblings__summary::-webkit-details-marker { display: none; }
.pd-siblings__summary::after { content: "\25be"; margin-left: auto; font-size: 11px; opacity: .6; transition: transform .2s ease; }
.pd-siblings[open] .pd-siblings__summary::after { transform: rotate(180deg); }
.pd-siblings__count { font-weight: 600; opacity: .6; }
.pd-siblings__row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 12px;
}


/* ====================================================================== *
 * Lot B — product-detail refinement (density, groups, mobile ordering)   *
 * ====================================================================== */

/* Tighter buy column + compact title so the CTA stays high on the page. */
.pd-info { gap: 12px; }
.pd-title { font-size: clamp(21px, 2.6vw, 32px); line-height: 1.18; }
@media (max-width: 600px) { .pd-title { font-size: clamp(19px, 5.4vw, 24px); line-height: 1.2; } }

/* Discreet SKU / reference. */
.pd-ref {
    margin: -4px 0 0;
    font-size: 12px;
    letter-spacing: .01em;
    color: var(--ink-soft, rgba(23, 18, 15, .5));
}

/* Delivery window (days only — never a freight cost). */
.pd-delivery {
    margin: 0;
    font-size: 13px;
    color: var(--ink-soft, rgba(23, 18, 15, .62));
}

/* Caractéristiques — compact label/value grid. */
.pd-specs { margin-top: 4px; }
.pd-specs__title {
    font-family: var(--serif);
    font-size: 15px;
    margin: 0 0 8px;
    color: var(--ink);
}
.pd-specs__list { margin: 0; display: grid; gap: 6px; }
.pd-specs__row {
    display: grid;
    grid-template-columns: minmax(90px, 40%) 1fr;
    gap: 12px;
    padding: 6px 0;
    border-top: 1px solid var(--rule, rgba(23, 18, 15, .08));
    font-size: 13.5px;
    min-width: 0;
}
.pd-specs__key { margin: 0; color: var(--ink-soft, rgba(23, 18, 15, .55)); }
.pd-specs__val { margin: 0; color: var(--ink); overflow-wrap: break-word; min-width: 0; }

/* "Autres modèles" / Accessoires / recommandations — mini-cards très denses:
   3 mobile / 5 tablette / 8 desktop (spec densité Lot B). */
[data-testid="product-autres-modeles"] .m-feat-row-inner--related,
body:has(.pd) .m-feat-row-inner--related {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
@media (min-width: 640px) {
    [data-testid="product-autres-modeles"] .m-feat-row-inner--related,
    body:has(.pd) .m-feat-row-inner--related { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 1100px) {
    [data-testid="product-autres-modeles"] .m-feat-row-inner--related,
    body:has(.pd) .m-feat-row-inner--related { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
body:has(.pd) .m-feat-row-inner--related > * { min-width: 0; }
body:has(.pd) .m-feat-row-inner--related .pc-card-name { font-size: 12px; line-height: 1.25; }
body:has(.pd) .m-feat-row-inner--related .pc-card-body { padding: 8px 9px 10px; }
[data-testid="product-autres-modeles"] .pc-card { min-width: 0; }
[data-testid="product-autres-modeles"] .pc-card--current {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: 12px;
}
[data-testid="product-autres-modeles"] .pc-card--current .pc-card-name::after {
    content: " ·";
}

/* Keep secondary section headings modest (not oversized like hero). */
.sd-related-title { font-size: clamp(18px, 2.2vw, 26px); }

/* UX pass 2 — compact vertical rhythm on the product page (no big gaps). */
.sd-related { margin-block: clamp(20px, 3vw, 36px); }
.sd-related-head { margin-bottom: 10px; }
.pd-specs { margin-top: 8px; }
@media (max-width: 600px) {
    .sd-related { margin-block: 20px; }
    .sd-related-head { margin-bottom: 8px; }
}

/* Sticky mobile CTA — safe-area + never oversized. */
.pd-sticky { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }

/* Overflow safety across long content. */
.pd, .pd-info, .pd-gallery { min-width: 0; }
.pd-ref, .pd-article-sub { overflow-wrap: anywhere; }
