﻿/* =========================================================
   Home Page Styles (Cleaned & Optimized)
   - Palette & variables
   - Hero frame (remplace l’ancienne page-title-block)
   - Cards avec theming dynamique (variables inline)
   - Collapse animé (JS pilotant height)
   - Accessibilité améliorée
========================================================= */

/* ---------- ROOT VARIABLES ---------- */
:root {
    --gin-primary: #BC70A4;
    --gin-secondary: #BFD641;
    --gin-primary-rgb: 188,112,164;
    --gin-secondary-rgb: 191,214,65;
    --surface-page: #f2f4f8;
    --surface-panel: #BC70A4;
    --surface-panel-alt: #f4f6f7;
    --border-soft: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.12);
    --text-strong: #202124;
    --text-normal: #2d3135;
    --text-dim: #6b7179;
    --text-faint: #9da5ae;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 9px;
    --shadow-elev: 0 4px 12px -4px rgba(0,0,0,0.15), 0 10px 28px -10px rgba(0,0,0,0.18);
    --shadow-hover: 0 8px 20px -8px rgba(0,0,0,0.18), 0 18px 44px -18px rgba(0,0,0,0.28);
    --ease: cubic-bezier(.16,.8,.3,1);
    --focus-ring: 0 0 0 3px rgba(188,112,164,0.35), 0 0 0 6px rgba(191,214,65,0.35);
    --font-sans: 'Inter','Source Sans 3','Segoe UI',system-ui,-apple-system,BlinkMacSystemFont,'Helvetica Neue',Arial,sans-serif;
    --collapse-height-duration: .45s;
    --collapse-opacity-duration: .30s;
    --accent: #c5ea77; /* vert lime clair */
    --accent-dark: #a3d66f; /* vert plus soutenu */
    --text-main: #1b1b1b;
    --text-sub: #6b7280;
}

/* ---------- GLOBAL FONT APPLICATION ---------- */
.home-wrapper,
.news-grid-home,
.card-home,
.headline,
.tagline,
.btn-toggle-content,
.summary-home,
.title-home,
.meta-line,
.pager-home {
    font-family: var(--font-sans);
}

/* === SECTION HEADER (nouvelle intégration) === */
.news-section-header {
    text-align: center;
    padding: 1.6rem 1rem 1.4rem; /* ↓ hauteur plus compacte */
    border-radius: var(--radius-xl);
    background: linear-gradient( 135deg, color-mix(in oklab, var(--gin-secondary), #fff 85%) 0%, color-mix(in oklab, var(--gin-primary), #fff 92%) 100% );
    box-shadow: var(--shadow-elev);
    border: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}

/* Barre accentuée, plus large et plus visible */
.news-heading-accent {
    display: block;
    width: 80px; /* ← élargie */
    height: 7px; /* ← légèrement plus épaisse */
    margin: 0.4rem auto 0.9rem; /* ← resserré verticalement */
    border-radius: 8px;
    background: var(--gin-secondary);
    box-shadow: 0 0 6px rgba(var(--gin-secondary-rgb), 0.5);
}

/* Titre */
.news-heading {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: 800;
    font-size: clamp(1.7rem, 2.8vw, 2.2rem);
    letter-spacing: -0.015em;
    color: var(--text-strong);
}

/* Sous-titre */
.news-tagline {
    display: block;
    margin-top: 0.4rem;
    font: 500 0.95rem/1.45 var(--font-sans);
    color: var(--text-dim);
}

/* Lueur douce derrière */
.news-section-header::before {
    content: "";
    position: absolute;
    top: -25%;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 300px;
    background: radial-gradient( circle at center, rgba(var(--gin-secondary-rgb), 0.12), transparent 70% );
    z-index: 0;
}




/* === NOUVELLE SÉPARATION DES NEWS === */
/* On transforme le container en simple pile avec espacement et on isole chaque carte */
.news-grid-home {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    gap: 2.6rem;
    display: flex;
    flex-direction: column;
}

/* Chaque carte a maintenant plus de "respiration" : */
.card-home {
    border-radius: 34px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 28px -16px rgba(0,0,0,0.28), 0 4px 14px -6px rgba(0,0,0,0.16);
    backdrop-filter: blur(4px);
}

    /* Accent latéral plus discret et mieux détaché */
    .card-home::before {
        width: 10px;
        border-top-left-radius: 34px;
        border-bottom-left-radius: 34px;
        box-shadow: 2px 0 6px -2px rgba(var(--gin-primary-rgb),0.4), 0 0 0 1px rgba(255,255,255,0.4) inset;
    }

    /* Séparateur visuel entre cartes (fine ligne gradient) */
    .card-home + .card-home {
        position: relative;
    }

        .card-home + .card-home::after {
            content: "";
            position: absolute;
            top: -1.3rem;
            left: 10%;
            right: 10%;
            height: 1px;
            /*background: linear-gradient(90deg, rgba(var(--gin-primary-rgb),0), rgba(var(--gin-primary-rgb),.4) 25%, rgba(var(--gin-secondary-rgb),.45) 75%, rgba(var(--gin-secondary-rgb),0));*/
            background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.15) 50%, rgba(0,0,0,0));
opacity: .35;
            opacity: .55;
            pointer-events: none;
        }

    /* Hover rehaussé */
    .card-home:hover {
        transform: translateY(-4px);
    }

    /* Ajustement du hero interne pour se fondre dans la nouvelle pile */
    .card-home.with-hero .card-hero-bg {
        opacity: .22;
    }

    .card-home.with-hero:hover .card-hero-bg {
        opacity: .32;
    }

/* Titre de carte : légère opacité d’arrière-plan boostée */
.title-home .title-chip {
    background: linear-gradient(140deg, rgba(var(--gin-primary-rgb),0.28), rgba(var(--gin-secondary-rgb),0.26));
    backdrop-filter: blur(4px);
}

.card-home:hover .title-home .title-chip {
    background: linear-gradient(140deg, rgba(var(--gin-primary-rgb),0.34), rgba(var(--gin-secondary-rgb),0.32));
}

/* Bouton collapse + edit cohérents dans la pile espacée */
.collapse-toolbar {
    margin-top: .4rem;
}

/* Pagination : un peu plus de marge au-dessus maintenant que la pile est aérée */
.pager-home {
    margin-top: 2.8rem;
}

/* Réduction des grosses ombres sur mobile pour performance */
@media (max-width: 640px) {
    .card-home {
        box-shadow: 0 6px 18px -10px rgba(0,0,0,0.28), 0 3px 8px -4px rgba(0,0,0,0.18);
        border-radius: 30px;
    }

        .card-home::before {
            width: 8px;
            border-top-left-radius: 30px;
            border-bottom-left-radius: 30px;
        }

        .card-home + .card-home::after {
            top: -1rem;
        }
}

/* ---------- LAYOUT WRAPPER ---------- */
.home-wrapper {
    max-width: 1280px;
    margin: 0 auto 2rem;
    padding: 0 1.5rem;
}

/* ---------- NEWS LIST CONTAINER ---------- */
.news-grid-home {
    display: flex;
    flex-direction: column;
    background: var(--surface-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-elev);
    overflow: hidden;
}

/* ---------- CARD ---------- */
.card-home {
    --_card-bg: var(--card-bg, #ffffff);
    --_card-text: var(--card-text, var(--text-normal));
    --_card-primary: var(--card-primary, var(--gin-primary));
    --_card-secondary: var(--card-secondary, var(--gin-secondary));
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 1.6rem;
    padding: 1.4rem 1.9rem 1.55rem;
    background: linear-gradient(120deg, rgba(var(--gin-primary-rgb),0.06), rgba(var(--gin-secondary-rgb),0.05) 70%), var(--_card-bg);
    color: var(--_card-text);
    border-bottom: 1px solid var(--border-soft);
    isolation: isolate;
    transition: box-shadow .55s var(--ease), transform .55s var(--ease), background .55s var(--ease);
}

    .card-home[data-has-bg="true"] {
        background: linear-gradient(120deg, rgba(var(--gin-primary-rgb),0.04), rgba(var(--gin-secondary-rgb),0.04) 70%), var(--_card-bg);
    }

    .card-home:first-of-type {
        border-top-left-radius: var(--radius-xl);
        border-top-right-radius: var(--radius-xl);
    }

    .card-home:last-of-type {
        border-bottom-left-radius: var(--radius-xl);
        border-bottom-right-radius: var(--radius-xl);
        border-bottom: none;
    }

    .card-home::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background: linear-gradient(180deg,var(--_card-primary), var(--_card-secondary));
        opacity: .95;
    }

    .card-home.with-hero {
        overflow: hidden;
    }

        .card-home.with-hero .card-hero-bg {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            filter: brightness(.92) saturate(1.05);
            opacity: .28;
            z-index: 0;
            transition: opacity 1s ease, transform 1.8s ease;
        }

        .card-home.with-hero .card-hero-overlay {
            position: absolute;
            inset: 0;
            background: linear-gradient(110deg, rgba(var(--gin-primary-rgb),0.25) 0%, rgba(255,255,255,0.75) 55%);
            mix-blend-mode: lighten;
            pointer-events: none;
            z-index: 1;
            opacity: .85;
        }

        .card-home.with-hero:hover .card-hero-bg {
            opacity: .36;
            transform: scale(1.04);
        }

    .card-home:hover {
        box-shadow: var(--shadow-hover);
        background: linear-gradient(120deg, rgba(var(--gin-primary-rgb),0.10), rgba(var(--gin-secondary-rgb),0.09) 70%), var(--_card-bg);
    }

    .card-home:focus-within {
        box-shadow: var(--shadow-hover), var(--focus-ring);
    }

    .card-home.expanded {
        box-shadow: var(--shadow-hover);
    }

    .card-home .media-zone,
    .card-home .body-home {
        position: relative;
        z-index: 2;
    }

/* ---------- MEDIA ---------- */
.media-zone {
    width: 32%;
    min-width: 250px;
    max-width: 360px;
    aspect-ratio: 16/9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg,#eceff3,#dfe3e8);
    position: relative;
    box-shadow: 0 4px 14px -4px rgba(0,0,0,0.20);
    flex-shrink: 0;
}

    .media-zone .cover {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        filter: saturate(1.05) contrast(1.02) brightness(.98);
        transition: transform 1.4s ease, filter 1s ease;
    }

.card-home:hover .media-zone .cover {
    transform: scale(1.06);
    filter: saturate(1.16) contrast(1.05) brightness(1);
}

.media-zone .cover.placeholder {
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: .95rem;
    letter-spacing: .5px;
    color: var(--text-dim);
    background: linear-gradient(135deg,#e3e6ea,#d2d6db);
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 45%, rgba(0,0,0,0.22) 100%);
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* ---------- BADGES ---------- */
.type-badge {
    position: absolute;
    top: .55rem;
    left: .55rem;
    background: linear-gradient(120deg,var(--_card-primary), var(--_card-secondary));
    color: #222;
    font-size: .63rem;
    font-weight: 600;
    padding: .42rem .65rem .38rem;
    letter-spacing: .14em;
    border-radius: 999px;
    box-shadow: 0 3px 10px -4px rgba(var(--gin-primary-rgb),0.55), 0 2px 5px -2px rgba(var(--gin-secondary-rgb),0.45);
}

.featured-ribbon {
    position: absolute;
    top: .55rem;
    right: .55rem;
    background: #ffffff;
    color: #333;
    font-size: .8rem;
    font-weight: 600;
    padding: .45rem .55rem;
    border-radius: 14px;
    box-shadow: 0 3px 10px -4px rgba(0,0,0,0.2);
    opacity: .92;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
}

/* ---------- BODY / TEXT ---------- */
.body-home {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding-top: .2rem;
}

.meta-line {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .62rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: 0 0 .55rem;
}

    .meta-line .date {
        font-weight: 600;
        color: var(--text-dim);
    }

.title-home {
    margin: 0 0 .75rem;
    line-height: 1.22;
    font-size: clamp(1.2rem, 2.2vw, 1.65rem);
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--_card-text);
    position: relative;
}

    .title-home .title-chip {
        display: inline-block;
        padding: .45rem .9rem .40rem;
        border-radius: 18px;
        background: linear-gradient(140deg, rgba(var(--gin-primary-rgb),0.22), rgba(var(--gin-secondary-rgb),0.20));
        font-weight: 600;
        letter-spacing: .35px;
        box-shadow: 0 4px 10px -6px rgba(var(--gin-primary-rgb),0.45), 0 2px 4px -2px rgba(var(--gin-secondary-rgb),0.35);
        backdrop-filter: blur(3px);
        color: var(--_card-text);
        transition: background .5s var(--ease), box-shadow .5s var(--ease), transform .5s var(--ease);
    }

.card-home:hover .title-home .title-chip {
    background: linear-gradient(140deg, rgba(var(--gin-primary-rgb),0.30), rgba(var(--gin-secondary-rgb),0.28));
    transform: translateY(-2px);
}

.title-home .title-chip:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--gin-primary-rgb), .55);
}

.summary-home {
    font-size: .97rem;
    line-height: 1.6;
    color: #3a4047;
    margin: 0 0 .85rem;
    max-width: 70ch;
}

/* ---------- COLLAPSE (JS-driven height animation) ---------- */
.collapse-toolbar {
    margin: 0 0 .6rem;
}

.btn-toggle-content {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    background: linear-gradient(120deg,var(--_card-primary), var(--_card-secondary));
    color: #222;
    border: none;
    padding: .55rem 1rem .5rem;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 12px -6px rgba(var(--gin-primary-rgb),0.45);
    transition: transform .35s var(--ease), box-shadow .4s var(--ease), filter .4s;
}

    .btn-toggle-content:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px -10px rgba(var(--gin-primary-rgb),0.55);
        filter: brightness(1.05);
    }

    .btn-toggle-content:active {
        transform: translateY(0);
    }

    .btn-toggle-content .chevron {
        width: .75rem;
        height: .75rem;
        position: relative;
        display: inline-block;
        transform-origin: 50% 50%;
        transition: transform .55s var(--ease);
    }

        .btn-toggle-content .chevron::before,
        .btn-toggle-content .chevron::after {
            content: "";
            position: absolute;
            top: 50%;
            left: 50%;
            width: 100%;
            height: 2px;
            background: #333;
            border-radius: 2px;
            transform-origin: center;
            transition: background .4s;
        }

        .btn-toggle-content .chevron::before {
            transform: translate(-50%,-50%) rotate(45deg);
        }

        .btn-toggle-content .chevron::after {
            transform: translate(-50%,-50%) rotate(-45deg);
        }

.card-home.expanded .btn-toggle-content .chevron {
    transform: rotate(180deg);
}

.collapse-content {
    display: block;
    height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: height var(--collapse-height-duration) cubic-bezier(.25,.8,.25,1), opacity var(--collapse-opacity-duration) ease;
    will-change: height, opacity;
}

    .collapse-content.open {
        opacity: 1;
        pointer-events: auto;
        /* La hauteur est gérée par JS: on termine sur height:auto inline */
    }

    .collapse-content .cc-inner {
        font-size: .95rem;
        line-height: 1.55;
        color: var(--_card-text, var(--text-normal));
        padding: .05rem 0 .4rem;
    }

        .collapse-content .cc-inner > *:first-child {
            margin-top: 0;
        }

        .collapse-content .cc-inner > *:last-child {
            margin-bottom: 0;
        }

    .collapse-content img {
        max-width: 100%;
        border-radius: 14px;
        margin: .6rem 0 1rem;
        box-shadow: 0 4px 12px -6px rgba(0,0,0,.22);
    }

    .collapse-content h2,
    .collapse-content h3,
    .collapse-content h4 {
        margin: 1.1rem 0 .55rem;
        line-height: 1.25;
        font-weight: 600;
        color: var(--_card-text, var(--text-strong));
    }

    .collapse-content a {
        color: var(--_card-primary, var(--gin-primary));
        border-bottom: 1px solid rgba(var(--gin-primary-rgb), .4);
        text-decoration: none;
        transition: color .25s, border-color .25s;
    }

        .collapse-content a:hover {
            color: var(--_card-secondary, var(--gin-secondary));
            border-color: rgba(var(--gin-secondary-rgb), .6);
        }

    .collapse-content blockquote {
        margin: 1rem 0;
        padding: .75rem 1rem;
        border-left: 4px solid var(--_card-primary, var(--gin-primary));
        background: rgba(var(--gin-primary-rgb), .08);
        border-radius: 10px;
        font-style: italic;
        color: #4a4f55;
    }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .collapse-content {
        transition: none;
    }
}

/* ---------- ADMIN BUTTON ---------- */
.admin-actions {
    margin-top: auto;
}

.btn-edit-home {
    --btn-bg: var(--_card-primary);
    background: var(--btn-bg);
    color: #1f2022;
    border: 1px solid rgba(var(--gin-primary-rgb),0.35);
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 600;
    padding: .6rem 1.05rem .55rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: 0 4px 14px -6px rgba(var(--gin-primary-rgb),0.45);
    transition: background .4s var(--ease), transform .35s var(--ease), box-shadow .45s var(--ease);
}

    .btn-edit-home:hover {
        background: linear-gradient(120deg,var(--_card-primary), var(--_card-secondary));
        transform: translateY(-3px);
        box-shadow: 0 9px 24px -10px rgba(var(--gin-primary-rgb),0.5), 0 4px 10px -4px rgba(var(--gin-secondary-rgb),0.45);
    }

    .btn-edit-home:active {
        transform: translateY(-1px);
    }

/* ---------- ALERTS / STATES ---------- */
.alert-home {
    margin: 0 0 1.1rem;
    background: linear-gradient(125deg, rgba(var(--gin-primary-rgb),0.15), rgba(var(--gin-secondary-rgb),0.12));
    border: 1px solid rgba(var(--gin-primary-rgb),0.35);
    color: #642c50;
    padding: .9rem 1.1rem;
    font-size: .85rem;
    line-height: 1.4;
    border-radius: var(--radius-lg);
}

    .alert-home.error {
        background: linear-gradient(125deg, rgba(255,90,140,0.18), rgba(var(--gin-primary-rgb),0.18));
        border-color: rgba(255,90,140,0.45);
        color: #7a1f42;
    }

.loading-home,
.empty-home {
    padding: 2.3rem 1.2rem;
    text-align: center;
    font-size: .9rem;
    color: var(--text-dim);
}

/* ---------- PAGINATION ---------- */
.pager-home {
    margin: 1.8rem 0 .4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.15rem;
}

.btn-nav-home {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg,#ffffff,#f2f4f6);
    border: 1px solid var(--border-soft);
    display: grid;
    place-items: center;
    color: #3c4043;
    font-size: 1.05rem;
    cursor: pointer;
    box-shadow: 0 4px 12px -6px rgba(0,0,0,0.2);
    transition: background .45s var(--ease), transform .4s var(--ease), box-shadow .5s var(--ease);
}

    .btn-nav-home:hover:not([disabled]) {
        background: linear-gradient(120deg,var(--gin-primary), var(--gin-secondary));
        color: #222;
        transform: translateY(-4px);
        box-shadow: 0 10px 26px -12px rgba(var(--gin-primary-rgb),0.55), 0 6px 16px -8px rgba(var(--gin-secondary-rgb),0.5);
    }

    .btn-nav-home[disabled] {
        opacity: .35;
        cursor: not-allowed;
    }

.page-indicator-home {
    font-size: .7rem;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--text-faint);
    display: flex;
    align-items: center;
}

/* ---------- FOCUS ACCESSIBILITY ---------- */
.card-home a:focus,
.btn-edit-home:focus,
.btn-nav-home:focus,
.btn-toggle-content:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
    .card-home {
        gap: 1.2rem;
        padding: 1.25rem 1.4rem 1.35rem;
    }

    .media-zone {
        min-width: 230px;
    }
}

@media (max-width: 880px) {
    .card-home {
        flex-direction: column;
        padding: 1.15rem 1.25rem 1.35rem;
    }

    .media-zone {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .card-home::before {
        width: 100%;
        height: 6px;
        top: 0;
        left: 0;
        right: 0;
        background: linear-gradient(90deg,var(--_card-primary), var(--_card-secondary));
    }
}

@media (max-width: 640px) {
    .hero-frame {
        padding: 1.1rem 1.4rem 1rem;
        border-radius: 34px;
    }

    .headline .headline-fill {
        padding: .25rem .9rem .2rem;
    }
}

@media (max-width: 520px) {
    .headline {
        font-size: 2.1rem;
    }

    .summary-home {
        font-size: .88rem;
    }

    .card-home {
        padding: 1rem 1rem 1.2rem;
    }

    .btn-edit-home {
        font-size: .63rem;
        padding: .55rem .85rem .5rem;
    }

    .btn-nav-home {
        width: 46px;
        height: 46px;
    }
}
