/**
 * Home — mobile & tablet only.
 * Design from new_design/components/home/home-content.tsx
 * Identical sizing: --gutter clamp(16px,4vw,32px), vc-radius-sm 6px, vc-radius-md 10px.
 */

:root {
  --home-gutter: clamp(16px, 4vw, 32px);
}

/* ========== Tablet & Mobile (max-width: 1024px) ========== */
@media (max-width: 1024px) {
    body .main-layout {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .home-page-container {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        margin-left: 0 !important;
        padding: 20px var(--home-gutter) calc(var(--bottom-bar-h, 64px) + env(safe-area-inset-bottom, 0px) + 24px);
        gap: 24px;
        min-height: auto;
        box-sizing: border-box;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .home-main-column {
        gap: 24px;
        order: 1;
    }

    .home-sidebar {
        order: 2;
        position: static;
        margin-top: 0;
        gap: 12px;
        width: 100%;
    }

    /* ── Welcome Banner (design: p clamp(14px,1.4vw,24px), rounded 10-14px) ── */
    .home-welcome-banner {
        padding: 16px 20px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 12px;
    }

    .home-welcome-banner::before {
        height: 3px;
    }

    .home-welcome-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .home-welcome-left {
        gap: 12px;
    }

    .home-welcome-logo-badge {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .home-welcome-logo-icon {
        width: 28px;
        height: 28px;
    }

    .home-welcome-text h1 {
        font-size: 18px;
        font-weight: 800;
    }

    .home-welcome-text p {
        font-size: 13px;
        line-height: 1.5;
    }

    .home-welcome-right {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .home-btn-primary {
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 8px;
    }

    .home-btn-primary i {
        font-size: 14px !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
    }

    @media (max-width: 639px) {
        .home-welcome-right {
            display: none;
        }
    }

    /* ── Section Headers (design: icon 28–36px, title 16–22px) ── */
    .home-section-header {
        margin-bottom: 14px;
    }

    .home-section-title-row {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .home-section-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .home-section-icon i,
    .home-section-icon .fa,
    .home-section-icon .fas {
        font-size: 16px !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .home-section-title {
        font-size: 18px;
        font-weight: 700;
    }

    /* ── Latest News: 2 колонки как в newswire.php ── */
    .home-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(8px, 1vw, 16px);
    }

    .home-cards-grid .news-card-search {
        border-radius: 8px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .home-cards-grid .news-card-search:hover {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.06);
        transform: none;
    }

    .home-cards-grid .news-card-search:hover .news-image-search {
        transform: none;
    }

    .home-cards-grid .news-image-container-search {
        aspect-ratio: 16 / 9;
    }

    .home-cards-grid .news-content-search {
        padding: clamp(8px, 1vw, 14px);
        gap: 4px;
    }

    .home-cards-grid .news-date-search {
        font-size: 10px;
    }

    .home-cards-grid .news-title-search {
        font-size: clamp(13px, 0.9vw, 15px);
        font-weight: 600;
        line-height: 1.35;
    }

    .home-cards-grid .news-description-search {
        font-size: clamp(11px, 0.66vw, 13px);
        line-height: 1.45;
    }

    .home-cards-grid .news-stat-search {
        font-size: 11px;
        padding: 4px 6px;
        gap: 5px;
    }

    .home-cards-grid .news-stat-search i {
        font-size: 11px !important;
        width: auto !important;
        height: auto !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
    }

    .home-cards-grid .news-read-more {
        font-size: 12px;
    }

    /* ── Trending Now (Wiki cards): 2 колонки, как новости — читаемый текст ── */
    .home-trending-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: clamp(8px, 1vw, 16px);
        overflow: visible;
    }

    .home-trending-grid .category-card-search {
        border-radius: 8px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .home-trending-grid .category-card-search:hover {
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.06);
        transform: none;
    }

    .home-trending-grid .category-card-search:hover .category-image-search {
        transform: none;
    }

    .home-trending-grid .category-image-container-search {
        aspect-ratio: 16 / 9;
    }

    .home-trending-grid .category-content-search {
        padding: 10px 12px 12px;
        gap: 6px;
    }

    .home-trending-grid .category-header-search {
        gap: 8px;
    }

    .home-trending-grid .category-icon-search {
        width: 22px;
        height: 22px;
        min-width: 22px;
        min-height: 22px;
        border-radius: 6px;
        font-size: 10px;
    }

    .home-trending-grid .category-icon-search i {
        font-size: 10px !important;
        width: auto !important;
        height: auto !important;
    }

    .home-trending-grid .category-title-search {
        font-size: 14px;
        font-weight: 600;
        line-height: 1.35;
        -webkit-line-clamp: 2;
    }

    .home-trending-grid .category-footer-search {
        margin-top: 6px;
        padding-top: 8px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .home-trending-grid .category-meta-info,
    .home-trending-grid .category-explore-link {
        font-size: 12px;
    }

    .home-trending-grid .category-meta-info {
        gap: 5px;
        padding: 4px 6px;
    }

    .home-trending-grid .category-meta-info i {
        width: 10px;
        height: 10px;
        min-width: 10px;
        min-height: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* ── Community Stats (design: p 10–16px, icon 28–38px, gap 6–10px) ── */
    .home-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .home-stat-card {
        padding: 14px 16px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 10px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .home-stat-card:hover {
        border-color: rgba(79, 110, 247, 0.4);
    }

    .home-stat-top-row {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .home-stat-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .home-stat-icon i,
    .home-stat-icon .fa,
    .home-stat-icon .fas {
        font-size: 18px !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .home-stat-value {
        font-size: 20px;
        font-weight: 800;
    }

    .home-stat-label {
        font-size: 13px;
    }

    /* ── Explore Vice Community (design: p 10–18px, icon 34–46px, gap 8–16px) ── */
    .home-nav-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .home-nav-link {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 18px;
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 10px;
        background: #fff;
        text-decoration: none;
        transition: none;
        width: 100%;
        box-sizing: border-box;
    }

    .home-nav-link:hover {
        transform: none;
    }

    .home-nav-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .home-nav-icon i,
    .home-nav-icon .fa,
    .home-nav-icon .fas {
        font-size: 20px !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

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

    .home-nav-title {
        font-size: 15px;
        font-weight: 600;
    }

    .home-nav-desc {
        font-size: 13px;
    }

    .home-nav-arrow {
        flex-shrink: 0;
    }

    .home-nav-arrow i,
    .home-nav-arrow .fa,
    .home-nav-arrow .fas {
        font-size: 16px !important;
        width: auto !important;
        height: auto !important;
    }

    /* ── Sidebar (Top Users, Quick Links) ── */
    .home-sidebar-card {
        width: 100%;
        border: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 10px;
        overflow: hidden;
    }

    .home-sidebar-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 16px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .home-sidebar-header i,
    .home-sidebar-header .fa,
    .home-sidebar-header .fas {
        font-size: 18px !important;
        line-height: 1 !important;
        width: auto !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .home-sidebar-header span {
        font-size: 15px;
        font-weight: 600;
    }

    .home-sidebar-content {
        padding: 8px 12px 12px;
    }

    .home-contributor-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 8px;
        border-radius: 6px;
    }

    .home-contributor-rank {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .home-contributor-avatar {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 50%;
    }

    .home-contributor-name {
        font-size: 14px;
    }

    .home-contributor-xp {
        font-size: 12px;
    }

    .home-quick-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px;
        border-radius: 6px;
    }

    .home-quick-link span {
        font-size: 14px;
    }

    .home-quick-link .home-quick-arrow i,
    .home-quick-link .home-quick-arrow .fa,
    .home-quick-link .home-quick-arrow .fas {
        font-size: 14px !important;
        width: auto !important;
        height: auto !important;
    }

    .home-ad-banner {
        width: 100%;
        min-height: 180px;
        border: 1px dashed #d1d5db;
        border-radius: 10px;
        padding: 24px;
        box-sizing: border-box;
        gap: 12px;
    }

    .home-ad-banner .home-ad-badge {
        font-size: 12px;
        padding: 6px 12px;
    }

    .home-ad-banner .home-ad-text {
        font-size: 14px;
    }

    .home-ad-banner .home-ad-subtext {
        font-size: 12px;
    }
}

/* ========== Tablet (641px–1024px) ── 2 col news, 3 col trending, 2 col nav ── */
@media (min-width: 641px) and (max-width: 1024px) {
    .home-welcome-right {
        display: flex !important;
    }

    .home-welcome-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .home-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .home-trending-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        overflow-x: visible;
        gap: 12px;
    }

    .home-trending-grid .category-card-search {
        width: auto;
        min-width: 0;
    }

    .home-stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .home-nav-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .home-show-all-stats-wrapper {
        display: none !important;
    }
}

/* ========== Mobile only (max-width: 640px) ── 2 col news и wiki, 4 карточки wiki ── */
@media (max-width: 640px) {
    .home-page-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .home-cards-grid,
    .home-trending-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* На 2 колонки — показываем только 4 карточки вики (5-я скрыта) */
    .home-trending-grid .category-card-search:nth-child(n+5) {
        display: none !important;
    }

    .home-stats-grid {
        gap: 12px;
    }

    .home-stat-card {
        padding: 14px 16px;
    }

    .home-stats-grid .home-stat-card.home-stat-hidden-mobile {
        display: none;
    }

    .home-stats-grid.home-stats-expanded .home-stat-card.home-stat-hidden-mobile {
        display: flex;
        flex-direction: column;
    }

    .home-show-all-stats-wrapper {
        display: block;
        margin-top: 10px;
    }

    .home-show-all-stats-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
        color: #4f6ef7;
        background: transparent;
        border: 1px solid rgba(79, 110, 247, 0.2);
        border-radius: 10px;
        cursor: pointer;
    }

    .home-show-all-stats-btn:hover {
        background: rgba(79, 110, 247, 0.04);
    }

    .home-stats-grid.home-stats-expanded + .home-show-all-stats-wrapper {
        display: none;
    }
}

@media (min-width: 1025px) {
    .home-show-all-stats-wrapper {
        display: none !important;
    }
}
