/* ============================================================
   Byte Sermons — scoped plugin stylesheet
   All selectors prefixed .byte-sermons-* to avoid theme bleed
   ============================================================ */

/* Content containers — width & padding
 * ------------------------------------
 * Our <main> uses is-layout-flow (full-width, matching block themes).
 * Each content container centres itself at the theme's wideSize so content
 * aligns with the rest of the site rather than being squeezed to contentSize.
 * Horizontal padding uses the theme's root padding variable so the plugin
 * matches the site's own spacing; clamp() fallback covers classic themes.
 */

/* ── CSS custom properties ────────────────────────────────────
 * Prefer WP theme-preset values so the plugin adapts to the active
 * theme. All vars have sensible fallbacks for classic themes.
 * ─────────────────────────────────────────────────────────── */
:root {
    /* Spacing — default is 0px; the Settings page (Sermons → Settings → Layout)
     * lets admins set a custom value which is injected via wp_add_inline_style(). */
    --bs-page-padding-x: 0px;

    /* Layout — use the theme's declared content / wide sizes (block themes set
     * these via theme.json; classic themes fall back to common values) */
    --bs-wide-size:    var(--wp--style--global--wide-size,    1200px);
    --bs-content-size: var(--wp--style--global--content-size,  720px);

    /* Color — pick up the theme's primary color for accents (pagination active
     * state, etc.).  Falls back to a neutral near-black that's readable on any
     * background. */
    --bs-color-primary: var(--wp--preset--color--primary, #1a1a1a);

    /* Placeholder background — neutral dark for thumbnails with no image.
     * Using a CSS var lets themes override it if needed. */
    --bs-color-placeholder: #222;
}

/* ── Classic-theme content wrapper ────────────────────────────
 * On classic themes, byte_sermons_content_open() emits this wrapper
 * directly inside <main class="site-main">. It provides centering and
 * horizontal padding so the plugin's content aligns with the rest of
 * the site even when the theme's own structural wrappers (site-container,
 * content-wrap, etc.) are absent because we replace the page template.
 *
 * On block themes this element is never rendered — is-layout-constrained
 * + alignwide on each archive container handles layout instead.
 * ─────────────────────────────────────────────────────────── */
.byte-sermons-content-inner {
    max-width: var(--bs-wide-size);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--bs-page-padding-x);
    padding-right: var(--bs-page-padding-x);
    box-sizing: border-box;
    width: 100%;
}

/* Archive / list containers — plugin-owned centering.
 * No dependency on WP block layout classes (is-layout-constrained, alignwide)
 * so theme CSS that targets those classes never interferes. */
.byte-sermons-archive,
.byte-sermons-preacher-archive,
.byte-sermons-topic-archive,
.byte-sermons-scripture-archive,
.byte-sermons-series-list,
.byte-sermons-topics-list,
.byte-sermons-preachers-list,
.byte-sermons-bible-refs-list,
.byte-sermons-single-series__body,
.byte-sermons-single {
    width: 100%;
    max-width: var(--bs-wide-size);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Series single outer wrapper spans full-width (hero is edge-to-edge by design) */
.byte-sermons-single-series {
    width: 100%;
}

/* Hero text content follows wideSize for alignment with grid below.
 * Always has padding since the outer wrapper is full-bleed. */
.byte-sermons-single-series__hero-inner {
    width: 100%;
    max-width: var(--bs-wide-size);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--bs-page-padding-x);
    padding-right: var(--bs-page-padding-x);
    box-sizing: border-box;
}

/* ── Responsive embed ─────────────────────────────────────── */
.byte-sermons-embed-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 6px;
    background: #000;
    margin-bottom: 1.5rem;
}
.byte-sermons-embed-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}

/* ── Sermon card grid ─────────────────────────────────────── */
.byte-sermons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.byte-sermons-card {
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    background: #fff;
    transition: transform .15s ease, box-shadow .15s ease;
    /* Stretched-link anchor: the title <a>::after covers the entire card */
    position: relative;
    cursor: pointer;
}
.byte-sermons-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}

/* Stretched link — title <a> expands to cover the whole card */
.byte-sermons-card__title a {
    position: static;
}
.byte-sermons-card__title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
}

.byte-sermons-card__thumb {
    display: block;
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: var(--bs-color-placeholder);
}
.byte-sermons-card__thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}
.byte-sermons-card:hover .byte-sermons-card__thumb img {
    transform: scale(1.04);
}
.byte-sermons-card__thumb--placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: var(--bs-color-placeholder);
    color: rgba(255,255,255,.3);
}
.byte-sermons-card__thumb--video iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: 0;
}
.byte-sermons-card__thumb--placeholder svg {
    width: 36px; height: 36px;
    fill: rgba(255,255,255,.25);
}
.byte-sermons-card__thumb--placeholder-text {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    font-weight: 600;
}

.byte-sermons-card__body {
    padding: .875rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
}
.byte-sermons-card__series-badge {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    opacity: .7;
    position: relative;
    z-index: 3; /* above stretched link overlay */
}
.byte-sermons-card__series-badge a {
    text-decoration: none;
    color: inherit;
}
.byte-sermons-card__title {
    font-size: 1rem;
    margin: 0;
    line-height: 1.35;
}
.byte-sermons-card__title a {
    text-decoration: none;
    color: inherit;
}
.byte-sermons-card__title a:hover { text-decoration: underline; }
.byte-sermons-card__meta {
    font-size: .8rem;
    opacity: .65;
    margin-top: .1rem;
}
.byte-sermons-card__excerpt {
    font-size: .82rem;
    line-height: 1.5;
    opacity: .7;
    margin: .4rem 0 0;
}

/* ── Series card grid ─────────────────────────────────────── */
.byte-sermons-series-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.byte-sermons-series-card {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}
.byte-sermons-series-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.byte-sermons-series-card__thumb {
    display: block;
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: var(--bs-color-placeholder);
}
.byte-sermons-series-card__thumb img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .2s ease;
}
.byte-sermons-series-card:hover .byte-sermons-series-card__thumb img {
    transform: scale(1.04);
}
.byte-sermons-series-card__thumb--placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bs-color-placeholder);
}
.byte-sermons-series-card__body {
    padding: .875rem 1rem 1rem;
    flex: 1;
}
.byte-sermons-series-card__name {
    font-size: 1rem;
    margin: 0 0 .4rem;
    line-height: 1.3;
}
.byte-sermons-series-card__name a {
    text-decoration: none;
    color: inherit;
}
.byte-sermons-series-card__name a:hover { text-decoration: underline; }
.byte-sermons-series-card__description {
    font-size: .85rem;
    opacity: .7;
    margin: 0 0 .5rem;
    line-height: 1.4;
}
.byte-sermons-series-card__count {
    font-size: .75rem;
    opacity: .55;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── All topics list (topics-list.php) ───────────────────── */
.byte-sermons-topics-list {
    width: 100%;
}
.byte-sermons-topics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.byte-sermons-topic-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    background: #fff;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, box-shadow .15s ease;
}
.byte-sermons-topic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.byte-sermons-topic-card__body {
    padding: 1.25rem 1.25rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.byte-sermons-topic-card__name {
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.3;
}
.byte-sermons-topic-card__name a {
    text-decoration: none;
    color: inherit;
}
/* Stretched link — entire card is clickable */
.byte-sermons-topic-card__name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
}
.byte-sermons-topic-card__name a:hover { text-decoration: underline; }
.byte-sermons-topic-card__description {
    font-size: .85rem;
    opacity: .7;
    margin: 0;
    line-height: 1.4;
}
.byte-sermons-topic-card__count {
    margin-top: auto;
    padding-top: .5rem;
    font-size: .75rem;
    opacity: .55;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── All preachers list (preachers-list.php) ─────────────── */
.byte-sermons-preachers-list {
    width: 100%;
}
.byte-sermons-preachers-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}
.byte-sermons-preacher-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    background: #fff;
    padding: 1.25rem;
    transition: transform .15s ease, box-shadow .15s ease;
    overflow: hidden;
}
.byte-sermons-preacher-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.byte-sermons-preacher-row__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.byte-sermons-preacher-row__name {
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.3;
}
.byte-sermons-preacher-row__name a {
    text-decoration: none;
    color: inherit;
}
/* Stretched link — entire row is clickable */
.byte-sermons-preacher-row__name a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
}
.byte-sermons-preacher-row__name a:hover { text-decoration: underline; }
.byte-sermons-preacher-row__description {
    font-size: .875rem;
    opacity: .7;
    margin: 0;
    line-height: 1.4;
}
.byte-sermons-preacher-row__count {
    font-size: .75rem;
    opacity: .55;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
/* Square photo — uniform size, flush right */
.byte-sermons-preacher-row__photo {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0,0,0,.08);
}
.byte-sermons-preacher-row__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ── Bible references archive (bible-references.php) ────────── */
.byte-sermons-bible-refs-list {
    width: 100%;
}
.byte-sermons-book-group {
    margin-bottom: 2rem;
}
.byte-sermons-book-group__title {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .6;
    margin: 0 0 .75rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid rgba(0,0,0,.1);
}
.byte-sermons-chapters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
}
.byte-sermons-chapter-card {
    position: relative;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    background: #fff;
    padding: .875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    transition: transform .15s ease, box-shadow .15s ease;
}
.byte-sermons-chapter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,.15);
}
.byte-sermons-chapter-card__title {
    font-size: .95rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}
.byte-sermons-chapter-card__title a {
    text-decoration: none;
    color: inherit;
}
/* Stretched link — entire card is clickable */
.byte-sermons-chapter-card__title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
}
.byte-sermons-chapter-card__title a:hover { text-decoration: underline; }
.byte-sermons-chapter-card__count {
    font-size: .7rem;
    opacity: .5;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ── Term hero banner (series page) ──────────────────────── */
.byte-sermons-term-hero {
    width: 100%;
    min-height: 320px;
    background-color: var(--bs-color-placeholder);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    align-items: flex-end;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 2rem;
}
.byte-sermons-term-hero__overlay {
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.2) 60%, transparent 100%);
    padding: 2rem 1.5rem 1.5rem;
}
.byte-sermons-term-hero__title {
    color: #fff;
    margin: 0 0 .4rem;
    font-size: clamp(1.4rem, 4vw, 2.5rem);
    text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
.byte-sermons-term-hero__description {
    color: rgba(255,255,255,.85);
    margin: 0;
    max-width: 52ch;
    line-height: 1.5;
    font-size: .95rem;
}

/* ── Preacher hero ────────────────────────────────────────── */
.byte-sermons-preacher-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0 2rem;
    border-bottom: 1px solid rgba(0,0,0,.1);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.byte-sermons-preacher-hero__photo img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.byte-sermons-preacher-hero__name {
    font-size: clamp(1.3rem, 3vw, 2rem);
    margin: 0 0 .4rem;
}
.byte-sermons-preacher-hero__bio {
    opacity: .7;
    margin: 0;
    max-width: 52ch;
    line-height: 1.5;
    font-size: .9rem;
}

/* ── Sermon meta row ──────────────────────────────────────── */
.byte-sermons-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.5rem;
    padding: .875rem 0;
    border-top: 1px solid rgba(0,0,0,.08);
    border-bottom: 1px solid rgba(0,0,0,.08);
    margin-bottom: 1.5rem;
}
.byte-sermons-meta__item {
    display: flex;
    align-items: baseline;
    gap: .3rem;
    font-size: .875rem;
}
.byte-sermons-meta__label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: .7rem;
    opacity: .55;
}
.byte-sermons-meta__value a {
    text-decoration: none;
    color: inherit;
}
.byte-sermons-meta__value a:hover { text-decoration: underline; }

/* ── Archive header ───────────────────────────────────────── */
.byte-sermons-archive__header {
    padding: 1.5rem 0 1rem;
}
.byte-sermons-archive__title {
    font-size: clamp(1.4rem, 3.5vw, 2.2rem);
    margin: 0 0 .25rem;
}
.byte-sermons-archive__description {
    opacity: .7;
    margin: 0 0 1rem;
    font-size: .95rem;
    max-width: 60ch;
    line-height: 1.5;
}

/* ── Filter bar ───────────────────────────────────────────── */
.byte-sermons-filter-bar {
    display: flex;
    flex-wrap: nowrap;   /* always one row on desktop */
    gap: .5rem;
    margin-bottom: 1.5rem;
    align-items: center;
}
.byte-sermons-filter__search {
    /* grow to fill spare space; shrink if needed; base 160px */
    flex: 1 1 160px;
    min-width: 100px;
    width: auto !important;  /* override themes that set width:100% on inputs */
    padding: .55rem .75rem;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 4px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
}
.byte-sermons-filter__select {
    flex: 0 1 auto;
    min-width: 0;
    width: auto !important;  /* override themes that set width:100% on selects */
    padding: .55rem .75rem;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 4px;
    font-size: .9rem;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
}
.byte-sermons-filter__clear {
    display: none; /* shown by JS when filters are active */
    flex-shrink: 0;
    white-space: nowrap;
    padding: .55rem .75rem;
    border: 1px solid rgba(0,0,0,.3);
    border-radius: 4px;
    font-size: .85rem;
    font-family: inherit;
    background: transparent;
    color: #333;
    cursor: pointer;
    opacity: .75;
    transition: opacity .15s;
}
.byte-sermons-filter__clear:hover { opacity: 1; }

/* ── Pagination ───────────────────────────────────────────── */
.byte-sermons-pagination {
    margin: 1.5rem 0;
}

/* nav-links wraps plain paginate_links() output (same as the_posts_pagination) */
.byte-sermons-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

.byte-sermons-pagination .page-numbers,
.bs-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .6rem;
    border: 1px solid rgba(0,0,0,.2);
    border-radius: 4px;
    text-decoration: none;
    font-size: .85rem;
    line-height: 1;
    color: #333;
    background: transparent;
    cursor: pointer;
    transition: background .12s;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    vertical-align: middle;
}
.byte-sermons-pagination .page-numbers.current,
.bs-page-btn[aria-current="page"],
.bs-page-btn.current {
    background: var(--bs-color-primary);
    color: #fff;
    border-color: var(--bs-color-primary);
}
.byte-sermons-pagination .page-numbers:hover:not(.current),
.bs-page-btn:hover:not([aria-current="page"]):not(.current) {
    background: rgba(0,0,0,.06);
}
.byte-sermons-pagination .page-numbers.dots,
.bs-page-btn.dots {
    border-color: transparent;
    background: transparent;
    cursor: default;
    pointer-events: none;
}

/* ── Loading & empty states ───────────────────────────────── */
.byte-sermons-empty {
    text-align: center;
    padding: 3rem 1rem;
    opacity: .5;
    font-size: .95rem;
}

/* Result area — holds grid-wrap and spinner as siblings */
#bs-result-area {
    position: relative;
    min-height: 200px;
}

/* Grid content fades to invisible while loading — spinner sits on top as a sibling */
#byte-sermons-grid-wrap {
    transition: opacity .25s ease;
}
#byte-sermons-grid-wrap.bs-loading {
    opacity: 0;
    pointer-events: none;
}

/* Spinner — sibling to grid-wrap, absolutely centred in result-area */
.bs-spinner {
    display: none;
    position: absolute;
    top: 3rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}
.bs-spinner.bs-spinner--active {
    display: block;
}
.bs-spinner::before {
    content: '';
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid rgba(0, 0, 0, .15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: bs-spin .7s linear infinite;
}
@keyframes bs-spin {
    to { transform: rotate(360deg); }
}

/* ── Related sermons section ──────────────────────────────── */
.byte-sermons-related {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0,0,0,.1);
}
.byte-sermons-related__title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: .01em;
}

.byte-sermons-single__excerpt {
    font-size: 1.05rem;
    line-height: 1.65;
    opacity: .8;
    margin-bottom: 1.25rem;
    font-style: italic;
}
.byte-sermons-single__excerpt p:last-child { margin-bottom: 0; }

.byte-sermons-single__placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    background: var(--bs-color-placeholder);
}
.byte-sermons-single__placeholder svg {
    width: 52px; height: 52px;
    fill: rgba(255,255,255,.2);
}
.byte-sermons-single__placeholder span {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
    color: rgba(255,255,255,.35);
}

/* ── Single sermon ────────────────────────────────────────── */

/*
 * .byte-sermons-single uses WordPress is-layout-constrained so block layout
 * CSS handles the width — don't override max-width here. Text content
 * children are constrained to the theme's contentSize; .alignwide children
 * (video, related grid) expand to the theme's wideSize.
 */
.byte-sermons-single {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}
.byte-sermons-single__header {
    margin-bottom: 1rem;
}
.byte-sermons-single__title {
    font-size: clamp(1.4rem, 4vw, 2.2rem);
    margin: 0;
    line-height: 1.25;
}
.byte-sermons-single__content {
    margin-top: 1.5rem;
    line-height: 1.7;
}
/* Featured image (no video) — full width within alignwide container */
.byte-sermons-single__thumbnail {
    margin-bottom: 1.5rem;
}
.byte-sermons-single__thumbnail img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .byte-sermons-chapters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 640px) {
    .byte-sermons-grid,
    .byte-sermons-series-grid {
        grid-template-columns: 1fr 1fr;
    }
    .byte-sermons-chapters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .byte-sermons-filter-bar {
        flex-wrap: wrap;
        flex-direction: column;
        align-items: stretch;
    }
    .byte-sermons-filter__search,
    .byte-sermons-filter__select,
    .byte-sermons-filter__clear {
        width: 100% !important;
        flex: 1 1 100%;
    }
    .byte-sermons-preacher-hero {
        flex-direction: column;
        text-align: center;
    }
    .byte-sermons-meta {
        flex-direction: column;
        gap: .4rem;
    }
}
@media (max-width: 400px) {
    .byte-sermons-grid,
    .byte-sermons-series-grid,
    .byte-sermons-chapters-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Block-theme padding ───────────────────────────────────────
 * On block themes the plugin renders full-width pages (main.is-layout-flow).
 * Archive containers need their own horizontal padding since the theme's
 * root padding applies to .wp-site-blocks, not to our inner containers.
 *
 * On classic themes this rule doesn't fire — padding comes from
 * .byte-sermons-content-inner (the wrapper added by byte_sermons_content_open).
 * ─────────────────────────────────────────────────────────── */
main.is-layout-flow .byte-sermons-archive,
main.is-layout-flow .byte-sermons-preacher-archive,
main.is-layout-flow .byte-sermons-topic-archive,
main.is-layout-flow .byte-sermons-scripture-archive,
main.is-layout-flow .byte-sermons-series-list,
main.is-layout-flow .byte-sermons-topics-list,
main.is-layout-flow .byte-sermons-preachers-list,
main.is-layout-flow .byte-sermons-bible-refs-list,
main.is-layout-flow .byte-sermons-single-series__body,
main.is-layout-flow .byte-sermons-single-series__hero-inner,
main.is-layout-flow .byte-sermons-single {
    padding-left: var(--bs-page-padding-x);
    padding-right: var(--bs-page-padding-x);
}
