/*
 * Mode Encore Front — shared visual controls
 *
 * A small, explicit compatibility layer loaded after the existing component
 * styles. It centralises the new editorial radius hierarchy while preserving
 * the validated markup, layout and interactions from Core 1.0.
 */

/* Large structural surfaces: restrained, but still distinct from cards. */
:is(
    .mev2-home-hero,
    .mev2-hub-hero,
    .mev2-tax-hero,
    .mev2-search-hero,
    .mev2-game-hero,
    .mev2-assistant-shell,
    .mev2-generic-page,
    .mev2-site-footer__inner,
    .mev2-tax-filters
) {
    border-radius: var(--mev2-radius-panel) !important;
}

/* Content, catalogue and recommendation cards. */
:is(
    .mev2-game-card__visual,
    .mev2-home-platform-card,
    .mev2-home-genre-card,
    .mev2-home-list-card,
    .mev2-hub-feature-card,
    .mev2-hub-card,
    .mev2-search-tax-card,
    .mev2-search-start__grid > a,
    .mev2-discovery-card,
    .mev2-game-section,
    .mev2-game-info-card,
    .mev2-game-links-card,
    .mev2-game-profile__item,
    .mev2-game-fit__card,
    .mev2-game-media__item,
    .mev2-game-play__recommendation,
    .mev2-game-play__card,
    .mev2-game-more__card,
    .mev2-assistant-live,
    .mev2-assistant-profile-grid > button,
    .mev2-assistant-tax-grid > button,
    .mev2-assistant-platform-row > button,
    .mev2-assistant-result,
    .mev2-assistant-empty,
    .mev2-search-empty,
    .mev2-empty-state,
    .mev2-results-loading,
    body.mef-native-v2 .mef-native-error
) {
    border-radius: var(--mev2-radius) !important;
}

/* Buttons, fields, navigation blocks and compact controls. */
:is(
    .mev2-site-tool,
    .mev2-site-menu-toggle,
    .mev2-site-nav__link,
    .mev2-site-search,
    .mev2-mobile-search,
    .mev2-mobile-actions a,
    .mev2-mobile-nav,
    .mev2-home-search,
    .mev2-home-search button,
    .mev2-hub-tools,
    .mev2-hub-search,
    .mev2-hub-search button,
    .mev2-hub-alphabet button,
    .mev2-search-form,
    .mev2-search-form button,
    .mev2-search-pagination a.page-numbers,
    .mev2-search-pagination span.page-numbers,
    .mev2-search-empty a,
    .mev2-tax-nav__item,
    .mev2-tax-filters__close,
    .mev2-filter-option,
    .mev2-filter-reset,
    .mev2-sort select,
    .mev2-mobile-filter-btn,
    .mev2-load-more,
    .mev2-assistant-segments,
    .mev2-assistant-btn,
    .mev2-lightbox button
) {
    border-radius: var(--mev2-radius-control) !important;
}

/* Icon and media frames follow the same, slightly tighter geometry. */
:is(
    .mev2-home-platform-card__icon,
    .mev2-home-genre-card__icon,
    .mev2-hub-card__icon,
    .mev2-search-tax-card__icon,
    .mev2-search-start__icon,
    .mev2-tax-hero__icon,
    .mev2-tax-nav__icon,
    .mev2-discovery-card__icon,
    .mev2-game-hero__boxart,
    .mev2-game-profile__icon,
    .mev2-game-fit__title > span,
    .mev2-assistant-choice__icon,
    .mev2-assistant-tax-icon,
    .mev2-assistant-result__rank,
    .mev2-generic-page__content img,
    .mev2-lightbox > img
) {
    border-radius: var(--mev2-radius-sm) !important;
}

/* Platform pictograms are supplied as white SVGs. Give them a sufficiently
 * dense accent surface instead of letting them disappear on pale cards. */
.mev2-taxonomy-page--plateforme .mev2-tax-hero__icon,
.mev2-taxonomy-page--plateforme .mev2-tax-nav__icon {
    background: color-mix(in srgb, var(--mev2-tax-accent, var(--mev2-action)) 72%, var(--mev2-icon-base)) !important;
}

.mev2-taxonomy-page--plateforme .mev2-tax-hero__icon img,
.mev2-taxonomy-page--plateforme .mev2-tax-nav__icon img {
    opacity: 1;
    filter: none;
}

.mev2-home-platform-card__icon,
.mev2-hub-page--plateforme .mev2-hub-card__icon,
.mev2-search-tax-card--plateforme .mev2-search-tax-card__icon {
    border-color: transparent !important;
    background: color-mix(in srgb, var(--mev2-card-accent, var(--mev2-result-accent, var(--mev2-action))) 72%, var(--mev2-icon-base)) !important;
}

.mev2-home-platform-card__icon img,
.mev2-hub-page--plateforme .mev2-hub-card__icon img,
.mev2-search-tax-card--plateforme .mev2-search-tax-card__icon img {
    opacity: 1;
    filter: none;
}

/* True semantic pills stay fully rounded: badges, chips, toggles and states. */
:is(
    .mev2-game-card__platform,
    .mev2-game-card__reco,
    .mev2-home-hero__quicklinks a,
    .mev2-home-hero__quicklinks span,
    .mev2-hub-hero__stats > span,
    .mev2-hub-feature-card__label,
    .mev2-hub-category-filters button,
    .mev2-search-filter,
    .mev2-search-filter small,
    .mev2-scale-options button,
    .mev2-toggle-row i,
    .mev2-mobile-filter-btn i,
    .mev2-game-hero__reco,
    .mev2-game-hero__meta > span,
    .mev2-game-hero__meta > a,
    .mev2-game-play__badge,
    .mev2-game-pills a,
    .mev2-assistant-summary span,
    .mev2-assistant-result__reasons i
) {
    border-radius: var(--mev2-radius-pill) !important;
}

/* Drawers retain a square anchored edge and a subtle outer radius. */
@media (min-width: 1001px) {
    .mev2-tax-filters {
        border-radius: 0 var(--mev2-radius-panel) var(--mev2-radius-panel) 0 !important;
    }
}

/* Sharper surfaces benefit from quieter borders instead of large curvature. */
:is(
    .mev2-home-platform-card,
    .mev2-home-genre-card,
    .mev2-home-list-card,
    .mev2-hub-feature-card,
    .mev2-hub-card,
    .mev2-search-tax-card,
    .mev2-search-start__grid > a,
    .mev2-discovery-card,
    .mev2-game-section,
    .mev2-game-info-card,
    .mev2-game-links-card,
    .mev2-assistant-result
) {
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease;
}

:is(
    .mev2-home-platform-card,
    .mev2-home-genre-card,
    .mev2-home-list-card,
    .mev2-hub-feature-card,
    .mev2-hub-card,
    .mev2-search-tax-card,
    .mev2-search-start__grid > a,
    .mev2-discovery-card
):hover {
    border-color: var(--mev2-purple-border);
}

@media (max-width: 700px) {
    :is(
        .mev2-home-hero,
        .mev2-hub-hero,
        .mev2-tax-hero,
        .mev2-search-hero,
        .mev2-game-hero,
        .mev2-assistant-shell,
        .mev2-generic-page,
        .mev2-site-footer__inner
    ) {
        border-radius: var(--mev2-radius-panel) !important;
    }
}

/* Soft pill controls; content surfaces retain their existing radius hierarchy. */
body.mef-native-v2 .mev2-sort select {
    min-height: 40px;
    border-color: transparent;
    background-color: var(--mev2-surface-alt);
    border-radius: var(--mev2-radius-pill) !important;
}
.mev2-taxonomy-page .mev2-filter-reset { border-radius: var(--mev2-radius-pill) !important; }

/* Density follows usable grid space, including the permanent navigation rail. */
.mev2-tax-results,
.mev2-search-games,
.mev2-home-section:has(> .mev2-home-games),
.mev2-related-block { container-type: inline-size; container-name: mev2-games; }

@media (min-width: 1025px) {
    @container mev2-games (min-width: 900px) {
        .mev2-game-grid,
        .mev2-search-game-grid,
        .mev2-home-games,
        .mev2-related-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    }
    @container mev2-games (min-width: 1180px) {
        .mev2-game-grid,
        .mev2-search-game-grid,
        .mev2-home-games,
        .mev2-related-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    }
}
