/*
 * Home promo banners (admin > Website management > Home Banners).
 *
 * The SAME file is used by the admin live preview
 * (dreamRunnerNewEcommerce/public/admin/assets/css/dr-home-banners.css) —
 * keep the two copies identical.
 *
 * Responsive rules use container queries (not viewport media queries) so the
 * banner adapts to the space it is given — that is what lets the admin preview
 * show the real mobile layout inside a narrow frame.
 *
 * Per-banner settings arrive as CSS variables in the banner's style attribute
 * (HomeBanner::css_vars): colours (--hb-heading, --hb-btn-bg ...), button
 * radius, and desktop / mobile margin + padding (--hb-mt, --hb-mt-m ...).
 * Mobile values (-m) apply under 576px; desktop values cover tablet too.
 */

.dr-hb-wrap {
    container-type: inline-size;
}

.dr-hb {
    --hb-fg: #0b0b0b;
    --hb-muted: rgba(11, 11, 11, .7);
    --hb-line: rgba(11, 11, 11, .18);
    --hb-btn-bg: #0b0b0b;
    --hb-btn-fg: #fff;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    margin: var(--hb-mt, 0) var(--hb-mr, 0) var(--hb-mb, 0) var(--hb-ml, 0);
}

.dr-hb.is-light {
    --hb-fg: #fff;
    --hb-muted: rgba(255, 255, 255, .82);
    --hb-line: rgba(255, 255, 255, .28);
    --hb-btn-bg: #fff;
    --hb-btn-fg: #0b0b0b;
}

/*
 * Corners: --hb-radius from admin, else square (full width) / rounded (boxed).
 * --hb-r is the radius actually used, so the frame below can follow it.
 */
.dr-hb {
    --hb-r: var(--hb-radius, 0px);
    border-radius: var(--hb-r);
}

/* Boxed (inside the site container) */
.dr-hb.is-boxed {
    --hb-r: var(--hb-radius, 20px);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .12);
}

/*
 * Border / frame. --hb-border-inset 0 = on the edge; larger = a thin frame
 * inside the banner. Drawn on top of image and text, never blocks clicks.
 */
.dr-hb::after {
    content: "";
    position: absolute;
    inset: var(--hb-border-inset, 0px);
    z-index: 2;
    border: var(--hb-border-w, 0px) solid var(--hb-border-c, currentColor);
    border-radius: max(0px, calc(var(--hb-r) - var(--hb-border-inset, 0px)));
    pointer-events: none;
}

/* ===================== Split layout ===================== */
.dr-hb-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: clamp(440px, 44cqi, 680px);
    background: var(--hb-bg);
    color: var(--hb-fg);
}

.dr-hb-split.img-left .dr-hb-media { order: -1; }

.dr-hb-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding:
        var(--hb-pt, clamp(40px, 5.5cqi, 96px))
        var(--hb-pr, clamp(28px, 6cqi, 104px))
        var(--hb-pb, clamp(40px, 5.5cqi, 96px))
        var(--hb-pl, clamp(28px, 6cqi, 104px));
}

.dr-hb-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: 540px;
    text-align: left;
}

/* Text alignment */
.dr-hb.align-center .dr-hb-inner { align-items: center; text-align: center; margin-inline: auto; }
.dr-hb.align-right .dr-hb-inner { align-items: flex-end; text-align: right; margin-left: auto; }
.dr-hb.align-center .dr-hb-cta,
.dr-hb.align-center .dr-hb-features { justify-content: center; }
.dr-hb.align-right .dr-hb-cta,
.dr-hb.align-right .dr-hb-features { justify-content: flex-end; }

.dr-hb-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: var(--hb-badge, var(--hb-fg));
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin-bottom: 24px;
}

/* Badge with a short line underneath (no border) */
.dr-hb-badge.is-line {
    flex-direction: column;
    align-items: inherit;
    gap: 14px;
    padding: 0;
    border: 0;
    border-radius: 0;
    letter-spacing: .28em;
    margin-bottom: 28px;
}

.dr-hb-badge.is-line::after {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    opacity: .7;
}

.dr-hb-badge.is-plain {
    padding: 0;
    border: 0;
    border-radius: 0;
}

.dr-hb-heading {
    font-weight: var(--hb-heading-weight, 800);
    line-height: .95;
    letter-spacing: -.045em;
    color: var(--hb-heading, inherit);
    margin: 0 0 22px;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.dr-hb-heading strong,
.dr-hb-heading b { font-weight: 800; }
.dr-hb-heading em { font-style: italic; }

.dr-hb.h-sm .dr-hb-heading { font-size: clamp(2rem, 4cqi, 3.5rem); line-height: 1.02; letter-spacing: -.03em; }
.dr-hb.h-md .dr-hb-heading { font-size: clamp(2.5rem, 5.2cqi, 4.75rem); }
.dr-hb.h-lg .dr-hb-heading { font-size: clamp(3rem, 6.8cqi, 6.25rem); }

.dr-hb-desc {
    font-size: clamp(1rem, 1.3cqi, 1.2rem);
    line-height: 1.6;
    color: var(--hb-desc, var(--hb-muted));
    margin: 0 0 32px;
    max-width: 470px;
    text-wrap: pretty;
}

.dr-hb-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
}

.dr-hb-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dr-hb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 28px;
    border: 1.5px solid var(--hb-btn-bg);
    border-radius: var(--hb-btn-radius, 999px);
    background: var(--hb-btn-bg);
    color: var(--hb-btn-fg) !important;
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, color .25s ease;
}

.dr-hb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .45);
    background: var(--hb-btn-hover-bg, var(--hb-btn-bg));
    border-color: var(--hb-btn-hover-bg, var(--hb-btn-bg));
    color: var(--hb-btn-hover-fg, var(--hb-btn-fg)) !important;
}

.dr-hb-btn:focus-visible {
    outline: 2px solid var(--hb-fg);
    outline-offset: 3px;
}

.dr-hb-btn svg { transition: transform .25s ease; }
.dr-hb-btn:hover svg { transform: translateX(3px); }

.dr-hb-btn.is-outline {
    background: transparent;
    border-color: var(--hb-fg);
    color: var(--hb-fg) !important;
}

.dr-hb-btn.is-outline:hover {
    background: var(--hb-btn-hover-bg, var(--hb-fg));
    border-color: var(--hb-btn-hover-bg, var(--hb-fg));
    color: var(--hb-btn-hover-fg, var(--hb-bg)) !important;
}

.dr-hb-note {
    font-size: 13px;
    color: var(--hb-muted);
}

.dr-hb-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 30px;
    width: 100%;
    margin: 44px 0 0;
    padding: 22px 0 0;
    border-top: 1px solid var(--hb-line);
    list-style: none;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
}

.dr-hb-features li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dr-hb-features li::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .55;
}

/* Media */
.dr-hb-media {
    position: relative;
    overflow: hidden;
    min-height: 100%;
}

.dr-hb-media a {
    position: absolute;
    inset: 0;
    display: block;
}

.dr-hb-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform 1.4s cubic-bezier(.2, .7, .2, 1);
}

.dr-hb.fit-contain .dr-hb-media img {
    object-fit: contain;
    object-position: center bottom;
}

.dr-hb-split:hover .dr-hb-media img { transform: scale(1.035); }
.dr-hb.fit-contain.dr-hb-split:hover .dr-hb-media img { transform: none; }

/* ===================== Full image layout ===================== */
.dr-hb-image {
    display: block;
    line-height: 0;
}

/*
 * Text over the image ("Text on the image" = show). Image and text share one
 * grid cell: the banner is as tall as the image, or taller if the text needs
 * it — then the image covers the extra height. Clicks pass through the empty
 * overlay to the image link; buttons stay clickable.
 */
.dr-hb-image-wrap.has-text {
    display: grid;
    background: var(--hb-bg);
    color: var(--hb-fg);
}

.dr-hb-image-wrap.has-text > .dr-hb-image,
.dr-hb-image-wrap.has-text > .dr-hb-overlay {
    grid-area: 1 / 1;
    min-width: 0;
}

.dr-hb-image-wrap.has-text .dr-hb-image img {
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.dr-hb-overlay {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    padding:
        var(--hb-pt, clamp(32px, 4.5cqi, 80px))
        var(--hb-pr, clamp(28px, 6cqi, 104px))
        var(--hb-pb, clamp(32px, 4.5cqi, 80px))
        var(--hb-pl, clamp(28px, 6cqi, 104px));
    pointer-events: none;
}

.dr-hb-overlay a,
.dr-hb-overlay button {
    pointer-events: auto;
}

.dr-hb-image img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 1.4s cubic-bezier(.2, .7, .2, 1);
}

a.dr-hb-image:hover img { transform: scale(1.015); }

/* ===================== Colour banner (no image uploaded) =====================
 * Background colour + text only. Uses the banner's text alignment, colours
 * and spacing; the block is centred vertically in a comfortable height.
 */
.dr-hb-color {
    display: flex;
    align-items: center;
    min-height: clamp(320px, 34cqi, 560px);
    background: var(--hb-bg);
    color: var(--hb-fg);
}

.dr-hb-color .dr-hb-content {
    width: 100%;
    min-width: 0;
}

.dr-hb-color .dr-hb-inner { max-width: 760px; }
.dr-hb-color .dr-hb-desc { max-width: 560px; }

/* Room for the slider dots under the text. */
.dr-hb-slider .dr-hb-color { padding-bottom: 32px; }

/* ===================== Text background effect + image overlay =====================
 * Set per banner in admin (Effects card), separately for desktop and mobile:
 *   fx-*  = desktop / tablet effect, mfx-* = mobile effect (under 576px)
 *   --hb-fx / --hb-fx-m = effect strength 0-100 (50 = default look)
 *   --hb-ov / --hb-ov-m = image overlay opacity 0-90, --hb-ov-c = its colour
 * The effect sits behind the text area of every layout: next to the photo,
 * over the image, and on a colour banner.
 */
.dr-hb {
    /* Strength multiplier: 50 -> 1 (default), 0 -> off, 100 -> double. */
    --hb-fx-a: calc(var(--hb-fx, 50) / 50);
    --hb-fx-x: 28%;
    --hb-fx-dir: 90deg;

    /* Per text colour (dark text on a light banner) */
    --hb-fx-soft-a: .2;
    --hb-fx-glow-a: .45;
    --hb-fx-shade-rgb: 255, 255, 255;
    --hb-fx-shade-a: .7;
    --hb-fx-glass-a: .4;
    --hb-fx-glass-line: .6;

    --hb-fx-soft: linear-gradient(135deg, rgba(255, 255, 255, calc(var(--hb-fx-soft-a) * var(--hb-fx-a))), rgba(255, 255, 255, 0) 55%);
    --hb-fx-glow: radial-gradient(ellipse 60% 85% at var(--hb-fx-x) 50%, rgba(255, 255, 255, calc(var(--hb-fx-glow-a) * var(--hb-fx-a))), rgba(255, 255, 255, 0) 70%);
    --hb-fx-shade: linear-gradient(var(--hb-fx-dir), rgba(var(--hb-fx-shade-rgb), calc(var(--hb-fx-shade-a) * var(--hb-fx-a))), rgba(var(--hb-fx-shade-rgb), 0) 75%);
    --hb-fx-shade-c: radial-gradient(ellipse 80% 90% at 50% 50%, rgba(var(--hb-fx-shade-rgb), calc(var(--hb-fx-shade-a) * var(--hb-fx-a))), rgba(var(--hb-fx-shade-rgb), 0) 80%);
}

/* White text (dark banner / dark photo) */
.dr-hb.is-light {
    --hb-fx-soft-a: .08;
    --hb-fx-glow-a: .16;
    --hb-fx-shade-rgb: 0, 0, 0;
    --hb-fx-shade-a: .55;
    --hb-fx-glass-a: .1;
    --hb-fx-glass-line: .22;
}

.dr-hb.align-center { --hb-fx-x: 50%; }
.dr-hb.align-right { --hb-fx-x: 72%; --hb-fx-dir: 270deg; }

.dr-hb-content,
.dr-hb-overlay {
    background: var(--hb-fx-bg, none);
}

/* Image overlay: a colour tint over the photo (under the text). */
.dr-hb-image { position: relative; }

.dr-hb-image::after,
.dr-hb-media::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: var(--hb-ov-c, #000);
    opacity: calc(var(--hb-ov, 0) / 100);
    pointer-events: none;
}

/* ----- Desktop + tablet effect (fx-*) ----- */
@container (min-width: 576px) {
    .dr-hb.fx-soft { --hb-fx-bg: var(--hb-fx-soft); }
    .dr-hb.fx-glow { --hb-fx-bg: var(--hb-fx-glow); }
    .dr-hb.fx-shade { --hb-fx-bg: var(--hb-fx-shade); }
    .dr-hb.fx-shade.align-center { --hb-fx-bg: var(--hb-fx-shade-c); }

    .dr-hb.fx-glass .dr-hb-inner {
        width: auto;
        max-width: min(100%, 600px);
        padding: clamp(24px, 3.2cqi, 48px);
        border: 1px solid rgba(255, 255, 255, calc(var(--hb-fx-glass-line) * min(1, var(--hb-fx-a))));
        border-radius: 22px;
        background: rgba(255, 255, 255, calc(var(--hb-fx-glass-a) * var(--hb-fx-a)));
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        backdrop-filter: blur(14px) saturate(140%);
        box-shadow: 0 24px 60px -28px rgba(0, 0, 0, .35);
    }
}

/* ----- Mobile effect (mfx-*), own strength and overlay ----- */
@container (max-width: 575.98px) {
    .dr-hb {
        --hb-fx-a: calc(var(--hb-fx-m, var(--hb-fx, 50)) / 50);
        /* Text is stacked full width on phones: centre the glow. */
        --hb-fx-x: 50%;
    }

    .dr-hb.mfx-soft { --hb-fx-bg: var(--hb-fx-soft); }
    .dr-hb.mfx-glow { --hb-fx-bg: var(--hb-fx-glow); }
    .dr-hb.mfx-shade { --hb-fx-bg: var(--hb-fx-shade-c); }

    .dr-hb.mfx-glass .dr-hb-inner {
        width: auto;
        max-width: 100%;
        padding: 22px 20px;
        border: 1px solid rgba(255, 255, 255, calc(var(--hb-fx-glass-line) * min(1, var(--hb-fx-a))));
        border-radius: 16px;
        background: rgba(255, 255, 255, calc(var(--hb-fx-glass-a) * var(--hb-fx-a)));
        -webkit-backdrop-filter: blur(12px) saturate(140%);
        backdrop-filter: blur(12px) saturate(140%);
        box-shadow: 0 18px 44px -24px rgba(0, 0, 0, .35);
    }

    .dr-hb-image::after,
    .dr-hb-media::after {
        opacity: calc(var(--hb-ov-m, var(--hb-ov, 0)) / 100);
    }
}

/* ===================== Scroll reveal (frontend adds .dr-hb-anim) ===================== */
.dr-hb-anim .dr-hb-inner > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
}

.dr-hb-anim.is-in .dr-hb-inner > * { opacity: 1; transform: none; }
.dr-hb-anim.is-in .dr-hb-inner > *:nth-child(2) { transition-delay: .08s; }
.dr-hb-anim.is-in .dr-hb-inner > *:nth-child(3) { transition-delay: .16s; }
.dr-hb-anim.is-in .dr-hb-inner > *:nth-child(4) { transition-delay: .24s; }
.dr-hb-anim.is-in .dr-hb-inner > *:nth-child(5) { transition-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
    .dr-hb-anim .dr-hb-inner > * { opacity: 1; transform: none; transition: none; }
    .dr-hb-media img,
    .dr-hb-image img,
    .dr-hb-btn,
    .dr-hb-btn svg { transition: none; }
}

/* ===================== Tablet ===================== */
@container (max-width: 991.98px) {
    .dr-hb-split {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
    }

    .dr-hb-split .dr-hb-media,
    .dr-hb-split.img-left .dr-hb-media {
        order: -1;
        min-height: 0;
        aspect-ratio: 16 / 11;
    }

    .dr-hb-content {
        padding: var(--hb-pt, 40px) var(--hb-pr, 32px) var(--hb-pb, 48px) var(--hb-pl, 32px);
    }

    .dr-hb-inner { max-width: 620px; }
    .dr-hb.is-boxed { --hb-r: var(--hb-radius, 16px); }

    .dr-hb-color { min-height: clamp(280px, 50cqi, 420px); }

    .dr-hb-color .dr-hb-content {
        padding: var(--hb-pt, 56px) var(--hb-pr, 32px) var(--hb-pb, 56px) var(--hb-pl, 32px);
    }
}

/* ===================== Mobile ===================== */
@container (max-width: 575.98px) {
    .dr-hb {
        margin: var(--hb-mt-m, 0) var(--hb-mr-m, 0) var(--hb-mb-m, 0) var(--hb-ml-m, 0);
    }

    .dr-hb-split .dr-hb-media,
    .dr-hb-split.img-left .dr-hb-media { aspect-ratio: 4 / 5; }

    .dr-hb-content {
        padding: var(--hb-pt-m, 32px) var(--hb-pr-m, 20px) var(--hb-pb-m, 40px) var(--hb-pl-m, 20px);
    }

    .dr-hb-color { min-height: 0; }

    .dr-hb-color .dr-hb-content {
        padding: var(--hb-pt-m, 48px) var(--hb-pr-m, 20px) var(--hb-pb-m, 48px) var(--hb-pl-m, 20px);
    }

    .dr-hb-color .dr-hb-inner { max-width: none; }

    .dr-hb-overlay {
        padding: var(--hb-pt-m, 32px) var(--hb-pr-m, 20px) var(--hb-pb-m, 32px) var(--hb-pl-m, 20px);
    }

    /* Mobile text alignment (overrides the desktop one) */
    .dr-hb.m-align-left .dr-hb-inner { align-items: flex-start; text-align: left; margin-inline: 0 auto; }
    .dr-hb.m-align-center .dr-hb-inner { align-items: center; text-align: center; margin-inline: auto; }
    .dr-hb.m-align-right .dr-hb-inner { align-items: flex-end; text-align: right; margin-inline: auto 0; }
    .dr-hb.m-align-left .dr-hb-features { justify-content: flex-start; }
    .dr-hb.m-align-center .dr-hb-features { justify-content: center; }
    .dr-hb.m-align-right .dr-hb-features { justify-content: flex-end; }
    .dr-hb.m-align-left .dr-hb-note { text-align: left; }
    .dr-hb.m-align-right .dr-hb-note { text-align: right; }
    .dr-hb-badge { margin-bottom: 16px; }
    .dr-hb-heading { margin-bottom: 14px; }
    .dr-hb.h-sm .dr-hb-heading { font-size: 2rem; }
    .dr-hb.h-md .dr-hb-heading { font-size: 2.5rem; }
    .dr-hb.h-lg .dr-hb-heading { font-size: 3rem; }
    .dr-hb-desc { margin-bottom: 24px; }

    .dr-hb-cta,
    .dr-hb-btns { flex-direction: column; align-items: stretch; width: 100%; }
    .dr-hb-btn { width: 100%; }
    .dr-hb-note { text-align: center; }

    .dr-hb-features { margin-top: 30px; padding-top: 18px; gap: 8px 20px; }
    .dr-hb.is-boxed { --hb-r: var(--hb-radius, 14px); }

    /* Keep the frame close to the edge on small screens. */
    .dr-hb::after { inset: min(var(--hb-border-inset, 0px), 10px); }
}

/* ===================== Banner slider (banners marked "show in slider") ===================== */
.dr-hb-slider {
    position: relative;
}

.dr-hb-slider .swiper-slide {
    height: auto;
}

.dr-hb-slider .dr-hb-slider-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 18px;
    z-index: 2;
    display: flex;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
}

.dr-hb-slider .dr-hb-slider-dots .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    margin: 0 !important;
    border: 1px solid rgba(255, 255, 255, .9);
    background: rgba(0, 0, 0, .35);
    opacity: 1;
    pointer-events: auto;
    transition: width .3s ease, background-color .3s ease;
}

.dr-hb-slider .dr-hb-slider-dots .swiper-pagination-bullet-active {
    width: 24px;
    border-radius: 999px;
    background: #fff;
}
