/* Explore cards block, following the GSTHR design system (tokens/*.css).
   Each value falls back to the design-system default until the tokens are loaded globally.
   The block only holds the cards; the section heading is composed from separate blocks.
   Text sits on the left with the illustration beside it on the right. */
.explore-cards {
    --ec-heading: var(--text-heading, #222);
    --ec-body: var(--text-secondary, #626262);
    --ec-brand: var(--text-brand, #c53030);
    --ec-link-hover: var(--text-link-hover, #a92727);
    --ec-card: var(--surface-card, #fff);
    --ec-tint: rgba(197, 48, 48, 0.05);
    --ec-arrow-bg: var(--mdb-primary-highlight-bg, #f8e8e8);
    --ec-arrow-fg: var(--text-brand, #c53030);
    --ec-border: var(--border-default, #dededa);
    --ec-border-strong: var(--border-strong, #c9c9c4);
    --ec-shadow: var(--shadow-card, 0 1px 2px rgba(34, 34, 34, 0.04));
    --ec-shadow-hover: 0 12px 32px rgba(34, 34, 34, 0.08);
    --ec-focus: var(--focus-ring, 0 0 0 2px #f7f7f5, 0 0 0 4px #c53030);
    --ec-ease: var(--ease-out, cubic-bezier(0.22, 0.61, 0.36, 1));
    --ec-duration: var(--duration-base, 200ms);
}

/* Dark band variant (Advanced settings → theme). */
.explore-cards[data-bs-theme="dark"],
[data-bs-theme="dark"] .explore-cards {
    --ec-heading: var(--text-on-dark, #f5f4f1);
    --ec-body: var(--text-on-dark-secondary, #b8b6b0);
    --ec-brand: #e46a6a;
    --ec-link-hover: #fff;
    --ec-card: var(--surface-dark-raised, #2b2b2b);
    --ec-tint: rgba(228, 106, 106, 0.08);
    --ec-arrow-bg: rgba(228, 106, 106, 0.16);
    --ec-arrow-fg: #f0a0a0;
    --ec-border: var(--border-on-dark, rgba(255, 255, 255, 0.16));
    --ec-border-strong: rgba(255, 255, 255, 0.32);
    --ec-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.explore-cards {
    container: explore-cards / inline-size;
}

.explore-cards > link {
    display: none;
}

.explore-cards__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 24px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.explore-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--ec-card);
    border: 1px solid var(--ec-border);
    overflow: hidden;
    border-radius: 16px;
    box-shadow: var(--ec-shadow);
    transition:
        box-shadow var(--ec-duration) var(--ec-ease),
        border-color var(--ec-duration) var(--ec-ease);
}

/* Two columns: text on the left, illustration beside it on the right. */
.explore-card__body {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-self: stretch;
    gap: 8px;
    min-width: 0;
}

/* Reaches into the card's right padding, so the illustration gets as much room as possible. */
.explore-card__media {
    display: flex;
    flex: 0 0 55%;
    align-self: stretch;
    min-height: 200px;
    margin: -12px -24px -12px 0;
    background: radial-gradient(closest-side, var(--ec-tint), transparent);
}

/* Fills the column; best with illustrations trimmed to their content (no transparent margin). */
.explore-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform calc(var(--ec-duration) * 2) var(--ec-ease);
}

.explore-card__title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.explore-card__link {
    color: var(--ec-heading);
    text-decoration: none;
}

/* Makes the whole card clickable while keeping a single link for screen readers. */
.explore-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.explore-card__link:focus-visible {
    outline: none;
}

.explore-card:has(.explore-card__link:focus-visible) {
    box-shadow: var(--ec-focus);
}

.explore-card__desc {
    margin: 0;
    color: var(--ec-body);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.explore-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    color: var(--ec-brand);
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
}

.explore-card__arrow {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ec-arrow-bg);
    color: var(--ec-arrow-fg);
    transition:
        background-color var(--ec-duration) var(--ec-ease),
        color var(--ec-duration) var(--ec-ease);
}

.explore-card__arrow i {
    transition: transform var(--ec-duration) var(--ec-ease);
}

.explore-card:hover {
    border-color: var(--ec-border-strong);
    box-shadow: var(--ec-shadow-hover);
}

.explore-card:hover .explore-card__link {
    color: var(--ec-link-hover);
}

.explore-card:hover .explore-card__img {
    transform: scale(1.05);
}

.explore-card:hover .explore-card__arrow {
    background: var(--ec-brand);
    color: #fff;
}

.explore-card:hover .explore-card__arrow i {
    transform: translateX(2px);
}

/* Between one card per row (under 2 × 340px + gap) and three side-by-side cards
   (3 × 340px + gaps), each card stacks its title, illustration, description and link,
   so the cards still fit three in a row. Narrower blocks keep one side-by-side card
   per row. */
@container explore-cards (704px <= width < 1068px) {
    .explore-cards__grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
        gap: 16px;
    }

    .explore-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 20px;
    }

    /* Lets the title and link take part in the card's own ordering. */
    .explore-card__body {
        display: contents;
    }

    .explore-card__title {
        order: 1;
        font-size: 1.125rem;
    }

    .explore-card__media {
        order: 2;
        flex: none;
        height: 170px;
        min-height: 0;
        margin: 0;
    }

    /* After the illustration, so the illustrations line up across the row. */
    .explore-card__desc {
        order: 3;
        font-size: 0.875rem;
    }

    .explore-card__cta {
        order: 4;
        padding-top: 4px;
    }
}

/* One card per row: the earlier, more even split, so the description has room. */
@container explore-cards (width < 704px) {
    .explore-card__media {
        flex-basis: 50%;
        min-height: 180px;
        margin: -8px -8px -8px 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .explore-card__img,
    .explore-card__arrow,
    .explore-card__arrow i {
        transition: none;
    }

    .explore-card:hover .explore-card__img,
    .explore-card:hover .explore-card__arrow i {
        transform: none;
    }
}
