/*
 * Tajriba-sinov natijalari — /tajriba-sinov (views/TajribaView.js).
 *
 * Grafik ranglari:
 *   baholar  — bitta ko'k tusning uch pog'onasi (tartibli shkala: qoniqarli →
 *              yaxshi → a'lo; ochiq uchi ham oq fonda ≥ 2:1);
 *   guruhlar — tajriba ko'k (urg'u), nazorat kulrang (fon ma'lumoti).
 * Matn hech qachon ma'lumot rangida emas: rang faqat belgida (kalit, bo'lak, nuqta).
 */
.tj {
    --tj-qoniqarli: #86aaea;
    --tj-yaxshi: var(--kok);
    --tj-alo: var(--kok-3);
    --tj-tajriba: var(--kok);
    --tj-nazorat: var(--siyoh-3);
    --tj-yuza: var(--qogoz-2);
    --tj-nom: 6.5rem;                   /* qator nomi ustuni */
}

/* === HERO === */
.tj-hero { padding: clamp(2rem, 4vw, 3.5rem) 0 clamp(2.5rem, 4vw, 3.5rem); }

.tj-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(1.75rem, 4vw, 4rem);
    align-items: center;
    margin-top: 1.5rem;
}

.tj-hero__matn .eyebrow svg { width: 14px; height: 14px; }

.tj-hero__sarlavha {
    font-size: clamp(2.1rem, 3vw + 1rem, 3.9rem);
    line-height: 1.04;
    letter-spacing: -0.03em;
    margin: 1.2rem 0 1.25rem;
}

.tj-hero__matn .lead { max-width: 38rem; }

/* Asosiy raqam kartasi — naqsh: nuqtalar matritsasi + ingichka halqa */
.tj-raqam {
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: clamp(1.5rem, 2.5vw, 2.1rem);
    border-radius: var(--radius-2xl);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
    box-shadow: var(--shadow-md);
}

.tj-raqam::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -18%;
    width: 62%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 58%, rgba(var(--kok-rgb), 0.14) 59%, rgba(var(--kok-rgb), 0.14) 60%, transparent 61%),
                radial-gradient(circle, rgba(var(--kok-rgb), 0.16) 1.2px, transparent 1.6px) 0 0 / 12px 12px;
    pointer-events: none;
}

.tj-raqam > * { position: relative; }

.tj-raqam__yorliq {
    max-width: 17rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--siyoh-2);
    line-height: 1.4;
}

.tj-raqam__qiymat {
    margin: 0.35rem 0 0.2rem;
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: clamp(3.4rem, 5vw + 1rem, 5rem);
    line-height: 1;
    letter-spacing: -0.035em;
    color: var(--kok);
}

.tj-raqam__farq {
    font-size: 0.95rem;
    color: var(--siyoh-3);
}

.tj-raqam__farq b { color: var(--maydon-2); font-weight: 700; }

.tj-raqam__qiyos {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--chiziq);
    font-size: 0.92rem;
    color: var(--siyoh-2);
}

.tj-raqam__qiyos b { font-weight: 600; color: var(--siyoh-3); }

.tj-raqam__kalit {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: var(--tj-nazorat);
}

.tj-panel {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: clamp(2rem, 3.5vw, 3rem);
}

.tj-panel .korsatkich span:last-child {
    font-size: 0.86rem;
    color: var(--siyoh-3);
    line-height: 1.35;
}

/* === GRAFIK KARTASI === */
.tj-karta {
    padding: clamp(1.25rem, 2.5vw, 2rem);
    border-radius: var(--radius-2xl);
    background: var(--tj-yuza);
    border: 1px solid var(--chiziq);
    box-shadow: var(--shadow-sm);
}

.tj-afsona {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
    color: var(--siyoh-2);
}

.tj-afsona li { display: inline-flex; align-items: center; gap: 0.45rem; }

/* Belgi: to'rtburchak (bo'lak), chiziq (guruh), halqa/nuqta (bosqich) */
.tj-kalit {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: var(--r);
}

.tj-kalit--chiziq { width: 16px; height: 3px; border-radius: 2px; }

.tj-kalit--halqa,
.tj-kalit--nuqta {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--siyoh-2);
}

.tj-kalit--halqa { background: var(--tj-yuza); box-shadow: inset 0 0 0 2px var(--siyoh-2); }

/* === 100% LI YIG'MA CHIZIQLAR === */
.tj-guruh + .tj-guruh {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--qogoz-3);
}

.tj-guruh__bosh,
.tj-otm__bosh {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.75rem;
    margin-bottom: 0.75rem;
}

.tj-guruh__bosh h3,
.tj-otm__bosh h3 {
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.tj-guruh__bosh span,
.tj-otm__bosh span {
    font-size: 0.85rem;
    color: var(--siyoh-3);
}

.tj-qator,
.tj-oq {
    display: grid;
    grid-template-columns: var(--tj-nom) minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
}

.tj-qator {
    padding: 0.3rem 0;
    border-radius: var(--radius-sm);
    outline: none;
}

.tj-qator:focus-visible { box-shadow: 0 0 0 2px var(--tj-yuza), 0 0 0 4px var(--kok); }

.tj-qator__nom {
    font-size: 0.88rem;
    color: var(--siyoh-2);
}

/* Chiziq — 24px, bo'laklar orasida 2px oq tirqish, o'ng uchi yumaloq */
.tj-chiziq {
    display: flex;
    gap: 2px;
    height: 24px;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 900ms var(--ease-out) 150ms;
}

.is-visible .tj-chiziq { clip-path: inset(0 0 0 0); }
.tj-guruh .tj-qator:nth-of-type(3) .tj-chiziq { transition-delay: 300ms; }

.tj-bolak {
    position: relative;
    flex: 0 0 calc(var(--w) - 2px);
    min-width: 2px;
    display: grid;
    place-items: center;
    background: var(--r);
    transition: filter var(--duration-fast);
}

.tj-bolak:last-child { flex-grow: 1; border-radius: 0 4px 4px 0; }

.tj-bolak em {
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: #fff;
}

.tj-bolak[data-baho="qoniqarli"] em { color: var(--siyoh); }

/* Sig'magan yozuv ko'rsatilmaydi (kesilmaydi) — qiymat tooltip va jadvalda */
.tj-bolak.is-tor em { visibility: hidden; }

.tj-qator:hover .tj-bolak:not(.is-faol) { filter: saturate(0.6) opacity(0.55); }

/* O'zgarish (p.p.) — matn rangi siyoh, yo'nalish belgisi bilan */
.tj-ozgarish {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.75rem 0 0 calc(var(--tj-nom) + 0.75rem);
    padding: 0;
    list-style: none;
}

.tj-ozgarish li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-pill);
    background: var(--qogoz);
    border: 1px solid var(--chiziq);
    font-size: 0.82rem;
    color: var(--siyoh-2);
}

.tj-ozgarish .tj-kalit { width: 9px; height: 9px; border-radius: 2px; }
.tj-ozgarish b { font-weight: 700; color: var(--siyoh); font-variant-numeric: tabular-nums; }
.tj-ozgarish li[data-yon="usish"] b::before { content: '▲ '; font-size: 0.7em; color: var(--maydon); }
.tj-ozgarish li[data-yon="kamayish"] b::before { content: '▼ '; font-size: 0.7em; color: var(--siyoh-3); }

/* O'q — 0…100% belgilari */
.tj-oq { margin-top: 1.25rem; }

.tj-oq__shkala {
    position: relative;
    height: 1.1rem;
    border-top: 1px solid var(--chiziq);
}

.tj-oq__shkala i {
    position: absolute;
    top: 0.3rem;
    left: var(--x);
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 0.7rem;
    color: var(--siyoh-3);
    font-variant-numeric: tabular-nums;
}

.tj-oq__shkala i:first-child { transform: none; }
.tj-oq__shkala i:last-child { transform: translateX(-100%); }

/* === OTMLAR — GANTEL CHIZIQLARI === */
.tj-otm + .tj-otm {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--qogoz-3);
}

.tj-gantel,
.tj-oq--gantel {
    display: grid;
    grid-template-columns: var(--tj-nom) minmax(0, 1fr) 6.5rem;
    align-items: center;
    gap: 0.75rem;
}

.tj-gantel {
    --r: var(--tj-tajriba);
    padding: 0.35rem 0;
    border-radius: var(--radius-sm);
    outline: none;
}

.tj-gantel[data-guruh="nazorat"] { --r: var(--tj-nazorat); }
.tj-gantel:focus-visible { box-shadow: 0 0 0 2px var(--tj-yuza), 0 0 0 4px var(--kok); }

.tj-gantel__nom { font-size: 0.88rem; color: var(--siyoh-2); }

/* Maydon: 25/50/75% da ingichka to'r chiziqlari */
.tj-gantel__maydon {
    position: relative;
    height: 24px;
    background:
        linear-gradient(var(--qogoz-3), var(--qogoz-3)) 25% 0 / 1px 100% no-repeat,
        linear-gradient(var(--qogoz-3), var(--qogoz-3)) 50% 0 / 1px 100% no-repeat,
        linear-gradient(var(--qogoz-3), var(--qogoz-3)) 75% 0 / 1px 100% no-repeat;
}

.tj-gantel__chiziq {
    position: absolute;
    top: 50%;
    left: var(--chap);
    width: 0;
    height: 2px;
    margin-top: -1px;
    border-radius: 2px;
    background: var(--r);
    opacity: 0.55;
    transition: width 900ms var(--ease-out) 200ms;
}

.tj-gantel__nuqta {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: var(--r);
    box-shadow: 0 0 0 2px var(--tj-yuza);
}

.tj-gantel__nuqta--b {
    left: var(--b);
    background: var(--tj-yuza);
    box-shadow: inset 0 0 0 2px var(--r), 0 0 0 2px var(--tj-yuza);
}

.tj-gantel__nuqta--o {
    left: var(--b);
    transition: left 900ms var(--ease-out) 200ms;
}

.is-visible .tj-gantel__chiziq { width: var(--en); }
.is-visible .tj-gantel__nuqta--o { left: var(--o); }

.tj-gantel:hover .tj-gantel__nuqta { transform: scale(1.2); }
.tj-gantel__nuqta { transition: transform var(--duration-fast), left 900ms var(--ease-out) 200ms; }

.tj-gantel__qiymat {
    font-size: 0.88rem;
    color: var(--siyoh-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tj-gantel__qiymat b { color: var(--siyoh); font-weight: 700; }

/* === TOOLTIP === */
.tj-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    min-width: 12rem;
    max-width: 18rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    font-size: 0.84rem;
    color: var(--siyoh-2);
}

.tj-tooltip[hidden] { display: none; }

.tj-tooltip__sarlavha {
    margin-bottom: 0.45rem;
    font-size: 0.78rem;
    color: var(--siyoh-3);
}

.tj-tooltip__qator {
    display: grid;
    grid-template-columns: 14px 3rem 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.12rem 0;
}

.tj-tooltip__qator b {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--siyoh);
    font-variant-numeric: tabular-nums;
}

.tj-tooltip__qator.is-faol { color: var(--siyoh); }
.tj-tooltip__qator.is-faol span:last-child { font-weight: 600; }

/* Tooltipda qator kaliti — qisqa chiziq, bosqichda halqa */
.tj-tooltip__kalit { width: 14px; height: 3px; border-radius: 2px; background: var(--r); }

.tj-tooltip__kalit.is-halqa {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: transparent;
    box-shadow: inset 0 0 0 2px var(--r);
}

.tj-tooltip__izoh {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--qogoz-3);
    font-size: 0.76rem;
    color: var(--siyoh-3);
}

/* === USLUB === */
.tj-uslub {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: clamp(1rem, 2.5vw, 1.75rem);
    align-items: start;
}

.tj-bosqichlar {
    display: grid;
    gap: 0.85rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.tj-bosqich {
    position: relative;
    display: grid;
    grid-template-columns: 2.75rem minmax(0, 1fr);
    column-gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-radius: var(--radius-lg);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
}

/* Bosqichlar orasidagi tik ulagich — pastga «ko'tarilish» chizig'i kabi */
.tj-bosqich:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1.25rem + 1.375rem - 1px);
    bottom: calc(-0.85rem - 1px);
    width: 2px;
    height: calc(0.85rem + 2px);
    background: var(--kok);
    opacity: 0.35;
}

.tj-bosqich__raqam {
    grid-row: 1 / 3;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--kok);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
}

.tj-bosqich h3 { font-size: 1.05rem; margin: 0.15rem 0 0.3rem; }
.tj-bosqich p { font-size: 0.93rem; line-height: 1.6; color: var(--siyoh-2); }

.tj-maydon {
    padding: 1.25rem 1.35rem;
    border-radius: var(--radius-lg);
    background: var(--kok-yumshoq);
    border: 1px solid rgba(15, 31, 56, 0.05);
}

.tj-maydon h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.05rem;
    margin-bottom: 0.85rem;
}

.tj-maydon h3 svg { width: 18px; height: 18px; color: var(--kok); }

.tj-maydon ul { margin: 0; padding: 0; list-style: none; }

.tj-maydon li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid rgba(var(--kok-rgb), 0.15);
}

.tj-maydon li:first-child { border-top: 0; padding-top: 0; }

.tj-maydon__nom { font-weight: 600; color: var(--siyoh); line-height: 1.35; }

.tj-maydon__son {
    flex-shrink: 0;
    text-align: right;
    font-size: 0.9rem;
    color: var(--siyoh-2);
}

.tj-maydon__son b { font-size: 1.1rem; color: var(--kok-3); }

.tj-maydon__son small {
    display: block;
    font-size: 0.78rem;
    color: var(--siyoh-3);
}

/* === JADVAL === */
.tj-jadval {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    background: var(--qogoz-2);
    border: 1px solid var(--chiziq);
}

.tj-jadval table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.tj-jadval th,
.tj-jadval td {
    padding: 0.6rem 0.8rem;
    text-align: right;
    border-bottom: 1px solid var(--qogoz-3);
    white-space: nowrap;
}

.tj-jadval thead th {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--siyoh-3);
    background: var(--qogoz);
    text-align: center;
}

.tj-jadval thead tr:first-child th[rowspan]:first-child { text-align: left; }
.tj-jadval thead tr:first-child th[rowspan] { text-align: right; }
.tj-jadval tbody th { text-align: left; font-weight: 500; color: var(--siyoh-2); }
.tj-jadval td small { color: var(--siyoh-4); font-size: 0.8em; }

.tj-jadval__otm th {
    padding-top: 0.9rem;
    font-weight: 700 !important;
    color: var(--siyoh) !important;
    border-bottom-color: var(--chiziq);
}

.tj-jadval__jami { background: var(--kok-yumshoq); }
.tj-jadval__jami td { font-weight: 600; color: var(--siyoh); }
.tj-jadval tbody:last-child tr:last-child > * { border-bottom: 0; }

/* === MOSLASHUV === */
@media (max-width: 1000px) {
    .tj-hero__grid, .tj-uslub { grid-template-columns: 1fr; }
    .tj-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .tj { --tj-nom: 4.1rem; }
    .tj-panel { grid-template-columns: 1fr; }
    .tj-qator, .tj-oq { gap: 0.6rem; }
    .tj-ozgarish { margin-left: 0; }

    /* Gantel: nom va qiymat tepada, maydon butun kenglikda — tor ustunda
       yaqin nuqtalar (55 → 57%) bir-birini yopib qo'yardi */
    .tj-gantel {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "nom qiymat" "maydon maydon";
        row-gap: 0.15rem;
    }
    .tj-gantel__nom { grid-area: nom; }
    .tj-gantel__qiymat { grid-area: qiymat; }
    .tj-gantel__maydon { grid-area: maydon; margin: 0 6px; }
    .tj-oq--gantel { grid-template-columns: 1fr; }
    .tj-oq--gantel > span { display: none; }
    .tj-oq--gantel .tj-oq__shkala { margin: 0 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .tj-chiziq, .tj-gantel__chiziq, .tj-gantel__nuqta { transition: none; }
}

@media print {
    .tj-chiziq { clip-path: none; }
    .tj-gantel__chiziq { width: var(--en); }
    .tj-gantel__nuqta--o { left: var(--o); }
}
