/*
 * Grab-it Market — pages rayons (direction D1R)
 * Complète css/site.css : en-tête avec fil d'Ariane, bandeau du rayon, navigation
 * des rayons et grille des produits injectés par sinLib.php.
 * Le contrat DOM de js/sinlib.js impose : #sinMain, .sinCard > img + .body-SinCard,
 * .title-sinCard / .price-sinCard / .car-sinCard, et les identifiants des modales.
 */

/* -------------------------------------------------------------- header */

.gm-rhd {
    background: #fff;
    border-bottom: 1px solid #DCE6EB;
}

.gm-rhd-in {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 24px;
    min-height: 64px;
}

.gm-rtrail {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12.5px;
    color: #6A7F8B;
}

.gm-rtrail a:hover {
    color: var(--gm-brand);
}

.gm-rtrail .gm-ico {
    flex: 0 0 auto;
    color: #A7B8C2;
}

.gm-rtrail [aria-current] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    color: var(--gm-ink-soft);
}

/* ------------------------------------------------------ bandeau rayon */

.gm-rlay {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    grid-template-areas:
        "hero hero"
        "nav main";
    column-gap: 28px;
    row-gap: 24px;
    align-items: start;
    padding-top: 20px;
}

.gm-site .gm-rhero {
    grid-area: hero;
    position: relative;
    height: 132px;
    border-radius: 10px;
    overflow: hidden;
    background: #0C2B3D;
    isolation: isolate;
}

.gm-rhero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 70% 50%;
    z-index: -1;
}

.gm-rhero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(6, 26, 40, .94), rgba(6, 26, 40, .74) 44%, rgba(6, 26, 40, .12));
    z-index: 0;
}

.gm-rhero-in {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 22px 26px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.gm-rhero-in h1 {
    margin: 0;
    font-size: clamp(21px, 2.2vw, 29px);
    line-height: 1.12;
    font-weight: 900;
    letter-spacing: -.4px;
    color: #fff;
}

.gm-rhero-in p {
    margin: 0;
    max-width: 440px;
    font-size: clamp(11.5px, .95vw, 13.5px);
    line-height: 1.5;
    color: rgba(255, 255, 255, .82);
}

/* -------------------------------------------------- navigation rayons */

.gm-rnav {
    grid-area: nav;
    background: #fff;
    border: 1px solid #E0E8ED;
    border-radius: var(--gm-radius);
    padding: 16px;
}

.gm-rnav h2 {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 900;
}

.gm-rnav nav {
    display: block;
}

.gm-site .gm-rnav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 42px;
    padding: 0 2px;
    border-bottom: 1px solid var(--gm-line-soft);
    font-size: 14px;
    line-height: 1.25;
    color: #1B3543;
}

.gm-site .gm-rnav-link:last-of-type {
    border-bottom: 0;
}

.gm-site span.gm-rnav-link {
    cursor: default;
}

.gm-site .gm-rnav-link:hover {
    color: var(--gm-brand);
}

.gm-site .gm-rnav-link.is-current {
    font-weight: 900;
    color: var(--gm-brand);
}

.gm-site .gm-rnav-link .gm-ico {
    flex: 0 0 auto;
    color: #8AA0AC;
}

.gm-site .gm-rnav-link.is-current .gm-ico {
    color: var(--gm-brand);
}

.gm-rnav-sep {
    display: block;
    height: 1px;
    margin: 12px 0 4px;
    background: var(--gm-line);
}

.gm-site .gm-rnav-util {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 2px;
    font-size: 13px;
    color: #3C5361;
}

.gm-site .gm-rnav-util:hover {
    color: var(--gm-brand);
}

.gm-rnav .gm-note {
    margin-top: 14px;
}

/* ------------------------------------------------------ grille produits */

.gm-rmain {
    grid-area: main;
    min-width: 0;
}

.gm-rhead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.gm-rhead h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #3D5563;
}

.gm-rhead p {
    margin: 0;
    font-size: 12.5px;
    color: #6A7F8B;
    white-space: nowrap;
}

/* Réponse de sinLib.php : soit un texte (« Aucun résultat retrouvé... »),
   soit des cartes .sinCard. Le conteneur sert de panneau dans le premier cas. */
.gm-site .gm-rlist {
    display: block;
    margin: 0;
    padding: 20px;
    height: auto;
    overflow: visible;
    background: #fff;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius);
    font-size: 13.5px;
    line-height: 1.55;
    color: #526975;
}

/* Avant la réponse du serveur, le conteneur reste invisible */
.gm-site .gm-rlist:empty {
    display: none;
}

.gm-site .gm-rlist:has(.sinCard) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(206px, 1fr));
    gap: 20px;
    align-content: start;
    padding: 0;
    background: none;
    border: 0;
    color: var(--gm-ink);
}

/* Les infobulles de sinlib.js ne portent que les libellés « Login » et « Panier »,
   déjà affichés dans l'en-tête : on les masque sur les rayons. */
body[data-page="rayon"] .tippy-popper,
body[data-page="rayon"] .tippy-box {
    display: none;
}

/* Cartes produites par sinLib.php (codemap 1) */
.gm-site .gm-rlist .sinCard {
    display: flex;
    flex-direction: column;
    width: auto;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid var(--gm-line);
    border-radius: var(--gm-radius);
    box-shadow: none;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .18s, transform .18s;
}

.gm-site .gm-rlist .sinCard:hover {
    border-color: #B9CBD6;
    transform: translateY(-2px);
}

.gm-site .gm-rlist .sinCard > img {
    width: 100%;
    height: auto;
    aspect-ratio: 7 / 6;
    object-fit: cover;
    box-shadow: none;
    background: var(--gm-soft);
}

.gm-site .gm-rlist .body-SinCard {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 12px 14px;
}

.gm-site .gm-rlist .title-sinCard {
    order: 1;
    min-height: 2.6em;
    font-size: clamp(12.5px, 1vw, 14px);
    line-height: 1.3;
    font-weight: 700;
    text-align: left;
    color: var(--gm-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gm-site .gm-rlist .car-sinCard {
    order: 2;
    font-size: clamp(11px, .85vw, 12px);
    line-height: 1.35;
    color: #6A7F8B;
}

.gm-site .gm-rlist .price-sinCard {
    order: 3;
    margin-top: 2px;
    font-size: clamp(15px, 1.2vw, 17px);
    font-weight: 900;
    letter-spacing: -.2px;
    color: var(--gm-brand);
}

/* ------------------------------------------------------------ tablette */

@media (max-width: 1080px) {
    .gm-rlay {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .gm-rnav,
    .gm-rmain {
        width: 100%;
        max-width: 100%;
    }

    .gm-site .gm-rhero {
        order: 1;
        height: 118px;
    }

    .gm-rnav {
        order: 2;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .gm-rmain {
        order: 3;
    }

    .gm-rnav h2,
    .gm-rnav-sep,
    .gm-rnav .gm-note {
        display: none;
    }

    .gm-rnav nav {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        max-width: 100%;
        padding-bottom: 2px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .gm-rnav nav::-webkit-scrollbar {
        height: 0;
    }

    .gm-site .gm-rnav-link {
        flex: 0 0 auto;
        height: 38px;
        padding: 0 14px;
        border: 1px solid var(--gm-line);
        border-radius: 19px;
        background: #fff;
        font-size: 13px;
    }

    .gm-site .gm-rnav-link.is-current {
        border-color: var(--gm-brand);
        background: var(--gm-brand);
        color: #fff;
    }

    .gm-site .gm-rnav-link .gm-ico {
        display: none;
    }

    .gm-site .gm-rnav-util {
        flex: 0 0 auto;
        height: 38px;
        padding: 0 14px;
        border: 1px dashed #C3D3DC;
        border-radius: 19px;
        background: #fff;
    }

    .gm-site .gm-rlist:has(.sinCard) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

/* --------------------------------------------------------------- mobile */

@media (max-width: 760px) {
    .gm-rhd-in {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        min-height: 56px;
    }

    .gm-rtrail {
        display: none;
    }

    .gm-rlay {
        padding-top: 12px;
    }

    .gm-site .gm-rhero {
        height: 96px;
        border-radius: 8px;
    }

    .gm-rhero-in {
        padding: 14px 16px;
        gap: 4px;
    }

    .gm-rhero-in p {
        max-width: 100%;
    }

    .gm-rhead p {
        display: none;
    }

    .gm-site .gm-rlist:has(.sinCard) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .gm-site .gm-rlist .body-SinCard {
        padding: 10px;
    }
}
