/**
 * Homepage banner variants.
 *
 * Styles for the "Homepage — Video Background", "Homepage — Carousel" and
 * "Homepage — Header Image" page templates. Everything here is namespaced
 * .smr-*; no existing theme class is touched or overridden.
 */

/* ---------------------------------------------------------------------------
 * Shared banner shell
 * ------------------------------------------------------------------------- */

.smr-video-banner,
.smr-header-banner,
.smr-carousel-banner {
    position: relative;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.smr-video-banner,
.smr-header-banner {
    min-height: clamp(420px, 68vh, 720px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.smr-video-banner .hero-content,
.smr-header-banner .hero-content,
.smr-carousel-banner .hero-content {
    position: relative;
    z-index: 2;
}

/* ---------------------------------------------------------------------------
 * Video background banner
 * ------------------------------------------------------------------------- */

.smr-video-banner-media,
.smr-video-banner-embed {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    border: 0;
    opacity: 0;
    transition: opacity .6s ease-in-out;
    pointer-events: none;
}

.smr-video-banner-media {
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
}

/* 16:9 kept while covering the box, so an embed never letterboxes. */
.smr-video-banner-embed {
    width: 100vw;
    height: 56.25vw;
    min-height: 100%;
    min-width: 177.78vh;
}

.smr-video-banner-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* The script adds .has-video only once playback actually starts, so a blocked
 * or refused autoplay simply leaves the hero image on screen. */
.smr-video-banner.has-video .smr-video-banner-media,
.smr-video-banner.has-video .smr-video-banner-embed {
    opacity: 1;
}

.smr-video-banner-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .38) 45%, rgba(0, 0, 0, .72) 100%);
    pointer-events: none;
}

/* ---------------------------------------------------------------------------
 * Static header image banner
 * ------------------------------------------------------------------------- */

.smr-header-banner-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(rgba(0, 0, 0, .62) 0%, rgba(0, 0, 0, .38) 45%, rgba(0, 0, 0, .72) 100%);
    pointer-events: none;
}

.smr-header-banner-subtitle {
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------------------------------------------------------------------------
 * Carousel banner
 * ------------------------------------------------------------------------- */

.smr-carousel-banner {
    padding: 80px 0;
}

.smr-carousel-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(rgba(0, 0, 0, .72), rgba(0, 0, 0, .78));
    pointer-events: none;
}

.smr-carousel-banner > .container {
    position: relative;
    z-index: 2;
}

.smr-carousel {
    position: relative;
    margin-top: 40px;
    --smr-carousel-gap: 24px;
    --smr-carousel-per-view: 3;
}

.smr-carousel-viewport {
    overflow: hidden;
}

.smr-carousel-track {
    display: flex;
    gap: var(--smr-carousel-gap);
    margin: 0;
    padding: 0;
    list-style: none;
    transition: transform var(--transition, .3s ease);
}

.smr-carousel-track:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.smr-carousel-item {
    flex: 0 0 calc((100% - (var(--smr-carousel-per-view) - 1) * var(--smr-carousel-gap)) / var(--smr-carousel-per-view));
    max-width: calc((100% - (var(--smr-carousel-per-view) - 1) * var(--smr-carousel-gap)) / var(--smr-carousel-per-view));
    list-style: none;
}

.smr-carousel-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    text-align: left;
}

.smr-carousel-card-image {
    line-height: 0;
}

.smr-carousel-card-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.smr-carousel-card-body {
    padding: 20px;
    flex: 1 1 auto;
}

.smr-carousel-card-title {
    font-size: 1.125rem;
    margin: 0 0 8px;
    color: var(--text);
}

.smr-carousel-card-price {
    display: inline-block;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.smr-carousel-card-desc {
    margin: 0;
    font-size: .9rem;
    color: var(--text-light);
}

.smr-carousel-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

/* Nothing to page through: the script sets .is-static and the controls go. */
.smr-carousel.is-static .smr-carousel-controls,
.smr-carousel.is-static .smr-carousel-status {
    display: none;
}

.smr-carousel-controls button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    border: 2px solid var(--white);
    background: transparent;
    color: var(--white);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition, .3s ease);
}

.smr-carousel-controls button:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
}

.smr-carousel-controls button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.smr-carousel-controls button:disabled {
    opacity: .4;
    cursor: default;
}

.smr-carousel-status {
    text-align: center;
    margin: 12px 0 0;
    font-size: .85rem;
    color: #ddd;
}

.smr-carousel-empty {
    text-align: center;
    color: #ddd;
    margin-top: 30px;
}

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .smr-carousel {
        --smr-carousel-per-view: 2;
    }
}

@media (max-width: 767px) {
    .smr-carousel {
        --smr-carousel-per-view: 1;
    }

    .smr-carousel-banner {
        padding: 60px 0;
    }

    .smr-video-banner,
    .smr-header-banner {
        min-height: 420px;
    }

    /* Mobile never gets the video: the hero image behind it is the banner. */
    .smr-video-banner-media,
    .smr-video-banner-embed {
        display: none;
    }
}

/* ---------------------------------------------------------------------------
 * Reduced motion
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .smr-video-banner-media,
    .smr-video-banner-embed {
        display: none;
    }

    .smr-carousel-track,
    .smr-carousel-controls button,
    .smr-video-banner-media,
    .smr-video-banner-embed {
        transition: none;
    }
}
