/**
 * Pulpit Studio — theme compatibility (1.18.0).
 *
 * Theme-chrome rules split out of pulpit-studio.css: they widen theme
 * containers, hide sidebars and the theme's own page title on sermon pages,
 * and undo Astra's flex sidebar layout. They style the THEME, not Pulpit's
 * components, so they load right after pulpit-studio.css. Every theme gets
 * them for now, Esselith included (its .es-container and the full-bleed
 * sermon band rely on them); phase 2 moves that layout into the theme.
 * Content is unchanged from the main file.
 */

/* ═════════════════════════════════════════════════════════════════════════
   THEME COMPATIBILITY — auto full-width no-sidebar on sermon pages
   ═════════════════════════════════════════════════════════════════════════
   These rules are scoped to body.pulpit-sermon-page (added by
   PS_Theme_Compat) so they ONLY affect sermon-related views. They null
   out common theme container constraints and hide sidebar widget areas.
   The plugin's own .ps-section-inner enforces a 1240px max-width with
   centering, so removing theme containers doesn't make content too wide.
   ═════════════════════════════════════════════════════════════════════════ */

/* Remove theme container max-widths and padding so .ps-section can render edge-to-edge */
body.pulpit-sermon-page .entry-content,
body.pulpit-sermon-page .entry-header,
body.pulpit-sermon-page .post-content,
body.pulpit-sermon-page .site-content,
body.pulpit-sermon-page .content-area,
body.pulpit-sermon-page .ast-container,
body.pulpit-sermon-page .ast-container-fluid,
body.pulpit-sermon-page #primary,
body.pulpit-sermon-page #content,
body.pulpit-sermon-page main.site-main,
body.pulpit-sermon-page .es-container,
body.pulpit-sermon-page .inside-article,
body.pulpit-sermon-page .inside-content,
body.pulpit-sermon-page .ct-container,
body.pulpit-sermon-page .entry-content-wrap,
body.pulpit-sermon-page .ast-no-sidebar .entry-content,
body.pulpit-sermon-page .single-content {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Hide sidebar widget areas */
body.pulpit-sermon-page #secondary,
body.pulpit-sermon-page .widget-area,
body.pulpit-sermon-page .sidebar,
body.pulpit-sermon-page #left-sidebar,
body.pulpit-sermon-page .ast-sidebar,
body.pulpit-sermon-page .right-sidebar,
body.pulpit-sermon-page .left-sidebar {
    display: none !important;
}

/* Hide WP/theme post titles, breadcrumbs, and meta — our template renders its own */
body.pulpit-sermon-page .entry-title,
body.pulpit-sermon-page .ast-archive-title,
body.pulpit-sermon-page .archive-title,
body.pulpit-sermon-page .page-title,
body.pulpit-sermon-page .entry-meta,
body.pulpit-sermon-page .post-meta,
body.pulpit-sermon-page .ast-breadcrumbs-wrapper,
body.pulpit-sermon-page .breadcrumb-trail,
body.pulpit-sermon-page header.entry-header,
body.pulpit-sermon-page .ast-archive-description {
    display: none !important;
}

/* Astra-specific: force the article to span full width — but only the MAIN
 * post article, not the article elements used by our internal cards
 * (continue-listening cards, archive grid cards, hub grid cards, etc.) */
body.pulpit-sermon-page article:not(.ps-listening-card):not(.ps-card):not(.ps-series-card):not(.ps-speaker-card),
body.pulpit-sermon-page .ast-row,
body.pulpit-sermon-page .ast-grid-common-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* GeneratePress, Kadence, Blocksy single-content wrappers */
body.pulpit-sermon-page .grid-container,
body.pulpit-sermon-page .grid-parent,
body.pulpit-sermon-page .one-container,
body.pulpit-sermon-page .separate-containers,
body.pulpit-sermon-page .container.grid-container {
    max-width: 100% !important;
    padding: 0 !important;
}

/* Strip any background/border on the post wrapper that would create a "boxed" feel */
body.pulpit-sermon-page article.post,
body.pulpit-sermon-page article[class*="post-"],
body.pulpit-sermon-page .single-post .ast-article-single,
body.pulpit-sermon-page .ast-article-single {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
/* ─── PAGE TITLE HIDE (multiple fallback selectors) ──────────────────── */
/* For shortcode pages where the WP page title shows above our content,
   use every selector we know themes might use. */

body.page header.entry-header,
body.page .entry-header,
body.page h1.entry-title,
body.page .entry-title,
body.page-template-default header.entry-header,
body.page-template-default .entry-title,
body[class*="page-id-"] header.entry-header,
body[class*="page-id-"] .entry-title,
.page header.entry-header:has(+ .entry-content .ps-section),
.page .entry-header:has(+ .entry-content .ps-section) {
    /* Only hide if our shortcode is actually on the page — use :has() to
       check that the entry-content following it contains our section. */
    /* The simpler approach: hide on any page that contains a .ps-section */
}

/* Simpler, more reliable: when our section is present anywhere on the
   current page, retroactively hide common page-title containers via
   sibling combinator (looks up the DOM via :has). Modern browsers only,
   gracefully degrades. */
body:has(.ps-archive-section) .entry-header,
body:has(.ps-archive-section) .entry-title,
body:has(.ps-archive-section) h1.entry-title,
body:has(.ps-archive-section) header.entry-header,
body:has(.ps-archive-section) .ast-archive-description,
body:has(.ps-archive-section) .ast-page-builder-template .entry-header,
body:has(.ps-section.ps-archive-section) .page-title,
body:has(.ps-section.ps-single-sermon) .entry-header,
body:has(.ps-section.ps-single-sermon) .entry-title {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* ─── FULL WIDTH OVERRIDE for sermon section content ─────────────────── */
/* Even without body class, force the section to stretch full-width
   inside its container. */

html body .entry-content .ps-section,
html body .post-content .ps-section,
html body article .ps-section,
.entry-content > .ps-section,
.post-content > .ps-section {
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    width: 100vw !important;
    max-width: 100vw !important;
}
/* ─── ASTRA FLEXBOX SIDEBAR LAYOUT — force content to 100% width ────── */
/* Astra renders archive/single CPT pages inside a flex container with
   #primary (content) at flex-basis ~70% and #secondary (sidebar) at ~30%.
   Hiding #secondary alone leaves #primary at 70%, creating left-aligned
   look. We must force the flex sizing explicitly. */

body.pulpit-sermon-page #primary,
body.pulpit-sermon-page .content-area,
body.pulpit-sermon-page .ast-grid-common-col,
body.pulpit-sermon-page .ast-row > [class*="col-"],
body.pulpit-sermon-page .ast-grid-col,
body.pulpit-sermon-page .ast-flex,
html body.pulpit-sermon-page #primary,
html body.pulpit-sermon-page .ast-archive-description,
html body.pulpit-sermon-page main#main,
html body.pulpit-sermon-page main.site-main,
body[class*="archive"] #primary,
body[class*="archive"][class*="post-type-archive"] #primary,
body[class*="single-ps_sermon"] #primary,
body[class*="post-type-archive-ps_sermon"] #primary,
body[class*="tax-ps_"] #primary {
    flex: 1 1 100% !important;
    flex-basis: 100% !important;
    flex-grow: 1 !important;
    flex-shrink: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* The .ast-container itself (parent of #primary + #secondary) — force
   grid/flex behavior to single column when our content is inside. */

body.pulpit-sermon-page .ast-container,
body.pulpit-sermon-page .ast-container-fluid,
body[class*="single-ps_sermon"] .ast-container,
body[class*="post-type-archive-ps_sermon"] .ast-container,
body[class*="tax-ps_"] .ast-container {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Belt-and-suspenders for archive views even when body class isn't present */
body.post-type-archive-ps_sermon #primary,
body.single-ps_sermon #primary,
body.tax-ps_series #primary,
body.tax-ps_speaker #primary,
body.tax-ps_book #primary {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

body.post-type-archive-ps_sermon .ast-container,
body.single-ps_sermon .ast-container,
body.tax-ps_series .ast-container,
body.tax-ps_speaker .ast-container,
body.tax-ps_book .ast-container {
    display: block !important;
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Hide sidebar widget areas explicitly with all known WP/Astra classes */
body.post-type-archive-ps_sermon #secondary,
body.single-ps_sermon #secondary,
body.tax-ps_series #secondary,
body.tax-ps_speaker #secondary,
body.tax-ps_book #secondary,
body.post-type-archive-ps_sermon .secondary,
body.single-ps_sermon .secondary,
body.post-type-archive-ps_sermon .widget-area,
body.single-ps_sermon .widget-area {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
}

/* If .ast-container is using CSS grid (Astra has variants), reset columns */
body.pulpit-sermon-page .ast-container[style*="grid"],
body[class*="ps_sermon"] .ast-container,
body[class*="tax-ps_"] .ast-container {
    grid-template-columns: 1fr !important;
}
