/* ==========================================================================
   PAGE RUBRIQUE : grille de cartes des sous-pages
   ========================================================================== */

.child-cards {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.child-cards__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3.5rem 4rem;
}

.child-cards__item {
    margin: 0;
    padding: 0;
}

/* --- Carte (tout est cliquable) --- */
.child-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .1);
    color: #111;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
}

.child-card:hover,
.child-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

.child-card:focus-visible {
    outline: 3px solid var(--rubrique-color, var(--primary-color));
    outline-offset: 4px;
}

/* --- Image --- */
.child-card__image {
    display: block;
    aspect-ratio: 16 / 10;
    background: #f0f0f1; /* si la sous-page n'a pas d'image */
    overflow: hidden;
}

.child-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.child-card:hover .child-card__image img,
.child-card:focus-visible .child-card__image img {
    transform: scale(1.04);
}

/* --- Titre --- */
.child-card__title {
    margin: 0;
    padding: 1.4rem 1rem;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-transform: uppercase;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
    transition: color .2s ease;
}

.child-card:hover .child-card__title,
.child-card:focus-visible .child-card__title {
    color: var(--rubrique-color, var(--primary-color));
}

/* --- Responsive --- */
@media (max-width: 1000px) {
    .child-cards__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2.5rem;
    }
}

@media (max-width: 600px) {
    .child-cards {
        margin: 2rem auto;
    }
    .child-cards__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .child-card__title {
        font-size: 1.15rem;
    }
}

/* Respect des préférences de mouvement */
@media (prefers-reduced-motion: reduce) {
    .child-card,
    .child-card__image img {
        transition: none;
    }
    .child-card:hover,
    .child-card:focus-visible {
        transform: none;
    }
    .child-card:hover .child-card__image img {
        transform: none;
    }
}

.front-banner {
    display: grid;
    grid-template-columns: 55% 45%;
    min-height: 25rem;
    position: relative;
    margin-bottom: 5rem;
    border-bottom: 1px solid var(--color-soft-gray);
}

.front-banner-image-wrapper {
    position: relative;
    z-index: 1;    
    filter: drop-shadow(6px 0 4px rgba(0, 0, 0, 0.3));
    width: 100%;
    height: 100%;
    min-height: 320px;
    clip-path: polygon(0 0, 100% 0, calc(100% - 4rem) 100%, 0 100%);
    background-size: cover;
    background-position: center;
    padding: 0 -1em -1em 0;
}

.front-banner-content {
    display: flex;
    align-items: flex-end;
    padding: 3rem 2rem 1rem 5rem;
}

.front-title-wrapper {
    background-color: var(--primary-color);
    clip-path: polygon(0 0, 100% 0, calc(100% - 15px) 100%, 0 100%);
    padding: 1.2rem 45px 1.2rem 25px;
    position: absolute;
    top: 3rem;
    left: 55%;
    transform: translateX(-40%);
    z-index: 10;
    filter: drop-shadow(6px 0 4px rgba(0, 0, 0, 0.3));
}

.front-title-wrapper h1 {
    font-family: 'Outfit', sans-serif;
    color: #111;
    text-transform: uppercase;
    font-size: clamp(1.8rem, 6vw, 4.2rem);
    font-weight: 900;
    margin: 0;
    line-height: 1.1;
}

section > .comp {
    margin-bottom: 2rem; 
}

.comp + .comp {
    margin-top: 1.5em;
}

.comp-text ul + ul {
    margin-top: 1em;
}

/* --------------------------------------------------
   BLOC : conteneur coloré (classes écrites par BlocNode.exportDOM)
-------------------------------------------------- */
.bloc {
    --bloc-bg: transparent;
    --bloc-fg: inherit;
    --bloc-padding: 0;
    --bloc-width: 100%;

    box-sizing: border-box;
    width: var(--bloc-width);
    padding: var(--bloc-padding);
    margin-top: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    background: var(--bloc-bg);
    color: var(--bloc-fg);
}

/* Fonds (mêmes couleurs que ColorPalette.js et les styles du bouton CTA) */
.bloc--bg-none        { --bloc-bg: transparent; --bloc-fg: inherit; }
.bloc--bg-orange      { --bloc-bg: #ed7203;     --bloc-fg: #1d1d1b; }
.bloc--bg-blue        { --bloc-bg: #04baee;     --bloc-fg: #1d1d1b; }
.bloc--bg-teal        { --bloc-bg: #2d989e;     --bloc-fg: #1d1d1b; }
.bloc--bg-dark-orange { --bloc-bg: #a14f00;     --bloc-fg: #fafafa; } /* teinte à valider */
.bloc--bg-dark-blue   { --bloc-bg: #005069;     --bloc-fg: #fafafa; }
.bloc--bg-dark-teal   { --bloc-bg: #175154;     --bloc-fg: #fafafa; }

/* Espacement intérieur */
.bloc--p-none { --bloc-padding: 0; }
.bloc--p-sm   { --bloc-padding: 1rem; }
.bloc--p-md   { --bloc-padding: 2rem; }
.bloc--p-lg   { --bloc-padding: 3rem; }

/* Largeur */
.bloc--w-100 { --bloc-width: 100%; }
.bloc--w-75  { --bloc-width: 75%; }
.bloc--w-50  { --bloc-width: 50%; }

/* Alignement horizontal du bloc */
.bloc--align-left   { margin-left: 0;    margin-right: auto; }
.bloc--align-center { margin-left: auto; margin-right: auto; }
.bloc--align-right  { margin-left: auto; margin-right: 0; }

/* Le contenu hérite la couleur du bloc (sinon titres/paragraphes gardent leur couleur du thème).
   Les boutons CTA sont exclus : ils ont leurs propres couleurs et pas de soulignement. */
.bloc :is(h1, h2, h3, h4, h5, h6, p, li, a:not(.cta)) {
    color: inherit;
}

.bloc a:not(.cta) { text-decoration: underline; }

/* Pas de marge parasite en haut et en bas du bloc */
.bloc > :first-child { margin-top: 0; }
.bloc > :last-child  { margin-bottom: 0; }

/* Mobile : on ignore la largeur réduite */
@media (max-width: 600px) {
    .bloc { --bloc-width: 100%; }
    .bloc--p-lg { --bloc-padding: 2rem; }
}

/* --------------------------------------------------
   CTA : bouton (classes écrites par CtaNode.exportDOM, normalisées par mware_cta_normalize)
   À coller après les règles du bloc dans la feuille du front.
   Chaque style ne définit que deux variables ; la bordure est le fond assombri
   (22 % de noir) et le survol assombrit un peu moins (12 %) avec un léger relief.
   `a.cta` (0,1,1) passe devant les styles de lien du thème ; les règles du bloc
   doivent exclure .cta (voir plus bas), sinon elles forcent couleur et soulignement.
-------------------------------------------------- */
a.cta {
    --cta-bg: #ed7203;
    --cta-fg: #1d1d1b;

    display: inline-block;
    box-sizing: border-box;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    color: var(--cta-fg);
    background: var(--cta-bg);
    border: 2px solid var(--cta-bg); /* repli si color-mix n'est pas supporté */
    border: 2px solid color-mix(in srgb, var(--cta-bg) 78%, #000);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease,
                transform 0.15s ease, box-shadow 0.15s ease;
}

a.cta:hover {
    color: var(--cta-fg);
    text-decoration: none;
    background: color-mix(in srgb, var(--cta-bg) 88%, #000);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

a.cta:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Anneau clair + anneau sombre : visible sur tous les fonds */
a.cta:focus-visible {
    outline: 3px solid #1d1d1b;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px #fafafa;
}

/* Styles */
a.cta--style-orange      { --cta-bg: #ed7203; --cta-fg: #1d1d1b; }
a.cta--style-blue        { --cta-bg: #04baee; --cta-fg: #1d1d1b; }
a.cta--style-teal        { --cta-bg: #2d989e; --cta-fg: #1d1d1b; }
a.cta--style-dark-orange { --cta-bg: #a14f00; --cta-fg: #fafafa; } /* teinte à valider */
a.cta--style-dark-blue   { --cta-bg: #005069; --cta-fg: #fafafa; }
a.cta--style-dark-teal   { --cta-bg: #175154; --cta-fg: #fafafa; }

/* Tailles */
a.cta--size-sm { padding: 0.4em 1em;   font-size: 0.875em; }
a.cta--size-md { padding: 0.7em 1.5em; font-size: 1em; }
a.cta--size-lg { padding: 1em 2em;     font-size: 1.125em; }

@media (prefers-reduced-motion: reduce) {
    a.cta { transition: none; }
    a.cta:hover { transform: none; }
}

.comp-columns {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

.comp-columns > .column {
    min-width: 0;
}

@media (min-width: 768px) {
    .grid-ratio-50-50 { 
        grid-template-columns: 1fr auto 1fr; 
    }
    
    .grid-ratio-66-33 { 
        grid-template-columns: 2fr auto 1fr; 
    }

    .grid-ratio-33-66 { 
        grid-template-columns: 1fr auto 2fr; 
    }

    .grid-ratio-33-33-33 {
        grid-template-columns: 1fr auto 1fr auto 1fr;
    }

    .grid-ratio-25-50-25 { 
        grid-template-columns: 1fr auto 2fr auto 1fr; 
    }

    .grid-ratio-25-25-25-25 { 
        grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; 
    }
}

.sepa-v {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

.sepa-v::before {
    content: '';
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--color-soft-gray) 15%,
        var(--color-soft-gray) 50%,
        var(--color-soft-gray) 85%,
        transparent 100%
    );
}

.comp-image {
    max-width: 100%;
    margin-top: 0;
    margin-bottom: 0;
}

.comp-image.align-left   { margin-left: 0;    margin-right: auto; }
.comp-image.align-center { margin-left: auto; margin-right: auto; }
.comp-image.align-right  { margin-left: auto; margin-right: 0; }

.comp-image img {
    display: block;
    width: 100%;
    height: auto; /* l'image garde ses proportions */
}

.comp-image > a {
    display: block;
    width: 100%;
    height: 100%;
}

.comp-image.has-link > a:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.polaroid {
    box-sizing: border-box;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 1px 10px rgba(0,0,0,0.2);
    padding: 15px;
    overflow: visible;    
    display: flex;
}

.comp-accordion {
    border: 1px solid var(--color-soft-gray);
    border-radius: 4px;
}

.accordion-header {
    display: flex;
    padding: 0 1em;
}

.accordion-header .accordion-title {
    flex: 1;
    display: flex;
    gap: 0;
}

.accordion-header button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    font-variant: inherit;
    padding: 1rem;
    margin: 0;
}

.accordion-header .accordion-header-icon {
    font-size: 1.8em;
}

.accordion-header button[aria-expanded="false"] .accordion-header-icon {
    transform: rotate(180deg);
    color: var(--color-soft-gray);
    transition: all ease 0.4s;
}

.accordion-header button[aria-expanded="false"]:hover .accordion-header-icon {
    transform: rotate(45deg);
    color: var(--color-medium-gray);
    transition: all ease 0.4s;
}

.accordion-header button[aria-expanded="true"] .accordion-header-icon {
    transform: rotate(0deg);
    color: var(--primary-color);
    transition: all ease 0.4s;
}

.accordion-item:not(:last-child) .accordion-header {
    margin: 0;
    border-bottom: 1px solid var(--color-soft-gray);
}

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

.accordion-panel-body {
    padding: 0 2rem 1rem 5rem;
    border-top: 1px solid var(--color-medium-gray);
}

.comp-diaporama {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
    width: 100%;
}

.comp-diaporama.columns-3 { 
    --nb-cols: 3; 
}

.comp-diaporama.columns-4 { 
    --nb-cols: 4; 
}

.comp-diaporama.columns-5 { 
    --nb-cols: 5; 
}

.comp-diaporama.columns-6 { 
    --nb-cols: 6; 
}

.comp-diaporama {
    grid-template-columns: repeat(var(--nb-cols, 4), minmax(0, 1fr));
}

.comp-diaporama .slide {
    margin: 0;
    display: flex;
}

.comp-diaporama .slide a {
    display: block;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

.comp-diaporama .slide a:hover {
    opacity: 0.9;
}

.comp-diaporama .slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 1024px) {
    .comp-diaporama {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 600px) {
    .comp-diaporama {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

/* Conteneur global du tableau */
.comp-comp-table-wrapper,
.comp-table-wrapper {
    width: 100%;
    overflow-x: auto; /* Permet le scroll horizontal sur les petits écrans */
    margin: 1.5rem 0;
}

/* Structure de la table */
.comp-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    color: #333;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

/* Style des cellules (Cellules de données et d'en-tête) */
.comp-table th,
.comp-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #edf2f7;
}

/* Style spécifique pour l'en-tête (si activé) */
.comp-table th {
    background-color: #f7fafc;
    font-weight: 600;
    color: #2d3748;
}

.comp-table tr td:first-child {
  width: 250px; /* Remplace par la taille souhaitée (ex: 200px, 30%, etc.) */
  min-width: 250px; /* Empêche la colonne de se réduire en dessous de cette taille */
}

/* Effet Zébré (alternance de lignes) */
.comp-table.table-zebra tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Effet au survol des lignes pour un meilleur confort de lecture */
.comp-table tr:hover {
    background-color: #edf2f7;
}

/* Supprime la bordure sur la dernière ligne pour un look plus propre */
.comp-table tr:last-child td {
    border-bottom: none;
}

/* Conteneur principal du composant vidéo */
.comp-video {
    position: relative;
    width: 100%;
    background-color: #000;
    overflow: hidden;
    margin-bottom: 1.5rem; /* Espace sous la vidéo */
}

/* Gestion des ratios dynamiques */
.comp-video.ratio-16-9 {
    aspect-ratio: 16 / 9;
}

.comp-video.ratio-4-3 {
    aspect-ratio: 4 / 3;
}

.comp-video.ratio-21-9 {
    aspect-ratio: 21 / 9;
}

/* L'iframe (YouTube / Vimeo) et la balise <video> s'adaptent parfaitement */
.comp-video iframe,
.comp-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.comp-iframe iframe {
    display: block;
    border: 0;
}
.comp-iframe.has-border iframe {
    border: 1px solid #ddd;
}