/* ==========================================================================
   PAGE GROUPES - navigation catalogue (Univers > Familles > Sous-familles)
   S'appuie sur les variables et composants de css/chavigny.css
   ========================================================================== */

.gp {
    background: var(--ch-white);
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.gp-head {
    padding: 22px 0 32px;
    border-bottom: 1px solid var(--ch-border);
    background: var(--ch-grey-light);
}

.gp-breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 0;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .85rem;
}

.gp-breadcrumb li {
    display: inline-flex;
    align-items: center;
    color: var(--ch-grey-dark);
}

.gp-breadcrumb li + li::before {
    content: "";
    width: 6px;
    height: 6px;
    margin: 0 12px;
    border-top: 1.5px solid var(--ch-grey);
    border-right: 1.5px solid var(--ch-grey);
    transform: rotate(45deg);
}

.gp-breadcrumb a {
    color: var(--ch-grey-dark);
    text-decoration: none;
}

.gp-breadcrumb a:hover {
    color: var(--ch-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gp-breadcrumb [aria-current] {
    color: var(--ch-text);
    font-weight: 700;
}

.gp-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px 32px;
    margin-top: 22px;
}

.gp-head-title {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.gp-head-icon {
    flex: 0 0 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--ch-white);
    color: var(--ch-red);
    font-size: 2rem;
    box-shadow: var(--ch-shadow);
}

.gp-kicker {
    margin: 0 0 4px;
    color: var(--ch-red);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.gp-title {
    margin: 0;
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
    font-weight: 700;
    line-height: 1.15;
    text-wrap: balance;
}

.gp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 0;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    color: var(--ch-grey-dark);
    font-size: .95rem;
}

.gp-meta li + li::before {
    content: "·";
    margin: 0 10px;
    color: var(--ch-grey);
}

.gp-head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Puces de navigation entre éléments de même niveau (tablette / mobile) */
.gp-chips {
    display: none;
    margin: 22px calc(var(--ch-gutter) * -1) 0;
}

.gp-chips ul {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 2px var(--ch-gutter) 4px;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.gp-chips ul::-webkit-scrollbar {
    display: none;
}

.gp-chips li {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.gp-chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-grey-dark);
    font-size: .9rem;
    white-space: nowrap;
    text-decoration: none;
}

.gp-chip:hover {
    border-color: var(--ch-red);
    color: var(--ch-red);
}

.gp-chip.is-current {
    border-color: var(--ch-red);
    background: var(--ch-red);
    color: var(--ch-white);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Mise en page : arborescence + contenu
   -------------------------------------------------------------------------- */
.gp-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    align-items: start;
    gap: 40px;
    padding-top: 40px;
    padding-bottom: 72px;
}

.gp-aside {
    position: sticky;
    top: calc(var(--ch-header-main-h) + var(--ch-header-nav-h) + 20px);
}

.gp-aside-inner {
    max-height: calc(100vh - var(--ch-header-main-h) - var(--ch-header-nav-h) - 40px);
    padding: 18px 0;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--ch-border) transparent;
}

.gp-aside-title {
    margin: 0 0 8px;
    padding: 0 20px;
    color: var(--ch-grey-dark);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.gp-tree,
.gp-tree-sub {
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-tree-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--ch-text);
    font-size: .93rem;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease);
}

.gp-tree-link > i {
    flex: 0 0 20px;
    color: var(--ch-red);
    font-size: 1.05rem;
    text-align: center;
}

.gp-tree-link > span:first-of-type {
    flex: 1 1 auto;
}

/* Photo du groupe (sinon logo Chavigny Distribution) devant le libellé */
.gp-tree-link > span.gp-tree-img {
    display: block;
    flex: 0 0 40px;
    width: 40px;
    height: 30px;
    overflow: hidden;
    border-radius: var(--ch-radius-sm);
    background: var(--ch-grey-light);
}

.gp-tree-link > span.gp-tree-img.is-small {
    flex-basis: 32px;
    width: 32px;
    height: 24px;
}

.gp-tree-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gp-tree-img.is-logo img {
    padding: 2px;
    object-fit: contain;
}

.gp-tree-link > .gp-tree-label {
    flex: 1 1 auto;
}

.gp-tree-link:hover {
    background: var(--ch-grey-light);
    color: var(--ch-red);
}

.gp-tree .is-open > .gp-tree-service {
    font-weight: 700;
}

.gp-tree-link.is-current {
    background: var(--ch-red-soft);
    color: var(--ch-red);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--ch-red);
}

.gp-tree-sub {
    padding: 2px 0 10px;
}

.gp-tree-sub .gp-tree-link {
    gap: 10px;
    padding: 8px 20px 8px 44px;
    color: var(--ch-grey-dark);
    font-size: .88rem;
}

/* Famille : flèche de rattachement à l'univers (même repère que le menu « Produits ») */
.gp-tree-link > span.gp-tree-subarrow {
    display: inline-flex;
    flex: 0 0 16px;
    align-items: center;
    justify-content: center;
    width: 16px;
    color: var(--ch-red);
    font-size: .9rem;
    opacity: .7;
    transition: opacity .15s var(--ch-ease), transform .15s var(--ch-ease);
}

.gp-tree-link:hover > span.gp-tree-subarrow,
.gp-tree-link.is-current > span.gp-tree-subarrow {
    opacity: 1;
    transform: translateX(2px);
}

.gp-count {
    flex: 0 0 auto;
    min-width: 34px;
    padding: 2px 8px;
    border-radius: var(--ch-radius-pill);
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .74rem;
    font-weight: 400;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Barre de filtre
   -------------------------------------------------------------------------- */
.gp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 24px;
}

.gp-filter {
    position: relative;
    flex: 1 1 320px;
    max-width: 440px;
}

.gp-filter > i {
    position: absolute;
    top: 50%;
    left: 18px;
    color: var(--ch-grey);
    transform: translateY(-50%);
    pointer-events: none;
}

.gp-filter-input {
    width: 100%;
    height: 46px;
    padding: 0 18px 0 46px;
    border: 1.5px solid var(--ch-border);
    border-radius: var(--ch-radius-pill);
    background: var(--ch-white);
    color: var(--ch-text);
    font-family: var(--ch-font);
    font-size: .95rem;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease);
}

.gp-filter-input::placeholder {
    color: var(--ch-grey);
}

.gp-filter-input:focus {
    outline: none;
    border-color: var(--ch-red);
    box-shadow: 0 0 0 4px rgba(208, 52, 58, .12);
}

.gp-results {
    margin: 0;
    color: var(--ch-grey-dark);
    font-size: .92rem;
}

.gp-results strong {
    color: var(--ch-text);
}

.gp mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(208, 52, 58, .16);
    color: inherit;
}

/* --------------------------------------------------------------------------
   Cartes (univers / familles avec leurs enfants)
   -------------------------------------------------------------------------- */
.gp-cards,
.gp-tiles {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gp-cards {
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 24px;
}

.gp-item[hidden] {
    display: none;
}

.gp-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius-lg);
    background: var(--ch-white);
    overflow: hidden;
    transition: box-shadow .25s var(--ch-ease), border-color .25s var(--ch-ease), transform .25s var(--ch-ease);
}

.gp-card:hover,
.gp-card:focus-within {
    border-color: transparent;
    box-shadow: var(--ch-shadow-lg);
    transform: translateY(-2px);
}

.gp-card-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-bottom: 1px solid var(--ch-grey-light);
    color: var(--ch-text);
    text-decoration: none;
}

.gp-card-visual {
    flex: 0 0 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: var(--ch-radius);
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 1.7rem;
    overflow: hidden;
    transition: background-color .25s var(--ch-ease), color .25s var(--ch-ease);
}

.gp-card-visual img,
.gp-tile-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Groupe sans photo : logo Chavigny Distribution entier, centré sur fond gris clair */
.gp-card-visual.is-logo img,
.gp-tile-icon.is-logo img {
    padding: 4px;
    object-fit: contain;
}

/* Photo du groupe (familles.ps_logo_famille) : remplit le cadre, coins arrondis */
.gp-card-visual.has-image,
.gp-tile-icon.has-image {
    overflow: hidden;
    background: var(--ch-white);
}

.gp-card-head:hover .gp-card-visual:not(.has-image):not(.is-logo) {
    background: var(--ch-red);
    color: var(--ch-white);
}

.gp-card-titles {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gp-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    /* Libellé long sans espace (ex. PARQUET/STRATIFIE/SOL VINYLE) : passe à la ligne au lieu d'être coupé */
    overflow-wrap: anywhere;
    transition: color .2s var(--ch-ease);
}

.gp-card-head:hover .gp-card-title {
    color: var(--ch-red);
}

.gp-card-meta {
    color: var(--ch-grey-dark);
    font-size: .82rem;
}

.gp-card-arrow,
.gp-tile-arrow {
    flex: 0 0 auto;
    color: var(--ch-grey);
    transition: color .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.gp-card-head:hover .gp-card-arrow,
.gp-tile:hover .gp-tile-arrow {
    color: var(--ch-red);
    transform: translateX(4px);
}

.gp-card-list {
    margin: 0;
    padding: 10px 0;
    list-style: none;
}

.gp-child.is-extra,
.gp-child[hidden] {
    display: none;
}

.gp.is-filtering .gp-child.is-extra:not([hidden]) {
    display: block;
}

.gp-card-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 40px;
    padding: 6px 20px;
    color: var(--ch-grey-dark);
    font-size: .9rem;
    text-decoration: none;
    transition: background-color .15s var(--ch-ease), color .15s var(--ch-ease);
}

.gp-card-list a:hover {
    background: var(--ch-grey-light);
    color: var(--ch-red);
}

.gp-card-list a:hover .gp-count {
    background: var(--ch-white);
}

.gp-card-direct {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 16px 20px;
    padding: 20px;
    border-radius: var(--ch-radius);
    background: var(--ch-grey-light);
    color: var(--ch-grey-dark);
    font-size: .9rem;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: background-color .2s var(--ch-ease), color .2s var(--ch-ease);
}

.gp-card-direct i {
    color: var(--ch-grey);
    font-size: 1.6rem;
    transition: color .2s var(--ch-ease);
}

.gp-card-direct:hover {
    background: var(--ch-red-soft);
    color: var(--ch-red);
}

.gp-card-direct:hover i {
    color: var(--ch-red);
}

.gp-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-top: auto;
    padding: 14px 20px;
    border-top: 1px solid var(--ch-grey-light);
}

.gp-card-more {
    color: var(--ch-grey-dark);
    font-size: .88rem;
    text-decoration: none;
}

.gp-card-more:hover {
    color: var(--ch-red);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.gp.is-filtering .gp-card-more {
    visibility: hidden;
}

.gp-card-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--ch-red);
    font-size: .9rem;
    font-weight: 700;
    text-decoration: none;
}

.gp-card-all i {
    transition: transform .2s var(--ch-ease);
}

.gp-card-all:hover {
    color: var(--ch-red-dark);
}

.gp-card-all:hover i {
    transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Tuiles (sous-familles)
   -------------------------------------------------------------------------- */
.gp-tiles {
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 16px;
}

.gp-tile {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 100%;
    padding: 18px 20px;
    border: 1px solid var(--ch-border);
    border-radius: var(--ch-radius);
    background: var(--ch-white);
    color: var(--ch-text);
    text-decoration: none;
    transition: border-color .2s var(--ch-ease), box-shadow .2s var(--ch-ease), transform .2s var(--ch-ease);
}

.gp-tile:hover {
    border-color: var(--ch-red);
    box-shadow: var(--ch-shadow);
    transform: translateY(-2px);
}

.gp-tile-icon {
    flex: 0 0 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: var(--ch-radius);
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 1.45rem;
    overflow: hidden;
    transition: background-color .2s var(--ch-ease), color .2s var(--ch-ease);
}

.gp-tile:hover .gp-tile-icon:not(.has-image):not(.is-logo) {
    background: var(--ch-red);
    color: var(--ch-white);
}

.gp-tile-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.gp-tile-name {
    font-size: .98rem;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.gp-tile-count {
    color: var(--ch-grey-dark);
    font-size: .82rem;
}

.gp-tile--all {
    border-color: transparent;
    background: var(--ch-red-soft);
}

.gp-tile--all .gp-tile-icon {
    background: var(--ch-red);
    color: var(--ch-white);
}

.gp-tile--all .gp-tile-name,
.gp-tile--all .gp-tile-arrow {
    color: var(--ch-red);
}

.gp.is-filtering .gp-tile-all {
    display: none;
}

/* --------------------------------------------------------------------------
   États vides
   -------------------------------------------------------------------------- */
.gp-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 56px 24px;
    border: 1.5px dashed var(--ch-border);
    border-radius: var(--ch-radius-lg);
    color: var(--ch-grey-dark);
    text-align: center;
}

.gp-empty[hidden] {
    display: none;
}

.gp-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 10px;
    border-radius: 50%;
    background: var(--ch-grey-light);
    color: var(--ch-grey);
    font-size: 1.8rem;
}

.gp-empty p {
    margin: 0;
}

.gp-empty-title {
    color: var(--ch-text);
    font-size: 1.1rem;
    font-weight: 700;
}

.gp-empty .ch-btn {
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
    .gp-layout {
        grid-template-columns: 250px minmax(0, 1fr);
        gap: 28px;
    }
}

/* Tablette : l'arborescence laisse place aux puces de navigation */
@media (max-width: 1023px) {
    .gp-layout {
        grid-template-columns: minmax(0, 1fr);
        padding-top: 28px;
        padding-bottom: 56px;
    }

    .gp-aside {
        display: none;
    }

    .gp-chips {
        display: block;
    }

    .gp-head-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .gp-head {
        padding: 16px 0 22px;
    }

    .gp-head-row {
        margin-top: 16px;
    }

    .gp-head-title {
        align-items: flex-start;
        gap: 14px;
    }

    .gp-head-icon {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
        border-radius: 14px;
        font-size: 1.45rem;
    }

    /* Fil d'Ariane sur une ligne, défilable */
    .gp-breadcrumb ol {
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
    }

    .gp-breadcrumb ol::-webkit-scrollbar {
        display: none;
    }

    /* Chiffres clés en pastilles : pas de séparateur orphelin en début de ligne */
    .gp-meta {
        gap: 6px;
        margin-top: 10px;
        font-size: .82rem;
    }

    .gp-meta li {
        padding: 3px 10px;
        border-radius: var(--ch-radius-pill);
        background: var(--ch-white);
    }

    .gp-meta li + li::before {
        content: none;
    }

    .gp-head-actions {
        width: 100%;
    }

    .gp-head-actions .ch-btn {
        flex: 1 1 auto;
    }

    .gp-toolbar {
        margin-bottom: 18px;
    }

    .gp-filter {
        flex-basis: 100%;
        max-width: none;
    }

    .gp-filter-input {
        font-size: 16px; /* évite le zoom automatique iOS */
    }

    .gp-cards {
        gap: 16px;
    }

    .gp-card-head {
        padding: 16px;
    }

    .gp-card-visual {
        flex-basis: 52px;
        width: 52px;
        height: 52px;
        font-size: 1.45rem;
    }

    .gp-card-list a {
        padding: 6px 16px;
    }

    .gp-card-foot {
        padding: 12px 16px;
    }

    .gp-tiles {
        gap: 12px;
    }

    .gp-tile {
        padding: 14px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gp-card,
    .gp-tile,
    .gp-card-arrow,
    .gp-tile-arrow {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   Libellés des groupes (univers, familles, sous-familles) en majuscules,
   comme dans le menu « Produits », la recherche et les fils d'Ariane
   -------------------------------------------------------------------------- */
.gp-chip,
.gp-tree-link span,
.gp-tile:not(.gp-tile--all) .gp-tile-name,
.gp-card-title,
.gp-child a span[data-highlight] {
    text-transform: uppercase;
}
