/* =========================================================================
   Archive des articles — hero par catégorie + grille de vignettes
   Disposition inspirée de tiess.ca/articles, styles alignés sur le thème elefen
   (couleurs --theme--color--N, rayons 5/11 px, Kanit/SourceSans, ombres du thème).
   Voir inc/archive-articles.php
   ========================================================================= */
.es-archive {
    --es-texte: #000;
    --es-gris: #646464;
    --es-gris-pale: #EBEBEB;
    --es-rayon-bloc: 11px;   /* .borderRadius / cartes entreprises */
    --es-rayon: 5px;         /* boutons, images, champs */
    --es-ombre: 0px 3px 6px #00000016;
    --es-ombre-hover: 0px 8px 8px 0px #0000001f;
    --es-largeur: min(var(--wp--style--global--content-size, 1268px), 100% - 40px);
}
.es-archive #content { padding-bottom: 80px; }

/* ---------- Hero ---------- */
.es-hero { width: var(--es-largeur); margin: 40px auto 0; }
.es-hero__fond {
    --es-hero-bg: var(--theme--color--1);
    --es-hero-texte: var(--es-texte);
    background: var(--es-hero-bg);
    color: var(--es-hero-texte);
    border-radius: var(--es-rayon-bloc);
    padding: clamp(28px, 4.5vw, 64px);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: clamp(28px, 4.5vw, 64px);
    align-items: center;
}
/* Couleurs du thème (palette theme.json) */
.es-hero--bleu-pale .es-hero__fond { --es-hero-bg: var(--theme--color--1); --es-hero-texte: #000; }
.es-hero--gold      .es-hero__fond { --es-hero-bg: var(--theme--color--0); --es-hero-texte: #000; }
.es-hero--rouge     .es-hero__fond { --es-hero-bg: var(--theme--color--2); --es-hero-texte: #fff; }
.es-hero--vert      .es-hero__fond { --es-hero-bg: var(--theme--color--3); --es-hero-texte: #fff; }
.es-hero--violet    .es-hero__fond { --es-hero-bg: var(--theme--color--4); --es-hero-texte: #fff; }
.es-hero--gris      .es-hero__fond { --es-hero-bg: var(--es-gris-pale);   --es-hero-texte: #000; }
.es-hero--blanc     .es-hero__fond { --es-hero-bg: #fff;                   --es-hero-texte: #000; }
.es-hero--blanc.es-hero--encadree .es-hero__fond { border: 1px solid var(--es-gris-pale); }
.es-hero--blanc.es-hero--pleine { border-bottom: 1px solid var(--es-gris-pale); }

.es-hero--simple .es-hero__fond,
.es-hero--banniere .es-hero__fond:not(:has(.es-hero__media)) { grid-template-columns: minmax(0, 1fr); }
.es-hero--simple .es-hero__contenu,
.es-hero--banniere .es-hero__fond:not(:has(.es-hero__media)) .es-hero__contenu { max-width: 860px; }

.es-archive .es-hero__img {
    display: block;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--es-rayon);
    box-shadow: 0px 3px 6px #00000029;
    background: var(--es-gris-pale);
}
.es-hero__surtitre {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
    margin: 0 0 16px;
    font-family: var(--wp--preset--font-family--kanit);
    font-weight: 300; font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
    color: inherit;
}
.es-hero__titre {
    font-family: var(--wp--preset--font-family--kanit);
    font-weight: 500; text-transform: uppercase; line-height: 110%;
    font-size: clamp(1.5625rem, 1.3839rem + 0.8929vw, 2.1875rem); /* = h2 du thème */
    color: inherit;
    margin: 0 0 18px;
}
.es-hero__titre a { color: inherit !important; text-decoration: none; transition: .5s opacity ease-in-out; }
.es-hero__titre a:hover { opacity: .75; }
.es-hero__titre--grand { font-size: clamp(2.375rem, 2.1964rem + 0.8929vw, 3rem); } /* = h1 du thème */
.es-hero__texte {
    font-family: var(--wp--preset--font-family--sourcesans);
    font-size: clamp(1rem, 0.9643rem + 0.1786vw, 1.125rem); line-height: 130%;
    margin: 0 0 28px; max-width: 62ch; color: inherit;
}
.es-hero__texte *, .es-hero__texte p { color: inherit; }
.es-hero__texte p:last-child { margin-bottom: 0; }
.es-hero__bouton { margin: 0; }
/* Bouton violet invisible sur fond violet : on passe à l'or (comme le menu) */
.es-hero--violet .es-hero__bouton > a { background-color: var(--theme--color--0); }
.es-hero--violet .es-hero__bouton > a:hover,
.es-hero--gold .es-hero__bouton > a:hover { background-color: var(--theme--color--3) !important; }

/* « À la une » (surtitre de l'article vedette) */
.es-hero__une {
    font-weight: 500;
    padding-right: 16px;
    border-right: 1px solid currentColor;
}

/* ---------- Hero « Pleine largeur » : image bord à bord à gauche, coupe en diagonale ---------- */
.es-hero--pleine { width: 100%; margin: 0; overflow: hidden; }
.es-hero--pleine .es-hero__fond {
    --es-hero-accent: var(--theme--color--4);
    --es-demi: calc((100vw - min(var(--wp--style--global--content-size, 1268px), 100vw - 40px)) / 2);
    position: relative;
    border-radius: 0;
    padding: 0;
    gap: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: clamp(420px, 58vh, 620px);
    align-items: stretch;
}
.es-hero--pleine.es-hero--violet .es-hero__fond,
.es-hero--pleine.es-hero--rouge  .es-hero__fond,
.es-hero--pleine.es-hero--vert   .es-hero__fond { --es-hero-accent: var(--theme--color--0); }
.es-hero--pleine.es-hero--gold   .es-hero__fond { --es-hero-accent: var(--theme--color--3); }

/* Image : occupe toute la moitié gauche, bord droit en diagonale (rappel des angles du thème) */
.es-hero--pleine .es-hero__media {
    position: relative;
    margin-right: -3vw;               /* la diagonale empiète légèrement sous le texte */
    clip-path: polygon(0 0, 100% 0, 88% 100%, 0 100%);
    overflow: hidden;
    z-index: 0;
}
.es-archive .es-hero--pleine .es-hero__img {
    position: absolute; inset: 0;
    width: 100% !important; height: 100% !important;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
    animation: es-hero-zoom 1.4s cubic-bezier(.2,.7,.2,1) both;
}
/* Liseré coloré qui suit la diagonale */
.es-hero--pleine .es-hero__media::after {
    content: "";
    position: absolute; inset: 0;
    background: var(--es-hero-accent);
    clip-path: polygon(calc(100% - 14px) 0, 100% 0, 88% 100%, calc(88% - 14px) 100%);
    z-index: 1;
}

.es-hero--pleine .es-hero__contenu {
    position: relative; z-index: 1;
    align-self: center;
    /* gauche : 3vw de chevauchement de la diagonale + espace libre minimal de ~4vw */
    padding: clamp(40px, 6vw, 88px) max(20px, var(--es-demi)) clamp(40px, 6vw, 88px) clamp(56px, 7.5vw, 140px);
    animation: es-hero-entree .9s .15s cubic-bezier(.2,.7,.2,1) both;
}
/* Petite barre d'accent au-dessus du titre */
.es-hero--pleine .es-hero__titre::before {
    content: "";
    display: block;
    width: 56px; height: 5px;
    margin-bottom: 18px;
    background: var(--es-hero-accent);
    border-radius: 5px;
}
.es-hero--pleine .es-hero__titre { font-size: clamp(1.75rem, 1.4rem + 1.3vw, 2.75rem); }
.es-hero--pleine .es-hero__titre--grand { font-size: clamp(2.375rem, 1.9rem + 2vw, 3.75rem); }

/* Sans image (Titre seulement / bannière sans image) : bandeau pleine largeur aligné sur le contenu */
.es-hero--pleine.es-hero--simple .es-hero__fond,
.es-hero--pleine.es-hero--banniere .es-hero__fond:not(:has(.es-hero__media)) {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
}
.es-hero--pleine.es-hero--simple .es-hero__contenu,
.es-hero--pleine.es-hero--banniere .es-hero__fond:not(:has(.es-hero__media)) .es-hero__contenu {
    max-width: none;
    padding: clamp(48px, 6vw, 80px) max(20px, var(--es-demi));
}

@keyframes es-hero-zoom   { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes es-hero-entree { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
    .es-hero--pleine .es-hero__fond { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .es-hero--pleine .es-hero__media {
        margin-right: 0;
        aspect-ratio: 16 / 10;
        clip-path: polygon(0 0, 100% 0, 100% 86%, 0 100%);
    }
    .es-hero--pleine .es-hero__media::after {
        clip-path: polygon(0 calc(100% - 10px), 100% calc(86% - 10px), 100% 86%, 0 100%);
    }
    .es-hero--pleine .es-hero__contenu { padding: 28px 20px 48px; }
}
@media (prefers-reduced-motion: reduce) {
    .es-archive .es-hero--pleine .es-hero__img,
    .es-hero--pleine .es-hero__contenu { animation: none; }
}

/* ---------- Pastille (étiquette principale) ---------- */
.es-pastille {
    display: inline-block;
    background: var(--theme--color--3);
    color: #fff;
    font-family: var(--wp--preset--font-family--kanit);
    font-size: 12px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; line-height: 1;
    padding: 8px 12px;
    border-radius: var(--es-rayon);
    box-shadow: var(--es-ombre);
    max-width: calc(100% - 24px);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.es-hero--vert .es-pastille { background: #fff; color: var(--theme--color--3); }

/* ---------- Barre d'outils ---------- */
.es-archive__liste { width: var(--es-largeur); margin: clamp(48px, 6vw, 80px) auto 0; }
.es-archive__entete {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 16px 32px; margin-bottom: 10px;
}
.es-archive__titre { margin: 0; }
.es-archive__outils {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    flex: 1 1 520px; justify-content: flex-end;
}
.es-archive__recherche { position: relative; flex: 1 1 280px; max-width: 520px; }
.es-archive form.es-archive__outils input[type="search"] {
    width: 100%; height: 48px; box-sizing: border-box; margin: 0;
    padding: 0 60px 0 18px;
    background: #fff !important;
    border: 1px solid #d3d5dc !important;
    border-radius: 6px !important;
    box-shadow: none;
    font-family: var(--wp--preset--font-family--sourcesans);
    font-size: 16px !important; color: #727278;
}
.es-archive form.es-archive__outils input[type="search"]:focus { border-color: var(--theme--color--4) !important; outline: none; }
.es-archive .es-archive__recherche button {
    position: absolute; top: 5px; right: 5px;
    width: 38px; height: 38px; padding: 0;
    display: grid; place-items: center;
    background-color: var(--theme--color--3);
    border-radius: var(--es-rayon);
    box-shadow: none; letter-spacing: 0;
}
.es-archive .es-archive__recherche button:hover { background-color: var(--theme--color--0) !important; }
/* Les listes déroulantes gardent le style global du thème (fond #EBEBEB, flèche) */
.es-archive .es-archive__select select {
    width: auto; min-width: 190px; max-width: 280px; height: 48px;
    padding-right: 40px !important;
    cursor: pointer;
}
.es-archive__compte {
    text-align: right; margin: 8px 0 24px;
    font-family: var(--wp--preset--font-family--sourcesans);
    font-size: 15px; color: var(--es-gris);
}
.es-archive__compte a { color: var(--theme--color--4); font-weight: 600; }
.es-archive__vide { padding: 40px 0; }

/* ---------- Grille + vignettes ---------- */
.es-grille {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    align-items: stretch;
}
.es-carte {
    position: relative;
    background: #fff;
    border-radius: var(--es-rayon-bloc);
    box-shadow: var(--es-ombre);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: 0.5s all ease-in-out;
    margin: 0 !important;
}
.es-carte:hover, .es-carte:focus-within { box-shadow: var(--es-ombre-hover); transform: translateY(-3px); }
.es-carte__media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--es-gris-pale); }
.es-archive .es-carte__img {
    position: absolute; inset: 0;
    display: block; width: 100% !important; height: 100% !important; max-width: none;
    object-fit: cover;
    transition: 0.5s transform ease-in-out;
}
.es-carte:hover .es-carte__img { transform: scale(1.04); }
/* Image par défaut (article sans image mise en avant) : logo du Pôle en filigrane */
.es-carte__img--vide, .es-hero__img.es-carte__img--vide { background: #F4F4F2; overflow: hidden; }
.es-carte__img--vide::before {
    content: "";
    position: absolute; inset: 0;
    background: url("../img/logo-symbole-filigrane.png") center / 38% auto no-repeat;
    opacity: .2;
    transition: 0.5s opacity ease-in-out;
}
.es-carte:hover .es-carte__img--vide::before { opacity: .3; }
.es-hero--encadree .es-hero__img.es-carte__img--vide { position: relative; }
.es-hero__img.es-carte__img--vide::before {
    background-image: url("../img/logo-pole-filigrane.png");
    background-size: min(62%, 460px) auto;
    opacity: .16;
}
.es-hero--pleine .es-hero__img.es-carte__img--vide::before { background-position: 44% 50%; } /* centré dans la partie visible (diagonale) */
/* Étiquette + date : sous l'image (la pastille ne cache plus le visuel) */
.es-carte__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.es-carte .es-pastille { box-shadow: none; max-width: 100%; }
/* Titres de section : À venir / Archives */
.es-archive .es-archive__section {
    margin: 8px 0 22px;
    font-family: var(--wp--preset--font-family--kanit);
    font-weight: 500; text-transform: uppercase; letter-spacing: 1.2px;
    font-size: clamp(1.5625rem, 1.3839rem + 0.8929vw, 2.1875rem);
}
.es-archive .es-archive__section::after {
    content: ""; display: block; width: 56px; height: 5px; margin-top: 12px;
    background: var(--theme--color--4); border-radius: 5px;
}
.es-grille--avenir { margin-bottom: 64px; }
.es-carte__corps { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.es-carte__date {   /* = .date du bloc Actualités */
    font-family: var(--wp--preset--font-family--kanit);
    font-weight: 300; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
    color: var(--es-gris);
}
.es-archive .es-carte__titre {
    font-family: var(--wp--preset--font-family--kanit);
    font-size: 17px; font-weight: 500; line-height: 120%;
    text-transform: uppercase; letter-spacing: 0;
    margin: 0 0 10px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.es-carte__lien { color: var(--es-texte) !important; text-decoration: none; transition: .5s color ease-in-out; }
.es-carte:hover .es-carte__lien { color: var(--theme--color--4) !important; }
.es-carte__lien::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* carte entièrement cliquable */
.es-carte__lien:focus-visible { outline: none; }
.es-carte:has(.es-carte__lien:focus-visible) { outline: 3px solid var(--theme--color--4); outline-offset: 2px; }
.es-carte__bouton {   /* version compacte de .bouton > a */
    margin-top: auto; align-self: flex-start;
    background-color: var(--theme--color--4); color: #fff;
    padding: 11px 22px; border-radius: var(--es-rayon);
    font-family: var(--wp--preset--font-family--kanit);
    font-size: 13px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; line-height: normal;
    box-shadow: 0px 3px 6px #00000029;
    transition: 0.5s all ease-in-out;
}
.es-carte:hover .es-carte__bouton { background-color: var(--theme--color--0); }

/* ---------- Pagination (styles du thème + espacement) ---------- */
.es-archive .pagination { margin-top: 56px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .es-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .es-hero__fond { grid-template-columns: minmax(0, 1fr); }
    .es-archive__outils { justify-content: flex-start; flex-basis: 100%; }
    .es-archive__recherche { max-width: none; }
}
@media (max-width: 560px) {
    .es-grille { grid-template-columns: minmax(0, 1fr); }
    .es-archive__select { flex: 1 1 calc(50% - 6px); }
    .es-archive .es-archive__select select { width: 100%; max-width: none; min-width: 0; }
    .es-archive__compte { text-align: left; }
    .es-hero { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .es-carte, .es-carte__img, .es-carte__bouton { transition: none; }
    .es-carte:hover { transform: none; }
    .es-carte:hover .es-carte__img { transform: none; }
}
