/* =========================================================================
   Product detail — refonte visuelle (desktop + mobile).
   Loaded AFTER product-detail-v2.css. White-label: generic tokens only.
   Mobile absolute rule: variant & recommendation cards = 3 per row.
   ========================================================================= */

/* ---------- Compact hero : gallery left, info right ---------- */
.pd { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: start; margin: 14px 0 8px; }
.pd-info { display: flex; flex-direction: column; gap: 0; }

/* Remove old bloat / reserved space */
.pd-specs, .pd-desc, .pd-delivery,
[data-testid="product-autres-modeles"],
[data-testid="product-accessoires"] { display: none !important; }

/* ---------- Gallery desktop : vertical thumbs on the left ---------- */
.pd-gallery { display: flex; flex-direction: row; gap: 14px; align-items: stretch; }
.pd-gallery__stage {
    order: 2; flex: 1 1 auto; position: relative;
    background: var(--bg, #f7f1e7); border-radius: 20px; overflow: hidden;
    aspect-ratio: 1 / 1;
    /* Responsive to viewport HEIGHT too: on a short laptop the image shrinks
       (never dominates the fold), on a tall screen it stays premium. No crop
       (img stays object-fit:contain + blurred bg fill). */
    max-width: min(100%, 66dvh);
    max-height: 66dvh;
    margin-inline: auto;
}
.pd-gallery__img { object-fit: contain !important; width: 100%; height: 100%; }

/* Image-to-model CTA: rendered only when the backend proved that the image
   belongs to exactly one OTHER Product in the same commercial variant group. */
.pd-gallery__model-cta {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    max-width: calc(100% - 32px);
    padding: 10px 15px;
    border: 1px solid var(--rule, #e7e0d3);
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--ink, #17120f);
    box-shadow: 0 8px 24px -14px rgba(23, 18, 15, .55);
    backdrop-filter: blur(8px);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.pd-gallery__model-cta:hover {
    transform: translateX(-50%) translateY(-1px);
    background: #fff;
    box-shadow: 0 10px 28px -14px rgba(23, 18, 15, .65);
}
.pd-gallery__model-cta:focus-visible {
    outline: 2px solid var(--rc-gold, #b1863b);
    outline-offset: 3px;
}
/* Vertical thumb rail = compact internal carousel. Its height NEVER exceeds
   the main stage (JS syncs an exact max-height; the dvh value is the no-JS
   fallback), so a 40-image gallery can't stretch the whole PDP. */
.pd-gallery__thumbsbar {
    order: 1; flex: 0 0 76px; display: flex; flex-direction: column;
    align-items: center; gap: 8px; margin-top: 0;
    max-height: 66dvh; min-height: 0; overflow: hidden;
}
.pd-gallery__thumbs {
    display: flex; flex-direction: column; flex-wrap: nowrap; gap: 10px;
    flex: 1 1 auto; min-height: 0; position: relative;
    overflow-y: auto; overflow-x: hidden;
    scroll-behavior: smooth; scroll-snap-type: none;
    scrollbar-width: none; -ms-overflow-style: none;
}
.pd-gallery__thumbs::-webkit-scrollbar { width: 0; height: 0; display: none; }
.pd-gallery__thumb {
    width: 68px; height: 68px; border-radius: 14px; overflow: hidden; flex: 0 0 auto;
    border: 1px solid var(--rule, #e7e0d3); background: var(--bg,#f7f1e7); padding: 0; cursor: pointer;
}
.pd-gallery__thumb img { width: 100%; height: 100%; object-fit: contain; }
.pd-gallery__thumb.is-active { border: 2px solid var(--rc-gold, #b1863b); }
/* Vertical up/down arrows (the ‹ › glyphs are rotated a quarter turn) */
.pd-gallery__thumbnav {
    display: flex; flex: 0 0 auto; width: 68px; height: 26px;
    border-radius: 10px; margin: 0;
}
.pd-gallery__thumbnav > * , .pd-gallery__thumbnav { line-height: 1; }
.pd-gallery__thumbnav--prev, .pd-gallery__thumbnav--next { font-size: 0; }
.pd-gallery__thumbnav--prev::before,
.pd-gallery__thumbnav--next::before {
    content: ""; width: 8px; height: 8px; display: block;
    border-left: 1.5px solid currentColor; border-top: 1.5px solid currentColor;
}
.pd-gallery__thumbnav--prev::before { transform: rotate(45deg); }
.pd-gallery__thumbnav--next::before { transform: rotate(225deg); }
.pd-gallery__thumbnav[hidden] { display: none; }

/* ---------- Info column ---------- */
.pd-title {
    font-family: var(--serif, Georgia, serif);
    font-size: clamp(22px, 2.35vw, 34px);
    line-height: 1.14;
    margin: 0 0 9px;
}
.pd-article-sub { margin: 0 0 10px; }
.pd-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 11px;
}
.pd-article-tag {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--rc-gold, #b1863b) 36%, var(--rule, #e7e0d3));
    border-radius: 999px;
    background: color-mix(in srgb, var(--rc-gold, #b1863b) 6%, var(--paper, #fff));
    color: var(--ink, #17120f);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
}
.pd-ref { font-size: 12px; color: var(--ink-soft,#6b625b); margin: 0 0 10px; }
.pd-price { margin: 0 0 12px; }
.pd-price__now { font-size: 30px; font-weight: 700; }

/* ---------- Reassurance ---------- */
.pd-trust {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 0;
    border: 1px solid var(--rule,#e7e0d3); border-radius: 12px;
    padding: 7px 2px; margin: 0 0 14px;
    background: var(--paper,#fff);
}
.pd-trust__item {
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: 6px; text-align: center; min-height: 34px; padding: 2px 8px;
    font-size: 12px; line-height: 1.25; color: var(--ink,#17120f);
    border-left: 1px solid var(--rule,#e7e0d3);
}
.pd-trust__item:first-child { border-left: 0; }
.pd-trust__item svg { color: var(--rc-gold, #b1863b); width: 15px; height: 15px; flex: 0 0 auto; }
.pd-buy + .pd-trust { margin: 12px 0 0; }

/* ---------- Integrated model selector (autres_modeles_cards, group-based) ---------- */
.pd-models { margin: 2px 0 20px; }
.pd-models__head { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; }
.pd-models__label { font-size: 13px; font-weight: 600; color: var(--ink,#17120f); }
.pd-models__count { font-size: 13px; color: var(--ink-soft,#6b625b); }
/* Compact VID/variant selector — a scrollable strip of small representative
   thumbs WITH a permanent differentiating label under each (e.g. "Rouge · S"),
   clearly NOT a second gallery. Handles 2 → 20+ siblings on one line. */
.pd-models__row {
    display: flex; flex-wrap: nowrap; gap: 10px; align-items: flex-start;
    overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.pd-models__item {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    flex: 0 0 auto; width: 60px; text-decoration: none;
}
.pd-models__media {
    display: block; width: 56px; height: 56px;
    border: 1px solid var(--rule,#e7e0d3); border-radius: 12px;
    overflow: hidden; background: var(--bg,#f7f1e7);
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.pd-models__item:hover .pd-models__media { transform: translateY(-2px); box-shadow: 0 8px 18px -12px rgba(23,18,15,.35); }
.pd-models__item.is-current .pd-models__media { border: 2px solid var(--rc-gold, #b1863b); }
.pd-models__media img, .pd-models__media .img-bg-fill__main { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-models__media .img-bg-fill { width: 100%; height: 100%; }
.pd-models__lab {
    display: block; max-width: 60px; font-size: 11px; line-height: 1.25;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    color: var(--ink-soft, #8a7f72);
}
.pd-models__item.is-current .pd-models__lab { color: var(--ink, #17120f); font-weight: 600; }

/* Hide the native horizontal scrollbar of the variant strip (kept swipe/touch/
   trackpad + wheel). Cleaner than a big native scrollbar with many variants. */
.pd-models__row { scrollbar-width: none; -ms-overflow-style: none; }
.pd-models__row::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Discrete left/right navigation arrows — shown ONLY when the strip overflows.
   Positioned over the thumbs row (not the labels). Swipe/touch/wheel kept. */
.pd-models__strip { position: relative; }
.pd-models__nav {
    position: absolute; top: 28px; transform: translateY(-50%);
    z-index: 3; width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--rule, #e7e0d3); background: rgba(255,255,255,.94);
    color: var(--ink, #17120f); font-size: 18px; line-height: 1; cursor: pointer;
    box-shadow: 0 4px 14px -6px rgba(23,18,15,.4);
    opacity: 0; pointer-events: none;
    transition: opacity .18s ease, background-color .18s ease, transform .18s ease;
}
.pd-models__nav.is-visible { opacity: 1; pointer-events: auto; }
.pd-models__nav:hover { background: #fff; }
.pd-models__nav--prev { left: -6px; }
.pd-models__nav--next { right: -6px; }

/* Remove the obsolete stock/shipping line under the cart — it duplicates the
   trust block above (En stock / Livraison offerte / Livraison estimée). */
.pd-stock { display: none; }

/* "Continuez la découverte" — dense Pinterest/masonry grid (CSS multi-column,
   no JS: avoids loading the landing-only count/CTA/Fill logic on the PDP).
   Cards keep their natural varied heights → same visual family as the listings. */
.sd-related__masonry {
    display: block !important;
    columns: 6 200px; column-gap: 16px;
    overflow: visible !important;
}
.sd-related__masonry > * {
    break-inside: avoid; -webkit-column-break-inside: avoid;
    display: block; width: 100%; margin: 0 0 16px !important;
}
@media (max-width: 1200px) { .sd-related__masonry { columns: 4 180px; } }
@media (max-width: 760px)  { .sd-related__masonry { columns: 2 150px; column-gap: 12px; } .sd-related__masonry > * { margin-bottom: 12px !important; } }

/* ---------- Quantity + Add to cart on ONE row ---------- */
.pd-buy .sd-buy-row, .pd-buy form, .sd-add-row { display: flex; align-items: stretch; gap: 12px; flex-wrap: nowrap; }
.pd-buy .qty-stepper, .pd-buy [data-qty], .sd-qty { display: inline-flex; align-items: center; border: 1px solid var(--rule,#e7e0d3); border-radius: 12px; overflow: hidden; flex: 0 0 auto; }
.pd-buy { margin-top: 0; }
.pd-buy .qty-stepper-in-cart { display: none !important; }
.pd-buy .btn-add, .pd-buy [data-add-to-cart], .sd-add-btn {
    flex: 1 1 auto; background: var(--ink,#17120f); color: #fff; border: 0; border-radius: 12px;
    padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 48px;
}

/* ---------- Recommendations : desktop ~5 / mobile EXACTLY 3 per row ---------- */
.sd-related { margin: 32px 0 8px; }
.sd-related-title { font-family: var(--serif, Georgia, serif); font-size: clamp(20px,2vw,28px); margin: 0 0 16px; }
.sd-related .pc-card { margin: 0; }

/* Sticky CTA owns the commit action on mobile/tablet. Keep the inline quantity
   picker usable, but never show a second "Ajouter au panier" button. */
@media (max-width: 919px) {
    .pd-buy > .qty-stepper .qty-stepper-commit { display: none !important; }
    .pd-buy + .pd-trust { margin-top: 10px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
    .pd { grid-template-columns: 1fr; gap: 18px; }
    /* Gallery : big image on top, thumbnails below (horizontal) */
    .pd-gallery { flex-direction: column; gap: 10px; }
    .pd-gallery__stage { order: 1; aspect-ratio: 1 / 1; border-radius: 18px; }
    .pd-gallery__thumbsbar { order: 2; flex: none; flex-direction: row; width: 100%; max-height: none; }
    .pd-gallery__thumbs { flex-direction: row; width: 100%; overflow-x: auto; overflow-y: hidden; gap: 8px; }
    .pd-gallery__thumb { width: calc((100% - 2 * 8px) / 3); aspect-ratio: 1/1; height: auto; flex: 0 0 auto; }
    .pd-gallery__thumbnav { display: none; }

    .pd-title { font-size: clamp(21px, 5.2vw, 27px); line-height: 1.16; }
    .pd-trust { grid-template-columns: repeat(3, 1fr); padding: 6px 2px; margin-bottom: 12px; }
    .pd-trust__item {
        flex-direction: column; min-height: 38px; font-size: 10.5px;
        line-height: 1.15; gap: 3px; padding: 2px 4px;
    }
    .pd-trust__item svg { width: 14px; height: 14px; }

    /* Model selector : EXACTLY 3 per row */
    .pd-models__row { grid-template-columns: repeat(3, 1fr); gap: 8px; }

    /* Qty + CTA on one line */
    .pd-buy .btn-add, .pd-buy [data-add-to-cart], .sd-add-btn { padding: 12px 12px; font-size: 14px; }
}
