/**
 * Slider de modèles — variante CHERY
 * Colonne d'onglets par gamme + colonnes par modèle avec déclinaisons empilées.
 *
 * Tokens injectés inline par render.php :
 *   --crc-active : couleur des éléments actifs (#A3886B)
 *   --crc-muted  : couleur des éléments inactifs (#B7AEA5)
 */

.crc-models {
    --crc-height: clamp(560px, 82vh, 880px);
    --crc-tabs-width: 180px;
    --crc-ink: #111111;
    --crc-white: #ffffff;
    --crc-ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* Pleine largeur : on sort du gabarit .max-w-layout (1100px) du thème.
       Les marges négatives ramènent le bloc aux bords de la fenêtre quelle
       que soit la largeur du conteneur parent. Le débordement résiduel dû à
       la barre de défilement est écrêté par .brand-chery .site-main
       (overflow-x: clip, cf. brands/chery/assets/css/chery.css). */
    width: 100vw;
    max-width: 100vw;
    margin-inline: calc(50% - 50vw);
    color: var(--crc-ink);
    font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Le chapeau reste dans le gabarit de lecture */
.crc-models__head {
    max-width: 1100px;
}

.crc-models__head {
    max-width: 1320px;
    margin: 0 auto 2rem;
    padding: 0 1.25rem;
    text-align: center;
}

.crc-models__title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.crc-models__subtitle {
    margin: 0;
    color: #51565d;
    font-size: 1rem;
}

/* ── Structure ───────────────────────────────────────────── */

.crc-models__inner {
    display: flex;
    width: 100%;
    height: var(--crc-height);
    background: var(--crc-ink);
    overflow: hidden;
}

/* ── Colonne d'onglets (gammes) ──────────────────────────── */

.crc-models__tabs {
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--crc-tabs-width);
    width: var(--crc-tabs-width);
}

.crc-tab {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 0;
    padding: 1rem 0.75rem;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
    background: var(--crc-muted);
    color: var(--crc-white);
    cursor: pointer;
    transition: background-color 0.35s var(--crc-ease), flex-grow 0.35s var(--crc-ease);
    -webkit-appearance: none;
    appearance: none;
}

.crc-tab:last-child {
    border-bottom: 0;
}

.crc-tab__label {
    font-size: clamp(1.05rem, 1.5vw, 1.5rem);
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    line-height: 1.1;
}

.crc-tab__count {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.3s var(--crc-ease), transform 0.3s var(--crc-ease);
}

.crc-tab:hover,
.crc-tab:focus-visible {
    background: color-mix(in srgb, var(--crc-active) 60%, var(--crc-muted));
    outline: none;
}

.crc-tab.is-active {
    background: var(--crc-active);
    flex-grow: 1.25;
}

.crc-tab.is-active .crc-tab__count,
.crc-tab:hover .crc-tab__count {
    opacity: 0.85;
    transform: translateY(0);
}

.crc-tab:focus-visible {
    box-shadow: inset 0 0 0 2px var(--crc-white);
}

/* ── Panneaux de gamme ───────────────────────────────────── */

.crc-models__panels {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.crc-panel {
    height: 100%;
}

.crc-panel[hidden] {
    display: none;
}

.crc-cols {
    display: flex;
    height: 100%;
}

/* ── Colonne modèle ──────────────────────────────────────── */

.crc-col {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    transition: flex-grow 0.45s var(--crc-ease);
}

.crc-col:first-child {
    border-left: 0;
}

.crc-cols:hover .crc-col:hover {
    flex-grow: 1.4;
}

/* ── Déclinaison (panneau dans la colonne) ───────────────── */

.crc-variant {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    transition: flex-grow 0.45s var(--crc-ease);
}

.crc-col[data-crc-variants="1"] .crc-variant {
    flex-grow: 1;
}

.crc-col[data-crc-variants="2"] .crc-variant.is-active,
.crc-col[data-crc-variants="3"] .crc-variant.is-active {
    flex-grow: 1.9;
}

.crc-variant:hover {
    flex-grow: 2.2;
}

.crc-variant__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 62%;
    transform: scale(1.02);
    transition: transform 0.7s var(--crc-ease), filter 0.45s var(--crc-ease);
    filter: saturate(0.92) brightness(0.9);
}

.crc-variant.is-active .crc-variant__img,
.crc-variant:hover .crc-variant__img {
    transform: scale(1.06);
    filter: saturate(1) brightness(1);
}

.crc-variant__scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.05) 38%, rgba(0, 0, 0, 0.72) 100%);
    transition: opacity 0.45s var(--crc-ease);
}

.crc-variant__content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.4rem 0.9rem 3.4rem;
    color: var(--crc-white);
    text-align: center;
    pointer-events: none;
}

.crc-variant__content > * {
    pointer-events: auto;
}

.crc-variant__name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0 0.12em;
    margin: 0;
    max-width: 100%;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

.crc-variant__name-base {
    font-size: clamp(0.9rem, 1.2vw, 1.4rem);
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.crc-variant__name-suffix {
    font-size: clamp(1.15rem, 1.9vw, 2.3rem);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.crc-variant__badge {
    margin-top: 0.55rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--crc-active);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.crc-variant__tagline {
    margin: auto 0 0.9rem;
    max-width: 22ch;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s var(--crc-ease), transform 0.4s var(--crc-ease);
}

.crc-variant__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: auto;
    padding: 0.7rem 1.4rem;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.06);
    color: var(--crc-white);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s var(--crc-ease), transform 0.4s var(--crc-ease),
                background-color 0.3s var(--crc-ease), border-color 0.3s var(--crc-ease);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.crc-variant__tagline + .crc-variant__btn {
    margin-top: 0;
}

/* Sélecteur renforcé : le thème colore les liens de .entry-content
   avec la couleur primaire, ce qui rendait le libellé illisible. */
.crc-models a.crc-variant__btn,
.crc-models a.crc-variant__btn:visited {
    color: var(--crc-white);
}

.crc-models a.crc-variant__btn:hover,
.crc-models a.crc-variant__btn:focus-visible,
.crc-variant__btn:hover,
.crc-variant__btn:focus-visible {
    background: var(--crc-active);
    border-color: var(--crc-active);
    color: var(--crc-white);
}

.crc-variant__btn.is-disabled {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.65);
    cursor: default;
}

/* Accroche + CTA révélés au survol / focus, comme sur le sélecteur CHERY.
   Au repos la colonne ne montre que le nom du modèle et son badge. */
.crc-variant:hover .crc-variant__tagline,
.crc-variant:hover .crc-variant__btn,
.crc-variant:focus-within .crc-variant__tagline,
.crc-variant:focus-within .crc-variant__btn {
    opacity: 1;
    transform: translateY(0);
}

/* Sans survol possible (tactile), la déclinaison active porte le contenu */
@media (hover: none) {
    .crc-variant.is-active .crc-variant__tagline,
    .crc-variant.is-active .crc-variant__btn {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Pastilles de déclinaison ────────────────────────────── */

.crc-col__chips {
    position: absolute;
    bottom: 0.9rem;
    left: 50%;
    z-index: 3;
    display: flex;
    gap: 0.35rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.55);
    transform: translateX(-50%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.crc-chip {
    padding: 0.32rem 0.7rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-family: inherit;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.3s var(--crc-ease), color 0.3s var(--crc-ease);
}

.crc-chip:hover {
    color: var(--crc-white);
    background: rgba(255, 255, 255, 0.14);
}

.crc-chip.is-active {
    background: var(--crc-active);
    color: var(--crc-white);
}

.crc-chip:focus-visible {
    outline: 2px solid var(--crc-white);
    outline-offset: 1px;
}

/* ── Tablette ────────────────────────────────────────────── */

@media (max-width: 1200px) {
    .crc-models {
        --crc-tabs-width: 140px;
    }
}

/* ── Étiquette de gamme (mode liste mobile uniquement) ───── */

.crc-panel__label {
    display: none;
}

/* ── Lien de couverture (mode liste mobile uniquement) ───── */

.crc-variant__cover {
    display: none;
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 900px) {
    .crc-models {
        --crc-height: auto;
    }

    .crc-models__inner {
        flex-direction: column;
        height: auto;
    }

    .crc-models__tabs {
        flex: 0 0 auto;
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .crc-models__tabs::-webkit-scrollbar {
        display: none;
    }

    .crc-tab {
        flex: 1 0 auto;
        min-width: 33%;
        padding: 0.85rem 1rem;
        border-bottom: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.22);
    }

    .crc-tab:last-child {
        border-right: 0;
    }

    .crc-tab.is-active {
        flex-grow: 1;
    }

    .crc-tab__label {
        font-size: 1rem;
        letter-spacing: 0.16em;
    }

    /* ── Mode liste ──────────────────────────────────────────
       Repris du mobile cheryinternational.com : les onglets de gamme
       deviennent des ancres, et tous les modèles se suivent en bannières
       pleine largeur, chacune entièrement cliquable. La classe est posée
       par script.js selon la media query. */

    .crc-models--list .crc-models__panels {
        display: block;
    }

    /* Tous les panneaux sont visibles : l'onglet ne filtre plus, il ancre */
    .crc-models--list .crc-panel[hidden] {
        display: block;
    }

    .crc-models--list .crc-panel {
        scroll-margin-top: 72px; /* header flottant du thème */
    }

    .crc-models--list .crc-panel__label {
        display: block;
        margin: 0;
        padding: 0.6rem 1.1rem;
        background: var(--crc-muted);
        color: var(--crc-white);
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.24em;
        text-transform: uppercase;
    }

    .crc-models--list .crc-panel.is-current .crc-panel__label {
        background: var(--crc-active);
    }

    .crc-models--list .crc-cols,
    .crc-models--list .crc-col {
        display: block;
        height: auto;
        overflow: visible;
    }

    .crc-models--list .crc-col {
        width: 100%;
        border-left: 0;
    }

    .crc-models--list .crc-variant {
        display: block;
        height: 210px;
        border-top: 1px solid rgba(255, 255, 255, 0.14);
    }

    .crc-models--list .crc-variant__img {
        object-position: center 55%;
        transform: none;
        filter: none;
    }

    /* Nom en bas au centre. Le séparateur ne marque que la déclinaison
       (TIGGO 4 | CSH), pas la découpe typographique du nom (TIGGO 4). */
    .crc-models--list .crc-variant__content {
        justify-content: flex-end;
        padding: 1rem 1rem 1.15rem;
    }

    .crc-models--list .crc-variant__name--declinaison .crc-variant__name-base + .crc-variant__name-suffix::before {
        content: '|';
        margin-right: 0.45em;
        font-weight: 300;
        opacity: 0.65;
    }

    .crc-models--list .crc-variant__name-base {
        font-size: 1.15rem;
    }

    .crc-models--list .crc-variant__name-suffix {
        font-size: 1.5rem;
    }

    .crc-models--list .crc-variant__badge {
        position: absolute;
        top: 0.85rem;
        left: 50%;
        margin: 0;
        transform: translateX(-50%);
    }

    /* La bannière entière fait office de lien : ni accroche ni bouton */
    .crc-models--list .crc-variant__tagline,
    .crc-models--list .crc-variant__btn,
    .crc-models--list .crc-col__chips {
        display: none;
    }

    .crc-models--list .crc-variant__cover {
        position: absolute;
        inset: 0;
        z-index: 5;
        display: block;
    }

    .crc-models--list .crc-variant.is-soon {
        cursor: default;
    }
}

/* ── Accessibilité : mouvement réduit ────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .crc-tab,
    .crc-col,
    .crc-variant,
    .crc-variant__img,
    .crc-variant__tagline,
    .crc-variant__btn {
        transition: none;
    }
}
