/* ===========================================================================
   ГЛАВНАЯ ВИКИ: «С чего начать», «Разделы», «Статистика»
   Поверхности те же, что у карточек хаба (wiki-rules.css): мягкая панель,
   светлая верхняя грань, тень снизу. Внутри панелей - только строки и
   разделители, без вложенных карточек.
   =========================================================================== */
.wh-sec { margin: 0; }
.wh-sec[hidden], .wh-sec [hidden] { display: none !important; }
.wh-kpis.is-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wh-sec + .wh-sec { margin-top: clamp(40px, 6vw, 64px); }

.wh-sec__head {
    position: relative;
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px;
    margin: 0 0 18px; padding: 0 2px 12px;
}
.wh-sec__head::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(207, 41, 41, .55), rgba(255, 255, 255, .08) 38%, transparent);
}
.wh-sec__title {
    margin: 0;
    font-size: 22px; font-weight: 800; letter-spacing: -.005em;
    color: var(--on-dark);
}
.wh-sec__sub {
    margin: 0;
    font-family: var(--f-read);
    font-size: 13.5px; line-height: 1.5;
    color: var(--on-dark-faint);
}

/* общая поверхность: шаги, плитки, таблица */
.wh-step__a, .wh-kpi, .wh-board {
    position: relative;
    border: 1px solid;
    border-color: var(--edge-top) var(--edge-side) var(--edge-bottom);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--lift-edge), var(--lift-1);
}
.wh-step__a, a.wh-kpi {
    color: inherit;
    text-decoration: none;
    transition: transform var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out),
                background var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out);
}
.wh-step__a:hover, a.wh-kpi:hover {
    transform: translateY(-3px);
    border-color: rgba(239, 59, 59, .5);
    background: var(--panel-2);
    box-shadow: var(--lift-edge), var(--lift-2);
}
/* сияние из-под верхней грани - как у карточек хаба */
.wh-step__a::after, a.wh-kpi::after {
    content: "";
    position: absolute; inset: -1px -1px auto;
    height: 80px;
    border-radius: 12px 12px 0 0;
    background: radial-gradient(60% 100% at 50% 0, rgba(207, 41, 41, .16), transparent 70%);
    opacity: 0;
    transition: opacity var(--t-slow) var(--ease-out);
    pointer-events: none;
}
.wh-step__a:hover::after, a.wh-kpi:hover::after { opacity: 1; }

/* ---- С чего начать -------------------------------------------------------- */
.wh-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 0; padding: 0;
    list-style: none;
}
.wh-step { position: relative; display: flex; }
/* стрелка между шагами - в зазоре, на уровне номера */
.wh-step + .wh-step::before {
    content: "";
    position: absolute; left: -13px; top: 37px;
    width: 7px; height: 7px;
    border-top: 2px solid rgba(239, 59, 59, .65);
    border-right: 2px solid rgba(239, 59, 59, .65);
    transform: rotate(45deg);
}
.wh-step__a {
    display: flex; flex-direction: column; gap: 14px;
    width: 100%;
    padding: 22px 22px 20px;
}
.wh-step__n {
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border: 1px solid rgba(239, 59, 59, .55);
    border-radius: 50%;
    background: rgba(207, 41, 41, .14);
    color: #ffc2c2;
    font-size: 15px; font-weight: 800; line-height: 1;
}
.wh-step__body { display: flex; flex-direction: column; gap: 6px; }
.wh-step__title { font-size: 18px; font-weight: 800; color: var(--on-dark); }
.wh-step__desc {
    font-family: var(--f-read);
    font-size: 14px; line-height: 22px;
    color: var(--on-dark-dim);
}
.wh-step__go {
    margin-top: auto;
    font-size: 12px; font-weight: 700; letter-spacing: .05em;
    color: var(--red-br);
}

/* ---- Статистика: плитки --------------------------------------------------- */
.wh-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.wh-kpi {
    display: flex; flex-direction: column;
    min-width: 0;
    padding: 18px 20px 16px;
}
.wh-kpi__k {
    margin: 0;
    font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: var(--on-dark-faint);
}
.wh-kpi__v {
    display: flex; align-items: center; gap: 10px;
    min-height: 34px;
    margin: 10px 0 6px;
    font-size: 20px; font-weight: 800; line-height: 1.2;
    color: var(--on-dark);
    font-variant-numeric: tabular-nums;
}
.wh-kpi__v img { flex: 0 0 auto; width: 30px; height: 30px; object-fit: contain; }
.wh-kpi__v span { min-width: 0; overflow-wrap: anywhere; }
.wh-kpi__sub {
    margin: auto 0 0;
    font-family: var(--f-read);
    font-size: 12.5px; line-height: 1.45;
    color: var(--on-dark-dim);
}

/* ---- Статистика: таблица фракций ----------------------------------------- */
.wh-board { margin-top: 18px; padding: 6px 0; }
.wh-board__head, .wh-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 170px 96px;
    align-items: center;
    column-gap: 20px;
    padding: 0 22px;
}
.wh-board__head {
    padding-top: 10px; padding-bottom: 10px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    color: var(--on-dark-faint);
}
.wh-board__head span:not(:first-child) { text-align: right; }
.wh-board__list { margin: 0; padding: 0; list-style: none; }
.wh-row {
    min-height: 54px;
    border-top: 1px solid rgba(255, 255, 255, .055);
    color: inherit;
    text-decoration: none;
    transition: background var(--t-fast) var(--ease-out);
}
.wh-row:hover { background: rgba(255, 255, 255, .03); }
.wh-row__who { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 0; }
.wh-row__rank {
    flex: 0 0 18px;
    font-size: 12px; font-weight: 800; color: var(--on-dark-faint);
    font-variant-numeric: tabular-nums;
}
.wh-row__logo { flex: 0 0 auto; width: 28px; height: 28px; object-fit: contain; }
.wh-row__name {
    min-width: 0;
    font-size: 14.5px; font-weight: 700; line-height: 1.3;
    color: var(--on-dark);
    transition: color var(--t-fast) var(--ease-out);
}
.wh-row:hover .wh-row__name { color: #fff; }
.wh-row__mem { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.wh-row__num {
    font-size: 15px; font-weight: 800; color: var(--on-dark);
    font-variant-numeric: tabular-nums;
}
.wh-bar {
    width: 100%; height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .06);
    overflow: hidden;
}
.wh-bar i {
    display: block; height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--red-d), var(--red-br));
}
.wh-row__on {
    display: flex; align-items: center; justify-content: flex-end; gap: 7px;
    font-size: 15px; font-weight: 800; color: var(--on-dark);
    font-variant-numeric: tabular-nums;
}
.wh-row__on::before {
    content: "";
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #3fb97a;
    box-shadow: 0 0 0 3px rgba(63, 185, 122, .16);
}
.wh-board__note {
    margin: 0;
    padding: 12px 22px 8px;
    border-top: 1px solid rgba(255, 255, 255, .055);
    font-family: var(--f-read);
    font-size: 12.5px; line-height: 1.5;
    color: var(--on-dark-faint);
}

/* загрузка: спокойные плашки на месте цифр, без мерцания */
.wh-kpi__v:empty::before,
.wh-kpi__sub:empty::before,
.wh-row--ph .wh-row__name::before {
    content: "";
    display: block;
    width: 62%; height: 18px;
    border-radius: 6px;
    background: linear-gradient(rgba(255, 255, 255, .06), rgba(255, 255, 255, .06)) 0 50% / 100% 12px no-repeat;
}
.wh-kpi__v:empty::before { width: 70%; height: 24px; background-size: 100% 20px; }
.wh-row--ph .wh-row__name { flex: 1 1 auto; }
.wh-row--ph .wh-row__logo { border-radius: 50%; background: rgba(255, 255, 255, .06); }
.wh-board__list, .wh-kpi__v, .wh-kpi__sub { transition: opacity var(--t-slow) var(--ease-out); }
.wh-stats.is-in .wh-board__list { animation: whIn var(--t-slow) var(--ease-out) both; }
@keyframes whIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 900px) {
    .wh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
}
@media (max-width: 720px) {
    .wh-steps { grid-template-columns: 1fr; gap: 14px; }
    /* шаги столбиком - стрелка смотрит вниз, под номером */
    .wh-step + .wh-step::before { left: 36px; top: -11px; transform: rotate(135deg); }
    .wh-step__a { flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 8px 14px; padding: 18px 18px 16px; }
    .wh-step__body { flex: 1 1 0; min-width: 0; }
    .wh-step__go { flex: 1 0 100%; margin-top: 2px; padding-left: 48px; }
    .wh-board__head, .wh-row { grid-template-columns: minmax(0, 1fr) 70px 46px; column-gap: 10px; padding: 0 14px; }
    .wh-board__head { font-size: 9.5px; letter-spacing: .06em; }
    .wh-board__note { padding-left: 14px; padding-right: 14px; }
    .wh-row__rank { display: none; }
    .wh-row__who { gap: 10px; }
    .wh-row__logo { width: 24px; height: 24px; }
    .wh-row__name { font-size: 13px; }
}
@media (max-width: 520px) {
    .wh-kpis, .wh-kpis.is-two { grid-template-columns: 1fr; }
    .wh-kpi__v { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .wh-step__a:hover, a.wh-kpi:hover { transform: none; }
    .wh-stats.is-in .wh-board__list { animation: none; }
}
