/**
 * Circular score indicator for the homepage pick cards.
 *
 * Scoped to .abp5-ngc-card--pick, so the comparison table and the review cards
 * keep the plain "9.5/10" text they have always used.
 *
 * Pure CSS: a conic-gradient painted into a ring by a radial-gradient mask.
 * Nothing is rasterised, so it stays sharp at any device pixel ratio and needs
 * no image asset. The filled proportion comes from --ngc-score, which the
 * rating helper derives from the operator's real rating - the percentage is
 * never hard-coded.
 *
 * The ring uses currentColor. Every site's palette already sets a green on
 * .abp5-ngc-rating, so this single file gives each site its own accent.
 */

.abp5-ngc-card--pick .abp5-ngc-card-head {
    justify-content: center;
    /* claw back the old text line's leading so the card grows as little as
       possible now that the rating is a disc rather than one line of type */
    margin: -2px 0 -4px;
}

.abp5-ngc-card--pick .abp5-ngc-card-rating {
    display: block;
    line-height: 0;
    white-space: normal;
}

.abp5-ngc-card--pick .abp5-ngc-rating {
    --ngc-score: 0;          /* 0-100, set inline from the real rating */
    --ngc-ring: 5px;         /* ring thickness */
    --ngc-track: #E4E8EF;    /* unfilled portion */

    position: relative;
    isolation: isolate;      /* keeps the ring behind the digits, above the card */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    line-height: 1;
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.abp5-ngc-card--pick .abp5-ngc-rating::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 50%;
    background: conic-gradient(
        currentColor 0 calc(var(--ngc-score) * 1%),
        var(--ngc-track) calc(var(--ngc-score) * 1%) 100%
    );
    -webkit-mask: radial-gradient(farthest-side,
        transparent calc(100% - var(--ngc-ring)), #000 calc(100% - var(--ngc-ring)));
            mask: radial-gradient(farthest-side,
        transparent calc(100% - var(--ngc-ring)), #000 calc(100% - var(--ngc-ring)));
}

/* "/10" sits directly under the score, inside the disc */
.abp5-ngc-card--pick .abp5-ngc-rating-max {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

/* Pending entries keep their text treatment - no empty ring */
.abp5-ngc-card--pick .abp5-ngc-rating-na {
    display: inline-block;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .abp5-ngc-card--pick .abp5-ngc-rating {
        width: 58px;
        height: 58px;
        font-size: 18px;
    }
}

/* Browsers without conic-gradient fall back to the original inline text */
@supports not (background: conic-gradient(#000 0 50%, #fff 50% 100%)) {
    .abp5-ngc-card--pick .abp5-ngc-rating {
        display: inline;
        width: auto;
        height: auto;
        font-size: inherit;
    }
    .abp5-ngc-card--pick .abp5-ngc-rating::before { content: none; }
    .abp5-ngc-card--pick .abp5-ngc-rating-max {
        display: inline;
        margin: 0;
        font-size: .8em;
    }
    .abp5-ngc-card--pick .abp5-ngc-card-head { justify-content: flex-end; margin: 0; }
}
