/* Modern sermon page 1.5.2
 *
 * Two columns on wide screens: the sermon on the left, the Study Tools
 * panel on the right, where it stays in view while the page scrolls.
 * One column on narrow screens: media, panel, details.
 *
 * Colours and fonts are left to the site design; this file only sets
 * layout, spacing and shape.
 */
.cd-sermon-modern {
    --cd-sm-top: 20px;
    --cd-sm-gap: 28px;
    --cd-sm-radius: 14px;
    --cd-sm-panel: 380px;
}
/* Breathing room above the footer (and the previous / next links).
 * The site stylesheet clears all padding on this article with
 * ".content .override", so the selector here has to outrank that. */
.content article.cd-sermon-modern,
.content article.cd-sermon-modern.override,
article.sermons-single.cd-sermon-modern {
    padding-bottom: 56px;
}
.cd-sermon-modern-page .post-navigation,
.cd-sermon-modern-page .navigation.post-navigation {
    padding: 0 20px 40px;
}

/* Full Width: let the page's content area use the whole screen. The
 * banner and footer are outside it and keep their own widths. */
body.cd-sermon-modern-full .site-inner,
body.cd-sermon-modern-full .content-sidebar-wrap,
body.cd-sermon-modern-full main.content {
    width: auto;
    max-width: none;
    float: none;
}
body.cd-sermon-modern-full .cd-sermon-modern {
    --cd-sm-panel: clamp(380px, 26vw, 460px);
    --cd-sm-gap: clamp(24px, 2.5vw, 40px);
}
body.cd-sermon-modern-full .cd-sermon-modern .cd-sm-grid {
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(20px, 3vw, 48px);
    padding-right: clamp(20px, 3vw, 48px);
}
/* The wider player is taller, so the panel beside it can be too. */
@media (min-width: 861px) {
    body.cd-sermon-modern-full .cd-sermon-modern .cd-sm-tools-inner {
        height: min(760px, calc(100vh - var(--cd-sm-top) - 20px));
    }
}

.cd-sermon-modern .cd-sm-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--cd-sm-panel);
    grid-template-areas:
        "media tools"
        "body  tools";
    grid-template-rows: auto 1fr;
    column-gap: var(--cd-sm-gap);
    row-gap: 22px;
    align-items: start;
}
.cd-sermon-modern.cd-sm-no-tools .cd-sm-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "media" "body";
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* Media */
.cd-sermon-modern .cd-sm-media {
    grid-area: media;
    min-width: 0;
    overflow: hidden;
    border-radius: var(--cd-sm-radius);
    background: #000;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 0, 0, .10);
}
.cd-sermon-modern .cd-sm-media > div {
    width: 100%;
    margin: 0;
}
/* An embed printed without a responsive wrapper. */
.cd-sermon-modern .cd-sm-media > div > iframe,
.cd-sermon-modern .cd-sm-media > div > video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}
.cd-sermon-modern .cd-sm-media .cd-sm-image {
    display: block;
    float: none;
    width: 100%;
    height: auto;
    max-height: 62vh;
    margin: 0;
    object-fit: cover;
}
.cd-sermon-modern .cd-sm-media-audio,
.cd-sermon-modern .cd-sm-media-image {
    background: transparent;
}
.cd-sermon-modern .cd-sm-audio {
    padding: 14px 16px 16px;
    background: color-mix(in srgb, currentColor 6%, transparent);
}
.cd-sermon-modern .cd-sm-audio audio,
.cd-sermon-modern .cd-sm-audio .mejs-container {
    width: 100% !important;
    max-width: 100%;
}
.cd-sermon-modern .cd-sm-save {
    display: inline-block;
    margin-top: 10px;
    font-size: .9em;
}

/* Study Tools panel
 * Placed by row and column, with its own margins cleared, so its top edge
 * always lines up with the top of the player whatever else a design or an
 * editing tool adds inside the article.
 */
.cd-sermon-modern .cd-sm-media {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
}
.cd-sermon-modern .cd-sm-tools {
    grid-area: tools;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: stretch;
    min-width: 0;
    margin: 0;
    padding: 0;
}
.cd-sermon-modern .cd-sm-tools-inner,
.cd-sermon-modern .cd-sm-tools .cd-study {
    margin: 0;
}
.cd-sermon-modern .cd-sm-tools-inner {
    position: sticky;
    top: var(--cd-sm-top);
    display: flex;
    height: min(680px, calc(100vh - var(--cd-sm-top) - 20px));
    min-height: 420px;
}
/* Signed-in staff see the toolbar across the top of the screen. The panel
 * keeps the same top offset as for everyone else, so it stays level with
 * the player; only its height allows for the toolbar. */
.admin-bar .cd-sermon-modern .cd-sm-tools-inner {
    height: min(680px, calc(100vh - var(--cd-sm-top) - 52px));
}
/* The panel fills the column instead of using its own fixed height. */
.cd-sermon-modern .cd-sm-tools .cd-study {
    flex: 1 1 auto;
    height: 100%;
    background: var(--cds-bg, #fff);
    color: var(--cds-text, #1f2328);
}
.cd-sermon-modern .cd-sm-tools .cd-study .cd-study-panels {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    max-height: none;
}

/* Details */
.cd-sermon-modern .cd-sm-body {
    grid-area: body;
    min-width: 0;
}
.cd-sermon-modern .cd-sm-body > * {
    margin-bottom: 28px;
}
.cd-sermon-modern .cd-sm-header {
    margin-bottom: 28px;
    padding: 0;
}
.cd-sermon-modern .cd-sm-header .entry-title {
    margin: 0 0 10px;
    line-height: 1.2;
}
.cd-sermon-modern ul.cd-sm-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    font-size: .92em;
}
.cd-sermon-modern ul.cd-sm-meta li {
    margin: 0;
    padding: 0;
    list-style: none;
}
.cd-sermon-modern ul.cd-sm-meta .cd-sm-date {
    margin-right: 6px;
    opacity: .7;
}
.cd-sermon-modern ul.cd-sm-meta .cd-sm-date:empty {
    display: none;
}
.cd-sermon-modern ul.cd-sm-meta li.tax a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, currentColor 9%, transparent);
    text-decoration: none;
    line-height: 1.4;
    transition: background-color .15s;
}
.cd-sermon-modern ul.cd-sm-meta li.tax a:hover {
    background: color-mix(in srgb, currentColor 16%, transparent);
}
.cd-sermon-modern #tabs {
    margin: 0;
}
.cd-sermon-modern ul.cd-sm-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.cd-sermon-modern ul.cd-sm-buttons li {
    margin: 0;
    padding: 0;
    list-style: none;
}
/* Shape only: each design keeps its own button colours. */
.cd-sermon-modern ul.cd-sm-buttons a.sermon-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color .15s, color .15s, box-shadow .15s;
}
.cd-sermon-modern ul.cd-sm-buttons a.sermon-btn.is-current {
    box-shadow: inset 0 0 0 2px currentColor;
}
.cd-sermon-modern .cd-sm-section {
    padding-top: 26px;
    border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

@media (max-width: 1000px) {
    .cd-sermon-modern,
    body.cd-sermon-modern-full .cd-sermon-modern {
        --cd-sm-panel: 340px;
        --cd-sm-gap: 20px;
    }
}

@media (max-width: 860px) {
    .cd-sermon-modern .cd-sm-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "media" "tools" "body";
        grid-template-rows: auto;
    }
    .cd-sermon-modern .cd-sm-media,
    .cd-sermon-modern .cd-sm-tools {
        grid-column: 1;
        grid-row: auto;
    }
    .cd-sermon-modern .cd-sm-tools-inner,
    .admin-bar .cd-sermon-modern .cd-sm-tools-inner {
        position: static;
        height: 480px;
        max-height: 80vh;
    }
}
