/*
 * Live design effects: button gradients and hover lift, card borders and hover glow, tinted section backgrounds, focus rings.
 * Loaded after the theme only when the active Brand Theme preset has "Live design effects" ticked, and before the admin's
 * Custom CSS, so it can still be overridden there. Everything uses the theme colour variables (--primary, --primary-dark,
 * --primary-light, --primary-rgb, --secondary, --bg, --border), so it follows whichever palette is active.
 */
:root {
    --ld-ease: cubic-bezier(.2, .7, .2, 1);
    --ld-radius: 8px;
    --ld-glow: 0 8px 22px rgba(var(--primary-rgb), .22);
    --ld-tint: var(--bg);
    --ld-line: var(--border, #e5e5e5);
}

@supports (color: color-mix(in srgb, red, blue)) {
    :root {
        --ld-tint: color-mix(in srgb, var(--primary) 6%, var(--bg));
        --ld-line: color-mix(in srgb, var(--primary) 18%, var(--border, #e5e5e5));
    }
}

/* ── Buttons: filled ─────────────────────────────────────────────── */
.btn-buy-now,
.btn-order,
.btn-view-all,
.btn-load-more {
    background-image: linear-gradient(135deg, var(--primary-light), var(--primary) 55%, var(--primary-dark));
    transition: transform .2s var(--ld-ease), box-shadow .2s var(--ld-ease), filter .2s ease;
}

.btn-buy-now:hover,
.btn-order:hover,
.btn-view-all:hover,
.btn-load-more:hover {
    background-image: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: var(--ld-glow);
}

.btn-buy-now:active,
.btn-order:active,
.btn-view-all:active,
.btn-load-more:active {
    transform: translateY(0) scale(.98);
    box-shadow: none;
}

/* ── Buttons: outline (they fill with the gradient on hover) ─────── */
.btn-add-cart,
.btn-cart {
    transition: background .2s ease, color .2s ease, transform .2s var(--ld-ease), box-shadow .2s var(--ld-ease);
}

.btn-add-cart:hover,
.btn-cart:hover {
    background-image: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: var(--ld-glow);
}

.btn-add-cart:active,
.btn-cart:active {
    transform: translateY(0) scale(.98);
    box-shadow: none;
}

/* ── Cards: soft border, lift + glow + image zoom on hover ───────── */
.product-card,
.category-menu-card,
.vendor-card {
    border-color: var(--ld-line);
    border-radius: var(--ld-radius);
    transition: border-color .25s ease, box-shadow .25s var(--ld-ease), transform .25s var(--ld-ease);
}

.product-card:hover,
.category-menu-card:hover,
.vendor-card:hover {
    border-color: var(--primary);
    box-shadow: var(--ld-glow);
    transform: translateY(-3px);
}

.product-card .product-thumb img {
    transition: transform .45s var(--ld-ease);
}

.product-card:hover .product-thumb img {
    transform: scale(1.05);
}

/* ── "Shop by" tiles: they were hard-coded purple; follow the theme instead ── */
.home-shopby {
    background: var(--ld-tint);
}

.home-shopby-card {
    background: linear-gradient(135deg, var(--ld-tint), var(--bg));
    border-color: var(--ld-line);
    transition: transform .25s var(--ld-ease), box-shadow .25s var(--ld-ease), border-color .25s ease;
}

.home-shopby-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--ld-glow);
}

.home-shopby-label {
    color: var(--secondary);
}

.home-shopby-card.has-img .home-shopby-label {
    color: #fff;
}

.home-shopby-card.is-logo {
    background: #fff;
}

/* ── Badges ──────────────────────────────────────────────────────── */
.deal-badge {
    background-image: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
}

/* ── Colours that flow left to right ─────────────────────────────── */
/* The gradient starts and ends on the same colour and is 2x the element width, so the loop has no visible jump. */
@keyframes rb-flow {
    from { background-position: 200% 50%; }
    to   { background-position: 0% 50%; }
}

.header-category-bar,
.top-bar,
.notice-ticker,
.hot-deal-head,
.flash-sale-panel {
    background-image: linear-gradient(90deg, var(--primary-dark), var(--primary) 25%, var(--primary-light) 50%, var(--primary) 75%, var(--primary-dark));
    background-size: 200% 100%;
    animation: rb-flow 18s linear infinite;
}

.btn-buy-now,
.btn-order {
    background-image: linear-gradient(90deg, var(--primary), var(--primary-light) 50%, var(--primary));
    background-size: 200% 100%;
    animation: rb-flow 7s linear infinite;
}

.btn-buy-now:hover,
.btn-order:hover {
    background-image: linear-gradient(90deg, var(--primary-dark), var(--primary) 50%, var(--primary-dark));
    animation-duration: 2.4s; /* the colours speed up when the pointer is on the button */
}

/* ── Keyboard focus and text selection ───────────────────────────── */
:where(a, button, input, select, textarea):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background: rgba(var(--primary-rgb), .22);
}

/* ── Respect "reduce motion" ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .header-category-bar, .top-bar, .notice-ticker, .hot-deal-head, .flash-sale-panel, .btn-buy-now, .btn-order {
        animation: none;
    }

    .btn-buy-now, .btn-order, .btn-view-all, .btn-load-more, .btn-add-cart, .btn-cart,
    .product-card, .category-menu-card, .vendor-card, .home-shopby-card, .product-card .product-thumb img {
        transition: none;
    }

    .btn-buy-now:hover, .btn-order:hover, .btn-view-all:hover, .btn-load-more:hover, .btn-add-cart:hover, .btn-cart:hover,
    .product-card:hover, .category-menu-card:hover, .vendor-card:hover, .home-shopby-card:hover,
    .product-card:hover .product-thumb img {
        transform: none;
    }
}
