/* Styles extraits de page-ressources.php — servis en fichier cacheable (voir colibris_enqueue_template_css). */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

/* ═══════════════════════════════════════════════════════
   GLOBALS
════════════════════════════════════════════════════════ */
.lib-page {
    background: #FAFAF8;
}

.lib-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.lib-section {
    padding: 72px 0;
}

.lib-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.lib-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: #1F2A44;
    margin: 0;
}

.lib-section-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #009c8e;
    text-decoration: none;
    white-space: nowrap;
    transition: gap 0.2s;
}

.lib-section-link:hover { gap: 8px; }

.lib-all-count {
    font-size: 0.85rem;
    color: #9ca3af;
    font-weight: 400;
}

/* ═══════════════════════════════════════════════════════
   HERO
════════════════════════════════════════════════════════ */
.lib-hero {
    background: #fff;
    padding: 80px 0 60px;
    border-bottom: 1px solid #f0ede8;
}

.lib-hero__inner {
    max-width: 680px;
    margin: 0 auto;
    text-align: center;
}

.lib-hero__title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: #1F2A44;
    margin: 0 0 16px;
    line-height: 1.2;
}

.lib-hero__sub {
    font-size: 1.05rem;
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 36px;
}

.lib-hero__search-wrap {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.lib-hero__search-wrap svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.lib-hero__search-input {
    width: 100%;
    padding: 16px 20px 16px 50px !important;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    font-size: 1rem;
    color: #1F2A44;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box !important;
}

.lib-hero__search-input::placeholder { color: #9ca3af; }

.lib-hero__search-input:focus {
    outline: none;
    border-color: #009c8e;
    box-shadow: 0 0 0 4px rgba(0,156,142,0.08), 0 2px 12px rgba(0,0,0,0.06);
}

/* ═══════════════════════════════════════════════════════
   QUICK FILTERS BAR
════════════════════════════════════════════════════════ */
.lib-quick-bar {
    background: #fff;
    border-bottom: 1px solid #f0ede8;
    position: sticky;
    top: 0;
    z-index: 90;
}

.lib-quick-bar__inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    overflow: visible; /* ne pas clipper les panels des dropdowns */
}

/* Les pills seules défilent horizontalement */
.lib-age-pills {
    display: flex;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px; /* évite de clipper le focus ring */
}
.lib-age-pills::-webkit-scrollbar { display: none; }

.lib-age-pill {
    padding: 6px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.lib-age-pill:hover {
    border-color: #009c8e;
    color: #009c8e;
}

.lib-age-pill.is-active {
    background: #1F2A44;
    border-color: #1F2A44;
    color: #fff;
}

/* Separator */
.lib-quick-dropdowns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    padding-left: 12px;
    border-left: 1px solid #e5e7eb;
    overflow: visible;
}

/* Quick dropdowns */
.lib-quick-dd {
    position: relative;
    overflow: visible;
}

.lib-quick-dd__btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.lib-quick-dd__btn:hover { border-color: #009c8e; color: #009c8e; }
.lib-quick-dd.is-open .lib-quick-dd__btn,
.lib-quick-dd__btn.is-active {
    border-color: #009c8e;
    color: #009c8e;
}

.lib-quick-dd__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 999; /* élevé dans le contexte de la sticky bar (z-index 90) */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
}

.lib-quick-dd.is-open .lib-quick-dd__panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.18s, transform 0.18s, visibility 0s;
}

.lib-quick-dd__opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.12s;
}

.lib-quick-dd__opt:hover { background: #f3f4f6; }
.lib-quick-dd__opt.is-selected { background: #009c8e; color: #fff; }

/* ═══════════════════════════════════════════════════════
   À LA UNE
════════════════════════════════════════════════════════ */
.lib-featured-section { background: #fff; }

.lib-featured-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 16px;
    min-height: 440px;
}

/* Main card */
.lib-feat-main {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    text-decoration: none;
    min-height: 440px;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.lib-feat-main:hover { transform: translateY(-4px); }

.lib-feat-main__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 20%, rgba(10,12,28,0.88) 100%);
}

.lib-feat-main--fallback .lib-feat-main__overlay {
    background: linear-gradient(180deg, transparent 50%, rgba(10,12,28,0.5) 100%);
}

.lib-feat-main__body {
    position: relative;
    z-index: 1;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lib-feat-main__title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.35;
}

.lib-feat-main--fallback .lib-feat-main__title { color: #1F2A44; }

.lib-feat-main__desc {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.78);
    margin: 0;
    line-height: 1.6;
}

.lib-feat-main--fallback .lib-feat-main__desc { color: #64748b; }

.lib-feat-main__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    margin-top: 4px;
}

.lib-feat-main--fallback .lib-feat-main__cta { color: #009c8e; }

/* Side cards */
.lib-feat-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mini card,  même style que la principale, format compact */
.lib-feat-mini {
    position: relative;
    flex: 1;
    border-radius: 16px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    text-decoration: none;
    transition: transform 300ms cubic-bezier(0.4,0,0.2,1);
    min-height: 120px;
}

.lib-feat-mini:hover { transform: translateY(-3px); }

.lib-feat-mini__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 20%, rgba(10,12,28,0.85) 100%);
}

.lib-feat-mini--fallback .lib-feat-mini__overlay {
    background: linear-gradient(180deg, transparent 50%, rgba(10,12,28,0.4) 100%);
}

.lib-feat-mini__body {
    position: relative;
    z-index: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.lib-feat-mini__title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-feat-mini--fallback .lib-feat-mini__title { color: #1F2A44; }

.lib-feat-mini__cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}

.lib-feat-mini--fallback .lib-feat-mini__cta { color: #009c8e; }

.lib-feat-side-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: #FAFAF8;
    border: 1px solid #f0ede8;
    border-radius: 14px;
    text-decoration: none;
    flex: 1;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.lib-feat-side-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
}

.lib-feat-side-card__img {
    width: 80px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e5e7eb;
}

.lib-feat-side-card__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lib-feat-side-card__img-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
}

.lib-feat-side-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lib-feat-side-card__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1F2A44;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lib-feat-side-card__arrow {
    color: #9ca3af;
    flex-shrink: 0;
    transition: transform 0.2s, color 0.2s;
}

.lib-feat-side-card:hover .lib-feat-side-card__arrow {
    color: #009c8e;
    transform: translateX(3px);
}

/* Badges */
.lib-feat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: flex-start;
}

.lib-feat-badge--sm {
    font-size: 10px;
    padding: 3px 8px;
}

/* ═══════════════════════════════════════════════════════
   EXPLORER PAR THÈME
════════════════════════════════════════════════════════ */
.lib-topics-section { background: #F5F3EE; }

.lib-topics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.lib-topic-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 20px;
    background: #fff;
    border: 1px solid #ede9e2;
    border-radius: 14px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
}

.lib-topic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: #009c8e;
}

.lib-topic-card__name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1F2A44;
    line-height: 1.3;
}

.lib-topic-card__count {
    font-size: 0.75rem;
    color: #9ca3af;
    font-weight: 400;
}

.lib-topic-card__arrow {
    position: absolute;
    bottom: 16px;
    right: 16px;
    color: #d1d5db;
    transition: color 0.2s, transform 0.2s;
}

.lib-topic-card:hover .lib-topic-card__arrow {
    color: #009c8e;
    transform: translateX(3px);
}

/* ═══════════════════════════════════════════════════════
   RESSOURCES RÉCENTES
════════════════════════════════════════════════════════ */
.lib-recent-section { background: #FAFAF8; }

.lib-recent-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 16px !important;
    margin-bottom: 0 !important;
}

/* ═══════════════════════════════════════════════════════
   EXPLORER PAR ÂGE
════════════════════════════════════════════════════════ */
.lib-ages-section { background: #fff; }

.lib-ages-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.lib-age-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 20px 16px 20px;
    background: var(--age-bg, #E6F4F1);
    border: 1px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: left;
    position: relative;
}

.lib-age-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.lib-age-card__range {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--age-color, #009c8e);
    line-height: 1.1;
}

.lib-age-card__label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--age-color, #009c8e);
    opacity: 0.75;
}

.lib-age-card__arrow {
    position: absolute;
    bottom: 14px;
    right: 14px;
    color: var(--age-color, #009c8e);
    opacity: 0.4;
    transition: opacity 0.2s, transform 0.2s;
}

.lib-age-card:hover .lib-age-card__arrow {
    opacity: 0.9;
    transform: translateX(3px);
}

/* ═══════════════════════════════════════════════════════
   TOUTES LES RESSOURCES
════════════════════════════════════════════════════════ */
.lib-all-section { background: #F5F3EE; }

/* ── Filter toolbar ─────────────────────────────────── */
.filter-toolbar {
    margin-bottom: 28px;
    position: sticky;
    top: 57px;
    z-index: 50;
}

.filter-toolbar__row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.filter-toolbar__search {
    position: relative;
    flex: 1;
    min-width: 0;
}

.filter-toolbar__search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.filter-toolbar__search-input {
    width: 100%;
    padding: 9px 12px 9px 36px !important;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1f2937;
    background: #f9fafb;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box !important;
}

.filter-toolbar__search-input::placeholder { color: #9ca3af; }

.filter-toolbar__search-input:focus {
    outline: none;
    background: #fff;
    border-color: #009c8e;
    box-shadow: 0 0 0 3px rgba(0,156,142,0.08);
}

.filter-toolbar__dropdowns { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Dropdown ── */
.filter-dropdown { position: relative; }

.filter-dropdown__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    user-select: none;
}

.filter-dropdown__btn:hover { border-color: #009c8e; color: #009c8e; background: #fff; }
.filter-dropdown__btn.is-active { border-color: #009c8e; background: #009c8e; color: #fff; }
.filter-dropdown__btn.is-active .filter-dropdown__chevron { stroke: #fff; }
.filter-dropdown__chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.filter-dropdown.is-open .filter-dropdown__chevron { transform: rotate(180deg); }
.filter-dropdown.is-open .filter-dropdown__btn { border-color: #009c8e; background: #fff; color: #009c8e; }

.filter-dropdown__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 200;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.filter-dropdown.is-open .filter-dropdown__panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.filter-dropdown__option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.filter-dropdown__option:hover { background: #f3f4f6; }

.filter-dropdown__option::before {
    content: '';
    flex-shrink: 0;
    width: 15px;
    height: 15px;
    border: 1.5px solid #d1d5db;
    border-radius: 3px;
    background: #fff;
    transition: all 0.15s;
}

.filter-dropdown__option.is-selected::before {
    background: #009c8e;
    border-color: #009c8e;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 4l3 3 5-6' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px 8px;
}

.filter-dropdown__option[data-value="all"]::before { display: none; }
.filter-dropdown__option[data-value="all"] { font-size: 0.8rem; color: #6b7280; padding: 6px 12px 8px; border-bottom: 1px solid #f3f4f6; margin-bottom: 4px; }
.filter-dropdown__option[data-value="all"]:hover { color: #009c8e; background: transparent; }
.filter-dropdown__option[data-value="all"].is-selected { color: #009c8e; background: transparent; font-weight: 600; }

/* ── More filters button ── */
.filter-more-wrap {
    position: relative; /* containing block pour le panel */
    flex-shrink: 0;
}

.filter-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.filter-more-btn:hover { border-color: #009c8e; color: #009c8e; }
.filter-more-btn.is-active { border-color: #009c8e; background: #009c8e; color: #fff; }

.filter-more-btn__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #fff;
    color: #009c8e;
    border-radius: 9px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}

.filter-more-btn.is-active .filter-more-btn__badge { background: rgba(255,255,255,0.25); color: #fff; }

/* ── Floating panel ── */
.filter-panel {
    display: none; /* togglé par JS,  pas de transition CSS à risque */
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 460px;
    max-width: calc(100vw - 32px);
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    padding: 18px 20px 20px;
    z-index: 9999;
    animation: panelFadeIn 0.18s ease both;
}

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

.filter-panel__section { padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.filter-panel__section:first-child { padding-top: 4px; }
.filter-panel__section:last-child  { border-bottom: none; padding-bottom: 4px; }

.filter-panel__label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
    margin-bottom: 10px;
}

.filter-panel__pills { display: flex; flex-wrap: wrap; gap: 6px; }

.filter-panel__pill {
    padding: 5px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    font-size: 0.825rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}

.filter-panel__pill:hover { border-color: #009c8e; color: #009c8e; }
.filter-panel__pill.is-selected { background: #009c8e; border-color: #009c8e; color: #fff; }
.filter-panel__pill[data-value="all"] { color: #6b7280; border-color: transparent; background: #f9fafb; font-size: 0.775rem; }
.filter-panel__pill[data-value="all"]:hover { color: #374151; border-color: transparent; background: #f3f4f6; }
.filter-panel__pill[data-value="all"].is-selected { background: #f3f4f6; border-color: transparent; color: #374151; font-weight: 600; }

/* ── Active chips ── */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 8px 2px 0;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px 3px 10px;
    border-radius: 20px;
    font-size: 0.775rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    line-height: 1.4;
    background: color-mix(in srgb, var(--c, #009c8e) 10%, #fff);
    color: var(--c, #009c8e);
    border: 1px solid color-mix(in srgb, var(--c, #009c8e) 22%, transparent);
}

.filter-chip:hover { opacity: 0.75; }
.filter-chip__x { font-size: 0.9rem; line-height: 1; opacity: 0.6; }

.filter-chips__clear {
    font-size: 0.75rem;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 3px 4px;
    transition: color 0.15s;
}
.filter-chips__clear:hover { color: #6b7280; }

/* ── Mobile bottom sheet ── */
.filter-sheet { position: fixed; inset: 0; z-index: 1000; display: none; }
.filter-sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); animation: backdropIn 0.2s ease; }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
.filter-sheet__panel { position: absolute; bottom: 0; left: 0; right: 0; background: #fff; border-radius: 16px 16px 0 0; max-height: 85vh; display: flex; flex-direction: column; animation: sheetIn 0.22s ease; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.filter-sheet__header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f3f4f6; flex-shrink: 0; }
.filter-sheet__title { font-size: 1rem; font-weight: 600; color: #1f2937; }
.filter-sheet__close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background: #f3f4f6; border: none; border-radius: 50%; cursor: pointer; color: #374151; transition: background 0.15s; }
.filter-sheet__close:hover { background: #e5e7eb; }
.filter-sheet__body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.filter-sheet__group-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; margin-bottom: 10px; }
.filter-sheet__pills { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-sheet__pill { padding: 7px 14px; border: 1.5px solid #e5e7eb; border-radius: 20px; font-size: 0.875rem; font-weight: 500; color: #374151; background: #fff; cursor: pointer; transition: all 0.15s; }
.filter-sheet__pill:hover { border-color: #009c8e; color: #009c8e; }
.filter-sheet__pill.is-selected { background: #009c8e; border-color: #009c8e; color: #fff; }

/* ── Resources grid ── */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

/* ── Immersion mode ── */
.resources-grid.is-immersive { gap: 16px; }
.resources-grid.is-immersive .resource-card { overflow: hidden; }
.resources-grid.is-immersive .rc-media { aspect-ratio: 16 / 10; }
.resources-grid.is-immersive .rc-media__overlay { background: linear-gradient(180deg, transparent 15%, rgba(10,12,28,0.4) 50%, rgba(10,12,28,0.90) 100%); }
.resources-grid.is-immersive .rc-body { position: absolute; bottom: 0; left: 0; right: 0; padding: 20px; background: transparent; gap: 10px; }
.resources-grid.is-immersive .rc-title { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.25); -webkit-line-clamp: 3; min-height: unset; }
.resources-grid.is-immersive .rc-meta__item { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.85); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.resources-grid.is-immersive .rc-cta { background: rgba(255,255,255,0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 1px 4px rgba(0,0,0,0.2); color: #fff; }
.resources-grid.is-immersive .resource-card:hover .rc-cta { background: rgba(255,255,255,0.28); transform: translateX(4px) scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

.resources-empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: #9ca3af; }
.resources-empty svg { margin-bottom: 16px; }
.resources-empty__text { font-size: 1.1rem; color: #6b7280; }

.resource-card.is-hidden           { display: none; }
.resource-card.is-initially-hidden { display: none; }

/* ── CTA ── */
.resources-cta { text-align: center; padding: 40px; background: linear-gradient(135deg, #f9f9f9 0%, #f0f0f0 100%); border-radius: 12px; margin: 0 0 80px; }
.resources-cta__text { font-size: 1.1rem; color: #374151; margin: 0 0 20px; }
.resources-cta__button { display: inline-block; padding: 14px 32px; background: linear-gradient(135deg, #009c8e 0%, #00857a 100%); color: #fff; border-radius: 8px; font-size: 1rem; font-weight: 600; text-decoration: none; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.resources-cta__button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,156,142,0.3); }

/* ── Load More ── */
.resources-load-more { text-align: center; margin: 0 0 48px; }
#resources-load-more-btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 32px; background: #fff; border: 2px solid #e5e7eb; border-radius: 40px; font-size: 1rem; font-weight: 600; color: #374151; cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
#resources-load-more-btn:hover { border-color: #009c8e; color: #009c8e; box-shadow: 0 4px 12px rgba(0,156,142,0.15); }
#resources-load-more-count { font-size: 0.85rem; font-weight: 400; color: #9ca3af; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .lib-ages-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .lib-featured-grid { grid-template-columns: 1fr 1fr; }
    .lib-topics-grid { grid-template-columns: repeat(3, 1fr); }
    .lib-recent-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .resources-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (max-width: 768px) {
    .lib-section { padding: 48px 0; }
    .lib-hero { padding: 48px 0 40px; }
    .lib-hero__title { font-size: 2rem; }
    .lib-section-title { font-size: 1.4rem; }
    .lib-featured-grid { grid-template-columns: 1fr; }
    .lib-feat-main { min-height: 320px; }
    .lib-topics-grid { grid-template-columns: repeat(2, 1fr); }
    .lib-ages-grid { grid-template-columns: repeat(2, 1fr); }
    .lib-quick-dropdowns { margin-left: 0; padding-left: 0; border-left: none; }
    .filter-toolbar__row { flex-wrap: wrap; }
    .filter-toolbar__search { flex: 1 1 100%; }
    .filter-toolbar__dropdowns { flex: 1; }
    .filter-more-btn { flex: 1; justify-content: center; }
}

@media (max-width: 600px) {
    .lib-topics-grid { grid-template-columns: 1fr 1fr; }
    .lib-ages-grid { grid-template-columns: repeat(2, 1fr); }
    .lib-recent-grid { grid-template-columns: 1fr !important; }
    .resources-grid { grid-template-columns: 1fr; }
    .lib-hero__search-input { font-size: 0.95rem; }
}

/* ═══════════════════════════════════════════════════════
   DYNAMIC TOPIC SECTIONS
════════════════════════════════════════════════════════ */
.lib-topic-section {
    border-bottom: 1px solid #f0ede8;
}

.lib-topic-section:nth-of-type(odd)  { background: #fff; }
.lib-topic-section:nth-of-type(even) { background: #FAFAF8; }

.lib-topic-section__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.lib-topic-section__meta {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    flex: 1;
    min-width: 0;
}

.lib-topic-section__icon {
    font-size: 2.6rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 4px;
    display: flex;
    align-items: center;
}

.lib-topic-section__icon svg {
    width: 2.4rem;
    height: 2.4rem;
}

.lib-topic-section__text {
    flex: 1;
    min-width: 0;
}

.lib-topic-section__title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.65rem;
    font-weight: 600;
    color: #1F2A44;
    margin: 0 0 10px;
    line-height: 1.3;
}

.lib-topic-section__desc {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
    max-width: 620px;
}

.lib-topic-section__view-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 22px;
    background: transparent;
    border: 1.5px solid #e5e7eb;
    border-radius: 40px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    font-family: 'Montserrat', sans-serif;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.lib-topic-section__view-all:hover {
    border-color: #009c8e;
    color: #009c8e;
    background: rgba(0,156,142,0.04);
    box-shadow: 0 2px 10px rgba(0,156,142,0.12);
}

.lib-topic-section__count {
    font-size: 0.78rem;
    font-weight: 400;
    color: #9ca3af;
}

.lib-topic-section__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1024px) {
    .lib-topic-section__grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .lib-topic-section__title { font-size: 1.4rem; }
}

@media (max-width: 600px) {
    .lib-topic-section__grid { grid-template-columns: 1fr; }
    .lib-topic-section__meta { gap: 12px; }
    .lib-topic-section__icon { font-size: 2rem; }
    .lib-topic-section__title { font-size: 1.25rem; }
    .lib-topic-section__view-all { width: 100%; justify-content: center; }
}
