/* ============================================================
   Home page — Design System §10
   Hero styles are in home-hero.css
   ============================================================ */

/* ---------- Main 2-column layout (§10.2) ---------- */
.home-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-7);
    align-items: stretch;
    padding-block: var(--space-8);
}

.home-videos {
    display: flex;
    flex-direction: column;
}

.home-news {
    display: grid;
    grid-template-rows: auto 1fr;
    min-height: 0;
}

/* ---------- Home news: unified scrollable panel ---------- */
/* Высота задаётся CSS-grid: ряд 1fr в .home-main (align-items:stretch) */
.home-news__panel {
    height: 0;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: var(--space-3);
    gap: var(--space-5);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.home-news__panel::-webkit-scrollbar {
    width: 3px;
}
.home-news__panel::-webkit-scrollbar-track {
    background: transparent;
}
.home-news__panel::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: var(--r-full);
}
.home-news__panel::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* Компактные строки внутри панели (кнопка-карточка) */
.home-news__item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3);
    border-radius: var(--r-md);
    text-decoration: none;
    color: inherit;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition:
        background var(--dur-fast) var(--ease-standard),
        color var(--dur-fast) var(--ease-standard);
}

.home-news__item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.home-news__item:hover {
    background: var(--surface-2);
}

.home-news__item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

/* Превью-картинка внутри строки */
.home-news__item-preview {
    width: calc(100% + var(--space-3) * 2);
    margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-3);
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: var(--surface-2);
    flex-shrink: 0;
}

.home-news__item:first-child .home-news__item-preview {
    /* Скруглить верхние углы вместе с карточкой */
    border-radius: calc(var(--r-lg) - 2px) calc(var(--r-lg) - 2px) 0 0;
}

.home-news__item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--dur) var(--ease-standard);
}

.home-news__item:hover .home-news__item-img {
    transform: scale(1.03);
}

.home-news__date {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.home-news__text {
    font-size: var(--fs-sm);
    line-height: var(--lh-snug);
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--dur-fast) var(--ease-standard);
}

.home-news__item:hover .home-news__text {
    color: var(--text);
}

/* ---------- Section helpers ---------- */
.section__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.section__title {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: var(--tracking-section);
    color: var(--text);
    line-height: var(--lh-tight);
}

/* ---------- Quick access (§10.4) ---------- */
.home-quick-access {
    background: var(--bg-soft);
    padding-block: var(--space-7);
    margin-top: var(--space-9);
}

.home-quick-access__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    align-items: start;
}

.home-quick-access__col {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.home-quick-access__heading {
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-section);
    color: var(--accent);
    margin-bottom: var(--space-4);
}

/* ---------- Quick-access cards (shared across all three columns) ----------
   One horizontal rhythm: leading visual (thumbnail or platform icon) + title.
   Used by articles, worlds and community links so the columns read as a set. */
.home-qa-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--r-md);
    background: var(--surface-glass-lite);
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-muted);
    transition:
        transform var(--dur-fast) var(--ease-standard),
        border-color var(--dur-fast),
        color var(--dur-fast);
}

.home-qa-card:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateX(2px);
}

/* Leading slot: thumbnail (articles/worlds) or icon tile (links) */
.home-qa-card__media {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-qa-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Icon variant (community links): tinted tile, brand-coloured on hover */
.home-qa-card__media--icon {
    background: var(--surface-2);
    color: var(--text-muted);
    transition:
        color var(--dur-fast),
        background var(--dur-fast);
}

.home-qa-card:hover .home-qa-card__media--icon {
    color: var(--text);
}

.home-qa-card[data-platform="youtube"]:hover .home-qa-card__media--icon {
    color: var(--c-youtube);
}
.home-qa-card[data-platform="twitch"]:hover .home-qa-card__media--icon {
    color: var(--c-twitch);
}
.home-qa-card[data-platform="telegram"]:hover .home-qa-card__media--icon {
    color: var(--c-telegram);
}
.home-qa-card[data-platform="vk"]:hover .home-qa-card__media--icon {
    color: var(--c-vk);
}
.home-qa-card[data-platform="discord"]:hover .home-qa-card__media--icon {
    color: var(--c-discord);
}
.home-qa-card[data-platform="boosty"]:hover .home-qa-card__media--icon {
    color: var(--c-boosty);
}
.home-qa-card[data-platform="tiktok"]:hover .home-qa-card__media--icon {
    color: var(--c-tiktok);
}

.home-qa-card__title {
    font-size: var(--fs-sm);
    font-weight: 500;
    line-height: var(--lh-snug);
}

/* ---------- Quick access card sizing ---------- */
/* Cards keep their natural height; columns align to the top (grid
   align-items: start) so uneven item counts don't stretch them. */
.home-qa-card {
    min-height: 56px;
}

/* ---------- Section header ghost-button hover (issue 9) ---------- */
/* Override global .btn-ghost:hover background; keep only text color change */
.section__header .btn-ghost:hover {
    background: transparent;
    color: var(--text);
}

/* ---------- Merch promo (§10.3) ---------- */
.home-merch {
    padding-block: var(--space-7);
}

.home-merch__card {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 46%);
    align-items: center;
    gap: var(--space-7);
    padding: var(--space-6);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--surface-glass);
    border: 1px solid var(--border);
    text-decoration: none;
    transition:
        border-color var(--dur) var(--ease-standard),
        box-shadow var(--dur) var(--ease-standard),
        transform var(--dur) var(--ease-standard);
}
.home-merch__card:hover {
    border-color: var(--border-strong);
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px var(--accent-weak);
    transform: translateY(-3px);
}

.home-merch__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: flex-start;
}
.home-merch__title {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: var(--tracking-section);
    color: var(--text);
    line-height: var(--lh-tight);
}
.home-merch__desc {
    color: var(--text-muted);
    font-size: var(--fs-md);
    line-height: var(--lh-base);
    max-width: 44ch;
}
.home-merch__cta {
    margin-top: var(--space-2);
}

.home-merch__media {
    display: flex;
    align-self: center;
}
.home-merch__media img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: var(--r-md);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .home-hero {
        padding-block: var(--space-6);
    }
    .home-main {
        grid-template-columns: 1fr;
        gap: var(--space-6);
        padding-block: var(--space-6);
    }

    .home-quick-access__grid {
        grid-template-columns: 1fr;
        gap: var(--space-5);
    }

    /* На мобиле панель сжимается по контенту */
    .home-news {
        display: flex;
        flex-direction: column;
    }

    .home-news__panel {
        height: auto;
        min-height: unset;
        flex: none;
    }

    /* Видео в 2 колонки — новости ближе к верху */
    .home-videos .grid-auto {
        grid-template-columns: repeat(2, 1fr);
    }

    /* На мобильном показываем только 4 видео из 6 */
    .home-videos .grid-auto > *:nth-child(n + 5) {
        display: none;
    }

    .home-merch__card {
        grid-template-columns: 1fr;
        gap: var(--space-5);
        padding: var(--space-5);
    }
    /* on mobile image is on top */
    .home-merch__media {
        order: -1;
    }
    .home-merch__body {
        align-items: center;
        text-align: center;
    }
    .home-merch__desc {
        max-width: none;
    }
}
