/*
Theme Name:   Моя Дочерняя Тема astra-child
Template:     astra
Version:      1.0.0
*/

/* ========================================
   СТИЛИ ДЛЯ СТРАНИЦ КАТЕГОРИЙ
   ======================================== */

/* Скрываем оглавление на архивах */
body.archive.category .ez-toc-title-container,
body.archive.category .ez-toc-widget-container,
body.archive.category #ez-toc-container,
body.archive.category .ez-toc-counter,
body.archive.category .ez-toc-list,
body.archive.category .toc,
body.archive.category .table-of-contents,
body.archive.category .tableofcontents {
    display: none !important;
}



.single-post .site-content > .ast-container {
    max-width: 1300px;
    padding-top: 10px;
}

.site .site-content #primary {
    margin-top: 0px;
    margin-bottom: 50px;
}



/* Карточки постов */
body.archive.category .post-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

body.archive.category .post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

body.archive.category .card-title {
    font-size: 1rem;
    margin-bottom: 10px;
    font-family: "Arial", Sans-serif;
    font-weight: 300;
}

body.archive.category .card-title a {
    color: #000000;
    text-decoration: none;
}

body.archive.category .card-title a:hover {
    color: #385892;
}

body.archive.category .card-meta {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-family: "Arial", Sans-serif;
    font-weight: 300;
}

body.archive.category .post-thumbnail img {
    border-radius: 12px;
    width: 100%;
    height: auto;
}

body.archive.category .card-excerpt {
    color: #000000;
    line-height: 1.65em;
    margin-bottom: 15px;
    font-family: "Arial", Sans-serif;
    font-weight: 300;
}

body.archive.category .read-more {
    display: inline-block;
    color: #385892;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease;
    font-family: "Arial", Sans-serif;
}

body.archive.category .read-more:hover {
    color: #000000;
}

body.archive.category .posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

/* Адаптивность */
@media (max-width: 1024px) {
    body.archive.category .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    body.archive.category .posts-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    body.archive.category .post-card {
        padding: 18px;
    }
    body.archive.category .card-title {
        font-size: 1.2rem;
    }
}




// Добавляем стили для шорткода
add_action('wp_head', 'add_shortcode_menu_styles');
function add_shortcode_menu_styles() {
    ?>
    <style>
        /* Стили для меню в шорткоде */
        .category-menu-title {
            display: inline-block;
            margin-right: 10px;
            padding: 4px 12px;
            background: #385892;
            color: #fff;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            line-height: 1.3;
        }
        
        /* Если нужно убрать отступы на страницах без категорий */
        .page-template .category-menu-elementor-style,
        .single .category-menu-elementor-style {
            margin: 0 auto 20px auto;
        }
        
        @media (max-width: 768px) {
            .category-menu-title {
                font-size: 9px;
                padding: 3px 10px;
                margin-right: 6px;
                width: 100%;
                text-align: center;
                margin-bottom: 4px;
            }
        }
    </style>
    <?php
}




/* ============================================
   АРХИВНАЯ СТРАНИЦА (ДОЛГАНЫ) – ОБНОВЛЕННЫЙ СТИЛЬ
   ============================================ */

/* ----- 1. ОБЩИЕ НАСТРОЙКИ АРХИВА ----- */
.archive-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
    color: #1e293b;
}

/* ----- 2. ЗАГОЛОВОК СТРАНИЦЫ ----- */
.archive-header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.archive-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #0b1e33;
    text-transform: uppercase;
    display: inline-block;
    background: linear-gradient(135deg, #0b3b5c, #1a6e8a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 8px;
    border-bottom: 4px solid #d4a373;
}

.archive-title::after {
    content: "✦";
    display: block;
    font-size: 1.6rem;
    color: #d4a373;
    margin-top: -12px;
    -webkit-text-fill-color: #d4a373;
}

/* ----- 3. СЕТКА КАРТОЧЕК (GRID) ----- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 50px;
}

/* ----- 4. КАРТОЧКА ПОСТА ----- */
.post-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(11, 59, 92, 0.12);
    border-color: rgba(212, 163, 115, 0.3);
}

/* --- Изображение (если есть) --- */
.post-thumbnail {
    display: block;
    overflow: hidden;
    background: #f1f5f9;
    border-bottom: 1px solid #e9edf2;
}

.card-image {
    width: 100%;
    height: 210px;
    object-fit: cover;
    transition: transform 0.4s ease;
    display: block;
}

.post-card:hover .card-image {
    transform: scale(1.03);
}

/* --- Контент карточки --- */
.card-content {
    padding: 22px 24px 26px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 10px 0;
}

.card-title a {
    color: #0b3b5c;
    text-decoration: none;
    transition: color 0.2s;
}

.card-title a:hover {
    color: #d48c5c;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* --- Мета (дата) --- */
.card-meta {
    font-size: 0.85rem;
    color: #7c8b9c;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-date::before {
    content: "📅 ";
    font-size: 0.9rem;
}

/* --- Анонс (excerpt) --- */
.card-excerpt {
    font-size: 0.98rem;
    line-height: 1.6;
    color: #334155;
    margin-bottom: 18px;
    flex-grow: 1;
}

.card-excerpt p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Кнопка "Читать далее" --- */
.read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #0b3b5c;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.25s;
    align-self: flex-start;
    margin-top: 4px;
}

.read-more::after {
    content: "→";
    transition: transform 0.25s;
    font-size: 1.2rem;
}

.read-more:hover {
    color: #d48c5c;
    border-bottom-color: #d4a373;
}

.read-more:hover::after {
    transform: translateX(5px);
}

/* ----- 5. ПАГИНАЦИЯ ----- */
.pagination-wrapper {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.custom-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #f8fafc;
    padding: 10px 18px;
    border-radius: 60px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
}

.custom-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    transition: all 0.2s;
    background: transparent;
}

.custom-pagination .page-numbers.current {
    background: #0b3b5c;
    color: #fff;
    box-shadow: 0 4px 10px rgba(11, 59, 92, 0.25);
}

.custom-pagination .page-numbers:not(.current):hover {
    background: #e9edf2;
    color: #0b3b5c;
}

.custom-pagination .next {
    gap: 6px;
}

.custom-pagination .next::after {
    content: "→";
    font-size: 1.1rem;
}

/* ----- 6. АДАПТИВНОСТЬ (МОБИЛЬНЫЕ) ----- */
@media (max-width: 768px) {
    .archive-title {
        font-size: 2.2rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .post-card {
        border-radius: 16px;
    }

    .card-image {
        height: 170px;
    }

    .card-content {
        padding: 18px 18px 22px;
    }

    .card-title {
        font-size: 1.15rem;
    }

    .custom-pagination .nav-links {
        padding: 8px 12px;
        border-radius: 40px;
        gap: 4px;
    }

    .custom-pagination .page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .archive-container {
        padding: 16px 12px;
    }

    .archive-title {
        font-size: 1.8rem;
    }

    .card-excerpt {
        font-size: 0.92rem;
        -webkit-line-clamp: 3;
    }
}
