/* ==========================================================================
   Accueil : titres de section centrés et bouton « Voir tout » commun à toutes les sections.
   Chargé seulement sur la page d'accueil (layouts/base.blade.php), après style.css
   et le CSS personnalisé (style.integration.css) qu'il complète.
   ========================================================================== */

/* « Annonces à la une », « Actualités et essais »… (.title-section)
   Le thème les aligne à gauche sur mobile (flex-direction: column; align-items: start) */
section .title-section {
    align-items: center;
    justify-content: center;
    text-align: center;
}

section .title-section > div {
    text-align: center;
}

/* « Recherche par marque », « Recherche par carrosserie » (.tv-home__head) : titre centré */
.tv-home .tv-home__head {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.tv-home .tv-home__intro {
    max-width: 720px;
    margin: 0 auto;
}

/* ---------- Un seul style de titre de section ----------
   .title-xy (annonces à la une, actualités), .tv-home__title (marques, carrosseries),
   .tv-section-title (pourquoi Top Voitures). !important : .title-xy en a dans le CSS personnalisé. */
section .title-xy,
.tv-home .tv-home__title,
section .tv-section-title {
    margin: 0 !important;
    color: var(--heading-color, #0f172a);
    font-size: clamp(1.6rem, 2.6vw, 2.25rem) !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    letter-spacing: -.01em !important;
    text-align: center;
    text-transform: none;
}

/* Sous-titre optionnel : même gris, même taille, même espace sous le titre */
section .title-section .text-secondary,
.tv-home .tv-home__lead {
    max-width: 640px;
    margin: 10px auto 0 !important;
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.6;
    text-align: center;
}

/* Même espace sous chaque bloc titre */
section .title-section,
.tv-home .tv-home__head,
section .mb-40:has(> .tv-section-title) {
    margin-bottom: clamp(24px, 3vw, 32px) !important;
}

/* ---------- « Annonces à la une » : grille régulière au lieu des colonnes Bootstrap + mb-30 ---------- */
.tv-home-featured__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 20px;
}

.tv-home-featured__grid > .tv-lcar {
    width: 100%;
    height: 100%;
}

@media (max-width: 1199px) {
    .tv-home-featured__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991px) {
    .tv-home-featured__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px 16px;
    }
}

@media (max-width: 575px) {
    .tv-home-featured__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
}

/* ---------- Rythme vertical : même espace pour toutes les sections ----------
   Fonds alternés (blanc / gris très clair) pour séparer les sections sans les espacer davantage.
   Ordre : à la une (gris) · pourquoi nous (blanc) · marques (gris) · carrosseries (blanc) · blog (gris) · FAQ (blanc) */
:root {
    --tv-home-gap: clamp(32px, 4vw, 48px);
    --tv-home-alt: #f6f8f7;
}

.tv-trust,
.tv-faq,
.tv-home-featured,
.tv-home,
.tv-home-blog {
    padding-block: var(--tv-home-gap) !important;
}

.tv-home-featured.background-light,
.tv-home-brands:not(.tv-home-types),
.tv-home-blog {
    background: var(--tv-home-alt) !important;
}

.tv-home-types {
    background: #fff !important;
}

/* ---------- « Recherche par marque » : logos un peu plus petits (style.integration.css : 64px / 96px) ---------- */
.tv-home-brands:not(.tv-home-types) .tv-home-brands__logo {
    height: 52px;
}

.tv-home-brands:not(.tv-home-types) .tv-home-brands__logo img {
    max-width: 76px;
}

@media (max-width: 767px) {
    .tv-home-brands:not(.tv-home-types) .tv-home-brands__logo {
        height: 40px;
    }

    .tv-home-brands:not(.tv-home-types) .tv-home-brands__logo img {
        max-width: 58px;
    }
}

/* ---------- « Achetez votre voiture en toute confiance » : bandeau de confiance ---------- */
.tv-trust {
    background: #fff;
}

.tv-trust__panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #e3e6e5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 20px rgba(15, 23, 42, .05);
    list-style: none;
}

.tv-trust__panel--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tv-trust__panel--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tv-trust__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 28px 24px;
}

.tv-trust__item + .tv-trust__item {
    border-left: 1px solid #e9eceb;
}

.tv-trust__item * {
    color: inherit;
    font-size: inherit;
}

.tv-trust__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
    border-radius: 12px;
    background: rgba(var(--primary-color-rgb, 152, 188, 42), .12);
    color: var(--primary-color, #98bc2a);
}

.tv-trust__icon svg,
.tv-trust__icon img {
    width: 24px;
    height: 24px;
}

.tv-trust .tv-trust__title {
    margin: 0;
    color: var(--heading-color, #0f172a);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.tv-trust .tv-trust__text {
    margin: 0;
    color: #6b7280;
    font-size: .9rem;
    line-height: 1.6;
}

/* Tablette : 2 × 2 */
@media (max-width: 991px) {
    .tv-trust__panel,
    .tv-trust__panel--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tv-trust__item + .tv-trust__item {
        border-left: 0;
    }

    .tv-trust__item:nth-child(even) {
        border-left: 1px solid #e9eceb;
    }

    .tv-trust__item:nth-child(n + 3) {
        border-top: 1px solid #e9eceb;
    }
}

/* Mobile : une colonne, icône à gauche du texte */
@media (max-width: 575px) {
    .tv-trust__panel,
    .tv-trust__panel--2,
    .tv-trust__panel--3 {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv-trust__item {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 14px;
        row-gap: 4px;
        padding: 18px 16px;
    }

    .tv-trust__item:nth-child(even) {
        border-left: 0;
    }

    .tv-trust__item + .tv-trust__item {
        border-top: 1px solid #e9eceb;
    }

    .tv-trust__icon {
        grid-row: span 2;
        width: 42px;
        height: 42px;
        margin: 0;
    }
}

/* ---------- Questions fréquentes (partials/home-faq.blade.php) ---------- */
.tv-faq {
    background: #fff;
}

.tv-faq__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 860px;
    margin: 0 auto;
}

.tv-faq__item {
    overflow: hidden;
    border: 1px solid #e3e6e5;
    border-radius: 12px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.tv-faq__item[open] {
    border-color: rgba(var(--primary-color-rgb, 152, 188, 42), .5);
    box-shadow: 0 6px 20px rgba(15, 23, 42, .06);
}

.tv-faq__item * {
    color: inherit;
    font-size: inherit;
}

.tv-faq__question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    cursor: pointer;
    list-style: none;
}

.tv-faq__question::-webkit-details-marker {
    display: none;
}

.tv-faq__question:focus-visible {
    outline: 3px solid rgba(var(--primary-color-rgb, 152, 188, 42), .4);
    outline-offset: -3px;
}

.tv-faq .tv-faq__question h3 {
    margin: 0;
    color: var(--heading-color, #0f172a);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.45;
}

.tv-faq__toggle {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(var(--primary-color-rgb, 152, 188, 42), .12);
    color: var(--primary-color, #98bc2a);
    transition: transform .25s ease, background-color .2s ease, color .2s ease;
}

.tv-faq__toggle svg {
    width: 18px;
    height: 18px;
}

.tv-faq__item[open] .tv-faq__toggle {
    background: var(--primary-color, #98bc2a);
    color: #fff;
    transform: rotate(45deg);
}

.tv-faq__answer {
    padding: 0 20px 18px;
}

.tv-faq .tv-faq__answer p {
    margin: 0;
    color: #4b5563;
    font-size: .95rem;
    line-height: 1.7;
}

@media (max-width: 575px) {
    .tv-faq__question {
        padding: 15px 16px;
    }

    .tv-faq__answer {
        padding: 0 16px 16px;
    }
}

/* ---------- Blog : cartes « Actualités et essais » ---------- */
.tv-home-blog__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 20px;
}

.tv-post {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e3e6e5;
    border-radius: 12px;
    background: #fff;
    transition: box-shadow .25s ease, border-color .25s ease;
}

.tv-post:hover {
    border-color: #cfd5d3;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .1);
}

.tv-post * {
    color: inherit;
    font-size: inherit;
}

.tv-post__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #eef1ef;
}

.tv-post__img,
.tv-post__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.tv-post:hover .tv-post__img,
.tv-post:hover .tv-post__media img {
    transform: scale(1.04);
}

.tv-post .tv-post__cat {
    position: absolute;
    left: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
    overflow: hidden;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.4;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.tv-post__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 18px;
}

.tv-post .tv-post__date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #7a817f;
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.3;
}

.tv-post__date svg {
    width: 15px;
    height: 15px;
    color: var(--primary-color, #98bc2a);
}

.tv-post .tv-post__title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--heading-color, #0f172a);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tv-post .tv-post__link {
    color: inherit;
    text-decoration: none;
}

/* Toute la carte est cliquable */
.tv-post__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tv-post:hover .tv-post__title {
    color: var(--primary-color, #98bc2a);
}

.tv-post__link:focus-visible {
    outline: none;
}

.tv-post:has(.tv-post__link:focus-visible) {
    outline: 3px solid rgba(var(--primary-color-rgb, 152, 188, 42), .4);
    outline-offset: 2px;
}

.tv-post .tv-post__excerpt {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #6b7280;
    font-size: .88rem;
    line-height: 1.55;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tv-post .tv-post__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 6px;
    color: var(--primary-color, #98bc2a);
    font-size: .88rem;
    font-weight: 700;
}

.tv-post__more svg {
    width: 16px;
    height: 16px;
    transition: transform .2s ease;
}

.tv-post:hover .tv-post__more svg {
    transform: translateX(3px);
}

@media (max-width: 1199px) {
    .tv-home-blog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Mobile : défilement horizontal des articles (glisser), la carte suivante dépasse un peu */
@media (max-width: 575px) {
    .tv-home-blog__grid {
        display: flex;
        gap: 14px;
        margin-inline: -15px;
        padding: 2px 15px 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .tv-home-blog__grid::-webkit-scrollbar {
        display: none;
    }

    .tv-home-blog__grid > .tv-post {
        flex: 0 0 82%;
        scroll-snap-align: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tv-post,
    .tv-post__img,
    .tv-post__media img,
    .tv-post__more svg {
        transition: none;
    }
}

/* ---------- Bouton « Voir tout » : un seul style, centré sous la grille de chaque section ----------
   (annonces à la une, marques, carrosseries). Préfixe .tv-home__actions : passe devant
   les règles « .tv-home .tv-home__more » du CSS personnalisé. */
.tv-home__actions {
    display: flex;
    justify-content: center;
    margin-top: clamp(24px, 3vw, 36px);
}

.tv-home__actions a.tv-home__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--primary-color, #98bc2a);
    border-radius: 999px;
    background: #fff;
    color: var(--primary-color, #98bc2a);
    font-size: .95rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .2s ease, color .2s ease;
}

.tv-home__actions a.tv-home__more svg {
    width: 18px;
    height: 18px;
    color: inherit;
    transition: transform .2s ease;
}

.tv-home__actions a.tv-home__more:hover,
.tv-home__actions a.tv-home__more:focus-visible {
    background: var(--primary-color, #98bc2a);
    color: #fff;
}

.tv-home__actions a.tv-home__more:hover svg {
    transform: translateX(3px);
}

/* Le thème met une couleur sur tous les éléments : le texte du bouton suit le lien */
.tv-home__actions a.tv-home__more * {
    color: inherit;
}

@media (max-width: 575px) {
    .tv-home__actions a.tv-home__more {
        width: 100%;
        justify-content: center;
    }
}
