/**
 * Haris Battery & Solar — animations.css (added in 1.3.0)
 *
 * All decorative motion lives here so it can be tuned or removed in one
 * place. Everything that moves is wrapped in
 * `prefers-reduced-motion: no-preference`: visitors who ask their device
 * for less motion get the normal static site. Scroll-reveal only hides
 * things when assets/js/animations.js has added `.hbs-anim` to <html>,
 * so with JavaScript off nothing is ever hidden.
 */

/* ---- Loading feedback (functional, so always on) ---------------------- */
@keyframes hbs-spin { to { transform: rotate(360deg); } }
.btn.is-loading::after {
    content: "";
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-left: 8px;
    vertical-align: -0.12em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: hbs-spin 0.7s linear infinite;
}
/* Slim progress bar across the top while the next page loads. */
.hbs-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0;
    background: var(--hbs-red, #d32f2f);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.6);
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
}
.hbs-progress.is-active { opacity: 1; width: 78%; transition: width 8s cubic-bezier(0.1, 0.6, 0.2, 1), opacity 0.2s; }
/* The product grid dims while filters/search fetch new results. */
.hbs-product-grid-container { transition: opacity 0.25s ease; }

@media (prefers-reduced-motion: no-preference) {

    html { scroll-behavior: smooth; }

    /* ---- Buttons ------------------------------------------------------ */
    .btn, button.btn {
        position: relative;
        overflow: hidden;
        transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
    }
    .btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18); }
    .btn:active { transform: translateY(0) scale(0.97); box-shadow: none; transition-duration: 0.08s; }
    /* A light sweep across the button on hover. */
    .btn::before {
        content: "";
        position: absolute;
        top: 0; left: -75%;
        width: 50%; height: 100%;
        background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
        transform: skewX(-20deg);
        pointer-events: none;
    }
    .btn:hover::before { left: 130%; transition: left 0.6s ease; }
    /* Tap ripple (element is added by animations.js). */
    .hbs-ripple {
        position: absolute;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.45);
        transform: scale(0);
        animation: hbs-ripple 0.6s ease-out forwards;
        pointer-events: none;
    }
    @keyframes hbs-ripple { to { transform: scale(3.2); opacity: 0; } }

    .hbs-carousel-arrow { transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease; }
    .hbs-carousel-arrow:hover:not(:disabled) { transform: scale(1.12); box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2); }
    .hbs-carousel-arrow:active:not(:disabled) { transform: scale(0.95); }
    .hbs-floating-btn { transition: transform 0.2s ease, box-shadow 0.2s ease; }
    .hbs-floating-btn:hover { transform: scale(1.12) translateY(-2px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25); }

    /* ---- Cards -------------------------------------------------------- */
    /* Room above/below the carousel row so a lifted card isn't clipped. */
    .hbs-carousel { padding-top: 8px; margin-top: -8px; }
    .product-card, .hbs-category-tile, .hbs-brand-logo, .hbs-testimonial-card, .hbs-news-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    }
    .product-card:hover, .hbs-category-tile:hover, .hbs-testimonial-card:hover, .hbs-news-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
    }
    .hbs-brand-logo:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1); }
    .product-card .product-thumb { overflow: hidden; }
    .product-card .product-thumb img { transition: transform 0.5s ease; }
    .product-card:hover .product-thumb img { transform: scale(1.07); }
    .hbs-category-tile img { transition: transform 0.4s ease; }
    .hbs-category-tile:hover img { transform: scale(1.08); }
    /* Stock / offer badges breathe slightly. */
    .hbs-offer-badge, .hbs-free-gift-badge { animation: hbs-badge-pulse 2.4s ease-in-out infinite; }
    @keyframes hbs-badge-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

    /* Product grids (shop, search, category pages) fade up on load and
       again every time the filter results are swapped in. */
    .product-grid > .product-card, .hbs-product-grid-container .product-card {
        animation: hbs-fade-up 0.5s ease both;
    }
    .product-grid > .product-card:nth-child(2), .hbs-product-grid-container .product-card:nth-child(2) { animation-delay: 0.05s; }
    .product-grid > .product-card:nth-child(3), .hbs-product-grid-container .product-card:nth-child(3) { animation-delay: 0.1s; }
    .product-grid > .product-card:nth-child(4), .hbs-product-grid-container .product-card:nth-child(4) { animation-delay: 0.15s; }
    .product-grid > .product-card:nth-child(5), .hbs-product-grid-container .product-card:nth-child(5) { animation-delay: 0.2s; }
    .product-grid > .product-card:nth-child(6), .hbs-product-grid-container .product-card:nth-child(6) { animation-delay: 0.25s; }
    .product-grid > .product-card:nth-child(n+7), .hbs-product-grid-container .product-card:nth-child(n+7) { animation-delay: 0.3s; }

    .hbs-news-grid > .hbs-news-card { animation: hbs-fade-up 0.5s ease both; }
    .hbs-news-grid > .hbs-news-card:nth-child(3n+2) { animation-delay: 0.08s; }
    .hbs-news-grid > .hbs-news-card:nth-child(3n+3) { animation-delay: 0.16s; }
    .hbs-news-thumb img { transition: transform 0.5s ease; }
    .hbs-news-card:hover .hbs-news-thumb img { transform: scale(1.06); }
    .hbs-article-hero-img { animation: hbs-fade-up 0.7s ease both; }

    /* ---- Hero text entrance ------------------------------------------ */
    .hbs-hero h1 { animation: hbs-fade-up 0.7s ease both; }
    .hbs-hero p { animation: hbs-fade-up 0.7s 0.15s ease both; }
    .hbs-hero .hbs-hero-actions { animation: hbs-fade-up 0.7s 0.3s ease both; }

    @keyframes hbs-fade-up {
        from { opacity: 0; transform: translateY(18px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* ---- Scroll reveal ------------------------------------------------- */
    .hbs-anim .hbs-reveal {
        opacity: 0;
        transform: translateY(26px);
        transition: opacity 0.7s ease, transform 0.7s ease;
        transition-delay: var(--hbs-delay, 0s);
        will-change: opacity, transform;
    }
    .hbs-anim .hbs-reveal.is-visible { opacity: 1; transform: none; will-change: auto; }
    .hbs-anim .hbs-reveal--zoom { transform: scale(0.92); }
    /* Section headings get an underline that draws itself in. */
    .hbs-section-heading-row h2::after { transform-origin: left center; }
    .hbs-anim .hbs-reveal:not(.is-visible) h2::after { transform: scaleX(0); }
    .hbs-section-heading-row h2::after { transition: transform 0.7s 0.2s ease; }

    /* "Why choose us" icons pop in, then lift on hover. */
    .hbs-why-item .dashicons { transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
    .hbs-why-item:hover .dashicons { transform: scale(1.25) rotate(-6deg); }

    /* ---- Header / cart ------------------------------------------------ */
    .site-header { transition: box-shadow 0.3s ease; }
    .site-header.is-scrolled { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); }
    .hbs-cart-count.is-bump { animation: hbs-bump 0.5s ease; }
    @keyframes hbs-bump { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.5); } }
}
