/* =========================================================================
   ФАЙЛ: СТИЛИ КАТАЛОГОВ БЛОГОВ И ГАЙДОВ (ЧАСТЬ 1: СЕТКА И КАРТОЧКА)
   ========================================================================= */

/* Красивый СЕО-заголовок шапки каталога */
.cs-archive-seo-header {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    padding: 35px !important;
    margin-bottom: 35px !important;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.01) !important;
}

.cs-ash-badge {
    background: rgba(230, 126, 34, 0.08) !important;
    color: #e67e22 !important;
    display: inline-block !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    border-radius: 6px !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 14px !important;
}

.cs-ash-main-title {
    font-size: 32px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 0 12px 0 !important;
    letter-spacing: -0.5px !important;
}

.cs-ash-description {
    font-size: 14px !important;
    color: #475569 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
    max-width: 850px !important;
}

/* МОЩНАЯ СЕТКА GRID ИЗ 4 КОЛОНОК (КАК НА ЭТАЛОНЕ) */
.cs-posts-archive-master-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important; /* Ровно 4 карточки в ряд */
    gap: 25px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin-bottom: 40px !important;
}

/* ОДНА ПРЕМИАЛЬНАЯ ПЛИТОЧНАЯ КАРТОЧКА */
.cs-archive-post-card-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease, box-shadow 0.25s ease !important;
}

/* Дорогой эффект наведения на плитку */
.cs-archive-post-card-item:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04) !important;
    transform: translateY(-4px) !important; /* Аккуратный подъем */
}
/* =========================================================================
   ФАЙЛ: СТИЛИ КАТАЛОГОВ (ЧАСТЬ 2: КАРТИНКИ, БЕЙДЖИ И ВНУТРЕННИЙ ТЕКСТ)
   ========================================================================= */

/* Адаптивный блок картинки-превью */
.cs-apc-image-link-wrap {
    width: 100% !important;
    height: 185px !important; /* Увеличили высоту для сохранения пропорций картинок */
    overflow: hidden !important;
    position: relative !important;
    display: block !important;
    background: #0f172a !important; /* Глубокий темный фон-подложка для краев картинки */
    flex-shrink: 0 !important;
}

.cs-apc-thumb-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* КАРТИНКА БОЛЬШЕ НЕ ОБРЕЗАЕТСЯ, А ВСТАЕТ ЦЕЛИКОМ! */
    display: block !important;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}


/* Эффект легкого приближения (zoom) обложки при наведении на плитку */
.cs-archive-post-card-item:hover .cs-apc-thumb-img {
    transform: scale(1.05) !important;
}

/* Заглушка, если у статьи нет картинки */
.cs-apc-stub-thumb {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    color: #cbd5e1 !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
}

/* СОЧНЫЙ ОРАНЖЕВЫЙ БЕЙДЖ КАТЕГОРИИ ПОВЕРХ КАРТИНКИ */
.cs-apc-category-badge {
    position: absolute !important;
    bottom: 12px !important;
    right: 12px !important;
    background: linear-gradient(135deg, #ff9f43 0%, #e67e22 100%) !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.25) !important;
    z-index: 2 !important;
}

/* Текстовое тело карточки */
.cs-apc-content-body {
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    box-sizing: border-box !important;
}

/* Дата публикации */
.cs-apc-meta-date {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    margin-bottom: 10px !important;
    letter-spacing: 0.5px !important;
}

/* Аккуратный заголовок плитки */
.cs-apc-card-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.4 !important;
    margin: 0 0 10px 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important; /* Авто-обрезание заголовка до 2 строк */
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    height: 44px !important; /* Защита от разъезжания сеток */
}

.cs-apc-card-title a {
    color: #0f172a !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
}

.cs-archive-post-card-item:hover .cs-apc-card-title a {
    color: #e67e22 !important; /* Подсветка оранжевым на ховер */
}

/* Краткое описание анонса (Excerpt) */
.cs-apc-card-excerpt {
    font-size: 13px !important;
    color: #475569 !important;
    line-height: 1.5 !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important; /* Текст аккуратно режется до 3 строк */
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}
/* =========================================================================
   ФАЙЛ: СТИЛИ КАТАЛОГОВ (ЧАСТЬ 3: ИНДИКАТОР ЗАГРУЗКИ И АДАПТИВНОСТЬ)
   ========================================================================= */

/* КРАСИВЫЙ БЛОК ЛОАДЕРА БЕСКОНЕЧНОЙ ПРОКРУТКИ */
.cs-infinite-scroll-loader {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 30px 0 !important;
    margin-top: 20px !important;
    box-sizing: border-box !important;
}

.cs-infinite-scroll-loader span {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* Крутящийся киберспортивный спиннер */
.cs-loader-spinner {
    width: 28px !important;
    height: 28px !important;
    border: 3px solid #e2e8f0 !important;
    border-top-color: #e67e22 !important; /* Наш фирменный оранжевый акцент */
    border-radius: 50% !important;
    animation: csCircleLoadSpinner 0.8s linear infinite !important;
}

/* Анимация вращения лоадера */
@keyframes csCircleLoadSpinner {
    to { transform: rotate(360deg); }
}

/* =========================================================================
   УЛЬТРА-АДАПТИВНОСТЬ ДЛЯ СМАРТФОНОВ И ПЛАНШЕТОВ
   ========================================================================= */

/* Экраны средних мониторов и ноутбуков (меньше 1200px) */
@media screen and (max-width: 1200px) {
    .cs-posts-archive-master-grid {
        grid-template-columns: repeat(3, 1fr) !important; /* 3 карточки в ряд */
        gap: 20px !important;
    }
}

/* Экраны планшетов (меньше 992px) */
@media screen and (max-width: 992px) {
    .cs-posts-archive-master-grid {
        grid-template-columns: repeat(2, 1fr) !important; /* 2 карточки в ряд */
        gap: 20px !important;
    }
    .cs-ash-main-title {
        font-size: 28px !important;
    }
    .cs-archive-seo-header {
        padding: 25px !important;
    }
}

/* Экраны мобильных телефонов (меньше 768px) */
@media screen and (max-width: 768px) {
    /* ПРИНУДИТЕЛЬНО ВЫСТРАИВАЕМ КАРТОЧКИ В 2 КОЛОНКИ (КАК НА ЭТАЛОНЕ) */
    .cs-posts-archive-master-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important; /* Уменьшаем зазоры на мобилках */
    }

    .cs-archive-seo-header {
        padding: 20px 15px !important;
        margin-bottom: 25px !important;
        border-radius: 12px !important;
    }

    .cs-ash-main-title {
        font-size: 22px !important;
    }

    .cs-ash-description {
        font-size: 13px !important;
        line-height: 1.5 !important;
    }

    /* Сжимаем карточки, чтобы они идеально помещались */
    .cs-archive-post-card-item {
        border-radius: 12px !important;
    }

    /* Уменьшаем высоту обложек постов, чтобы спасти экран */
    .cs-apc-image-link-wrap {
        height: 120px !important;
    }

    .cs-apc-category-badge {
        font-size: 9px !important;
        padding: 3px 8px !important;
        bottom: 8px !important;
        right: 8px !important;
    }

    .cs-apc-content-body {
        padding: 12px 10px !important; /* Сужаем поля */
    }

    .cs-apc-meta-date {
        font-size: 10px !important;
        margin-bottom: 6px !important;
    }

    /* Масштабируем заголовки */
    .cs-apc-card-title {
        font-size: 13px !important;
        line-height: 1.35 !important;
        height: 34px !important; /* Фиксируем высоту под 2 строчки на смартфонах */
        margin-bottom: 6px !important;
    }

    /* Ограничиваем описание, чтобы сетка шла идеально ровно */
    .cs-apc-card-excerpt {
        font-size: 11px !important;
        line-height: 1.4 !important;
        -webkit-line-clamp: 2 !important; /* Обрезаем до 2 строк */
    }
}

/* Микро-экраны старых смартфонов (меньше 400px) */
@media screen and (max-width: 400px) {
    .cs-posts-archive-master-grid {
        grid-template-columns: 1fr !important; /* Выстраиваем по одной в ряд на супер-узких экранах */
    }
    .cs-apc-image-link-wrap {
        height: 160px !important;
    }
}
