/* ==========================================================================
   Hub motion layer
   Animations, shadows and transitions for mnory.com pages that do not use
   the Books/store/freelance skins (home hub, 404/500, generic pages).
   Scoped to body:not(.sk-site) so skinned sites are untouched.
   ========================================================================== */

body:not(.sk-site) {
    --hm-accent: var(--mnory-accent, var(--mn-brand, #2563eb));
    --hm-ease: cubic-bezier(.22, .61, .36, 1);
    --hm-spring: cubic-bezier(.34, 1.56, .64, 1);
    --hm-ring: 0 0 0 4px color-mix(in srgb, var(--hm-accent) 18%, transparent);
    --hm-glow: 0 10px 26px -10px color-mix(in srgb, var(--hm-accent) 55%, transparent);
    --hm-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 8px rgba(15, 23, 42, .05);
    --hm-shadow-md: 0 4px 10px rgba(15, 23, 42, .06), 0 12px 28px rgba(15, 23, 42, .08);
    --hm-shadow-lg: 0 10px 24px rgba(15, 23, 42, .10), 0 24px 56px rgba(15, 23, 42, .12);
}
body.dark-mode:not(.sk-site) {
    --hm-shadow-sm: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 8px rgba(0, 0, 0, .25);
    --hm-shadow-md: 0 4px 12px rgba(0, 0, 0, .35), 0 12px 28px rgba(0, 0, 0, .35);
    --hm-shadow-lg: 0 10px 26px rgba(0, 0, 0, .45), 0 24px 56px rgba(0, 0, 0, .45);
}

/* ---------- Keyframes ---------- */
@keyframes hm-fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes hm-pop     { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes hm-drop    { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hm-bar     { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes hm-float   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- Home sections: scroll reveal ---------- */
body:not(.sk-site) .home-section { animation: hm-fade-up .7s var(--hm-ease) both; }
@supports (animation-timeline: view()) {
    body:not(.sk-site) .home-section {
        animation: hm-fade-up linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 35%;
    }
}

body:not(.sk-site) .sec-title { position: relative; }
body:not(.sk-site) .sec-title::after {
    content: ""; display: block; width: 44px; height: 3px; margin-top: .45rem;
    border-radius: 3px; background: var(--hm-accent);
    transform-origin: left center; animation: hm-bar .8s .2s var(--hm-ease) both;
}
[dir="rtl"] body:not(.sk-site) .sec-title::after,
body[dir="rtl"]:not(.sk-site) .sec-title::after { transform-origin: right center; }

body:not(.sk-site) .sec-label { transition: color .25s var(--hm-ease), letter-spacing .25s var(--hm-ease); }
body:not(.sk-site) .sec-link { transition: color .2s var(--hm-ease), gap .2s var(--hm-ease); }
body:not(.sk-site) .sec-link :is(i, .material-icons, .material-symbols-outlined, svg) {
    display: inline-block; transition: transform .25s var(--hm-spring);
}
body:not(.sk-site) .sec-link:hover :is(i, .material-icons, .material-symbols-outlined, svg) { transform: translateX(4px); }
[dir="rtl"] body:not(.sk-site) .sec-link:hover :is(i, .material-icons, .material-symbols-outlined, svg) { transform: translateX(-4px); }

/* ---------- Staggered card grids ---------- */
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > * {
    animation: hm-pop .55s var(--hm-ease) both;
}
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > :nth-child(2) { animation-delay: .06s; }
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > :nth-child(3) { animation-delay: .12s; }
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > :nth-child(4) { animation-delay: .18s; }
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > :nth-child(5) { animation-delay: .24s; }
body:not(.sk-site) :is(.quickpaths-grid, .account-hub-grid, .home-platform .swiper-wrapper) > :nth-child(n+6) { animation-delay: .3s; }

/* ---------- Hub cards ---------- */
body:not(.sk-site) :is(.platform-card, .quickpath-card, .account-hub-card) {
    box-shadow: var(--hm-shadow-sm);
    transition: transform .35s var(--hm-ease), box-shadow .35s var(--hm-ease), border-color .35s var(--hm-ease);
    will-change: transform;
}
body:not(.sk-site) :is(.platform-card, .quickpath-card, .account-hub-card):hover {
    transform: translateY(-5px);
    box-shadow: var(--hm-shadow-lg);
    border-color: color-mix(in srgb, var(--hm-accent) 30%, transparent);
}
body:not(.sk-site) :is(.platform-card, .quickpath-card, .account-hub-card):active {
    transform: translateY(-1px) scale(.99);
    box-shadow: var(--hm-shadow-md);
    transition-duration: .12s;
}
body:not(.sk-site) :is(.platform-icon, .quickpath-icon, .ah-icon) { transition: transform .4s var(--hm-spring), box-shadow .3s var(--hm-ease); }
body:not(.sk-site) :is(.platform-card, .quickpath-card, .account-hub-card):hover :is(.platform-icon, .quickpath-icon, .ah-icon) {
    transform: scale(1.1) rotate(-4deg);
    box-shadow: var(--hm-glow);
}

/* ---------- Stats bar ---------- */
body:not(.sk-site) .stats-bar { box-shadow: var(--hm-shadow-md); transition: box-shadow .3s var(--hm-ease); }
body:not(.sk-site) .stats-bar > * { transition: transform .3s var(--hm-ease); }
body:not(.sk-site) .stats-bar > *:hover { transform: translateY(-3px); }
body:not(.sk-site) .stat-num { animation: hm-pop .7s .15s var(--hm-spring) both; }

/* ---------- Tabs / swiper ---------- */
body:not(.sk-site) .section-tab {
    transition: background-color .25s var(--hm-ease), color .25s var(--hm-ease), box-shadow .25s var(--hm-ease), transform .2s var(--hm-ease);
}
body:not(.sk-site) .section-tab:hover { transform: translateY(-1px); box-shadow: var(--hm-shadow-sm); }
body:not(.sk-site) .section-tab.active { box-shadow: var(--hm-glow); }

body:not(.sk-site) .swiper-pagination-bullet { transition: width .3s var(--hm-ease), background-color .3s var(--hm-ease), opacity .3s; }
body:not(.sk-site) .swiper-pagination-bullet-active { width: 22px; border-radius: 6px; background: var(--hm-accent); }
body:not(.sk-site) :is(.swiper-button-next, .swiper-button-prev) {
    transition: transform .25s var(--hm-spring), box-shadow .25s var(--hm-ease), opacity .2s;
}
body:not(.sk-site) :is(.swiper-button-next, .swiper-button-prev):hover { transform: scale(1.08); box-shadow: var(--hm-shadow-md); }

/* ---------- Books shelf covers ---------- */
body:not(.sk-site) .home-book-cover {
    box-shadow: var(--hm-shadow-md);
    transition: transform .45s var(--hm-ease), box-shadow .45s var(--hm-ease);
    transform-origin: left center;
}
body:not(.sk-site) .home-book-cover img { transition: transform .6s var(--hm-ease); }
body:not(.sk-site) :is(a, div):hover > .home-book-cover,
body:not(.sk-site) .home-book-cover:hover {
    transform: perspective(700px) rotateY(-8deg) translateY(-4px);
    box-shadow: 12px 18px 34px -10px rgba(15, 23, 42, .35);
}
body:not(.sk-site) .home-book-cover:hover img { transform: scale(1.04); }

body:not(.sk-site) .pm-price-chip { transition: transform .25s var(--hm-spring), box-shadow .25s var(--hm-ease); }
body:not(.sk-site) .pm-price-chip:hover { transform: scale(1.06); box-shadow: var(--hm-shadow-sm); }

/* ---------- Error pages (404 / 500) ---------- */
body:not(.sk-site) .category-detail-section .account-card {
    box-shadow: var(--hm-shadow-lg);
    animation: hm-pop .6s var(--hm-ease) both;
}
body:not(.sk-site) .category-detail-section .account-card :is(.material-icons, .material-symbols-outlined, i):first-child {
    display: inline-block; animation: hm-float 3.2s ease-in-out infinite;
}

/* ---------- Generic components ---------- */
body:not(.sk-site) main .btn {
    transition: transform .2s var(--hm-ease), box-shadow .25s var(--hm-ease), background-color .25s var(--hm-ease), border-color .25s var(--hm-ease), color .25s var(--hm-ease);
}
body:not(.sk-site) main .btn:hover { transform: translateY(-2px); box-shadow: var(--hm-shadow-md); }
body:not(.sk-site) main .btn:active { transform: translateY(0) scale(.98); box-shadow: var(--hm-shadow-sm); transition-duration: .1s; }
body:not(.sk-site) main .btn-primary:hover { box-shadow: var(--hm-glow); }
body:not(.sk-site) main .btn:focus-visible { box-shadow: var(--hm-ring); }

body:not(.sk-site) main .card { transition: transform .35s var(--hm-ease), box-shadow .35s var(--hm-ease); }
body:not(.sk-site) main .card:hover { box-shadow: var(--hm-shadow-md); }

body:not(.sk-site) main :is(.form-control, .form-select, textarea, input[type="text"], input[type="email"], input[type="password"], input[type="search"]) {
    transition: border-color .2s var(--hm-ease), box-shadow .2s var(--hm-ease), background-color .2s var(--hm-ease);
}
body:not(.sk-site) main :is(.form-control, .form-select, textarea, input):focus {
    border-color: var(--hm-accent);
    box-shadow: var(--hm-ring);
}

body:not(.sk-site) main .alert { box-shadow: var(--hm-shadow-sm); animation: hm-drop .4s var(--hm-ease) both; }
body:not(.sk-site) main .page-link { transition: transform .2s var(--hm-ease), box-shadow .2s var(--hm-ease), background-color .2s, color .2s; }
body:not(.sk-site) main .page-link:hover { transform: translateY(-2px); box-shadow: var(--hm-shadow-sm); }

body:not(.sk-site) .dropdown-menu.show { box-shadow: var(--hm-shadow-lg); animation: hm-drop .22s var(--hm-ease) both; }
body:not(.sk-site) .dropdown-item { transition: background-color .2s var(--hm-ease), padding .2s var(--hm-ease), color .2s; }
body:not(.sk-site) .modal-content { box-shadow: var(--hm-shadow-lg); }
body:not(.sk-site) .modal.show .modal-dialog { animation: hm-pop .3s var(--hm-ease) both; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    body:not(.sk-site) *,
    body:not(.sk-site) *::before,
    body:not(.sk-site) *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: .01ms !important;
    }
}
