.mmdb-discover {
    --mmdb-discover-gap: 24px;
    --mmdb-discover-radius: 16px;

    position: relative;
    width: 100%;
}

/*
 * One shared animated colour field for the entire Discover block.
 * Because this lives on the grid rather than on each card, the same
 * "lava" blobs drift continuously across card boundaries.
 */
.mmdb-discover__grid {
    position: relative;

    display: grid;
    width: 100%;

    grid-template-columns:
        repeat(
            var(--mmdb-discover-columns, 3),
            minmax(0, 1fr)
        );

    gap: var(--mmdb-discover-gap);

    isolation: isolate;
}

/*
 * One shared animated lava field across the entire grid.
 * The mask exposes the field only inside card rectangles, so the page
 * background and inter-card gaps remain completely clean.
 */







.mmdb-discover-card {
    position: relative;

    z-index: 1;

    display: block;
    width: 100%;
    height: var(--mmdb-discover-card-height, 320px);

    overflow: hidden;

    background: var(--color-bg-raised, #17161a);
    color: var(--color-text-heading, #ffffff);

    border: 1px solid var(--color-border-main, #2d2d2d);
    border-radius: var(--mmdb-discover-radius);

    text-decoration: none;
}

/*
 * Animated lava overlay, clipped safely by each card.
 * Large gradient fields and synchronized animation keep the visual language
 * coherent across cards without leaking into gaps or creating mask artifacts.
 */
.mmdb-discover-card::before {
    content: "";

    position: absolute;
    inset: -12%;

    z-index: 2;

    pointer-events: none;

    background:
        radial-gradient(
            42% 58% at 12% 24%,
            rgba(181, 112, 222, 0.95) 0%,
            rgba(141, 90, 182, 0.70) 28%,
            rgba(96, 72, 118, 0.24) 54%,
            transparent 74%
        ),
        radial-gradient(
            50% 64% at 58% 76%,
            rgba(221, 148, 224, 0.90) 0%,
            rgba(163, 107, 174, 0.62) 30%,
            rgba(104, 79, 116, 0.20) 58%,
            transparent 76%
        ),
        radial-gradient(
            40% 56% at 92% 18%,
            rgba(137, 92, 211, 0.93) 0%,
            rgba(109, 79, 167, 0.64) 34%,
            rgba(78, 65, 106, 0.20) 60%,
            transparent 78%
        ),
        radial-gradient(
            36% 50% at 28% 88%,
            rgba(235, 171, 224, 0.78) 0%,
            rgba(171, 121, 165, 0.50) 38%,
            transparent 72%
        );

    background-repeat: no-repeat;

    background-size:
        150% 160%,
        170% 175%,
        145% 155%,
        160% 150%;

    background-position:
        -30% -20%,
        40% 10%,
        120% -15%,
        5% 110%;

    opacity: 0.72;

    mix-blend-mode: screen;

    filter:
        blur(18px)
        saturate(1.18)
        contrast(1.04);

    transform:
        translate3d(0, 0, 0)
        scale(1.06);

    animation:
        mmdb-discover-card-lava
        12s
        cubic-bezier(0.45, 0.05, 0.55, 0.95)
        infinite
        alternate;

    will-change:
        transform,
        opacity,
        background-position;
}

.mmdb-discover-card:nth-child(2n)::before {
    animation-delay: -3s;
}

.mmdb-discover-card:nth-child(3n)::before {
    animation-delay: -6s;
}

@keyframes mmdb-discover-card-lava {
    0% {
        background-position:
            -30% -20%,
            40% 10%,
            120% -15%,
            5% 110%;

        transform:
            translate3d(-6%, 2%, 0)
            scale(1.06);

        opacity: 0.66;
    }

    25% {
        background-position:
            0% 5%,
            20% -10%,
            90% 10%,
            30% 85%;

        transform:
            translate3d(8%, -5%, 0)
            scale(1.12);

        opacity: 0.76;
    }

    50% {
        background-position:
            25% -10%,
            55% 20%,
            60% -12%,
            8% 75%;

        transform:
            translate3d(-2%, 8%, 0)
            scale(1.04);

        opacity: 0.70;
    }

    75% {
        background-position:
            50% 8%,
            75% -8%,
            35% 18%,
            40% 105%;

        transform:
            translate3d(10%, 4%, 0)
            scale(1.10);

        opacity: 0.80;
    }

    100% {
        background-position:
            70% -5%,
            95% 15%,
            10% -8%,
            15% 88%;

        transform:
            translate3d(-5%, -7%, 0)
            scale(1.07);

        opacity: 0.74;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mmdb-discover-card::before {
        animation: none;
    }
}


/*
 * Animated colour field visible ONLY inside cards.
 * Every card samples the same fixed viewport-space gradient, so the blobs
 * appear to continue naturally from one card into the next.
 */




.mmdb-discover-card__image {
    position: absolute;
    inset: 0;

    z-index: 0;

    display: block;
    width: 100%;
    height: 100%;

    object-fit: cover;

    transform: scale(1.001);

    transition:
        transform 260ms ease,
        filter 260ms ease;
}

.mmdb-discover-card__image--empty {
    background:
        radial-gradient(
            circle at 25% 20%,
            var(--color-bg-hover, #242424),
            transparent 45%
        ),
        var(--color-bg-raised, #17161a);
}

.mmdb-discover-card__shade {
    position: absolute;
    inset: 0;

    z-index: 1;

    background:
        linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.03) 0%,
            rgba(0, 0, 0, 0.08) 48%,
            rgba(0, 0, 0, 0.22) 100%
        );

    pointer-events: none;
}

.mmdb-discover-card__overlay {
    position: absolute;
    inset: 0;

    z-index: 4;

    display: flex;

    padding: 0;

    pointer-events: none;
}

.mmdb-discover-card__overlay--top-left {
    align-items: stretch;
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--top-left .mmdb-discover-card__text {
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--top-center {
    align-items: stretch;
    justify-content: center;
}

.mmdb-discover-card__overlay--top-center .mmdb-discover-card__text {
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--top-right {
    align-items: stretch;
    justify-content: flex-end;
}

.mmdb-discover-card__overlay--top-right .mmdb-discover-card__text {
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--middle-left {
    align-items: stretch;
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--middle-left .mmdb-discover-card__text {
    justify-content: center;
}

.mmdb-discover-card__overlay--middle-center {
    align-items: stretch;
    justify-content: center;
}

.mmdb-discover-card__overlay--middle-center .mmdb-discover-card__text {
    justify-content: center;
}

.mmdb-discover-card__overlay--middle-right {
    align-items: stretch;
    justify-content: flex-end;
}

.mmdb-discover-card__overlay--middle-right .mmdb-discover-card__text {
    justify-content: center;
}

.mmdb-discover-card__overlay--bottom-left {
    align-items: stretch;
    justify-content: flex-start;
}

.mmdb-discover-card__overlay--bottom-left .mmdb-discover-card__text {
    justify-content: flex-end;
}

.mmdb-discover-card__overlay--bottom-center {
    align-items: stretch;
    justify-content: center;
}

.mmdb-discover-card__overlay--bottom-center .mmdb-discover-card__text {
    justify-content: flex-end;
}

.mmdb-discover-card__overlay--bottom-right {
    align-items: stretch;
    justify-content: flex-end;
}

.mmdb-discover-card__overlay--bottom-right .mmdb-discover-card__text {
    justify-content: flex-end;
}

/*
 * Text treatment:
 * no box, no border. The deep surface colour is strongest behind the
 * text and fades smoothly to transparent toward the right.
 */
.mmdb-discover-card__text {
    display: flex;

    width:
        min(
            var(--mmdb-discover-text-width, 72%),
            100%
        );

    height: 100%;

    padding:
        clamp(18px, 2vw, 26px);

    flex-direction: column;
    justify-content: inherit;

    background:
        linear-gradient(
            90deg,
            color-mix(
                in srgb,
                var(--color-bg-main, #0e0e10) 94%,
                transparent
            ) 0%,
            color-mix(
                in srgb,
                var(--color-bg-main, #0e0e10) 84%,
                transparent
            ) 42%,
            color-mix(
                in srgb,
                var(--color-bg-main, #0e0e10) 48%,
                transparent
            ) 72%,
            transparent 100%
        );

    border: 0;
    border-radius: 0;

    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.mmdb-discover-card__title {
    margin: 0;

    color:
        var(
            --color-text-heading,
            #ffffff
        );

    font-size:
        clamp(
            20px,
            2.1vw,
            30px
        );

    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.mmdb-discover-card__summary {
    margin: 8px 0 0;

    color:
        var(
            --color-text-body,
            #d2d2d2
        );

    font-size:
        clamp(
            16px,
            1.2vw,
            20px
        );

    font-weight: 500;
    line-height: 1.4;
}

.mmdb-discover-card[href]:hover,
.mmdb-discover-card[href]:focus-visible {
    color:
        var(
            --color-text-heading,
            #ffffff
        );

    text-decoration: none;
}

.mmdb-discover-card[href]:hover
.mmdb-discover-card__image,
.mmdb-discover-card[href]:focus-visible
.mmdb-discover-card__image {
    transform: scale(1.035);
    filter: brightness(1.04);
}

.mmdb-discover-card[href]:focus-visible {
    outline:
        2px solid
        var(
            --color-primary,
            #836fff
        );

    outline-offset: 3px;
}




@media (max-width: 1100px) {
    .mmdb-discover-card__summary {
        font-size: 18px;
        line-height: 1.45;
    }

    .mmdb-discover__grid {
        grid-template-columns:
            repeat(
                min(
                    var(--mmdb-discover-columns, 3),
                    2
                ),
                minmax(0, 1fr)
            );
    }
}

@media (max-width: 800px) {
    .mmdb-discover {
        --mmdb-discover-gap: 16px;
    }

    .mmdb-discover-card__summary {
        font-size: 16px;
        line-height: 1.45;
    }

    .mmdb-discover__grid {
        grid-template-columns:
            minmax(0, 1fr);
    }

    .mmdb-discover-card__text {
        width:
            min(
                var(
                    --mmdb-discover-text-width,
                    72%
                ),
                100%
            );
    }
}
