/**
 * Catalogue panel and listing.
 *
 * Deliberately restrained: this runs inside a Divi-styled site, so it lays
 * things out and leaves colour, type and spacing tokens to the theme wherever
 * it can. Everything is scoped under .bd-cs-catalog / .bd-cs-catalog-panel so
 * a child theme can override any of it without specificity games.
 *
 * @package BdCatalogShortcodes
 */

/* ── Filter panel ───────────────────────────────────────────────────────── */

.bd-cs-catalog-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25em;
}

.bd-cs-catalog-filters {
    display: flex;
    flex-direction: column;
    gap: 1.25em;
}

.bd-cs-catalog-filters__heading {
    margin: 0;
    font-size: 1.1em;
}

.bd-cs-facet {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin: 0;
    padding: 0;
    border: 0;
}

.bd-cs-facet__title {
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.bd-cs-facet__input {
    width: 100%;
    box-sizing: border-box;
}

.bd-cs-facet__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.bd-cs-facet__item label {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    cursor: pointer;
}

/* Nesting depth for a hierarchical taxonomy — one step per level. */
.bd-cs-facet__item--depth-1 {
    padding-left: 1.25em;
}

.bd-cs-facet__item--depth-2 {
    padding-left: 2.5em;
}

.bd-cs-facet__item--depth-3 {
    padding-left: 3.75em;
}

.bd-cs-facet__more > summary {
    cursor: pointer;
    margin-top: 0.35em;
}

.bd-cs-catalog-filters__actions {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

/* ── Search box ─────────────────────────────────────────────────────────── */

.bd-cs-catalog-search {
    display: flex;
    gap: 0.5em;
    align-items: stretch;
}

.bd-cs-catalog-search__field {
    flex: 1 1 auto;
    min-width: 0;
}

/* ── Listing ────────────────────────────────────────────────────────────── */

.bd-cs-catalog__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75em;
    margin-bottom: 1.25em;
}

.bd-cs-catalog__count {
    margin: 0;
}

.bd-cs-catalog__controls {
    display: flex;
    align-items: center;
    gap: 1em;
}

.bd-cs-catalog__order {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75em;
    margin: 0;
    padding: 0;
}

.bd-cs-catalog__order-current {
    font-weight: 600;
}

.bd-cs-catalog__views {
    display: flex;
    gap: 0.25em;
}

.bd-cs-catalog__view {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2em;
    height: 2em;
    border: 1px solid currentColor;
    border-radius: 3px;
    text-decoration: none;
    opacity: 0.55;
}

.bd-cs-catalog__view.is-active {
    opacity: 1;
}

.bd-cs-catalog__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bd-cs-catalog--grid .bd-cs-catalog__items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
    gap: 2em;
}

.bd-cs-catalog--list .bd-cs-catalog__items {
    display: flex;
    flex-direction: column;
    gap: 1.25em;
}

/* ── Card ───────────────────────────────────────────────────────────────── */

.bd-cs-card {
    position: relative;
    display: flex;
    gap: 1em;
}

.bd-cs-card--grid {
    flex-direction: column;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    padding-top: 1em;
}

.bd-cs-card--list {
    flex-direction: row;
    align-items: flex-start;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    padding-bottom: 1.25em;
}

.bd-cs-card--list .bd-cs-card__thumb {
    flex: 0 0 7em;
}

.bd-cs-card__thumb img {
    display: block;
    max-width: 100%;
    height: auto;
}

.bd-cs-card__body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.bd-cs-card__title {
    margin: 0;
    font-size: 1em;
    line-height: 1.3;
}

.bd-cs-card__authors,
.bd-cs-card__year,
.bd-cs-card__categories {
    margin: 0;
}

.bd-cs-card__actions {
    align-self: flex-end;
}

.bd-cs-card--list .bd-cs-card__actions {
    align-self: center;
}

/* ── Pagination ─────────────────────────────────────────────────────────── */

.bd-cs-catalog__pagination {
    margin-top: 2em;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
}

.bd-cs-catalog__pagination .page-numbers {
    display: inline-block;
    padding: 0.35em 0.7em;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 3px;
    text-decoration: none;
}

.bd-cs-catalog__pagination .page-numbers.current {
    font-weight: 600;
}

.bd-cs-catalog__empty {
    margin: 2em 0;
}
