/* Iridescent foil: add class "hm-foil" to any card or banner (it needs a border-radius of its own, or none).
   assets/js/foil.js adds the layers and moves them with the pointer and the scroll position:
     --foil-shift / --foil-y-shift  where the colour band sits     --shine-angle    direction of the bands
     --glare-x / --glare-y          pointer spot                   --shine-opacity  strength
   The band is navy #1B3A5F -> orange #E85D04 with their own light tints, so the reflection stays on brand.
   Every layer sits above the content with a blend mode and pointer-events: none, so text and links are untouched. */
.hm-foil {
    --foil-navy: #1B3A5F;
    --foil-orange: #E85D04;
    --foil-orange-tint: #FFC79E;
    --foil-navy-tint: #A9BFDA;
    --foil-shift: 0%;
    --foil-y-shift: 0%;
    --glare-x: 50%;
    --glare-y: 50%;
    --shine-angle: 135deg;
    --shine-opacity: .62;
    position: relative;
    isolation: isolate;
}
.hm-foil > .hm-foil-layer {
    position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
    transition: opacity .35s ease;
}

/* Colour film: a wide navy/orange band that slides across as you scroll */
.hm-foil > .hm-foil-film {
    background: linear-gradient(var(--shine-angle),
        transparent 18%,
        rgba(232, 93, 4, .55) 30%,
        rgba(255, 199, 158, .75) 38%,
        rgba(255, 255, 255, .55) 44%,
        rgba(169, 191, 218, .7) 51%,
        rgba(27, 58, 95, .6) 60%,
        transparent 74%);
    background-size: 280% 280%;
    background-position: calc(100% - var(--foil-shift)) calc(50% + var(--foil-y-shift));
    /* multiply: product photos sit on white, where soft-light/screen would show nothing */
    mix-blend-mode: multiply;
    opacity: calc(var(--shine-opacity) * .38);
}

/* Fine holographic lines riding on the film */
.hm-foil > .hm-foil-shine {
    background: repeating-linear-gradient(var(--shine-angle),
        transparent 0 7%, rgba(255, 255, 255, .5) 8.5%, transparent 10%,
        transparent 13%, rgba(255, 199, 158, .45) 14%, transparent 15.5%);
    background-size: 220% 220%;
    background-position: var(--foil-shift) var(--foil-y-shift);
    mix-blend-mode: screen;
    opacity: calc(var(--shine-opacity) * .55);
}

/* Glare that follows the pointer, only while hovered */
.hm-foil > .hm-foil-glare {
    background: radial-gradient(circle at var(--glare-x) var(--glare-y), rgba(255, 226, 204, .45) 0%, rgba(255, 226, 204, .12) 25%, transparent 50%);
    mix-blend-mode: screen;
    opacity: 0;
}

/* Iridescent rim */
.hm-foil > .hm-foil-edge {
    padding: 2px;
    background: linear-gradient(var(--shine-angle), var(--foil-navy), var(--foil-orange), var(--foil-orange-tint), #fff, var(--foil-navy-tint), var(--foil-navy), var(--foil-orange));
    background-size: 300% 300%;
    background-position: var(--foil-shift) var(--foil-y-shift);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: .75;
}

.hm-foil.is-foil-active > .hm-foil-film { opacity: calc(var(--shine-opacity) * .6); }
.hm-foil.is-foil-active > .hm-foil-shine { opacity: calc(var(--shine-opacity) * .8); }
.hm-foil.is-foil-active > .hm-foil-glare { opacity: 1; }
.hm-foil.is-foil-active > .hm-foil-edge { opacity: 1; }

/* Captions and badges stay above the foil so they keep full contrast */
.hm-foil .hero-showcase-item .cap, .hm-foil .hm-star-badge { z-index: 5; }

/* Where foil is on, it replaces the gold sheen of the best-product cards */
.best-card.hm-foil::before { display: none; }
.best-card.hm-foil { box-shadow: 0 26px 50px -26px rgba(0, 0, 0, .7); }
.best-card.hm-foil:hover { box-shadow: 0 34px 60px -26px rgba(0, 0, 0, .8); }
.product-card.is-featured.hm-foil { box-shadow: 0 18px 40px -24px rgba(27, 58, 95, .55) !important; }

@media (prefers-reduced-motion: reduce) {
    .hm-foil > .hm-foil-layer { transition: none; }
    .hm-foil > .hm-foil-glare { display: none; }
}
