/**
 * Black Friday-check v4 - "Zo lees je de prijsmeter": the animated example (templates/black-friday/meter-uitleg.php).
 * The default is the STATIC END STATE (lowest price: green face, green sentence, label at EUR 89, all steps lit): that is what a
 * visitor sees without JavaScript and with prefers-reduced-motion. meter-uitleg.js adds .bf-ma--anim; only then, and only when the
 * visitor accepts motion, the 8 s loop is switched on. It runs while .bf-ma--speel is set (the section is in view) and is paused
 * otherwise. Colours come from theme-vars.css only.
 */

.bf-ma {
    --bf-ma-ps: paused;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    margin-top: 16px;
}

.bf-ma--speel { --bf-ma-ps: running; }

.bf-ma__kaart {
    background: var(--oppervlak);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 16px 14px;
    box-shadow: 0 10px 30px color-mix(in srgb, var(--text-primary) 8%, transparent);
    min-width: 0;
}

.bf-ma__kop { display: flex; gap: 14px; align-items: center; }
.bf-ma__gezicht { flex: none; }
.bf-ma__tekst { min-width: 0; }

.bf-ma__kast { fill: color-mix(in srgb, var(--brand) 12%, var(--oppervlak)); stroke: var(--text-primary); stroke-width: 2.6; }
.bf-ma__streep { stroke: var(--brand); }
.bf-ma__f { opacity: 0; }
.bf-ma__f--nee path { stroke: var(--signal-block); }
.bf-ma__f--neutraal circle { fill: var(--text-primary); }
.bf-ma__f--neutraal path { stroke: var(--brand); }
.bf-ma__oog { stroke: var(--text-primary); }
.bf-ma__mond { stroke: var(--signal-go); }
.bf-ma__f--blij { opacity: 1; }

.bf-ma__product { font-size: 0.8125rem; color: var(--text-zwak); }

.bf-ma__zinnen { position: relative; height: 28px; margin-top: 2px; }

.bf-ma__zin {
    position: absolute;
    left: 0;
    top: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 1rem;
    white-space: nowrap;
    opacity: 0;
}

.bf-ma__zin--duur { color: var(--signal-block); }
.bf-ma__zin--gewoon { color: var(--brand); }
.bf-ma__zin--laag { color: var(--signal-go); opacity: 1; }

.bf-ma__meter { position: relative; margin-top: 46px; }

.bf-ma__balk {
    display: grid;
    grid-template-columns: 20% 50% 30%;
    gap: 3px;
    height: 14px;
    border-radius: 99px;
    overflow: hidden;
}

.bf-ma__z { display: block; }
.bf-ma__z1 { background: var(--signal-go); }
.bf-ma__z2 { background: color-mix(in srgb, var(--text-zwak) 45%, transparent); }
.bf-ma__z3 { background: var(--signal-block); }

.bf-ma__glans {
    position: absolute;
    left: 0;
    top: 0;
    width: 20%;
    height: 14px;
    border-radius: 99px 0 0 99px;
}

.bf-ma__pil {
    position: absolute;
    top: -38px;
    left: 7%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bf-ma__prijs {
    position: relative;
    display: block;
    background: var(--text-primary);
    color: var(--oppervlak);
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.9375rem;
    font-weight: 800;
    min-width: 66px;
    height: 28px;
    text-align: center;
}

.bf-ma__prijs b { position: absolute; left: 0; right: 0; top: 4px; opacity: 0; }
.bf-ma__prijs .bf-ma__p3 { opacity: 1; }

.bf-ma__pil i {
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 8px solid var(--text-primary);
}

.bf-ma__as { display: flex; justify-content: space-between; gap: 8px; font-size: 0.75rem; margin-top: 8px; color: var(--text-zwak); }
.bf-ma__as b { color: var(--signal-go); }

.bf-ma__zones {
    display: grid;
    grid-template-columns: 20% 50% 30%;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 4px;
    text-align: center;
}

.bf-ma__zones span:nth-child(1) { color: var(--signal-go); }
.bf-ma__zones span:nth-child(2) { color: var(--text-zwak); }
.bf-ma__zones span:nth-child(3) { color: var(--signal-block); }

.bf-ma__stappen { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: bfs; }

.bf-ma__s {
    position: relative;
    padding: 12px 14px 12px 48px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--oppervlak);
    font-size: 0.9375rem;
    line-height: 1.45;
}

.bf-ma__s::before {
    counter-increment: bfs;
    content: counter(bfs);
    position: absolute;
    left: 12px;
    top: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 800;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bf-ma__s b { color: var(--text-primary); }

@media (max-width: 760px) {
    .bf-ma__zin { font-size: 0.875rem; }
    .bf-ma__as span:nth-child(2) { display: none; }
}

@media (min-width: 761px) {
    .bf-ma { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 28px; }
    .bf-ma__kaart { padding: 22px 24px 18px; }
}

/* The loop: only with script (it adds .bf-ma--anim) and only when motion is accepted. */
@media (prefers-reduced-motion: no-preference) {
    .bf-ma--anim .bf-ma__f { animation: 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__f--nee { animation-name: bf-ma-f1; }
    .bf-ma--anim .bf-ma__f--neutraal { animation-name: bf-ma-f2; }
    .bf-ma--anim .bf-ma__f--blij { animation-name: bf-ma-f3; }
    .bf-ma--anim .bf-ma__zin { animation: 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__zin--duur { animation-name: bf-ma-f1; }
    .bf-ma--anim .bf-ma__zin--gewoon { animation-name: bf-ma-f2; }
    .bf-ma--anim .bf-ma__zin--laag { animation-name: bf-ma-f3; }
    .bf-ma--anim .bf-ma__prijs b { animation: 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__p1 { animation-name: bf-ma-f1; }
    .bf-ma--anim .bf-ma__p2 { animation-name: bf-ma-f2; }
    .bf-ma--anim .bf-ma__p3 { animation-name: bf-ma-f3; }
    .bf-ma--anim .bf-ma__balk { animation: bf-ma-teken 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__glans { animation: bf-ma-puls 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__pil { animation: bf-ma-schuif 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__zones { animation: bf-ma-zones 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__s { animation: 8s infinite both var(--bf-ma-ps); }
    .bf-ma--anim .bf-ma__s1 { animation-name: bf-ma-s1; }
    .bf-ma--anim .bf-ma__s2 { animation-name: bf-ma-s2; }
    .bf-ma--anim .bf-ma__s3 { animation-name: bf-ma-s3; }
}

@keyframes bf-ma-teken { 0% { clip-path: inset(0 100% 0 0 round 99px); } 10%, 100% { clip-path: inset(0 0 0 0 round 99px); } }
@keyframes bf-ma-zones { 0%, 8% { opacity: 0; } 14%, 100% { opacity: 1; } }
@keyframes bf-ma-schuif { 0%, 14% { left: 90%; opacity: 0; } 18% { opacity: 1; } 18%, 36% { left: 90%; } 48%, 60% { left: 42%; } 74%, 100% { left: 7%; } }
@keyframes bf-ma-f1 { 0%, 16% { opacity: 0; } 20%, 40% { opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes bf-ma-f2 { 0%, 44% { opacity: 0; } 50%, 64% { opacity: 1; } 70%, 100% { opacity: 0; } }
@keyframes bf-ma-f3 { 0%, 68% { opacity: 0; } 76%, 97% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bf-ma-puls {
    0%, 74% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal-go) 0%, transparent); }
    80% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--signal-go) 35%, transparent); }
    88%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal-go) 0%, transparent); }
}
@keyframes bf-ma-s1 { 0%, 12% { opacity: 1; border-color: var(--brand); } 16%, 100% { opacity: 0.45; border-color: var(--border); } }
@keyframes bf-ma-s2 { 0%, 16% { opacity: 0.45; } 20%, 60% { opacity: 1; border-color: var(--brand); } 66%, 100% { opacity: 0.45; border-color: var(--border); } }
@keyframes bf-ma-s3 { 0%, 64% { opacity: 0.45; } 70%, 97% { opacity: 1; border-color: var(--brand); } 100% { opacity: 0.45; } }
