/* ==========================================================================
   WOW VISUALS — trzy animacje w sekcji "Uczciwe zasady" (2026-11-15)

   1. LICZNIK       — "0,6 s" dolicza się od 2,4 s do 0,6 s przy wejściu w kadr
   2. LIGHTHOUSE    — cztery pierścienie 100/100/100/100 rysują się kolejno
   3. WODOSPAD      — paski ładowania: my 0,6 s vs konkurencja 4,1 s

   ZASADY:
   - wszystko na transform/opacity (kompozytor, bez layout thrash),
   - stany startowe ustawia JS (klasa .wow-armed), więc bez JS treść widać,
   - prefers-reduced-motion: wszystko widoczne od razu, zero animacji,
   - IntersectionObserver, animacja raz na wejście.
   ========================================================================== */

/* --- Wspólne: elementy ukryte tylko gdy JS przejął kontrolę ------------- */
.wow-armed .wow-fade {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
    transition:
        opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.wow-armed .wow-fade.wow-in {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* --- 1. LICZNIK --------------------------------------------------------- */
.metric-counter {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    font-variant-numeric: tabular-nums;
    /* rezerwa szerokości, żeby cyfry nie przesuwały layoutu przy liczeniu */
    min-width: 4.2ch;
}

.metric-counter .mc-value {
    font-family: var(--font-mono);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.metric-counter .mc-unit {
    font-size: 0.72em;
    opacity: 0.75;
}

/* Podkreślenie postępu — wypełnia się razem z licznikiem */
.metric-bar {
    display: block;
    height: 3px;
    margin-top: 8px;
    border-radius: 2px;
    background: rgba(250, 250, 191, 0.14);
    overflow: hidden;
}

.metric-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 2px;
    background: linear-gradient(90deg, #fafabf, #c0ecbf);
    transition: width 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.wow-in .metric-bar > span,
.metric-bar.wow-in > span {
    width: var(--bar-fill, 96%);
}

/* --- 2. LIGHTHOUSE — cztery pierścienie -------------------------------- */
.lh-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.lh-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.lh-ring {
    position: relative;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
}

.lh-ring svg {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
    overflow: visible;
}

.lh-ring circle {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
}

.lh-ring .lh-track {
    stroke: rgba(250, 250, 191, 0.12);
}

.lh-ring .lh-fill {
    stroke: #4ade80;
    stroke-dasharray: 138.2; /* 2πr, r=22 */
    stroke-dashoffset: 138.2;
    transition: stroke-dashoffset 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

.lh-ring.lh-in .lh-fill {
    stroke-dashoffset: calc(138.2 * (1 - var(--lh-score, 1)));
}

.lh-num {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 800;
    color: #4ade80;
    font-variant-numeric: tabular-nums;
}

.lh-label {
    font-size: 9px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

/* --- 3. WODOSPAD — porównanie czasów ----------------------------------- */
.wf-chart {
    margin-top: 16px;
    display: grid;
    gap: 9px;
}

.wf-row {
    display: grid;
    grid-template-columns: 62px 1fr 46px;
    align-items: center;
    gap: 8px;
}

.wf-name {
    font-size: 9.5px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--text-muted);
    line-height: 1.2;
}

.wf-track {
    position: relative;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.wf-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.wf-row.wf-in .wf-bar {
    width: var(--wf-width, 100%);
}

.wf-row.is-us .wf-bar {
    background: linear-gradient(90deg, #c0ecbf, #4ade80);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.4);
}

.wf-row.is-them .wf-bar {
    background: linear-gradient(90deg, #8a5a52, #e06c5a);
    opacity: 0.85;
}

.wf-value {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
}

.wf-row.is-them .wf-value {
    color: #e06c5a;
}

.wf-row.is-us .wf-value {
    color: #4ade80;
}

/* etykieta "6.8× szybciej" */
.wf-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 11px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: #14160f;
    background: linear-gradient(90deg, #c0ecbf, #4ade80);
}

/* --- Dostępność: wszystko widoczne, zero animacji ---------------------- */
@media (prefers-reduced-motion: reduce) {
    .wow-armed .wow-fade {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .metric-bar > span {
        width: var(--bar-fill, 96%) !important;
        transition: none !important;
    }

    .lh-ring .lh-fill {
        stroke-dashoffset: calc(138.2 * (1 - var(--lh-score, 1))) !important;
        transition: none !important;
    }

    .wf-row .wf-bar {
        width: var(--wf-width, 100%) !important;
        transition: none !important;
    }
}

/* --- Mobile: pierścienie mniejsze -------------------------------------- */
@media (max-width: 480px) {
    .lh-grid {
        gap: 6px;
    }

    .lh-ring {
        width: 44px;
        height: 44px;
    }

    .lh-num {
        font-size: 12px;
    }

    .lh-label {
        font-size: 8px;
    }

    .wf-row {
        grid-template-columns: 54px 1fr 40px;
    }
}
