/* ============================================
   Listing card price ribbon (shared)
   Used by: RTO listings, Business listings
   ============================================ */

/* Listing photos are mostly navy / orange / white, so the tag uses gold with
   navy text (~8.7:1 contrast) to stand apart from whatever image is behind it. */
.price-ribbon {
    --ribbon-bg: #ffc21a;
    --ribbon-shine: #fff4c2;
    color: #062c50;
    letter-spacing: .02em;
    /* Wide gradient with a light band in the middle; sliding it across the
       ribbon gives the shine without needing a pseudo-element */
    background: linear-gradient(110deg,
            var(--ribbon-bg) 40%, var(--ribbon-shine) 50%, var(--ribbon-bg) 60%) var(--ribbon-bg);
    background-size: 250% 100%;
    background-position: 100% 0;
    /* One shape: the swallowtail end is cut with clip-path instead of the theme's
       separate ::before tip, so the shine and height cover the whole tag */
    padding: .3rem 1.5rem .3rem .85rem;
    line-height: 1.3;
    clip-path: polygon(0 0, 100% 0, calc(100% - .7rem) 50%, 100% 100%, 0 100%);
    box-shadow: none;
    animation: ribbon-shine 4s ease-in-out 1.2s infinite;
}

.price-ribbon::before {
    display: none;
}

/* clip-path would cut off a shadow on the tag itself, so it goes on the overlay */
.card-img-overlay:has(> .price-ribbon) {
    filter: drop-shadow(0 .2rem .4rem rgba(0, 0, 0, .45));
}

.price-ribbon a {
    color: inherit;
    text-decoration: none;
}

.price-ribbon:has(a:hover) {
    --ribbon-bg: #062c50;
    --ribbon-shine: #062c50;
    color: #fff;
}

/* Sweep once, then rest for the remaining time */
@keyframes ribbon-shine {
    0% { background-position: 100% 0; }
    35%, 100% { background-position: 0 0; }
}

/* Slide in from behind the card edge once the card has revealed. The first
   card isn't a reveal-item, so it paints in place with no delay. */
.js-reveal .reveal-item .price-ribbon {
    transform: translateX(-100%);
    transition: transform .6s cubic-bezier(.22, .61, .36, 1) .35s;
}

.js-reveal .reveal-item.is-visible .price-ribbon {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {

    .price-ribbon {
        animation: none;
    }

    .js-reveal .reveal-item .price-ribbon {
        transform: none;
        transition: none;
    }
}
