/* Базовые стили: Современный Необанк */
:root {
    --bg-color: #f4f7fb;
    --white: #ffffff;
    --text-main: #1c1e21;
    --text-muted: #6b7280;
    --primary-blue: #4f46e5;
    --accent-green: #10b981;
    --tag-bg: #e0e7ff;
    --radius: 16px;
}

html {
    /* Делаем прокрутку плавной при клике на оглавление */
    scroll-behavior: smooth; 
    /* Делаем отступ от верхнего края, равный высоте шапки + немного "воздуха" */
    scroll-padding-top: 100px; 
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
    /* Новые правила для прижатия футера */




.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

#header {
    background-color: var(--white);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    /* Новые правила для фиксации */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-blue);
}



h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: var(--text-main);
}

/* =========================================
   ХЛЕБНЫЕ КРОШКИ (Breadcrumbs)
========================================= */
.breadcrumbs {
    margin-bottom: 24px;
}

/* Делаем навигацию гибкой, чтобы элементы переносились при нехватке места */
nav.breadcrumbs {
    display: flex;
    flex-wrap: wrap; 
    align-items: center;
    gap: 8px; /* Расстояние между ссылками и разделителями */
    margin: 0;
    padding: 0;
}

.breadcrumbs__link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.breadcrumbs__link:hover {
    color: var(--primary-blue);
}

.breadcrumbs__sep {
    color: #d1d5db; /* Светло-серый цвет для галочек */
    font-size: 14px;
    user-select: none; /* Запрещаем выделение разделителя мышкой при копировании пути */
}

.breadcrumbs__current {
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    /* Немного обрезаем слишком длинные названия только на узких экранах, добавляя троеточие */
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* На мобильных даем больше пространства для нажатия пальцем */
@media (max-width: 768px) {
    .breadcrumbs__link, .breadcrumbs__current {
        font-size: 13px;
    }
}

/* Блок SEO-тегов */
.seo-tags-wrapper {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 30px;
    scrollbar-width: none;
}

.seo-tags-wrapper::-webkit-scrollbar {
    display: none;
}

.seo-tags-wrapper a {
    display: inline-block;
    white-space: nowrap;
    background-color: var(--tag-bg);
    color: var(--primary-blue);
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.seo-tags-wrapper a.active-tag {
    background-color: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

/* Контейнер для CPA скрипта */
#cpa-offers-script {
    min-height: 300px;
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-bottom: 40px;
}

/* Сетка статей */
/*
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
*/
.article-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

/* Контент статьи */
.content-area {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    max-width: 800px;
    margin: 0 auto;
}

article > header {
    position: relative !important;
}

.content-area > header {
    position: relative !important;
}

@media (max-width: 768px) {
    h1 { font-size: 24px; }
    .content-area { padding: 20px; }
}


/* =========================================
   ШАПКА И МЕНЮ (Header & Nav)
========================================= */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-blue);
}

.nav-menu {
    display: flex;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover {
    color: var(--primary-blue);
}

/* Кнопка бургера (скрыта на десктопе) */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    margin: 5px 0;
    transition: 0.3s;
}

/* =========================================
   ТИПОГРАФИКА СТАТЕЙ (Content Area)
========================================= */
.content-area img {
    max-width: 100%;
    height: auto; /* Сохраняет правильные пропорции картинки */
    display: block; /* Убирает лишний отступ под картинкой, свойственный строчным элементам */
    border-radius: 8px; /* Легкое скругление углов для стиля "Необанк" */
    margin: 24px auto; /* Отступы сверху и снизу, центрирование по горизонтали */
}

.content-area h2 {
    font-size: 24px;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--primary-blue);
}

.content-area p {
    margin-bottom: 16px;
    font-size: 16px;
    color: #374151;
}

/* =========================================
   ТАБЛИЦЫ В СТАТЬЯХ
========================================= */
.content-area table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    background-color: var(--white);
    border-radius: 8px; /* Скругление углов таблицы */
    overflow: hidden; /* Прячем углы строк, чтобы скругление таблицы работало */
    box-shadow: 0 0 0 1px #e5e7eb; /* Тонкая аккуратная рамка вокруг всей таблицы */
}

.content-area th, 
.content-area td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    color: var(--text-main);
    font-size: 15px;
}

.content-area th {
    background-color: var(--tag-bg); /* Светло-синий фон для шапки */
    color: var(--primary-blue);
    font-weight: 600;
}

/* Убираем нижнюю линию у последней строки */
.content-area tr:last-child td {
    border-bottom: none;
}

/* "Зебра" — чередование цвета строк для удобства чтения широких таблиц */
.content-area tr:nth-child(even) {
    background-color: #f9fafb;
}

/* =========================================
   АДАПТИВНОСТЬ ТАБЛИЦ ДЛЯ МОБИЛЬНЫХ
========================================= */
@media (max-width: 768px) {
    .content-area table {
        display: block; /* Превращаем таблицу в блочный элемент */
        overflow-x: auto; /* Включаем горизонтальный скролл */
        white-space: nowrap; /* Запрещаем тексту сжиматься в нечитаемую узкую колонку */
        -webkit-overflow-scrolling: touch; /* Плавный скролл на iOS */
    }
    
    .content-area th, 
    .content-area td {
        padding: 12px;
        font-size: 14px;
    }
}

.content-area ul, .content-area ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.content-area li {
    margin-bottom: 10px;
}

/* Кастомные маркеры списков */
.content-area ul {
    list-style-type: none;
}

.content-area ul li {
    position: relative;
    padding-left: 10px;
}

.content-area ul li::before {
    content: "•";
    color: var(--accent-green);
    font-weight: bold;
    font-size: 20px;
    position: absolute;
    left: -15px;
    top: -2px;
}

.content-area blockquote {
    margin: 24px 0;
    padding: 16px 24px;
    background-color: var(--tag-bg);
    border-left: 4px solid var(--primary-blue);
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--primary-blue);
}

/* =========================================
   ПОДВАЛ САЙТА (Footer)
========================================= */
.site-footer {
    background-color: var(--white);
    padding: 40px 0 20px;
    margin-top: 60px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    /* Новое правило */
    flex-shrink: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.footer-col h4 {
    color: var(--text-main);
    font-size: 18px;
    margin-bottom: 20px;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-col ul a:hover {
    color: var(--primary-blue);
}

.footer-bottom {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* =========================================
   АДАПТИВ (Mobile)
========================================= */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }
    
    .nav-menu {
        display: none; /* Скрываем меню по умолчанию на мобилках */
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--white);
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        z-index: 100;
    }

    .nav-menu.active {
        display: flex; /* Показываем при клике на бургер */
    }
}

/* =========================================
   ОГЛАВЛЕНИЕ СТАТЬИ (TOC)
========================================= */
.toc-container {
    background-color: var(--bg-color);
    padding: 24px;
    border-radius: var(--radius);
    margin: 30px 0;
    border: 1px solid #e5e7eb;
}

.toc-container strong {
    display: block;
    margin-bottom: 16px;
    font-size: 18px;
    color: var(--primary-blue);
}

.toc-list {
    list-style: none !important; /* Перебиваем стили обычных списков статьи */
    padding-left: 0 !important;
    margin: 0 !important;
}

.toc-list li {
    margin-bottom: 10px !important;
}

/* Убираем кастомные точки, которые мы делали для списков в статье */
.toc-list li::before {
    display: none !important; 
}

.toc-item a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s ease;
}

.toc-item a:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

/* Делаем отступ для подзаголовков H3, чтобы показать иерархию */
.toc-h3 {
    padding-left: 20px !important;
    font-size: 15px;
}

.toc-h3 a {
    color: var(--text-muted);
    font-weight: 400;
}

/* =========================================
   ВИДЖЕТ КУРСОВ ВАЛЮТ
========================================= */
.exchange-rates-widget {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none; /* Прячем скроллбар в Firefox */
}

.exchange-rates-widget::-webkit-scrollbar {
    display: none; /* Прячем скроллбар в Chrome/Safari */
}

.rate-card {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 16px 20px;
    min-width: 220px;
    flex: 1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.rate-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    font-size: 18px;
}

.rate-flag {
    font-size: 20px;
}

.rate-values {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.rate-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rate-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rate-value {
    font-weight: 600;
    color: var(--text-main);
    font-size: 16px;
}

.rate-loading {
    color: var(--text-muted);
    font-size: 14px;
    padding: 20px 0;
}

/* =========================================
   ФИНАНСОВЫЙ ДАШБОРД (Dashboard)
========================================= */
.fin-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.dashboard-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dash-card {
    background-color: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e5e7eb;
}

.dash-card.h-100 {
    height: 100%;
}

.dash-card.bg-blue {
    background: linear-gradient(135deg, var(--primary-blue), #3b32c9);
    color: var(--white);
    border: none;
}

.dash-card.bg-blue h3, 
.dash-card.bg-blue .rate-date {
    color: rgba(255, 255, 255, 0.9);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
}

.card-icon {
    font-size: 24px;
}

/* Ставка */
.key-rate-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.rate-huge {
    font-size: 42px;
    font-weight: 800;
    line-height: 1;
}

.rate-date {
    font-size: 13px;
    opacity: 0.9;
}

/* Металлы */
.metal-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.metal-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.metal-name {
    font-weight: 500;
    color: var(--text-main);
}

.metal-price {
    font-weight: 700;
    color: var(--text-main);
}

/* Новости */
.news-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.news-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
}

.news-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-date {
    font-size: 12px;
    color: var(--text-muted);
}

.news-title {
    font-size: 15px;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.3s;
}

.news-item:hover .news-title {
    color: var(--primary-blue);
}

/* Адаптив для телефонов */
@media (max-width: 768px) {
    .fin-dashboard {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   СЕТКА СТАТЕЙ (БЛОГ)
========================================= */
.cms-article-cards__heading {
    font-size: 28px;
    color: var(--text-main);
    margin-bottom: 24px;
}

.cms-article-cards__grid {
    display: grid;
    /* Адаптивная сетка: колонки не уже 300px, заполняют все доступное пространство */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* Карточка статьи */
.cms-article-card {
    display: flex;
    flex-direction: column;
    background-color: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid #e5e7eb;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%; /* Все карточки в одном ряду будут одинаковой высоты */
}

.cms-article-card:hover {
    transform: translateY(-2px); /* Легкое поднятие при наведении */
    box-shadow: 0 12px 25px rgba(0,0,0,0.08);
}

/* Изображение карточки */
.cms-article-card__thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Жестко задаем пропорцию 16:9 для всех картинок */
    background-color: var(--tag-bg);
    overflow: hidden;
}

.cms-article-card__thumb img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Картинка заполняет блок без искажений пропорций */
    transition: transform 0.5s ease;
}

.cms-article-card:hover .cms-article-card__thumb img {
    transform: scale(1.05); /* Эффект наезда камеры на фото */
}

/* Заглушка (если в статье нет картинки, как в калькуляторе) */
.cms-article-card__thumb--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-size: 64px;
    color: var(--primary-blue);
    opacity: 0.15;
}

/* Тело карточки (текст и кнопка) */
.cms-article-card__body {
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-grow: 1; /* Заставляет тело растянуться и заполнить карточку */
}

.cms-article-card__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.4;
    transition: color 0.3s ease;
    /* Обрезаем длинный заголовок ровно до 2 строк с троеточием */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cms-article-card:hover .cms-article-card__title {
    color: var(--primary-blue);
}

.cms-article-card__desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1; /* Выталкивает кнопку "Подробнее" в самый низ */
    /* Обрезаем длинное описание ровно до 3 строк с троеточием */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Кнопка "Подробнее" */
.cms-article-card__button {
    display: block;
    width: 100%;
    padding: 12px 0;
    text-align: center;
    background-color: var(--tag-bg);
    color: var(--primary-blue);
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    margin-top: auto; /* Гарантирует, что кнопка всегда прижата ко дну */
}

.cms-article-card:hover .cms-article-card__button {
    background-color: var(--primary-blue);
    color: var(--white);
}

/* =========================================
   ПАГИНАЦИЯ (Навигация по страницам)
========================================= */
.cms-article-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    flex-wrap: wrap; /* Чтобы на телефонах страницы переносились аккуратно */
}

.cms-article-pagination__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border-radius: 8px;
    background-color: var(--white);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.cms-article-pagination__link:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
    background-color: var(--tag-bg);
}

.cms-article-pagination__link.is-active {
    background-color: var(--primary-blue);
    color: var(--white);
    border-color: var(--primary-blue);
    pointer-events: none; /* Запрещаем кликать по текущей странице */
}




/* =========================================
   Оглавление статьи (Table of Contents)
   ========================================= */
/* =========================================
   Оглавление (Светло-синий фон)
   ========================================= */
article.content-area nav {
    background-color: #e8f4f8; /* Фирменный светло-синий фон */
    border: 1px solid #cce5f0;
    border-radius: 8px;
    padding: 25px 30px;
    margin: 35px 0;
    /* Легкая синяя полоска слева для стиля */
    box-shadow: inset 4px 0 0 var(--primary-color); 
}

article.content-area nav p {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: var(--primary-dark);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

article.content-area nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

article.content-area nav li {
    margin-bottom: 12px;
    padding-left: 20px;
    position: relative;
}

article.content-area nav li:last-child {
    margin-bottom: 0;
}

/* Маркеры в виде стрелочек */
article.content-area nav li::before {
    content: "→";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--primary-color);
    font-weight: bold;
}

article.content-area nav a {
    color: var(--text-dark);
    text-decoration: none;
    font-size: 0.95em;
    transition: color 0.2s;
    border-bottom: 1px solid transparent;
}

article.content-area nav a:hover {
    color: var(--primary-color);
    border-bottom: 1px solid var(--primary-color);
}