/*
 * "Barakali Juma" link in the site header. One 3s loop: the icon turns around its
 * vertical axis with a glow, then a shine runs across the name. The header layout loads this
 * file only while the link is shown as Barakali Juma.
 */
.header__nav__link.barakali-juma-link img {
    animation: barakali-juma-turn 3s linear infinite;
}

@keyframes barakali-juma-turn {
    0%, 26% {
        transform: perspective(90px) rotateY(0deg) scale(1);
        filter: drop-shadow(0 0 0 rgba(0, 107, 255, 0)) brightness(1);
        animation-timing-function: ease-in;
    }
    43% {
        transform: perspective(90px) rotateY(90deg) scale(1);
        filter: drop-shadow(0 0 5px rgba(0, 107, 255, 0.9)) brightness(1.4);
    }
    /* Edge-on at both angles, so the icon comes back unmirrored without a visible jump. */
    43.01% {
        transform: perspective(90px) rotateY(-90deg) scale(1);
        filter: drop-shadow(0 0 5px rgba(0, 107, 255, 0.9)) brightness(1.4);
        animation-timing-function: ease-out;
    }
    60% {
        transform: perspective(90px) rotateY(0deg) scale(1.14);
        filter: drop-shadow(0 0 4px rgba(0, 107, 255, 0.6)) brightness(1.15);
        animation-timing-function: ease-in-out;
    }
    74%, 100% {
        transform: perspective(90px) rotateY(0deg) scale(1);
        filter: drop-shadow(0 0 0 rgba(0, 107, 255, 0)) brightness(1);
    }
}

/* Without background-clip the name stays plain text instead of turning invisible. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .header__nav__link.barakali-juma-link span {
        background-image: linear-gradient(105deg, currentColor 47%, #fff 50%, currentColor 53%);
        background-size: 300% 100%;
        background-position: 100% 0;
        background-repeat: no-repeat;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        animation: barakali-juma-shine 3s linear infinite;
    }
}

/* The gradient is three names wide, so sliding it moves the light band across the letters. */
@keyframes barakali-juma-shine {
    0%, 50% {
        background-position: 100% 0;
    }
    93%, 100% {
        background-position: 0 0;
    }
}

/*
 * Product cards that carry the Barakali Juma badge get a frame drawn from the rings of the
 * icon: blue, white, navy. The mask keeps only that band of the element, so the light bar
 * inside it shows on the frame and never on the card content.
 */
.product__item .barakali-juma-frame {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9;
    padding: 7px;
    border-radius: inherit;
    box-shadow: inset 0 0 0 3px #006bff, inset 0 0 0 5px #fff, inset 0 0 0 7px #143469;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* Without the mask the bar would cross the whole card, so it is added only where the mask works. */
@supports ((-webkit-mask-composite: xor) or (mask-composite: exclude)) {
    .product__item .barakali-juma-frame::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        /* A white core with a light-blue halo, so on a white card it reads as light and not as a gap in the lines. */
        background: linear-gradient(105deg, rgba(110, 200, 255, 0) 28%, rgba(110, 200, 255, 0.9) 42%, #fff 50%, rgba(110, 200, 255, 0.9) 58%, rgba(110, 200, 255, 0) 72%);
        transform: translateX(-100%);
        animation: barakali-juma-frame-shine 3s linear infinite;
    }
}

/* Only the transform moves, so dozens of cards shine without repainting the page. */
@keyframes barakali-juma-frame-shine {
    0%, 45% {
        transform: translateX(-100%);
    }
    90%, 100% {
        transform: translateX(100%);
    }
}

@media (max-width: 575px) {
    .product__item .barakali-juma-frame {
        padding: 5px;
        box-shadow: inset 0 0 0 2px #006bff, inset 0 0 0 3px #fff, inset 0 0 0 5px #143469;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header__nav__link.barakali-juma-link img,
    .header__nav__link.barakali-juma-link span,
    .product__item .barakali-juma-frame::before {
        animation: none;
    }
}
