/* =============================================
   Главная под роли — блоки home_blocks/*.php (Tasks/WBChess_TZ_homepage.md)
   Переменные и общие секции (hero тренеров, полоса преимуществ, видео, зигзаг,
   статистика) — в index.css; здесь только новые блоки.
   ============================================= */

.u-body .home-root {
    display: block;
}

.home-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Содержимое шириной как у прежних секций (--landing-max-width без отступов), поэтому
   максимальная ширина считается вместе с боковыми отступами */
.home-inner {
    max-width: calc(var(--landing-max-width) + 48px);
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.home-root a {
    text-decoration: none;
}

.home-muted {
    margin: 0;
    color: var(--landing-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.home-muted a {
    color: var(--landing-accent);
    text-decoration: underline;
}

/* ---------- Быстрый вход: две одинаковые карточки в ряд (урок — для гостя, номер задачи — для всех) ---------- */
.home-entries {
    padding: 20px 0;
    background: var(--c-bg);
    border-bottom: 1px solid var(--landing-card-border);
}

.home-entries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 16px;
}

.home-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 84px;
    margin: 0;
    padding: 14px 18px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    box-sizing: border-box;
}

/* Урок — режим «живого» занятия: выделен мягкой заливкой акцента */
.home-entry-lesson {
    background: var(--c-accent-soft);
    border-color: transparent;
}

.home-entry-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--c-accent-soft);
    color: var(--c-accent-text);
    font-size: 18px;
}

.home-entry-lesson .home-entry-icon {
    background: var(--c-surface);
}

.home-entry-text {
    flex: 1;
    min-width: 0;
}

.u-body .home-root .home-entry-title {
    display: block;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--c-text);
}

.home-entry-hint {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--c-muted);
}

.home-entry-action {
    flex: none;
    display: flex;
    gap: 8px;
}

.u-body .home-root .home-entry-input {
    width: 130px;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--c-border);
    border-radius: var(--c-radius);
    background: var(--c-bg);
    font-size: 15px;
    color: var(--c-text);
    box-sizing: border-box;
}

.u-body .home-root .home-entry-input:focus {
    outline: 3px solid rgba(102, 126, 234, 0.35);
    border-color: var(--c-accent);
}

.home-entry .home-btn {
    flex: none;
    height: 42px;
    padding: 0 20px;
}

@media (max-width: 480px) {
    .home-entry {
        flex-wrap: wrap;
    }

    .home-entry-text {
        flex: 1 1 calc(100% - 60px);
    }

    .home-entry > .home-btn,
    .home-entry-action {
        flex: 1 1 100%;
    }

    .home-entry-input {
        flex: 1;
        width: auto;
    }
}

/* ---------- Кнопки ---------- */
.home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.home-btn-primary {
    background: var(--c-accent);
    color: var(--c-on-accent);
}

.home-btn-primary:hover {
    background: var(--c-accent-hover);
    color: var(--c-on-accent);
}

.home-btn-light {
    background: var(--c-surface);
    border-color: var(--landing-card-border);
    color: var(--landing-text);
}

.home-btn-light:hover {
    border-color: var(--landing-accent);
}

.home-btn:focus-visible,
.home-door:focus-visible,
.home-card:focus-visible,
.home-quick-link:focus-visible,
.home-refresh:focus-visible {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* ---------- Шапка гостя ---------- */
.home-hero {
    padding: 56px 0 44px;
    background: linear-gradient(180deg, var(--c-accent-soft) 0%, var(--c-bg) 100%);
}

/* Заголовки: селекторы с .u-body .home-root, иначе заголовки nicepage (тонкие и крупные) перебивают размер и вес */
.u-body .home-root .home-hero-title {
    margin: 0 0 14px;
    text-align: center;
    font-size: clamp(1.55rem, 3.6vw, 2.4rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--landing-text);
}

.home-hero-sub {
    max-width: 760px;
    margin: 0 auto 32px;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--landing-text-muted);
}

.home-doors {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.home-door {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 24px;
    background: var(--landing-card-bg);
    border: 1px solid var(--landing-card-border);
    border-radius: var(--landing-radius);
    color: var(--landing-text);
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.home-door:hover {
    border-color: var(--landing-accent);
    box-shadow: var(--landing-shadow-lg);
    transform: translateY(-2px);
}

.home-door-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--landing-accent-light);
    color: var(--landing-accent);
    font-size: 18px;
}

.home-door-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.home-door-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--landing-text-muted);
}

.home-door-btn {
    font-size: 14px;
    font-weight: 600;
    color: var(--landing-accent);
}

/* ---------- Общий блок ---------- */
.home-block {
    padding: 52px 0;
    background: var(--landing-card-bg);
    border-top: 1px solid var(--landing-card-border);
}

.home-block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 8px;
}

.u-body .home-root .home-block-title {
    margin: 0 0 8px;
    font-size: clamp(1.4rem, 2.6vw, 1.75rem);
    font-weight: 800;
    line-height: 1.25;
    color: var(--landing-text);
}

.u-body .home-root .home-block-head .home-block-title {
    margin-bottom: 0;
}

.u-body .home-root .home-sub-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--landing-text);
}

/* Ссылки-карточки не наследуют жирность ссылок nicepage */
.u-body .home-root .home-door,
.u-body .home-root .home-card,
.u-body .home-root .home-cont-card {
    font-weight: 400;
}

.home-block-text {
    max-width: 760px;
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--landing-text-muted);
}

.home-link-all {
    font-size: 14px;
    font-weight: 600;
    color: var(--landing-accent);
}

.home-link-all:hover {
    text-decoration: underline;
}

.home-empty {
    padding: 24px;
    border: 1px dashed var(--landing-card-border);
    border-radius: var(--landing-radius);
    text-align: center;
}

/* ---------- Карточки ---------- */
.home-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.home-mine {
    margin-bottom: 28px;
}

.home-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    min-width: 0;
    background: var(--landing-card-bg);
    border: 1px solid var(--landing-card-border);
    border-radius: var(--landing-radius);
    color: var(--landing-text);
    box-sizing: border-box;
}

a.home-card {
    transition: box-shadow 0.2s, border-color 0.2s;
}

a.home-card:hover {
    border-color: var(--landing-accent);
    box-shadow: var(--landing-shadow-lg);
}

.home-card-logo,
.home-coach-avatar {
    position: relative;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--landing-accent-light);
    color: var(--landing-accent);
    font-size: 24px;
}

.home-coach-avatar {
    border-radius: 50%;
}

.home-card-logo img,
.home-coach-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-coach-initial {
    font-weight: 700;
}

.home-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.home-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.home-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    font-size: 13px;
    color: var(--landing-text-muted);
}

.home-card-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--landing-text-muted);
}

.home-card-price {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 700;
    color: var(--landing-accent);
}

.home-progress {
    height: 6px;
    margin-top: 4px;
    border-radius: 3px;
    background: var(--landing-card-border);
    overflow: hidden;
}

.home-progress > span {
    display: block;
    height: 100%;
    background: var(--landing-gradient);
}

.home-coach-courses-label {
    margin-top: 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--landing-text-muted);
}

.home-coach-courses {
    margin: 0;
    padding-left: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.home-coach-courses a {
    color: var(--landing-accent);
}

.home-coach-courses a:hover {
    text-decoration: underline;
}

/* Плитка сервиса — кнопка: выглядит как карточка-ссылка */
button.home-card {
    width: 100%;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

button.home-card:hover {
    border-color: var(--landing-accent);
    box-shadow: var(--landing-shadow-lg);
}

/* Диалог сервиса поверх главной */
.home-dialog[hidden] {
    display: none;
}

.home-dialog {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(20, 24, 40, 0.6);
}

.home-dialog-box {
    display: flex;
    flex-direction: column;
    width: min(1180px, 100%);
    height: min(900px, 100%);
    background: var(--c-surface);
    border-radius: var(--landing-radius);
    overflow: hidden;
    box-shadow: var(--landing-shadow-lg);
}

.home-dialog-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--landing-card-border);
}

.u-body .home-dialog .home-dialog-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--landing-text);
}

.home-dialog-close {
    flex: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    color: var(--landing-text-muted);
    cursor: pointer;
}

.home-dialog-close:hover {
    background: var(--landing-accent-light);
    color: var(--landing-text);
}

.home-dialog-frame {
    flex: 1;
    width: 100%;
    border: 0;
}

body.home-dialog-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .home-dialog {
        padding: 0;
    }

    .home-dialog-box {
        height: 100%;
        border-radius: 0;
    }
}

/* Сервисы: картинка сверху */
.home-service-card {
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    gap: 0;
}

.home-service-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}

.home-service-card .home-card-body {
    padding: 16px;
}

/* ---------- Студия ---------- */
.home-split {
    display: flex;
    align-items: center;
    gap: 48px;
}

.home-split-text {
    flex: 1;
    min-width: 0;
}

.home-split-media {
    flex: 0 0 46%;
    max-width: 520px;
}

.home-split-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--landing-radius);
    box-shadow: var(--landing-shadow-lg);
}

.home-bullets {
    margin: 0 0 24px;
    padding-left: 20px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--landing-text);
}

/* ---------- Продолжить ---------- */
.home-continue {
    background: var(--c-accent-soft);   /* непрозрачный оттенок акцента: полупрозрачный темнел на фоне страницы */
}

.home-continue-body {
    min-height: 84px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-cont-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 14px 16px;
    background: var(--landing-card-bg);
    border: 1px solid var(--landing-card-border);
    border-radius: var(--landing-radius);
    box-sizing: border-box;
}

.home-cont-info {
    flex: 1 1 220px;
    min-width: 0;
}

.home-cont-title {
    font-size: 15px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.home-cont-sub {
    margin-top: 2px;
    font-size: 13px;
    color: var(--landing-text-muted);
}

.home-cont-label {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--landing-text-muted);
}

.home-cont-card .home-btn {
    flex: none;
    padding: 9px 18px;
    font-size: 14px;
}

.home-continue-guest {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
}

.home-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.home-quick-link {
    padding: 8px 16px;
    border: 1px solid var(--landing-card-border);
    border-radius: 18px;
    background: var(--c-surface);
    font-size: 14px;
    font-weight: 600;
    color: var(--landing-text);
}

.home-quick-link:hover {
    border-color: var(--landing-accent);
    color: var(--landing-accent);
}

/* Ошибка загрузки личного блока: общий текст остаётся, рядом кнопка «Обновить» */
.home-error {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 0;
    font-size: 14px;
    color: var(--c-danger);
}

.home-refresh {
    padding: 6px 14px;
    border: 1px solid var(--landing-card-border);
    border-radius: 6px;
    background: var(--c-surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--landing-text);
    cursor: pointer;
}

.home-refresh:hover {
    border-color: var(--landing-accent);
}

/* Блок тренеров: общий блок преимуществ после hero-градиента не сливается с белым */
.home-coaches {
    background: var(--landing-bg);
}

/* ============================================= */
@media (max-width: 1024px) {
    .home-split {
        gap: 32px;
    }
}

@media (max-width: 768px) {
    .home-inner {
        padding: 0 20px;
    }

    .home-hero {
        padding: 36px 0 28px;
    }

    .home-hero-sub {
        font-size: 1rem;
        margin-bottom: 24px;
    }

    .home-doors {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .home-door {
        padding: 18px;
    }

    .home-block {
        padding: 36px 0;
    }

    .home-split {
        flex-direction: column;
        align-items: stretch;
    }

    .home-split-media {
        flex: none;
        max-width: none;
        order: -1;
    }
}

@media (max-width: 480px) {
    .home-inner {
        padding: 0 16px;
    }

    .home-card-grid {
        grid-template-columns: 1fr;
    }

    .home-cont-card .home-btn,
    .home-continue-guest .home-btn,
    .home-split-text .home-btn {
        width: 100%;
    }

    .home-block-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
