:root {
    --ibrac-home-gutter: 0px;
}

@media (min-width: 768px) {
    :root {
        --ibrac-home-gutter: 20px;
    }
}

@media (min-width: 1200px) {
    :root {
        --ibrac-home-gutter: 40px;
    }
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
}

main {
    flex: 1 0 auto;
}

:focus-visible {
    outline: 2px solid var(--ibrac-red);
    outline-offset: 2px;
}

.btn-pill {
    display: inline-block;
    padding: 9.5px 14.5px;
    border-radius: 999px;
    background-color: var(--ibrac-red);
    color: #fff;
    font: 600 0.8625rem/16px var(--ibrac-font-sans);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease-in-out;
}

.btn-pill:hover,
.btn-pill:focus-visible {
    background-color: var(--ibrac-red-dark);
    color: #fff;
}

/* Header */

/* Stays at the top while scrolling in the layout with the menu button (phones and tablets). */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

/* Links to an #anchor land below the sticky header. */
html {
    scroll-padding-top: 75.5px;
}

.site-header__inner {
    --bs-gutter-x: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 75.5px;
}

.site-header__brand {
    display: block;
    flex-shrink: 0;
}

.site-header__logo {
    display: block;
    width: 250px;
    /* Leaves room for the menu button on the narrowest phones. */
    max-width: calc(100vw - 100px);
    height: auto;
}

.site-header__menus {
    display: none;
}

.site-header__toggler {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    margin: 5px -8px 0 0;
    padding: 8px;
    border: 0;
    background: none;
}

.site-header__toggler span {
    display: block;
    width: 30px;
    height: 5px;
    border-radius: 3px;
    background-color: var(--ibrac-text);
}

@media (min-width: 768px) {
    html {
        scroll-padding-top: 105px;
    }

    .site-header__inner {
        min-height: 105px;
    }

    .site-header__logo {
        width: 360px;
    }
}

@media (min-width: 1200px) {
    html {
        scroll-padding-top: 0;
    }

    .site-header {
        position: relative;
        box-shadow: none;
    }

    .site-header__inner {
        --bs-gutter-x: 1.5rem;
        min-height: 121px;
    }

    /* Narrower than on tablets: it shares the row with the menu. */
    .site-header__logo {
        width: 300px;
    }

    .site-header__toggler {
        display: none;
    }

    .site-header__menus {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        padding: 20px 0 16px;
    }
}

.site-header__highlights {
    display: flex;
    gap: 10.5px;
    margin: 0;
    padding: 0 13px 0 0;
    list-style: none;
}

.site-nav__list {
    display: flex;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.site-nav__item {
    position: relative;
}

.site-nav__link {
    display: block;
    padding: 8px 13px 6px;
    border: 0;
    background: none;
    color: var(--ibrac-text);
    font: 700 1.0875rem/26px var(--ibrac-font-sans);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.site-nav__dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 1000;
    display: none;
    margin: 0;
    padding: 10px 0;
    list-style: none;
    border-radius: 6px;
    background-color: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
    transform: translateX(-50%);
}

.site-nav__item:hover > .site-nav__dropdown,
.site-nav__item:focus-within > .site-nav__dropdown,
.site-nav__item.is-open > .site-nav__dropdown {
    display: block;
}

.site-nav__dropdown-link {
    display: block;
    padding: 0 21px;
    color: var(--ibrac-text);
    font: 600 0.95rem/37.5px var(--ibrac-font-sans);
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.site-nav__dropdown-link:hover,
.site-nav__dropdown-link:focus-visible {
    background-color: #f5f5f5;
    color: var(--ibrac-red);
}

/* Mobile off-canvas menu */

.mobile-menu {
    --bs-offcanvas-width: 400px;
}

.mobile-menu__body {
    position: relative;
    padding: 42px 16px;
}

.mobile-menu__close {
    position: absolute;
    top: 40px;
    right: 21px;
    width: 44px;
    height: 44px;
    padding: 7px;
    border: 0;
    background: none;
    color: #808080;
}

.mobile-menu__close svg {
    display: block;
    width: 30px;
    height: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
}

.mobile-menu__highlights {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 19px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-menu__highlights .btn-pill {
    padding: 12.25px 15px;
    font-size: 1.109375rem;
    line-height: 17px;
}

.mobile-menu__list {
    margin: 13px 0 0;
    padding: 0;
    list-style: none;
}

.mobile-menu__link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 0;
    border: 0;
    background: none;
    color: var(--ibrac-text);
    font: 700 1.5125rem/29px var(--ibrac-font-sans);
    text-align: left;
    text-decoration: none;
}

.mobile-menu__chevron {
    width: 16px;
    height: 16px;
    color: #808080;
    transition: transform 0.2s ease-in-out;
}

.mobile-menu__link:not(.collapsed) .mobile-menu__chevron {
    transform: rotate(180deg);
}

.mobile-menu__submenu {
    margin: 0 0 10px;
    padding: 0 0 0 16px;
    list-style: none;
}

.mobile-menu__sublink {
    display: block;
    padding: 9px 0;
    color: var(--ibrac-text);
    font: 500 1.125rem/1.35 var(--ibrac-font-sans);
    text-decoration: none;
}

.mobile-menu__sublink:hover,
.mobile-menu__sublink[aria-current='page'] {
    color: var(--ibrac-red);
}

/* Home */

.home-video {
    margin: 0 var(--ibrac-home-gutter);
    background: #111 var(--home-video-poster-mobile) center / cover no-repeat;
}

/* The mobile file is 9:10, the tablet and desktop ones 1870:600. */
.home-video__media {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 9 / 10;
    object-fit: cover;
}

@media (min-width: 768px) {
    .home-video {
        background-image: var(--home-video-poster-tablet);
    }

    .home-video__media {
        aspect-ratio: 1870 / 600;
    }
}

@media (min-width: 1200px) {
    .home-video {
        background-image: var(--home-video-poster);
    }
}

/* iOS shows a play button instead when it blocks autoplay (e.g. in Low Power Mode). */
.home-video__media::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none;
}

.home-hero {
    padding: 15px 16px 24px;
    text-align: center;
}

.home-hero__text {
    max-width: 32.7em;
    margin: 0 auto;
    color: var(--ibrac-text);
    font: 400 clamp(1.35625rem, 1.162rem + 0.8635vw, 2.179rem)/1.425 var(--ibrac-font-sans);
}

.home-hero__text strong,
.home-hero__text a {
    font-weight: 700;
}

.home-hero__text a {
    color: var(--bs-link-color);
    text-decoration: underline;
    text-decoration-thickness: 0.065em;
    text-underline-offset: 0.12em;
}

@media (min-width: 768px) {
    .home-hero {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 400px;
        margin: 30px var(--ibrac-home-gutter) 0;
        padding: 48px 32px;
        background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), var(--home-hero-image) center / cover no-repeat;
        background-color: #1d1d1d;
    }

    .home-hero__text {
        color: #fff;
    }

    .home-hero__text a {
        color: var(--ibrac-highlight);
    }

    .home-hero__text a:hover {
        color: #fff;
    }
}

.home-cards {
    display: grid;
    grid-template-columns: 1fr;
    margin: 0 var(--ibrac-home-gutter);
}

@media (min-width: 768px) {
    .home-cards {
        grid-template-columns: repeat(2, 1fr);
        margin-top: 30px;
    }
}

@media (min-width: 992px) {
    .home-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

.home-card {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 1;
    background-color: #111;
    color: #fff;
    text-decoration: none;
}

.home-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.home-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 50%, rgba(0, 0, 0, 0.65) 75%, rgba(0, 0, 0, 0.85) 90%, rgba(0, 0, 0, 0.97) 100%);
}

.home-card:hover .home-card__image,
.home-card:focus-visible .home-card__image {
    transform: scale(1.04);
}

.home-card__body {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    padding: 0 clamp(18.5px, 15.78px + 0.7546vw, 30px) 21.5px;
}

.home-card__title {
    margin: 0;
    color: #fff;
    font: 700 clamp(1.875rem, 1.7275rem + 0.656vw, 2.5rem)/1.18 var(--ibrac-font-sans);
}

.home-card__subtitle {
    margin: 1.5px 0 0;
    font: italic 400 clamp(0.95rem, 0.92rem + 0.131vw, 1.075rem)/1.4 var(--ibrac-font-sans);
}

@media (prefers-reduced-motion: reduce) {
    .home-card__image {
        transition: none;
    }
}

/* CMS & error pages */

.page-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(350px, 314.6px + 9.84vw, 500px);
    padding: 40px 20px 49px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.35) 0%, rgb(0 0 0) 100%), var(--page-hero-image) center / cover no-repeat;
    background-color: #1d1d1d;
    text-align: center;
}

.page-hero__title {
    max-width: 1296px;
    margin: 0;
    color: #fff;
    font: 700 clamp(2.191rem, 1.816rem + 1.666vw, 3.778rem)/1.155 var(--ibrac-font-sans);
    overflow-wrap: break-word;
}

.page-content {
    padding-top: clamp(29.5px, 19.96px + 2.651vw, 69.9px);
    overflow-wrap: break-word;
}

/* Below 1200px Bootstrap's .container is already narrower than this. */
@media (min-width: 1200px) {
    .page-content {
        max-width: 1000px;
    }
}

/* Sermons: YouTube video grids */

.page-content .video-grid__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px 24px;
    margin: 20px 0 24px;
    padding: 0;
    list-style: none;
}

@media (min-width: 576px) {
    .page-content .video-grid__list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .page-content .video-grid__list {
        grid-template-columns: repeat(3, 1fr);
    }
}

.video-card {
    display: block;
    color: var(--ibrac-heading);
    text-decoration: none;
}

.video-card__thumbnail {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    background-color: #111;
}

.video-card__title {
    display: -webkit-box;
    margin-top: 10px;
    overflow: hidden;
    font: 600 1rem/1.4 var(--ibrac-font-sans);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    transition: color 0.15s ease-in-out;
}

.video-card:hover .video-card__title,
.video-card:focus-visible .video-card__title {
    color: var(--ibrac-red);
}

/* Footer */

.site-footer {
    padding: clamp(48px, 34.65px + 3.707vw, 104.5px) 0 clamp(18.5px, 12.71px + 1.608vw, 39px);
    color: var(--ibrac-muted);
    text-align: center;
}

.site-footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-footer__brand {
    display: block;
}

.site-footer__logo {
    display: block;
    width: 155px;
    height: auto;
}

.site-footer__contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 29.5px;
}

.site-footer__social {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.site-footer__social a {
    display: block;
    color: var(--ibrac-muted);
    transition: color 0.15s ease-in-out;
}

.site-footer__social a:hover,
.site-footer__phone:hover {
    color: var(--ibrac-red);
}

.site-footer__social .icon {
    display: block;
    width: 30px;
    height: 30px;
}

.site-footer__social .site-footer__icon-instagram {
    width: 26px;
    height: 26px;
}

.site-footer__social .site-footer__icon-youtube {
    width: 32px;
    height: 32px;
}

.site-footer__phone {
    display: inline-flex;
    align-items: center;
    gap: 8.5px;
    margin-top: 8.5px;
    color: var(--ibrac-muted);
    font: 400 1.18125rem/1.3 var(--ibrac-font-serif);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.site-footer__phone .icon {
    width: 17.5px;
    height: 17.5px;
}

.site-footer__address {
    margin: 21px 0 0;
    font-size: 0.825rem;
    line-height: 21.5px;
}

@media (min-width: 768px) {
    .site-footer {
        text-align: right;
    }

    .site-footer__inner {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
    }

    .site-footer__contact {
        align-items: flex-end;
        margin-top: 3px;
    }

    .site-footer__social {
        margin-right: 3.5px;
    }
}
