/*
 * Admin-managed Home gap capsules.
 * Desktop shows every active fixed slot. Mobile shows one item per band and
 * advances to the next item on tap.
 */

.mr-home-content-capsule-band,
.mr-home-content-capsule-band * {
    box-sizing: border-box;
}

.mr-home-content-capsule-band {
    position: relative;
    z-index: 8;
    width: 100%;
    min-width: 0;
    height: 100px;
    min-height: 100px;
    margin: 0 auto;
    padding: 7px 0;
    overflow: visible;
    isolation: isolate;
}

.mr-home-content-capsule-band.is-empty {
    pointer-events: none;
}

.mr-home-content-capsule-band__rail {
    width: 100%;
    height: 86px;
    display: grid;
    gap: clamp(10px, 1.05vw, 20px);
    align-items: stretch;
}

.mr-home-content-capsule-band--before_twelve
.mr-home-content-capsule-band__rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mr-home-content-capsule-band--before_proforma
.mr-home-content-capsule-band__rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mr-home-content-capsule {
    appearance: none;
    position: relative;
    min-width: 0;
    width: 100%;
    height: 86px;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: center;
    gap: clamp(10px, 1vw, 18px);
    margin: 0;
    padding: 6px clamp(12px, 1.1vw, 20px) 6px 6px;
    overflow: hidden;
    border: 1px solid rgba(216, 194, 142, .52);
    border-radius: 999px;
    background:
        radial-gradient(circle at 9% 50%, rgba(216, 194, 142, .18), transparent 28%),
        linear-gradient(105deg, rgba(14, 34, 29, .98), rgba(3, 10, 8, .98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .10),
        0 12px 28px rgba(0, 0, 0, .24);
    color: #f7f0df;
    font: inherit;
    direction: ltr;
    text-align: left;
    cursor: default;
}

.mr-home-content-capsule::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(110deg, rgba(255, 255, 255, .055), transparent 42%);
    pointer-events: none;
}

.mr-home-content-capsule__media {
    position: relative;
    z-index: 1;
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(216, 194, 142, .58);
    border-radius: 22px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .16), transparent 36%),
        linear-gradient(145deg, #31554b, #0b1d18);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .12),
        0 7px 18px rgba(0, 0, 0, .28);
}

.mr-home-content-capsule__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.mr-home-content-capsule__placeholder {
    color: rgba(247, 240, 223, .92);
    font-family: "Goodspace", "Rostex", Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .09em;
}

.mr-home-content-capsule__text {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    color: inherit;
    font-size: clamp(11px, .9vw, 15px);
    font-weight: 650;
    line-height: 1.55;
    text-wrap: pretty;
}

body.rtl .mr-home-content-capsule__text {
    direction: rtl;
    text-align: right;
    font-family: var(--mr-public-persian-font, "MR Arad Persian"), "Vazirmatn", sans-serif;
}

body:not(.rtl) .mr-home-content-capsule__text {
    direction: ltr;
    text-align: left;
}

.mr-home-content-capsule-band__counter {
    display: none;
}

/*
 * Desktop geometry: use the available separator band instead of leaving the
 * capsules floating inside a large empty gap. The 20px margins are the only
 * vertical clearance outside each capsule.
 */
@media (min-width: 901px) {
    html body.mr-home-has-desktop-sidebar
    .mr-home-desktop-content-shell
    .mr-home-clean-main
    > .mr-home-clean-frame
    > .mr-home-image-panels {
        margin-bottom: 20px !important;
    }

    html body.mr-home-has-desktop-sidebar
    .mr-home-desktop-content-shell
    .mr-home-clean-main
    > .mr-home-clean-frame
    > .mr-home-twelve-card-strip
    .mr-home-gap-refine-title {
        display: none !important;
    }

    html body.mr-home-has-desktop-sidebar
    .mr-home-desktop-content-shell
    .mr-home-clean-main
    > .mr-home-clean-frame
    > .mr-home-twelve-card-strip,
    html body.mr-home-has-desktop-sidebar
    .mr-home-desktop-content-shell
    .mr-home-clean-main
    > .mr-home-clean-frame
    > .quick-proforma-section.quick-proforma-section,
    html body.mr-home-has-desktop-sidebar.mr-global-has-desktop-sidebar
    .mr-home-desktop-content-shell
    .mr-home-clean-main
    > .mr-home-clean-frame
    > .quick-proforma-section.quick-proforma-section {
        margin-top: 20px !important;
    }

    .mr-home-content-capsule-band {
        --mr-home-content-capsule-media-size: clamp(104px, 9.4vw, 158px);
        height: clamp(150px, 14vw, 210px);
        min-height: clamp(150px, 14vw, 210px);
        margin-top: 20px;
        margin-bottom: 20px;
        padding: 0;
    }

    .mr-home-content-capsule-band--before_proforma {
        /*
         * The invoice block has a legacy responsive top margin of roughly
         * 2vw. Its positive margin collapses with this band, so the matching
         * negative correction keeps the real visual clearance at <= 20px.
         */
        margin-bottom: calc(20px - 2vw);
    }

    .mr-home-content-capsule-band__rail,
    .mr-home-content-capsule {
        height: 100%;
    }

    .mr-home-content-capsule {
        grid-template-columns:
            var(--mr-home-content-capsule-media-size)
            minmax(0, 1fr);
        gap: clamp(14px, 1.3vw, 24px);
        padding: clamp(12px, 1.15vw, 18px);
    }

    .mr-home-content-capsule__media {
        width: var(--mr-home-content-capsule-media-size);
        height: var(--mr-home-content-capsule-media-size);
        border-radius: clamp(24px, 2vw, 34px);
    }

    .mr-home-content-capsule__text {
        font-size: clamp(12px, .95vw, 17px);
    }
}

@media (max-width: 900px) {
    .mr-home-content-capsule-band {
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        height: 100px;
        min-height: 100px;
        margin-right: auto;
        margin-left: auto;
        padding: 7px 0;
        overflow: hidden;
    }

    .mr-home-content-capsule-band--before_twelve {
        /*
         * Mirror the existing mobile clearance above this band (the clearance
         * after the three large image cards) below it as well.
         */
        margin-bottom: 20px;
    }

    .mr-home-content-capsule-band__rail {
        position: relative;
        display: block;
        width: 100%;
        height: 86px;
    }

    .mr-home-content-capsule {
        position: absolute;
        inset: 0;
        display: grid;
        grid-template-columns: 74px minmax(0, 1fr);
        width: 100%;
        height: 86px;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(18px) scale(.985);
        transition:
            opacity 240ms ease,
            transform 320ms cubic-bezier(.2, .8, .2, 1),
            visibility 0s linear 320ms;
        cursor: pointer;
        touch-action: manipulation;
    }

    .mr-home-content-capsule.is-mobile-active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0) scale(1);
        transition-delay: 0s;
    }

    .mr-home-content-capsule-band__counter {
        position: absolute;
        z-index: 5;
        right: 20px;
        bottom: 10px;
        display: inline-flex;
        align-items: center;
        gap: 3px;
        color: rgba(247, 240, 223, .70);
        font: 600 9px/1 Arial, sans-serif;
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mr-home-content-capsule {
        transition: none !important;
    }
}
