/* 1. Сбрасываем поведение body из Pico CSS */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    display: block !important;
    overflow-x: hidden;
}
/*************************************************************/
:root {
    --pico-background-color: #F7F6F2;
    --pico-card-background-color: #FCFBF9;
    --pico-muted-border-color: #E6E4DD;
}

html, body {
    background-color: #F7F6F2 !important;
}

/* Мягкие «бумажные» карточки и форма обратной связи */
.contact-card, 
article {
    background-color: #FCFBF9;
    border: 1px solid #E6E4DD;
    border-radius: 10px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

/* Чтобы таблицы и инпуты не выбивались холодным белым */
input[type="text"],
input[type="email"],
textarea {
    background-color: #FFFFFF !important;
    border-color: #DCD9D0 !important;
}

th {
    background-color: #EFECE6 !important;
}
:root {
    --pico-color: #2F2E2B;           /* Мягкий угольный для всего текста */
    --pico-h1-color: #1C1B19;        /* Чуть более насыщенный для заголовков */
    --pico-h2-color: #1C1B19;
    --pico-h3-color: #1C1B19;
    --pico-muted-color: #6E6B63;     /* Тёплый серый для дат, тегов и подписей */
}

/* Дополнительно закрепляем цвет текста внутри карточек */
body, p, li {
    color: #2F2E2B;
}

h1, h2, h3, h4 {
    color: #1C1B19;
}

/* Отступ между карточками статей, чтобы они не слипались */
article {
    margin-bottom: 1.5rem;
}
/* Работает, даже если <a> внутри <h2> ИЛИ <h2> внутри <a> */
main h1 a, main h2 a, main h3 a,
main h1 a:visited, main h2 a:visited, main h3 a:visited,
main a h1, main a h2, main a h3,
main a:visited h1, main a:visited h2, main a:visited h3 {
    color: #1C1B19 !important;
    text-decoration: none !important;
    transition: color 0.2s ease;
}

/* Оранжевая подсветка при наведении в обоих случаях */
main h1 a:hover, main h2 a:hover, main h3 a:hover,
main a:hover h1, main a:hover h2, main a:hover h3 {
    color: #F97316 !important;
    text-decoration: none !important;
}

/* Если подчёркивание остаётся на самой ссылке-обёртке */
main a:has(h1), main a:has(h2), main a:has(h3) {
    text-decoration: none !important;
}


/*************************************************************/

/* 2. Жёстко ставим обёртку сайта строго по центру экрана */
.site-wrapper {
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh;
    width: 100% !important;
    max-width: 1140px !important; /* Можете поменять на 960px или 1200px, если нужно уже/шире */
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    box-sizing: border-box !important;
}

.site-wrapper > main {
    flex: 1;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ТЁМНАЯ ШАПКА (фон на всю ширину без обрезки выпадающего меню) */
.site-header {
    position: relative;
    z-index: 100;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.site-header::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background-color: #16181d;
    border-bottom: 1px solid #2a2d36;
    z-index: -1;
}

/* Внутренние элементы шапки (оставляем как было) */
.site-header nav {
    align-items: center;
}

.site-brand {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.site-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    color: #ffffff;
    text-decoration: none;
}

.site-tagline {
    font-size: 0.85rem;
    color: #F97316 !important; /*#9ca3af; */
}


/* Карточки и картинки */
article img {
    display: block;
    width: 100%;
    max-width: 640px;
    max-height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin: 1rem 0;
}

.meta {
    color: var(--pico-muted-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}


/* ТЁМНЫЙ ПОДВАЛ (фон на всю ширину через ::before) */
.site-footer {
    position: relative;
    z-index: 10;
    margin-top: 4rem;
    padding: 2rem 0 2.5rem;
    font-size: 0.9rem;
    color: #9ca3af;
}

.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    background-color: #16181d;
    border-top: 1px solid #2a2d36;
    z-index: -1;
}

/* Внутренняя сетка и ссылки подвала (оставляем как было) */
.footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-links li {
    margin: 0;
    list-style: none;
}

.footer-links a,
.site-footer a {
    color: #d1d5db;
    text-decoration: none;
}

.footer-links a:hover,
.site-footer a:hover {
    color: #ffffff;
    text-decoration: underline;
}


/* ПАГИНАЦИЯ (раздвигаем кнопки страниц внизу) */
.pagination,
.pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 2.5rem;
}

.pagination ul,
ul.pagination {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.pagination a,
.pagination span,
.pagination li a,
.pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--pico-muted-border-color, #d1d5db);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination a:hover,
.pagination li a:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.pagination .active a,
.pagination .active span,
.pagination li.active a,
.pagination li.active span,
.pagination span.current {
    background-color: #16181d;
    border-color: #16181d;
    color: #ffffff;
    font-weight: 600;
}

/* Аккуратная карточка формы обратной связи */
.contact-card {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    margin-top: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}
.contact-card h2 {
    margin-top: 0;
    margin-bottom: 0.4rem;
    font-size: 1.4rem;
}
.contact-card .form-subtitle {
    color: var(--pico-muted-color);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}
.contact-card label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}
.contact-card input[type="text"],
.contact-card input[type="email"],
.contact-card textarea {
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    margin-top: 0.35rem;
    margin-bottom: 0.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-card textarea {
    resize: vertical;
    max-width: 480px;
    min-height: 110px;
    width: 80%;
}
.contact-card button[type="submit"] {
    width: auto;
    padding: 0.65rem 1.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* ТАБЛИЦЫ */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 16px;
}

th, td {
    border: 1px solid #d0d7de;
    padding: 12px 15px;
    text-align: left;
}

th {
    background-color: #f6f8fa;
    font-weight: 600;
}

@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
    }
}

/* ТОП МЕНЮ (СВЕТЛЫЙ ТЕКСТ НА ТЁМНОМ ФОНЕ) */
header.site-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav {
    position: relative;
}

/* Кнопка-бургер (белые полоски на тёмном фоне) */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
}

.burger-btn span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #ffffff;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.burger-btn.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.burger-btn.open span:nth-child(2) { opacity: 0; }
.burger-btn.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* Основной список меню */
header.site-header nav ul.menu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
}

header.site-header nav ul.menu > li {
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

header.site-header nav ul.menu > li > a {
    display: block;
    padding: 0.5rem 0.85rem;
    margin: 0;
    color: #e5e7eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

header.site-header nav ul.menu > li > a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
}

header.site-header nav ul.menu > li.active > a,
header.site-header nav ul.menu > li > a[aria-current="page"] {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.16);
    font-weight: 600;
    text-decoration: none;
}

/* Выпадающее подменю (оставляем светлым, чтобы красиво читалось поверх контента) */
header.site-header nav ul.menu ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0.4rem 0 !important;
    display: block !important;
    flex-direction: column !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 220px;
    background-color: var(--pico-card-background-color, #ffffff);
    border: 1px solid var(--pico-muted-border-color, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 999 !important;
}

header.site-header nav ul.menu > li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/* Привязка 3-го уровня к пунктам 2-го уровня (например, «Финансы») */
header.site-header nav ul.menu ul li {
    position: relative !important;
}

/* Позиционирование 3-го уровня сбоку справа от 2-го уровня */
header.site-header nav ul.menu ul ul {
    top: -0.4rem !important;
    left: 100% !important;
    min-width: 250px;
    max-width: 320px;
}

/* Показ 3-го уровня при наведении на подкатегорию */
header.site-header nav ul.menu ul li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Разрешаем перенос длинных заголовков статей во вложенном меню */
header.site-header nav ul.menu ul ul li a {
    white-space: normal !important;
    line-height: 1.35;
}

header.site-header nav ul.menu ul li {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

header.site-header nav ul.menu ul li a {
    display: block !important;
    padding: 0.5rem 1rem !important;
    margin: 0 !important;
    color: var(--pico-color, #374151);
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 0;
    white-space: nowrap;
}

header.site-header nav ul.menu ul li a:hover {
    background-color: var(--pico-secondary-focus, rgba(0, 0, 0, 0.05));
    color: var(--pico-primary, #2563eb);
}

header.site-header nav ul.menu ul li.active > a {
    color: var(--pico-primary, #2563eb);
    background-color: var(--pico-primary-focus, rgba(37, 99, 235, 0.1));
    font-weight: 600;
}

/* --- МОБИЛЬНАЯ ВЕРСИЯ --- */
@media (max-width: 768px) {
    .burger-btn {
        display: flex !important;
    }

    .main-nav {
        position: static;
    }

    header.site-header nav ul.menu {
        display: none !important;
        width: 100%;
        flex-direction: column !important;
    }
    
    /* Добавьте ваш класс открытия мобильного меню, если он есть ниже */
}
