/* =========================================
   📐 ОСНОВНАЯ СЕТКА И LAYOUT
   ========================================= */
.grid-layout {
    display: grid;
    align-items: start;
    grid-template-columns: 330px 1fr;
    gap: 12px;
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

.right-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.orange-wrapper {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 12px;
    border-radius: 8px;
    min-height: 200px;
}

.bottom-row {
    display: grid;
    align-items: start;
    grid-template-columns: 1fr 330px;
    gap: 12px;
}

/* =========================================
   📦 БАЗОВЫЕ КОНТЕЙНЕРЫ
   ========================================= */
.box-red {
    background: rgba(57, 155, 147, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    font-size: 24px;
    font-weight: bold;
    min-height: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.box-purple {
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: auto;
    font-size: 20px;
    font-weight: bold;
}

.box-darkblue {
    background: rgba(57, 155, 147, 0.1);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    font-size: 24px;
    font-weight: bold;
    min-height: 450px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.box-green {
    color: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 5px;
    min-height: auto;
    font-weight: bold;
}

.box-lightblue {
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    min-height: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =========================================
   🟢 ВНУТРЕННЯЯ СТРУКТУРА ЗЕЛЁНОГО БЛОКА
   ========================================= */
.green-grid-top {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    flex-shrink: 0;
}

.g-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    /* ✅ Фикс: убираем вертикальное центрирование */
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    min-height: 200px;
    padding-bottom: 8px;
}

.g-item-image {
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    min-height: 120px;
    width: 100%;
    flex-shrink: 0;
}

.green-stack-bottom {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
    flex: 1;
}

.g-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    min-height: 100px;
    padding: 2px 4px;
    flex-shrink: 0;
    background: rgba(57, 155, 147, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.g-list-image {
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    min-height: 70px;
    width: 100%;
    overflow: hidden;
}

.g-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================================
   🎬 ГЕРОЙ-БЛОК
   ========================================= */
.hero-image {
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
    min-height: 350px;
}

.hero-main-wrapper a {
    color: #fff;
}

/* =========================================
   🔴🔵 КОНТЕЙНЕРЫ (ЛЕВЫЙ / ПРАВЫЙ)
   ========================================= */
.box-red.red-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 8px;
    gap: 12px;
    border-radius: 8px;
}

.red-top {
    flex: 2;
    border-radius: 6px;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    font-weight: bold;
    min-height: auto;
    /* ✅ Убрали жёсткий 1000px, чтобы не ломать скролл */
}

.red-bottom {
    flex: 1;
    border-radius: 6px;
    display: flex;
    min-height: 200px;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    color: #fff;
    background: rgba(57, 155, 147, 0.1);
}

.box-lightblue.blue-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 8px;
    gap: 12px;
    border-radius: 8px;
}

.blue-top {
    flex: 2;
    border-radius: 6px;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    font-weight: bold;
    height: auto;
    min-height: 200px;
}

.blue-bottom {
    flex: 1;
    background: rgba(57, 155, 147, 0.1);
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 300px;
    font-weight: bold;
}

/* =========================================
   🔗 ССЫЛКИ И ЭФФЕКТЫ
   ========================================= */
.hero-link {
    display: block;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hero-link:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.hero-link .box-purple {
    cursor: pointer;
}

.g-item-link,
.g-list-link {
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.g-item-link:hover,
.g-list-link:hover {
    background: rgba(57, 155, 147, 0.1);
}

.green-grid-top .g-item-link {
    display: flex;
    height: 100%;
}

.green-stack-bottom .g-list-link {
    display: block;
}

/* =========================================
   📑 ВКЛАДКИ (ТАБЫ)
   ========================================= */
.block-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 5px;
}

.block-tabs .tab {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.block-tabs .tab.active {
    background: rgba(57, 155, 147, 0.4);
    color: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.block-tabs .tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.3);
}

/* =========================================
   📜 СПИСОК ВНУТРИ КРАСНОГО БЛОКА
   ========================================= */
.side-list {
    list-style: none;
    padding: 0;
    margin: 0;
}


/* =========================================
   ⏳ ЗАГРУЗКА / АНИМАЦИЯ
   ========================================= */
.loading-text {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    padding: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 40px;
    height: 40px;
    display: block;
    margin: 30px auto;
    animation: spin 1s linear infinite;
}

/* =========================================
   🟠 БЛОК "ГЛАВНОЕ СЕГОДНЯ" (БАЗА)
   ========================================= */
.today-block {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: rgba(57, 155, 147, 0.1);
    color: #fff;
}

.sidebar-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.today-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.today-item {
    margin-bottom: 10px;
    border-radius: 6px;
    transition: transform 0.2s;
}

.today-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(-2px);
}

.today-item.empty {
    text-align: center;
    font-size: 13px;
    opacity: 0.7;
    background: none;
}

/* =========================================
   🎥 ВИДЕО / ОВЕРЛЕЙ / ТРИГГЕР
   ========================================= */
.hero-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.hero-poster,
.hero-video-element {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-video-element {
    display: none;
}

.hero-read-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.hero-video-container:hover .hero-read-overlay {
    opacity: 1;
}

.overlay-text {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: #eeebeb;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.hero-title-link:hover {
    text-decoration: underline;
    color: #e75806;
}

.hero-video-container.has-interacted .hero-read-overlay {
    display: none !important;
}

.hero-video-click-trigger {
    position: absolute;
    inset: 0;
    bottom: 67px;
    z-index: 50;
    cursor: pointer;
    pointer-events: auto;
    background: transparent;
}

.hero-video-container.has-interacted .hero-video-click-trigger,
.hero-video-container.has-interacted .hero-read-overlay {
    display: none !important;
}

/* =========================================
   🛠 ЕДИНЫЙ ФИКС: ОБРЕЗКА, ТИПОГРАФИКА, ПРАВЫЙ БЛОК
   ========================================= */

/* 1. Базовые правила для всех заголовков с обрезкой */

.g-item-title,
.g-list-title,
.hero-title-link {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2 !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    height: auto !important;
    width: 100%;
    box-sizing: border-box;
}

.g-item-title {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    padding: 8px 12px 4px 12px;
    text-align: center;
    color: #fff;
    border-radius: 4px;
    margin: 0 auto;
}

.g-list-title {
    -webkit-line-clamp: 2;
    line-clamp: 2;
    padding: 8px 10px;
    color: #fff;
    border-radius: 4px;
    text-align: left;
}

.hero-title-link {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    padding: 10px 12px !important;
    font-size: 24px;
    border-radius: 6px;
    display: block !important;
    font-weight: bold;
}

body:not(.light-theme) .hero-title-link {
    color: #ffffff !important;
}

body:not(.light-theme) .hero-title-link:hover {
    color: #c3d6d3 !important;
}

/* 3. Починка правого блока "Главное сегодня" */
.today-block {
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: auto !important;
    overflow-y: auto;
}

/* 🔹 Исправленный блок для "Главное сегодня" */
.today-link {
    /* ✅ КРИТИЧНО: возвращаем режим обрезки */
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 4;
    line-clamp: 4;

    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4 !important;
    /* Чуть свободнее, чтобы не резало буквы */

    /* Визуальное оформление */
    padding: 6px 10px 6px 10px !important;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
}

/* 4. Сброс конфликтов у родителей */
.g-list,
.g-item,
.orange-wrapper>*,
.bottom-row>*,
.red-top {
    min-width: 0;
    min-height: 0;
}

/* =========================================
   📱 АДАПТИВНОСТЬ
   ========================================= */
@media (max-width: 900px) {
    .grid-layout {
        grid-template-columns: 1fr;
        margin: 5px auto;
    }

    .box-red {
        min-height: 200px;
    }

    .orange-wrapper,
    .bottom-row {
        grid-template-columns: 1fr;
    }

    .box-purple,
    .box-darkblue,
    .box-green,
    .box-lightblue {
        min-height: 100px;
    }
}

/* ✅ ЕДИНОЕ ПРАВИЛО ДЛЯ ЛЕВОГО БЛОКА (Новости/Статьи) */
.side-item-link {
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;

    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;

    /* 🔑 line-height: 1.38 — точная граница обрезки для кириллицы без "хвостов" */
    line-height: 1.48 !important;

    /* Убираем padding-top, который ломает расчёт границы line-clamp */
    padding: 3px 12px 5px 12px !important;

    color: #fff !important;
    border-radius: 6px;
    margin-bottom: 8px !important;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.2s;

    /* Сброс flex-свойств, конфликтующих с line-clamp */
    align-items: flex-start !important;
    justify-content: flex-start !important;
    min-height: auto !important;
    height: auto !important;
}

.side-item-link:hover {
    text-decoration: none !important;
    transform: translateX(2px);
    background: rgba(255, 255, 255, 0.25);
}

/* =========================================
   ☀️ СВЕТЛАЯ ТЕМА ДЛЯ GRID-СЕТКИ
   ========================================= */


/* --- Цвета блоков --- */
body.light-theme .box-red {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

body.light-theme .box-purple {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

body.light-theme .box-darkblue {
    background: rgba(241, 245, 249, 0.9);
    /* Светло-серый/голубой */
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

body.light-theme .box-green {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

body.light-theme .box-lightblue {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1e293b;
}

/* --- Внутренние элементы блоков --- */
body.light-theme .red-top,
body.light-theme .red-bottom,
body.light-theme .blue-top,
body.light-theme .blue-bottom {
    background: transparent;
    /* Или легкий фон, если нужно */
    color: #1e293b;
}

body.light-theme .today-block {
    background: rgba(241, 245, 249, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-theme .sidebar-header {
    color: #0f172a;
}

body.light-theme .today-link {
    color: #1e293b;
}

body.light-theme .today-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* --- Карточки в зеленом блоке --- */
body.light-theme .g-item {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .g-item-title {
    color: #1e293b;
}

body.light-theme .g-list {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .g-list-title {
    color: #1e293b;
}

/* --- Табы (Вкладки) --- */
body.light-theme .block-tabs .tab {
    background: rgba(0, 0, 0, 0.05);
    color: #475569;
    border: 1px solid transparent;
}

body.light-theme .block-tabs .tab.active {
    background: #ffffff;
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.light-theme .block-tabs .tab:hover:not(.active) {
    background: rgba(0, 0, 0, 0.1);
}

/* --- Ссылки и ховеры --- */
body.light-theme .hero-title-link {
    color: #16373d;
}

body.light-theme .hero-title-link:hover {
    color: #585a5e;
}

body.light-theme .g-item-link:hover,
body.light-theme .g-list-link:hover {
    background: rgba(0, 0, 0, 0.03);
}

body.light-theme .side-item-link {
    color: #1e293b !important;
}

body.light-theme .side-item-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* --- Видео оверлеи --- */
body.light-theme .overlay-text {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: #ebebec;
}

body.light-theme .hero-read-overlay {
    background: rgba(255, 255, 255, 0.1);
}