/* ORDINARY_MOTION_OCT31 ORDINARY_MOTION_NOV1 BRANCH_HOVER_NOV1: shared motion for ordinary themes. */
@media (prefers-reduced-motion: no-preference) {
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) {
        --md-ui-ease: cubic-bezier(.22,1,.36,1);
    }

    /* Keep hover movement independent of the old instant-opening transform reset. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) #cases-grid .case-card {
        translate: 0 0;
        transition: opacity .6s ease, translate .65s var(--md-ui-ease),
            transform .6s var(--md-ui-ease), border-color .4s ease, box-shadow .5s ease !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) #cases-grid .case-card:not(.catalog-card-pending):is(:hover,:focus-visible) {
        translate: 0 -3px;
    }

    /* Set the starting position immediately, including for offscreen cards. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) #cases-grid .catalog-card-pending,
    html[data-halloween]:not([data-reduced-motion]) #cases-grid .catalog-card-pending {
        translate: 0 14px;
        transition: none !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) #cases-grid .case-img-box > img {
        transition: scale .8s var(--md-ui-ease), filter .5s ease, opacity .45s ease !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-branch-link {
        transition: background-color .55s ease, border-color .55s ease,
            box-shadow .65s ease, color .35s ease, filter .45s ease;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-branch-icon {
        transition: scale .8s var(--md-ui-ease), filter .55s ease;
    }

    /* Keep these on the resting state so pointer exit and quick reversals also ease. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-branch-link > .md-branch-emblem {
        transition: transform .9s var(--md-ui-ease), opacity .65s ease, filter .55s ease;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) #cases-grid .case-btn {
        transition: background-position .65s ease, background-color .35s ease,
            color .3s ease, border-color .35s ease, filter .4s ease,
            transform .45s var(--md-ui-ease), box-shadow .45s ease;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(
        .nav-links a, .nav-actions > a, .nav-actions > button,
        .profile-v2-page .pv2-profile-action, .profile-v2-page .pv2-deposit-btn,
        .profile-v2-page .bonus-promo-submit, .upgrade-page .upgrade-icon,
        .upgrade-page .bottom-panel-header button, .upgrade-page .bottom-panel-header select,
        .case-v2-page .case-v2-info-btn, .case-v2-page .case-v2-fav-btn
    ) {
        transition: background-color .3s ease, color .3s ease, border-color .35s ease,
            box-shadow .4s ease, opacity .3s ease, transform .4s var(--md-ui-ease);
    }

    /* Explicit paint/motion properties keep layout and game timing independent. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) body :is(button, a, [role="button"]):not(.case-card, .case-branch-link) {
        transition: background-color .35s ease, background-position .75s ease,
            color .3s ease, border-color .4s ease, box-shadow .5s ease,
            opacity .3s ease, filter .45s ease, transform .5s var(--md-ui-ease),
            translate .5s var(--md-ui-ease), scale .5s var(--md-ui-ease), rotate .4s var(--md-ui-ease) !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(input, select, textarea) {
        transition: background-color .35s ease, color .3s ease, border-color .4s ease,
            box-shadow .45s ease, opacity .3s ease !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(
        .case-v2-item, .upgrade-item-card, .pv2-item-card,
        .pv2-card, .pv2-best-drop, .deposit-method, .deposit-v3-amount-box,
        .auth-card, .payment-status-card
    ) {
        transition: background-color .35s ease, color .3s ease, border-color .4s ease,
            box-shadow .5s ease, opacity .35s ease, transform .6s var(--md-ui-ease) !important;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(
        .nav-png-icon, .nav-tile-icon, .header-icon-link > svg,
        .live-item-icon-img, .md-price-order svg
    ) {
        transition: transform .6s var(--md-ui-ease), scale .6s var(--md-ui-ease),
            filter .45s ease, opacity .3s ease;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(.deposit-quick-amounts button, .deposit-method) :is(b, span, small),
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-branch-text :is(b, small) {
        transition: color .3s ease, opacity .3s ease;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .mobile-drawer {
        transition: transform .5s var(--md-ui-ease);
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(.mobile-drawer-overlay, .theme-cursor-glow) {
        transition: opacity .35s ease;
    }

    /* Use scale for hover so the hero's independent floating animation can continue. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-v2-page:not(.md-case-motion-off) .case-v2-image-wrap > .case-v2-image {
        transition: transform .8s var(--md-ui-ease), scale .8s var(--md-ui-ease),
            filter .5s ease, opacity .4s ease !important;
    }

    @media (hover: hover) and (pointer: fine) {
        html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .case-v2-page:not(.md-case-motion-off) .case-v2-image-wrap:hover > .case-v2-image {
            scale: 1.025;
        }
    }

    /* Existing page/dialog entrances retain their names and staggered delays. */
    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(
        .profile-v2-page > .profile-v2-title, .profile-v2-grid > *,
        .history-page > .history-title, .history-page > .history-tabs,
        .history-page > .history-content, .case-v2-page > .case-v2-header,
        .case-v2-page > .case-v2-section-title, .case-v2-page > .case-v2-items,
        .auth-page > .auth-card, .payment-status-card,
        .upgrade-page > .upgrade-title, .upgrade-page > .upgrade-main > *,
        .upgrade-page > .upgrade-bottom > .upgrade-bottom-panel,
        .modal-overlay > .modal-content
    ) {
        animation-duration: .65s;
        animation-timing-function: var(--md-ui-ease);
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) .pv2-settings-panel.active {
        animation: mdOrdinaryPanelEntrance .4s var(--md-ui-ease) backwards;
    }

    html:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]):not([data-quality="performance"]) :is(.case-branch-nav, .case-search-shell) {
        animation: mdOrdinaryPanelEntrance .65s var(--md-ui-ease) backwards;
    }
}

@keyframes mdOrdinaryPanelEntrance {
    from { opacity: 0; translate: 0 8px; }
    to { opacity: 1; translate: 0 0; }
}

/* Older catalogue !important rules otherwise beat the site's motion setting. */
html:not([data-halloween]):not([data-theme="orange"]):is([data-reduced-motion], [data-quality="performance"]) :is(
    #cases-grid .case-card, #cases-grid .case-img-box > img,
    #cases-grid .case-btn, #cases-grid .md-case-outline path, .case-branch-icon, .case-branch-link
) {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html:not([data-halloween]):not([data-theme="orange"]) :is(
        #cases-grid .case-card, #cases-grid .case-img-box > img,
        #cases-grid .case-btn, #cases-grid .md-case-outline path, .case-branch-icon, .case-branch-link
    ) {
        transition: none !important;
    }
}

html[data-page-scrolling]:not([data-halloween]):not([data-theme="orange"]) #cases-grid .case-card:not(:hover,:focus-within) .md-case-spark,
html[data-page-scrolling]:not([data-halloween]):not([data-theme="orange"]) #cases-grid .case-btn::before,
html[data-page-scrolling]:not([data-halloween]):not([data-theme="orange"]) #cases-grid .case-card::after {
    animation-play-state: paused !important;
}
html[data-page-scrolling]:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]) #cases-grid:not(.is-catalog-switching) .case-card.catalog-revealed {
    transition-property: opacity, translate !important;
}
html[data-page-scrolling]:not([data-halloween]):not([data-theme="orange"]):not([data-reduced-motion]) #cases-grid:not(.is-catalog-switching) .case-img-box > img {
    transition: none !important;
}
