/* =====================================================
   MÉDIATHÈQUE — CENTRE DE RESSOURCES
   Gutenberg + CatFolders Document Gallery + WPML
   Classes réutilisables : ressource-*
   ===================================================== */

/* 1. STRUCTURE DE PAGE ET COULEURS */
body:has(.ressource-media) #page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

body:has(.ressource-media) #content {
    flex: 1 0 auto;
    width: 100%;
    background: #08070b;
}

.ressource-media {
    box-sizing: border-box;
    padding: 40px clamp(20px, 5vw, 70px) 80px;
    background: #08070b;
    color: #f5f5f5;
}

.ressource-media .ressource-hero,
.ressource-media .ressource-resources {
    width: 100%;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
}

/* 2. BANNIÈRE */
.ressource-media .ressource-hero {
    position: relative;
    overflow: hidden;
    padding: 45px;
    margin-bottom: 55px;
    background: linear-gradient(110deg, #0c0912, #21132c 75%, #100a18);
    border: 1px solid #392536;
    border-bottom: 2px solid #e6007e;
    border-radius: 8px;
}

.ressource-media .ressource-hero h1 {
    color: #ed62a7;
    font-size: clamp(42px, 5vw, 76px);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
}

.ressource-media .ressource-hero p {
    color: #c7c0c8;
    line-height: 1.7;
}

.ressource-media .ressource-hero img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    margin: 0 auto;
}

/* 3. SECTION RESSOURCES ET TYPOGRAPHIE */
.ressource-media .ressource-resources {
    padding-bottom: 45px;
    border-bottom: 1px solid #343039;
}

.ressource-media .ressource-resources h2 {
    color: #fff;
    font-size: 30px;
    font-weight: 600;
    margin-bottom: 30px;
}

.ressource-media .ressource-resources h3 {
    color: #fff;
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 18px;
}

.ressource-media .ressource-label,
.ressource-media .ressource-video-card .ressource-label,
.ressource-media .ressource-documents .ressource-label {
    color: #e353a0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.ressource-media .ressource-resources .wp-block-columns {
    align-items: flex-start;
    gap: 28px;
}

.ressource-media .ressource-resources .wp-block-column {
    min-width: 0;
}

/* 4. CARTE VIDÉO */
.ressource-media .ressource-video-card {
    box-sizing: border-box;
    padding: 24px;
    background: #141118;
    border: 1px solid #392536;
    border-radius: 8px;
    transition: border-color .25s ease, box-shadow .25s ease;
}

.ressource-media .ressource-video-card:hover {
    border-color: #e6007e;
    box-shadow: 0 0 12px rgba(230, 0, 126, .15);
}

.ressource-media .ressource-video-card .wp-block-video {
    text-align: center;
    margin: 15px auto;
}

.ressource-media .ressource-video-card video {
    display: block;
    width: 100%;
    max-width: 240px;
    aspect-ratio: 9 / 16;
    object-fit: contain;
    margin: 0 auto;
    background: #000;
    border-radius: 6px;
}

.ressource-media .ressource-video-card h3 {
    color: #fff;
    margin-top: 16px;
}

.ressource-media .ressource-video-card p {
    color: #b8b1b9;
    line-height: 1.6;
}

/* 5. CONTENEUR DES DOCUMENTS */
.ressource-media .ressource-documents {
    display: block; /* Ne pas transformer ce groupe Gutenberg en flex */
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.ressource-media .ressource-documents > * {
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.ressource-media .ressource-documents > .ressource-label,
.ressource-media .ressource-documents > .wp-block-heading {
    box-sizing: border-box;
    padding-left: 14px; /* Alignement sur la carte CatFolders */
}

.ressource-media .ressource-documents h3 {
    color: #fff;
    margin-bottom: 20px;
}

.ressource-media .ressource-documents #cf-app {
    width: 100%;
    max-width: none;
    color: #fff;
}

/* 6. CATFOLDERS — RECHERCHE (SI ACTIVÉE) */
.ressource-media .ressource-documents #cf-app
:is(input[type="search"], input[type="text"]) {
    background: #17141d;
    color: #fff;
    border: 1px solid #392536;
    border-radius: 6px;
}

.ressource-media .ressource-documents #cf-app
:is(input[type="search"], input[type="text"])::placeholder {
    color: #a9a0aa;
}

/* 7. CATFOLDERS — LISTE DE CARTES */
.ressource-media .ressource-documents #cf-app table.cf-table {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
    border: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
}

.ressource-media .ressource-documents #cf-app table.cf-table thead {
    display: none;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody {
    display: block;
    width: 100%;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody tr {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #17141d !important;
    border: 1px solid #392536;
    border-radius: 7px;
    transition: border-color .25s ease, background-color .25s ease;
}

/* Important : DataTables / CatFolders colorent certaines cellules au hover.
   La spécificité ci-dessous est volontairement élevée. */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td {
    box-sizing: border-box;
    min-width: 0;
    padding: 14px 16px;
    background: transparent !important;
    background-image: none !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Nom de document à gauche */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td:first-child {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
}

/* Colonne « Type » masquée (contenu conservé dans le HTML) */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td:nth-child(2) {
    display: none;
}

/* Bouton à droite */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td:last-child {
    flex: 0 0 auto;
    text-align: right;
}

/* Neutraliser le fond des conteneurs internes CatFolders */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td .flex,
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td .cf-column-last {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

/* Lien de titre : lisible aussi après visite / focus / hover */
.ressource-media .ressource-documents #cf-app table.cf-table a.cf-icon,
.ressource-media .ressource-documents #cf-app table.cf-table a.cf-icon:visited,
.ressource-media .ressource-documents #cf-app table.cf-table a.cf-icon:hover,
.ressource-media .ressource-documents #cf-app table.cf-table a.cf-icon:focus {
    color: #f5f5f5 !important;
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

/* Bouton « Voir » */
.ressource-media .ressource-documents #cf-app table.cf-table a.btn-download {
    color: #ed62a7 !important;
    background: #1b1620 !important;
    border: 1px solid #854466;
    border-radius: 6px;
    text-decoration: none;
}

/* 8. HOVER ET FOCUS — FOND SOMBRE PARTOUT */
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) {
    background: #211522 !important;
    border-color: #e6007e !important;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) > td,
.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) > td.sorting_1 {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #fff !important;
    box-shadow: none !important;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) > td :is(.flex, .cf-column-last, .cf-icon) {
    background: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) a.cf-icon {
    color: #fff !important;
}

.ressource-media .ressource-documents #cf-app table.cf-table tbody tr:is(:hover, :focus-within) a.btn-download,
.ressource-media .ressource-documents #cf-app table.cf-table a.btn-download:is(:hover, :focus) {
    color: #ed62a7 !important;
    background: #211522 !important;
    border-color: #e6007e !important;
}

.ressource-media .ressource-documents #cf-app table.cf-table a:focus-visible {
    outline: 2px solid #ed62a7;
    outline-offset: 3px;
}

/* 9. RESPONSIVE */
@media (max-width: 781px) {
    .ressource-media {
        padding: 25px 16px 50px;
    }

    .ressource-media .ressource-hero {
        padding: 25px;
        margin-bottom: 35px;
    }

    .ressource-media .ressource-hero h1 {
        font-size: clamp(36px, 8vw, 52px);
    }

    .ressource-media .ressource-hero img {
        max-height: 200px;
    }

    .ressource-media .ressource-resources h2 {
        font-size: 26px;
    }

    .ressource-media .ressource-resources .wp-block-columns {
        gap: 35px;
    }

    .ressource-media .ressource-video-card {
        padding: 18px;
    }

    .ressource-media .ressource-video-card video {
        max-width: 220px;
    }
}

@media (max-width: 600px) {
    .ressource-media .ressource-documents #cf-app table.cf-table tbody tr {
        gap: 4px;
    }

    .ressource-media .ressource-documents #cf-app table.cf-table tbody tr > td {
        padding: 12px 8px;
    }

    .ressource-media .ressource-documents #cf-app table.cf-table a.btn-download {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .ressource-media {
        padding: 20px 12px 40px;
    }

    .ressource-media .ressource-hero {
        padding: 20px;
    }

    .ressource-media .ressource-hero h1 {
        font-size: 36px;
    }

    .ressource-media .ressource-video-card video {
        max-width: 200px;
    }
}
