.catalogue-page {
    padding: 0 0 3.8rem;
    background: #fff;
}

/* =========================================================
   RECHERCHE
   ========================================================= */
.catalogue-keyword__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: center;
    max-width: 640px;
    margin-top: 1.5rem;
    padding: .35rem;
    border: 1px solid #dbe4ee;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(9, 31, 82, .08);
}

.catalogue-keyword__input-wrap {
    position: relative;
    display: block;
}

.catalogue-keyword__input-wrap > svg {
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--bbb-navy-800);
    stroke-width: 1.9;
    stroke-linecap: round;
    pointer-events: none;
}

.catalogue-keyword__form input[type="search"] {
    width: 100%;
    min-height: 46px;
    padding: .6rem .9rem .6rem 2.85rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--bbb-text);
    font-size: .95rem;
}

.catalogue-keyword__form input[type="search"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 161, 141, .14);
}

.catalogue-keyword__form .bbb-button {
    min-height: 46px;
    padding-inline: 1.35rem;
    border-radius: 999px;
    white-space: nowrap;
}

/* =========================================================
   PAGE DE LISTE - titre, recherche, ligne « Affiner »
   ========================================================= */
.catalogue-listing {
    padding: 1.4rem 0 1.1rem;
}

.catalogue-listing .resource-breadcrumb {
    margin-bottom: .7rem;
}

.catalogue-listing__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    gap: 1.5rem;
    align-items: center;
}

.catalogue-listing h1 {
    margin: 0;
    color: var(--bbb-navy-900);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 400;
    line-height: 1.15;
}

.catalogue-listing__intro {
    max-width: 680px;
    margin: .45rem 0 0;
    color: #4f5d75;
    font-size: .92rem;
    line-height: 1.45;
}

.catalogue-listing .catalogue-keyword__form {
    margin-top: 0;
    box-shadow: 0 6px 18px rgba(9, 31, 82, .07);
}

.catalogue-refine {
    display: grid;
    gap: .6rem;
    padding: .9rem 1rem;
    border: 1px solid #e1e8f0;
    border-radius: 16px;
    background: #f7f9fc;
}

/* Étiquette en retrait à gauche : les pastilles qui passent à la ligne restent alignées. */
.catalogue-refine__row {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
    padding-left: 4.6rem;
}

.catalogue-refine__label {
    position: absolute;
    top: .45rem;
    left: 0;
    color: var(--bbb-navy-900);
    font-size: .8rem;
    font-weight: 600;
}

.catalogue-refine__pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 32px;
    padding: .25rem .7rem;
    border: 1px solid var(--line, #dbe3ed);
    border-radius: 999px;
    background: #fff;
    color: var(--ink, var(--bbb-navy-900));
    font-size: .82rem;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease;
}

.catalogue-refine__pill span {
    color: #6b778c;
    font-size: .74rem;
}

.catalogue-refine__pill:hover,
.catalogue-refine__pill:focus-visible {
    outline: none;
    border-color: var(--ink, var(--bbb-navy-800));
    background: var(--soft, #eef3f9);
}

.catalogue-refine__pill.is-active {
    border-color: var(--ink, var(--bbb-navy-900));
    background: var(--ink, var(--bbb-navy-900));
    color: #fff;
}

.catalogue-refine__pill.is-active span {
    color: rgba(255, 255, 255, .82);
}

/* Couleurs des pastilles « Affiner » : une par niveau, une par famille de matières. */
.catalogue-choice--ps { --soft: #e6efff; --line: #cfdcf6; --ink: #24508f; }
.catalogue-choice--ms { --soft: #e3f5ec; --line: #c8e8d7; --ink: #1d6b4c; }
.catalogue-choice--gs { --soft: #fff0d9; --line: #f6dcb1; --ink: #9a5a08; }
.catalogue-choice--cp { --soft: #efeafe; --line: #dbd1f7; --ink: #4d3a99; }
.catalogue-choice--ce1 { --soft: #e0f4f2; --line: #c2e6e1; --ink: #0b6b60; }
.catalogue-choice--ce2 { --soft: #fde9f0; --line: #f5cddc; --ink: #96325c; }
.catalogue-choice--cm1 { --soft: #f1f6dc; --line: #dde8b4; --ink: #566f0f; }
.catalogue-choice--cm2 { --soft: #e2f1f8; --line: #c4e0ee; --ink: #1d587e; }

.catalogue-choice--default { --ink: #2c5aa0; --soft: #eef4ff; --line: #c9d8f0; }
.catalogue-choice--french { --ink: #2f6fd0; --soft: #eef4ff; --line: #c3d6f5; }
.catalogue-choice--math { --ink: #df7b12; --soft: #fff4e5; --line: #f5d2a6; }
.catalogue-choice--science { --ink: #0f8f79; --soft: #ecf8f5; --line: #b9e2d9; }
.catalogue-choice--world { --ink: #6a4fb8; --soft: #f3f0fc; --line: #d6ccf1; }
.catalogue-choice--language { --ink: #1f86a8; --soft: #ebf6fa; --line: #bcdfeb; }
.catalogue-choice--arts { --ink: #6c9a1d; --soft: #f3f8e6; --line: #d3e4ad; }
.catalogue-choice--sport { --ink: #e0503a; --soft: #fdeeea; --line: #f4c6bd; }
.catalogue-choice--civics { --ink: #c98a06; --soft: #fff7e2; --line: #efd99c; }

@media (max-width: 820px) {
    .catalogue-listing__row {
        grid-template-columns: 1fr;
    }

    .catalogue-refine__row {
        padding-left: 0;
    }

    .catalogue-refine__label {
        position: static;
        flex-basis: 100%;
    }
}

@media (max-width: 560px) {
    .catalogue-keyword__form {
        grid-template-columns: 1fr;
        border-radius: 18px;
    }

    .catalogue-keyword__form .bbb-button {
        width: 100%;
    }
}

.catalogue-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: .42rem;
    align-items: center;
    margin-top: 1.4rem;
    padding: .85rem 0 .1rem;
}

.catalogue-active-filters > span {
    margin-right: .15rem;
    color: #778399;
    font-size: .69rem;
    font-weight: 780;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.catalogue-active-filters a {
    padding: .37rem .62rem;
    border: 1px solid #cfe6e1;
    border-radius: 999px;
    background: #f1faf8;
    color: var(--bbb-teal-700);
    font-size: .69rem;
    font-weight: 770;
    text-decoration: none;
}

.catalogue-active-filters a:hover {
    border-color: #a9d5cc;
    background: #e8f6f3;
}

.catalogue-active-filters .catalogue-active-filters__reset {
    margin-left: auto;
    border-color: transparent;
    background: transparent;
    color: #7d899b;
}

/* =========================================================
   RESULTATS - liste de travail habillee, sans cartes
   ========================================================= */
.catalogue-results {
    margin-top: 2rem;
}

.catalogue-results__head {
    display: flex;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    align-items: center;
    margin-bottom: .75rem;
    padding-bottom: .72rem;
    border-bottom: 1px solid #dfe6ef;
}

.catalogue-result-bar h2 {
    margin: 0;
    color: var(--bbb-navy-900);
    font-size: 1.18rem;
}

.catalogue-sort {
    display: inline-flex;
    gap: .2rem;
    align-items: center;
    flex-wrap: wrap;
    padding: .25rem;
    border-radius: 999px;
    background: #f2f5f9;
    color: #748095;
    font-size: .71rem;
}

.catalogue-sort > span {
    margin: 0 .3rem 0 .35rem;
    font-weight: 730;
}

.catalogue-sort a {
    padding: .42rem .65rem;
    border-radius: 999px;
    color: #53617a;
    font-weight: 780;
    text-decoration: none;
}

.catalogue-sort a:hover {
    background: #fff;
    color: var(--bbb-teal-700);
}

.catalogue-sort a.is-active {
    background: #fff;
    color: var(--bbb-teal-700);
    box-shadow: 0 2px 7px rgba(9, 31, 82, .08);
}

.resource-table-wrap {
    overflow: visible;
}

.resource-table {
    display: block;
    width: 100%;
    border-collapse: collapse;
}

.resource-table__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(95px, .18fr) minmax(165px, .32fr) minmax(60px, .1fr) minmax(75px, .12fr) 34px;
    gap: .95rem;
    margin: 0 0 .2rem;
    padding: .42rem .8rem;
    color: #8390a3;
    font-size: .64rem;
    font-weight: 830;
    letter-spacing: .055em;
    text-transform: uppercase;
}

.resource-table__head tr {
    display: contents;
}

.resource-table__head th {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
}

.resource-table__head th:last-child {
    text-align: right;
}

.resource-table__metric-head {
    text-align: center !important;
}

.resource-table tbody {
    display: block;
}

.resource-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(95px, .18fr) minmax(165px, .32fr) minmax(60px, .1fr) minmax(75px, .12fr) 34px;
    gap: .95rem;
    align-items: center;
    width: 100%;
    min-height: 76px;
    margin: 0;
    padding: .82rem .8rem .82rem 1rem;
    border-top: 1px solid #e8edf3;
    cursor: pointer;
    background: transparent;
    transition: background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.resource-row:last-child {
    border-bottom: 1px solid #e8edf3;
}

.resource-row::before {
    content: "";
    position: absolute;
    top: 17px;
    bottom: 17px;
    left: 0;
    width: 3px;
    border-radius: 999px;
    background: transparent;
    transition: background 150ms ease, height 150ms ease;
}

.resource-row:hover,
.resource-row:focus {
    outline: none;
    z-index: 1;
    background: linear-gradient(90deg, #f3faf8, #fbfdfd 62%, #f8fbff);
    box-shadow: 0 7px 18px rgba(9, 31, 82, .045);
}

.resource-row:hover::before,
.resource-row:focus::before {
    background: var(--bbb-teal-500);
}

.resource-row--to-enrich {
    background: linear-gradient(90deg, #fff8ea, #fffdf8 62%, #fff);
}

.resource-row--to-enrich::before,
.resource-row--to-enrich:hover::before,
.resource-row--to-enrich:focus::before {
    background: var(--bbb-orange-500, #f8b84a);
}

.resource-row--to-enrich:hover,
.resource-row--to-enrich:focus {
    background: linear-gradient(90deg, #fff3dc, #fffaf0 62%, #fdfcf8);
}

.resource-row:focus-visible {
    box-shadow: 0 0 0 2px rgba(22, 161, 141, .16), 0 7px 18px rgba(9, 31, 82, .045);
}

.resource-row td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    color: var(--bbb-text);
    font-size: .8rem;
    line-height: 1.4;
}

.resource-row__resource {
    padding-right: .4rem !important;
}

.resource-row__title {
    display: inline;
    color: var(--bbb-navy-900);
    font-size: .98rem;
    font-weight: 820;
    line-height: 1.25;
    text-decoration: none;
    background-image: linear-gradient(var(--bbb-teal-500), var(--bbb-teal-500));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0 2px;
    transition: color 150ms ease, background-size 150ms ease;
}

.resource-row:hover .resource-row__title,
.resource-row:focus .resource-row__title {
    color: var(--bbb-teal-700);
    background-size: 100% 2px;
}

.resource-row__summary {
    display: block;
    overflow: hidden;
    margin-top: .28rem;
    color: #6f7c91;
    font-size: .74rem;
    line-height: 1.34;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resource-row__editorial-classification {
    display: flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    min-height: 21px;
    margin-top: .32rem;
    padding: .15rem .48rem;
    border: 1px solid #f2d49e;
    border-radius: 999px;
    background: #fff5df;
    color: #815615;
    font-size: .65rem;
    font-weight: 700;
    line-height: 1.15;
}

.resource-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
}

.resource-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .2rem .52rem;
    border-radius: 999px;
    font-size: .67rem;
    font-weight: 800;
    line-height: 1.1;
}

.resource-pill--level {
    border: 1px solid #d7e2f2;
    background: #f2f6fc;
    color: var(--bbb-navy-800);
}

.resource-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: .28rem;
}

.resource-subject {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: .2rem .52rem;
    border: 1px solid #d7ebe7;
    border-radius: 999px;
    background: #f3faf8;
    color: #2f5f59;
    font-size: .69rem;
    font-weight: 720;
}

.resource-subject::before {
    content: none;
}

.resource-meta-label {
    display: none;
}

.resource-row__muted {
    color: #909aab;
    font-size: .72rem;
    font-style: italic;
}

.resource-row__rating,
.resource-row__price {
    color: var(--bbb-navy-800) !important;
    font-size: .75rem !important;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.resource-row__open {
    text-align: right;
}

.resource-row__arrow {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid #dbe4ed;
    border-radius: 50%;
    background: #fff;
    color: var(--bbb-teal-700);
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 150ms ease, background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.resource-row:hover .resource-row__arrow,
.resource-row:focus .resource-row__arrow {
    border-color: var(--bbb-teal-600);
    background: var(--bbb-teal-600);
    color: #fff;
    transform: translateX(2px);
}

.catalogue-empty {
    padding: 1.4rem 1.2rem;
    border-radius: 14px;
    background: #f8fafc;
}

.catalogue-empty h3 {
    margin: 0 0 .35rem;
    color: var(--bbb-navy-900);
    font-size: 1rem;
}

.catalogue-empty p {
    margin: 0 0 .9rem;
    color: var(--bbb-muted);
    font-size: .82rem;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .7rem;
    margin-top: 1.55rem;
}

.pagination a {
    padding: .56rem .82rem;
    border: 1px solid #dbe3ed;
    border-radius: 999px;
    background: #fff;
    color: var(--bbb-navy-900);
    font-size: .77rem;
    font-weight: 760;
    text-decoration: none;
}

.pagination a:hover {
    border-color: var(--bbb-teal-500);
    background: #f3faf8;
    color: var(--bbb-teal-700);
}

.pagination span {
    color: var(--bbb-muted);
    font-size: .77rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 1080px) {
    .resource-table__head,
    .resource-row {
        grid-template-columns: minmax(0, 1fr) 95px minmax(145px, .32fr) 60px 75px 32px;
    }
}

@media (max-width: 760px) {
    .catalogue-results__head {
        align-items: flex-start;
        flex-direction: column;
    }

    .resource-table__head {
        display: none;
    }

    .resource-row {
        grid-template-columns: minmax(0, 1fr) 32px;
        gap: .55rem .7rem;
        min-height: 0;
        padding: .95rem .65rem .95rem .9rem;
    }

    .resource-row__resource {
        grid-column: 1;
    }

    .resource-row__levels,
    .resource-row__subjects,
    .resource-row__rating,
    .resource-row__price {
        grid-column: 1;
        display: flex !important;
        gap: .5rem;
        align-items: center;
    }

    .resource-row__open {
        grid-column: 2;
        grid-row: 1 / span 5;
        align-self: center;
    }

    .resource-row__rating,
    .resource-row__price {
        text-align: left;
    }

    .resource-meta-label {
        display: inline-block;
        flex: 0 0 50px;
        color: #8a95a6;
        font-size: .63rem;
        font-weight: 800;
        text-transform: uppercase;
    }
}

@media (max-width: 540px) {
    .catalogue-active-filters .catalogue-active-filters__reset {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
    }

    .catalogue-sort {
        border-radius: 12px;
    }

    .catalogue-sort > span {
        width: 100%;
        margin-bottom: .1rem;
    }
}
