/* ==========================================================================
   Archive blog (catégories) — élément lmec-archive
   Pattern : hero eyebrow/h1/vague, toolbar façon formations, cartes articles.
   La description longue reste gérée par le mu-plugin lmec-category-details
   (extrait + <details> SEO complet) — on ne fait que la restyler.

   Consomme la couche commune (assets/css/design-system.css) : tokens
   `--lmec-*` et primitives communes. `var(--text-light)` Core Framework
   n'existe pas : le texte secondaire utilise `--lmec-text-light`.
   ========================================================================== */

.lmec-arch {
    width: 100%;
    max-width: var(--lmec-content-width, 1180px);
    margin-left: auto;
    margin-right: auto;
}

/* Le conteneur Bricks parent est dimensionné à 1366px par Core Framework :
   on le ramène au cadre commun 1180px. `width: 100%` est obligatoire — la
   `width` fixe CF figerait sinon le bloc à 1180px même sur mobile. */
#brx-content .brxe-container:has(> .lmec-archive-element) {
    width: 100%;
    max-width: var(--lmec-content-width, 1180px);
}

/* ---------- Hero ---------- */
.lmec-arch-hero {
    text-align: center;
    padding: 0 0 var(--space-l);
}

.lmec-arch-eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(30px, 4vw, 44px);
    font-weight: 600;
    color: var(--lmec-text-title, #3C2E21);
    margin-top: var(--space-2xs);
    line-height: 1.15;
}

.lmec-arch-wave {
    display: block;
    width: 96px;
    margin: var(--space-xs) auto 0;
    color: var(--lmec-secondary, #F8BCA9);
}

.lmec-arch-wave img { display: block; width: 100%; height: auto; }

/* Extrait (1er paragraphe) */
.lmec-arch-desc {
    max-width: 640px;
    margin: var(--space-xs) auto 0;
}

.lmec-arch-desc > p,
.lmec-arch-desc p:first-of-type {
    font-size: 16px;
    line-height: 1.7;
    color: var(--lmec-text-light, #8A7A6B);
}

/* ---------- Accordéon description SEO (mu-plugin lmec-category-details) ---------- */
.lmec-arch-desc .lmec-category-details {
    max-width: 780px;
    margin: 18px auto 0;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
}

.lmec-arch-desc .lmec-category-details summary {
    display: flex;
    width: fit-content;
    margin: 0 auto;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--lmec-primary, #28A6A5);
    background: transparent;
    border: 1.5px solid var(--primary-40, rgba(40, 166, 165, .4));
    border-radius: 100px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
    list-style: none;
}

.lmec-arch-desc .lmec-category-details summary::-webkit-details-marker { display: none; }
.lmec-arch-desc .lmec-category-details summary::before { content: none; }

.lmec-arch-desc .lmec-category-details summary::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .25s;
}

.lmec-arch-desc .lmec-category-details[open] summary::after {
    transform: rotate(225deg) translate(-1px, -1px);
}

.lmec-arch-desc .lmec-category-details summary:hover {
    background: var(--primary-10, rgba(40, 166, 165, .1));
    border-color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-desc .lmec-category-details summary:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

.lmec-arch-desc .lmec-category-full-description {
    margin-top: 22px;
    padding: 34px 40px;
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    box-shadow: var(--lmec-shadow-card);
    text-align: left;
    line-height: 1.7;
}

.lmec-category-full-description h2,
.lmec-category-full-description h3,
.lmec-category-full-description h4 {
    font-family: 'Playfair Display', serif !important;
    color: var(--lmec-text-title, #3C2E21);
    line-height: 1.3;
}

.lmec-category-full-description h2 { font-size: 24px !important; margin: 26px 0 12px; }
.lmec-category-full-description h3 { font-size: 20px !important; margin: 22px 0 10px; }
.lmec-category-full-description h4 { font-size: 17px !important; margin: 18px 0 8px; }
.lmec-category-full-description > *:first-child { margin-top: 0; }
.lmec-category-full-description p { font-size: 15px; }

.lmec-category-full-description a {
    color: var(--lmec-primary, #28A6A5);
    text-decoration: underline;
    text-decoration-color: var(--primary-40, rgba(40, 166, 165, .4));
    text-underline-offset: 2px;
}

.lmec-category-full-description a:hover { text-decoration-color: var(--lmec-primary, #28A6A5); }
.lmec-category-full-description img { border-radius: var(--lmec-radius-field, 10px); }
.lmec-category-full-description blockquote {
    margin: 18px 0;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--lmec-secondary, #F8BCA9);
    font-style: italic;
}

/* ---------- Fil d'Ariane (catégories profondes) ---------- */
.lmec-arch-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    /* Pas de marge haute : le fil suit directement le hero. Bas aligné
       sur le rythme standard du fil d'Ariane (22px). */
    margin: 0 0 22px;
    font-size: 13px;
}

.lmec-arch-crumbs a {
    color: var(--lmec-text-light, #8A7A6B);
    text-decoration: none;
}

.lmec-arch-crumbs a:hover {
    color: var(--lmec-primary, #28A6A5);
    text-decoration: underline;
}

.lmec-arch-crumbs a:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
    border-radius: 2px;
}

.lmec-arch-crumbs__sep { color: var(--lmec-text-light, #8A7A6B); opacity: .55; }

.lmec-arch-crumbs [aria-current] {
    color: var(--lmec-text-title, #3C2E21);
    font-weight: 600;
}

/* ---------- Barre de filtres (toolbar commune, pattern formations) ---------- */
.lmec-arch-filters {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 16px 20px;
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    box-shadow: var(--lmec-shadow-card);
    margin-bottom: 34px;
}

.lmec-arch-search {
    flex: 1;
    min-width: 220px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    background: var(--lmec-bg-surface, #fff);
    border: 1.5px solid var(--lmec-border);
    border-radius: 100px;
    transition: border-color .2s, box-shadow .2s;
}

.lmec-arch-search:focus-within {
    border-color: var(--lmec-primary, #28A6A5);
    box-shadow: var(--lmec-focus-ring);
}

.lmec-arch-search svg {
    width: 16px;
    height: 16px;
    color: var(--lmec-primary, #28A6A5);
    flex-shrink: 0;
}

.lmec-arch-q {
    flex: 1;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 18px;
    color: var(--lmec-text-body, #6E5D4D);
    outline: none;
    padding: 0;
    min-height: 0;
}

.lmec-arch-q::placeholder { color: var(--lmec-text-light, #8A7A6B); }
.lmec-arch-q::-webkit-search-cancel-button { cursor: pointer; }

/* Le halo est porté par la pill (.lmec-arch-search:focus-within) :
   on neutralise tout outline/box-shadow natif ou global sur l'input. */
.lmec-arch-search .lmec-arch-q:focus,
.lmec-arch-search .lmec-arch-q:focus-visible,
.lmec-arch-search .lmec-arch-q:active {
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    border: none !important;
}

/* ---------- Recherche live (dropdown de suggestions) ---------- */
.lmec-arch-search { position: relative; }

.lmec-arch-live {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 40;
    padding: 8px;
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    box-shadow: 0 18px 45px rgba(60, 46, 33, .14);
    animation: lmec-arch-pop .18s ease-out;
}

.lmec-arch-live[hidden] { display: none; }

.lmec-arch-live a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--lmec-text-heading, #3D3129);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.lmec-arch-live a::before {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--lmec-primary, #28A6A5);
    opacity: .45;
}

.lmec-arch-live a:hover,
.lmec-arch-live a:focus-visible {
    background: var(--lmec-bg-soft, #F7F1EA);
    color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-live__empty {
    padding: 12px;
    font-size: 13px;
    color: var(--lmec-text-light, #8A7A6B);
    text-align: center;
}

.lmec-arch-live__all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
    padding: 10px 12px;
    border-top: 1px solid var(--lmec-border);
    border-radius: 0;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--lmec-primary, #28A6A5) !important;
}

.lmec-arch-live__all::before { display: none; }

/* ---------- Page résultats de recherche (template Bricks .brxe-posts) ---------- */
body.search-results .layout-default { padding-bottom: var(--space-3xl, 80px); }

body.search-results .brxe-posts .bricks-layout-wrapper {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 26px;
}

body.search-results .brxe-posts .bricks-isotope-sizer { display: none; }

body.search-results .brxe-posts .bricks-layout-item {
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    overflow: hidden;
    box-shadow: var(--lmec-shadow-card);
    transition: transform .25s, box-shadow .25s;
}

body.search-results .brxe-posts .bricks-layout-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--lmec-shadow-hover);
}

body.search-results .brxe-posts .bricks-layout-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

body.search-results .brxe-posts .image-wrapper {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--lmec-border);
}

body.search-results .brxe-posts .image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.search-results .brxe-posts .content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 22px 24px;
    flex: 1;
}

body.search-results .brxe-posts .content-wrapper h3.dynamic {
    font-family: var(--lmec-font-heading, 'Playfair Display', serif);
    font-size: 19px;
    line-height: 1.3;
    color: var(--lmec-text-heading, #3D3129);
    margin: 0;
}

body.search-results .brxe-posts .content-wrapper h3.dynamic a {
    color: inherit;
    text-decoration: none;
    transition: color .2s;
}

body.search-results .brxe-posts .content-wrapper h3.dynamic a:hover { color: var(--lmec-primary, #28A6A5); }

/* Date */
body.search-results .brxe-posts .content-wrapper .dynamic[data-field-id="1"] {
    order: -1;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--lmec-text-light, #8A7A6B);
}

/* Extrait */
body.search-results .brxe-posts .content-wrapper .dynamic[data-field-id="2"] {
    font-size: 14px;
    line-height: 1.55;
    color: var(--lmec-text-body, #6E5D4D);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

body.search-results .brxe-posts ul.page-numbers {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: 44px 0 0;
    padding: 0;
}

body.search-results .brxe-posts .page-numbers a,
body.search-results .brxe-posts .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--lmec-text-body, #6E5D4D);
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: 100px;
    text-decoration: none;
    transition: border-color .2s, color .2s;
}

body.search-results .brxe-posts .page-numbers a:hover {
    border-color: var(--lmec-primary, #28A6A5);
    color: var(--lmec-primary, #28A6A5);
}

body.search-results .brxe-posts .page-numbers a:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

body.search-results .brxe-posts .page-numbers .current {
    background: var(--lmec-primary, #28A6A5);
    border-color: var(--lmec-primary, #28A6A5);
    color: #fff;
}

@media (max-width: 1024px) {
    body.search-results .brxe-posts .bricks-layout-wrapper { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 600px) {
    body.search-results .brxe-posts .bricks-layout-wrapper { grid-template-columns: 1fr !important; }
}

.lmec-arch-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.lmec-arch-chip {
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--lmec-text-body, #6E5D4D);
    background: var(--lmec-bg-surface, #fff);
    border: 1.5px solid var(--lmec-border);
    border-radius: 100px;
    text-decoration: none;
    transition: border-color .2s, color .2s, background .2s;
    white-space: nowrap;
}

.lmec-arch-chip:hover {
    border-color: var(--lmec-primary, #28A6A5);
    color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-chip:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

.lmec-arch-chip.is-active,
.lmec-arch-chip[aria-current] {
    background: var(--lmec-primary, #28A6A5);
    border-color: var(--lmec-primary, #28A6A5);
    color: #fff;
}

.lmec-arch-count {
    font-size: 13px;
    color: var(--lmec-text-light, #8A7A6B);
    text-align: right;
    margin: -20px 4px 20px;
}

/* ---------- Dropdown "Plus de catégories" ---------- */
.lmec-arch-chips { position: relative; }

.lmec-arch-more {
    position: relative;
}

.lmec-arch-more summary.lmec-arch-chip {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.lmec-arch-more summary::-webkit-details-marker { display: none; }

.lmec-arch-more summary svg {
    width: 10px;
    height: 6px;
    transition: transform .25s;
}

.lmec-arch-more[open] summary svg { transform: rotate(180deg); }

.lmec-arch-more[open] summary {
    border-color: var(--lmec-primary, #28A6A5);
    color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-more__panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: max-content;
    max-width: min(560px, 88vw);
    padding: 14px;
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    box-shadow: 0 18px 45px rgba(60, 46, 33, .14);
    animation: lmec-arch-pop .18s ease-out;
}

@keyframes lmec-arch-pop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    /* Panel ancré à la toolbar entière (le <details> peut être en wrap) */
    .lmec-arch-filters { position: relative; }
    .lmec-arch-more { position: static; }
    .lmec-arch-more__panel {
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
    }
}

/* ---------- Grille d'articles ---------- */
.lmec-arch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 26px;
}

.lmec-arch-card {
    display: flex;
    flex-direction: column;
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
    overflow: hidden;
    box-shadow: var(--lmec-shadow-card);
    transition: transform .25s, box-shadow .25s;
}

.lmec-arch-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--lmec-shadow-hover);
}

.lmec-arch-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--lmec-border);
}

.lmec-arch-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lmec-arch-date {
    position: absolute;
    top: 14px;
    left: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, .94);
    border-radius: var(--lmec-radius-field, 10px);
    box-shadow: 0 4px 12px rgba(60, 46, 33, .12);
    line-height: 1.2;
}

.lmec-arch-date b {
    font-size: 17px;
    font-weight: 700;
    color: var(--lmec-text-title, #3C2E21);
}

.lmec-arch-date i {
    font-style: normal;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--lmec-text-light, #8A7A6B);
}

.lmec-arch-card__cat {
    position: absolute;
    bottom: 14px;
    left: 14px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--lmec-text-title, #3C2E21);
    background: rgba(255, 255, 255, .94);
    border-radius: 100px;
}

.lmec-arch-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px 22px 22px;
}

.lmec-arch-card__title {
    font-family: 'Playfair Display', serif;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.lmec-arch-card__title a {
    color: var(--lmec-text-title, #3C2E21);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .2s;
}

.lmec-arch-card__title a:hover { color: var(--lmec-primary, #28A6A5); }
.lmec-arch-card__title a:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

.lmec-arch-card__excerpt {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.65;
    color: var(--lmec-text-body, #6E5D4D);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.lmec-arch-card__cta {
    margin-top: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--lmec-primary, #28A6A5);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
}

.lmec-arch-card__cta svg {
    width: 14px;
    height: 14px;
    transition: transform .2s;
}

.lmec-arch-card__cta:hover svg { transform: translateX(3px); }

.lmec-arch-card__cta:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

.lmec-arch-empty {
    text-align: center;
    color: var(--lmec-text-light, #8A7A6B);
    padding: 30px 0;
}

/* Section archive (template catégorie) : padding bas ajusté. */
body.category #brx-content > #brxe-lmcarch1 {
    padding-bottom: var(--space-xl);
}

/* ---------- Pagination ---------- */
.lmec-arch-pagination .page-numbers {
    display: flex;
    justify-content: center;
    gap: 8px;
    list-style: none;
    margin: var(--space-m, 28px) 0 0;
    padding: 0;
}

.lmec-arch-pagination .page-numbers a,
.lmec-arch-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--lmec-text-body, #6E5D4D);
    background: var(--lmec-bg-surface, #fff);
    border: 1px solid var(--lmec-border);
    border-radius: 100px;
    text-decoration: none;
    transition: border-color .2s, color .2s;
}

.lmec-arch-pagination .page-numbers a:hover {
    border-color: var(--lmec-primary, #28A6A5);
    color: var(--lmec-primary, #28A6A5);
}

.lmec-arch-pagination .page-numbers a:focus-visible {
    outline: 2px solid var(--lmec-primary, #28A6A5);
    outline-offset: 2px;
}

.lmec-arch-pagination .page-numbers .current {
    background: var(--lmec-primary, #28A6A5);
    border-color: var(--lmec-primary, #28A6A5);
    color: #fff;
}

/* ---------- Builder note ---------- */
.lmec-arch-builder-note {
    padding: 20px;
    text-align: center;
    color: var(--lmec-text-light, #8A7A6B);
    border: 1px dashed var(--lmec-border);
    border-radius: var(--lmec-radius-card, 16px);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .lmec-arch-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .lmec-arch-filters { gap: 10px; }
}

@media (max-width: 600px) {
    .lmec-arch-hero { padding: 40px 0 30px; }
    .lmec-arch-grid { grid-template-columns: 1fr; }
    .lmec-arch-count { text-align: left; margin: -14px 2px 16px; }
    .lmec-category-full-description { padding: 24px 20px; }
    .lmec-arch-crumbs { margin: 0 0 16px; }
}
