/* ──────────────────────────────────────────────────────────────
   Nearest Stockist Finder — distance badge
   ──────────────────────────────────────────────────────────────
   Deliberately scoped to the distance pill only.

   assets/css/nsf-frontend.css is NOT enqueued on this site — the theme
   styles the finder — so this file must not restyle anything else, or it
   will fight the theme. Keep additions here limited to .nsf-result-distance
   and its children.
   ────────────────────────────────────────────────────────────── */

.nsf-result-distance {
    --nsf-brand-green: var(--GREEN, #144923);
    --nsf-brand-orange: #f36838;
    --nsf-brand-cream: #f7ecd9;

    display: inline-flex;
    align-items: center;
    gap: 0.35em;

    margin-left: 0.45em;
    padding: 0.2em 0.7em 0.2em 0.55em;

    border: 1px solid rgba(20, 73, 35, 0.16);
    border-radius: 999px;
    background-color: rgba(20, 73, 35, 0.07);

    color: var(--nsf-brand-green);
    font-family: inherit;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: 0.01em;

    /* Keep "0.6 km away" on one line, and keep the pill upright next to
       the address regardless of the surrounding line-height. */
    white-space: nowrap;
    vertical-align: middle;

    /* The theme underlines the whole row on hover; an underlined pill
       reads as a rendering bug. */
    text-decoration: none !important;

    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nsf-result-distance .nsf-pin {
    flex: 0 0 auto;
    width: 1.05em;
    height: 1.05em;
    margin-top: -0.08em; /* optical centring against the digits */
    color: var(--nsf-brand-orange);
    transition: color 0.2s ease, transform 0.2s ease;
}

/* Hover the result row → pill goes solid brand green, pin stays orange. */
.nsf-result-row a:hover .nsf-result-distance,
.nsf-result-row a:focus-visible .nsf-result-distance {
    background-color: var(--nsf-brand-green);
    border-color: var(--nsf-brand-green);
    color: var(--nsf-brand-cream);
}

.nsf-result-row a:hover .nsf-result-distance .nsf-pin,
.nsf-result-row a:focus-visible .nsf-result-distance .nsf-pin {
    color: var(--nsf-brand-orange);
    transform: translateY(-1px);
}

/* Nearest result gets the orange accent so the top hit reads first. */
.nsf-result-row:first-child .nsf-result-distance {
    border-color: rgba(243, 104, 56, 0.45);
    background-color: rgba(243, 104, 56, 0.1);
    color: #b8451f; /* darkened #f36838 — the raw orange fails contrast on cream */
}

.nsf-result-row:first-child a:hover .nsf-result-distance,
.nsf-result-row:first-child a:focus-visible .nsf-result-distance {
    background-color: var(--nsf-brand-orange);
    border-color: var(--nsf-brand-orange);
    color: #fff;
}

.nsf-result-row:first-child a:hover .nsf-result-distance .nsf-pin,
.nsf-result-row:first-child a:focus-visible .nsf-result-distance .nsf-pin {
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .nsf-result-distance,
    .nsf-result-distance .nsf-pin {
        transition: none;
    }
    .nsf-result-row a:hover .nsf-result-distance .nsf-pin {
        transform: none;
    }
}

@media (max-width: 560px) {
    .nsf-result-distance {
        font-size: 0.75em;
        padding: 0.18em 0.6em 0.18em 0.48em;
        /* On narrow screens the row already wraps — let the pill start a
           clean line instead of dangling one word wide. */
        margin-left: 0;
        margin-top: 0.15em;
    }
}
