/**
 * Витрины разделов верхнего уровня (ТЗ §161–162).
 *
 * Один файл на пять страниц — `/wiki/`, `/maps/`, `/tier-lists/`,
 * `/community/` и `/about/`. Они собраны из одних и тех же блоков:
 * шапка с иллюстрацией, полоса чисел, список игр, сетка карточек,
 * таблица фактов. Пять почти одинаковых файлов разъехались бы
 * через месяц, поэтому различия оставлены модификаторам `hub--*`.
 *
 * Все значения — через переменные `tokens.css`.
 */

.hub {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

/* ── Шапка ───────────────────────────────────────────────────────── */

.hub-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    background: var(--bg-cold);
}

.hub--community .hub-hero,
.hub--about .hub-hero {
    background: var(--bg-violet);
}

.hub-hero__text {
    min-width: 0;
}

.hub-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    font-size: var(--fs-micro);
    font-weight: var(--fw-semibold);
    color: var(--primary);
}

.hub-hero__title {
    margin: var(--space-4) 0 0;
    font-size: var(--fs-h1);
    font-weight: var(--fw-extrabold);
    line-height: var(--lh-heading);
    letter-spacing: var(--ls-heading);
}

.hub-hero__sub {
    margin: var(--space-3) 0 0;
    max-width: 62ch;
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.hub-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.hub-hero__figure {
    flex: 0 0 auto;
    display: block;
    width: 220px;
}

.hub-hero__figure img,
.hub-hero__img {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Полоса чисел ────────────────────────────────────────────────── */

.hub-numbers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap-card);
}

.hub-number {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    align-items: flex-start;
}

.hub-number__value {
    font-size: var(--fs-h2);
    font-weight: var(--fw-extrabold);
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-heading);
}

.hub-number__label {
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

/* ── Секция ──────────────────────────────────────────────────────── */

.hub-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--gap-card);
}

.hub-grid--tight {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Шесть карточек ложатся двумя ровными рядами, а не «четыре и два». */
.hub-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Список игр раздела ──────────────────────────────────────────── */

.hub-games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap-card);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-game {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    color: inherit;
    text-decoration: none;
    transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.hub-game:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.hub-game__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: var(--radius-md);
    background: var(--bg-soft);
}

.hub-game__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hub-game__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hub-game__name {
    font-weight: var(--fw-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-game__meta {
    font-size: var(--fs-small);
    color: var(--text-muted);
}

.hub-game__flag {
    flex: 0 0 auto;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--warning-soft);
    color: var(--warning-text);
    font-size: var(--fs-micro);
    font-weight: var(--fw-semibold);
}

.hub-game__arrow {
    flex: 0 0 auto;
    margin-left: auto;
    display: inline-flex;
    color: var(--text-muted);
}

.hub-game:hover .hub-game__arrow {
    color: var(--primary);
}

/* ── Карточка-объяснение ─────────────────────────────────────────── */

.hub-step {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
}

.hub-step__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    color: var(--primary);
}

.hub-step__title {
    margin: 0;
    font-size: var(--fs-h4);
    font-weight: var(--fw-semibold);
}

.hub-step__text {
    margin: 0;
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

/* ── Уровни подтверждения ────────────────────────────────────────── */

.hub-level {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-5);
}

.hub-level__badge {
    align-self: flex-start;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-micro);
    font-weight: var(--fw-semibold);
    background: var(--neutral-soft);
    color: var(--neutral-text);
}

.hub-level__badge--success {
    background: var(--success-soft);
    color: var(--success-text);
}

.hub-level__badge--accent {
    background: var(--primary-soft);
    color: var(--primary);
}

.hub-level__badge--warning {
    background: var(--warning-soft);
    color: var(--warning-text);
}

.hub-level__text {
    margin: 0;
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

/* ── Типы записей и ссылки разделов ──────────────────────────────── */

.hub-types {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.hub-types__text {
    margin: 0;
    max-width: 76ch;
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.hub-types__list,
.hub-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

/* ── Легенда карты ───────────────────────────────────────────────── */

.hub-legend {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.hub-legend__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-legend__item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.hub-legend__dot {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--marker-color, var(--primary));
    color: var(--text-invert);
}

.hub-legend__name {
    min-width: 0;
    font-size: var(--fs-small);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-legend__note {
    margin: 0;
    font-size: var(--fs-small);
    color: var(--text-muted);
}

/* ── Уровни tier list ────────────────────────────────────────────── */

.hub-tiers {
    padding: var(--space-5) var(--space-6);
}

.hub-tiers__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-tiers__row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
}

.hub-tiers__label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--tier-color, var(--primary));
    color: var(--text-invert);
    font-size: var(--fs-h4);
    font-weight: var(--fw-extrabold);
}

.hub-tiers__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hub-tiers__name {
    font-weight: var(--fw-semibold);
}

.hub-tiers__text {
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

/* ── Таблица фактов ──────────────────────────────────────────────── */

.hub-facts {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.hub-facts__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-facts__list--wide {
    grid-template-columns: minmax(0, 1fr);
}

.hub-facts__list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding-left: var(--space-4);
    border-left: 2px solid var(--border);
}

.hub-facts__key {
    font-size: var(--fs-micro);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}

.hub-facts__value {
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.hub-facts__note {
    margin: 0;
    font-size: var(--fs-small);
    color: var(--text-muted);
}

/* ── Репутация ───────────────────────────────────────────────────── */

.hub-points {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
}

.hub-points__text {
    margin: 0;
    max-width: 76ch;
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

.hub-points__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-2) var(--space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-points__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
}

.hub-points__label {
    min-width: 0;
    font-size: var(--fs-small);
}

.hub-points__value {
    flex: 0 0 auto;
    font-weight: var(--fw-bold);
    color: var(--success-text);
}

.hub-points__value--minus {
    color: var(--danger-text);
}

/* ── Достижения ──────────────────────────────────────────────────── */

.hub-achievement {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-5);
}

.hub-achievement__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-violet);
    color: var(--purple);
}

.hub-achievement__title {
    margin: 0;
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
}

.hub-achievement__text {
    margin: 0;
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

/* ── Участники и обсуждения ──────────────────────────────────────── */

.hub-people {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap-card);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-person {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    color: inherit;
    text-decoration: none;
}

.hub-person:hover {
    box-shadow: var(--shadow-card-hover);
}

.hub-person__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.hub-person__name {
    font-weight: var(--fw-semibold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hub-person__meta {
    font-size: var(--fs-small);
    color: var(--text-muted);
}

.hub-comments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap-card);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hub-comment {
    padding: 0;
}

.hub-comment__link {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    color: inherit;
    text-decoration: none;
}

.hub-comment__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
}

.hub-comment__author {
    font-weight: var(--fw-semibold);
}

.hub-comment__date {
    font-size: var(--fs-micro);
    color: var(--text-muted);
}

.hub-comment__text {
    font-size: var(--fs-small);
    line-height: var(--lh-body);
    color: var(--text-secondary);
}

/* ── Телефон ─────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
    .hub-hero__figure {
        width: 168px;
    }
}

@media (max-width: 768px) {
    .hub {
        gap: var(--space-6);
    }

    .hub-hero {
        flex-direction: column-reverse;
        align-items: flex-start;
        text-align: left;
    }

    .hub-hero__figure {
        align-self: center;
        width: 180px;
    }

    .hub-hero__actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .hub-numbers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hub-grid--three {
        grid-template-columns: minmax(0, 1fr);
    }

    .hub-types,
    .hub-legend,
    .hub-tiers,
    .hub-facts,
    .hub-points {
        padding: var(--space-4);
    }
}

@media (max-width: 420px) {
    .hub-game {
        padding: var(--space-4);
    }

    .hub-tiers__label {
        width: 38px;
        height: 38px;
    }
}
