/* =========================================================
   Страница статей
   Работает с существующим Smarty-шаблоном без изменения HTML
   ========================================================= */

.articles-page {
    --articles-blue: #0f5fa8;
    --articles-blue-dark: #073d70;
    --articles-blue-light: #eaf6ff;
    --articles-cyan: #20a8e0;
    --articles-border: #d8eaf7;
    --articles-text: #17324a;
    --articles-muted: #6c8193;

    padding-top: 20px;
    padding-bottom: 70px;
}

/* Заголовок страницы */

.articles-page > h1 {
    position: relative;
    margin-bottom: 24px !important;
    color: var(--articles-blue-dark);
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.08;
    letter-spacing: -0.03em;
}


/* Вводный текст */

.articles-page .text-block {
    position: relative;
    overflow: hidden;
    margin-bottom: 36px;
    padding: 24px 28px 24px 32px;
    border: 1px solid var(--articles-border);
    border-radius: 22px;
    background:
            radial-gradient(
                    circle at 95% 10%,
                    rgba(32, 168, 224, 0.14),
                    transparent 32%
            ),
            linear-gradient(135deg, #ffffff 0%, #f1f9ff 100%);
    box-shadow: 0 14px 38px rgba(15, 95, 168, 0.08);
}

.articles-page .text-block::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 0;
    width: 5px;
    border-radius: 0 10px 10px 0;
    background: linear-gradient(
            180deg,
            var(--articles-cyan),
            var(--articles-blue)
    );
}

.articles-page .text-block p {
    margin: 0;
    color: var(--articles-text);
    font-size: 16px;
    line-height: 1.8;
}

/* Сетка */

/*
На desktop и tablet — 2 колонки.
Bootstrap-классы в шаблоне оставляем как есть,
но переопределяем ширину элементов внутри страницы статей.
*/

.articles-page #clients-grid > [class*="col-"] {
    width: 50%;
    flex: 0 0 50%;
    max-width: 50%;
}

/* Карточка статьи */

.articles-page .clients-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--articles-border);
    border-radius: 24px;
    background: #ffffff;
    color: var(--articles-text);
    text-decoration: none;
    box-shadow:
            0 10px 30px rgba(18, 81, 133, 0.08),
            0 2px 8px rgba(18, 81, 133, 0.04);
    transform: translateY(0);
    transition:
            transform 0.35s ease,
            box-shadow 0.35s ease,
            border-color 0.35s ease;
}

.articles-page .clients-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    background: linear-gradient(
            135deg,
            rgba(32, 168, 224, 0.08),
            transparent 45%
    );
    transition: opacity 0.35s ease;
}

.articles-page .clients-card:hover {
    transform: translateY(-8px);
    border-color: rgba(32, 168, 224, 0.55);
    box-shadow:
            0 24px 55px rgba(15, 95, 168, 0.16),
            0 8px 18px rgba(15, 95, 168, 0.08);
}

.articles-page .clients-card:hover::before {
    opacity: 1;
}

/* Дата */

.articles-page .article-post__date {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 100px;
    background: rgba(4, 55, 95, 0.82);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    box-shadow: 0 6px 16px rgba(0, 39, 72, 0.2);
}

/* Изображение */

.articles-page .img-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--articles-blue-light);
}

.articles-page .img-wrap::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 45%;
    pointer-events: none;
    background: linear-gradient(
            180deg,
            transparent 0%,
            rgba(3, 45, 78, 0.25) 100%
    );
}

.articles-page .picture {
    display: block;
    width: 100%;
    height: 100%;
}

.articles-page .picture img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition:
            transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
            filter 0.4s ease;
}

.articles-page .clients-card:hover .picture img {
    transform: scale(1.065);
    filter: saturate(1.05) contrast(1.02);
}

/* Контент карточки */

.articles-page .card-body {
    position: relative;
    z-index: 3;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    padding: 22px 24px 24px;
}

.articles-page .badge-cat {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #c6e6f7;
    border-radius: 100px;
    background: var(--articles-blue-light);
    color: var(--articles-blue);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.articles-page .badge-cat::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--articles-cyan);
    box-shadow: 0 0 0 4px rgba(32, 168, 224, 0.12);
}

/* Название статьи */

.articles-page .card-body > p.fw-medium {
    min-height: auto !important;
    margin-top: 15px !important;
    margin-bottom: 11px !important;
    color: var(--articles-blue-dark);
    font-size: clamp(18px, 2vw, 23px) !important;
    font-weight: 700 !important;
    line-height: 1.32;
    letter-spacing: -0.015em;

    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Краткий текст */

.articles-page .card-body > p.smaller {
    min-height: auto !important;
    margin-bottom: 18px !important;
    color: var(--articles-muted);
    font-size: 14px;
    line-height: 1.68;

    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Псевдокнопка "Читать статью" без изменения HTML */

.articles-page .card-body::after {
    content: "Читать статью  →";
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 42px;
    margin-top: auto;
    padding: 0 17px;
    border-radius: 12px;
    background: linear-gradient(
            135deg,
            var(--articles-blue),
            var(--articles-cyan)
    );
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 95, 168, 0.18);
    transition:
            transform 0.3s ease,
            box-shadow 0.3s ease;
}

.articles-page .clients-card:hover .card-body::after {
    transform: translateX(4px);
    box-shadow: 0 11px 24px rgba(15, 95, 168, 0.28);
}

/* Появление карточек */

@keyframes articlesCardReveal {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.articles-page #clients-grid > [class*="col-"] {
    opacity: 0;
    animation: articlesCardReveal 0.65s ease forwards;
}

.articles-page #clients-grid > [class*="col-"]:nth-child(1) {
    animation-delay: 0.05s;
}

.articles-page #clients-grid > [class*="col-"]:nth-child(2) {
    animation-delay: 0.14s;
}

.articles-page #clients-grid > [class*="col-"]:nth-child(3) {
    animation-delay: 0.23s;
}

.articles-page #clients-grid > [class*="col-"]:nth-child(4) {
    animation-delay: 0.32s;
}

.articles-page #clients-grid > [class*="col-"]:nth-child(n + 5) {
    animation-delay: 0.38s;
}

/* Пагинация */

.articles-page .block-pagination {
    width: 100%;
    margin-top: 22px;
}

.articles-page .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0;
}

.articles-page .pagination a,
.articles-page .pagination span,
.articles-page .pagination .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--articles-border);
    border-radius: 12px !important;
    background: #ffffff;
    color: var(--articles-blue);
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
    transition:
            color 0.25s ease,
            background 0.25s ease,
            border-color 0.25s ease,
            transform 0.25s ease;
}

.articles-page .pagination a:hover,
.articles-page .pagination .page-link:hover {
    transform: translateY(-2px);
    border-color: var(--articles-cyan);
    background: var(--articles-blue-light);
    color: var(--articles-blue-dark);
}

.articles-page .pagination .active .page-link,
.articles-page .pagination .active,
.articles-page .pagination span.current {
    border-color: var(--articles-blue);
    background: linear-gradient(
            135deg,
            var(--articles-blue),
            var(--articles-cyan)
    );
    color: #ffffff;
}

/* Планшет */

@media (max-width: 991.98px) {
    .articles-page {
        padding-bottom: 50px;
    }

    .articles-page .card-body {
        padding: 20px;
    }
}

/* Телефон — одна колонка */

@media (max-width: 767.98px) {
    .articles-page #clients-grid > [class*="col-"] {
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    .articles-page > h1 {
        font-size: 34px;
    }

    .articles-page .text-block {
        margin-bottom: 26px;
        padding: 20px 19px 20px 24px;
        border-radius: 18px;
    }

    .articles-page .text-block p {
        font-size: 15px;
        line-height: 1.7;
    }

    .articles-page .clients-card {
        border-radius: 20px;
    }

    .articles-page .card-body > p.fw-medium {
        font-size: 20px !important;
    }
}

/* Очень маленькие экраны */

@media (max-width: 420px) {
    .articles-page .article-post__date {
        top: 12px;
        left: 12px;
        padding: 7px 10px;
        font-size: 11px;
    }

    .articles-page .card-body {
        padding: 18px;
    }

    .articles-page .card-body::after {
        width: 100%;
    }
}

/* Для пользователей с отключенной анимацией */

@media (prefers-reduced-motion: reduce) {
    .articles-page #clients-grid > [class*="col-"] {
        opacity: 1;
        animation: none;
    }

    .articles-page .clients-card,
    .articles-page .picture img,
    .articles-page .card-body::after {
        transition: none;
    }
}

/* ==================================================
   Навигация между статьями
   Предыдущая / следующая статья
================================================== */

.article-navigation {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 46px;
    margin-bottom: 50px;
}

/* Сбрасываем старые стили кнопок */

.article-navigation .button {
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

/* Карточка-ссылка */

.article-navigation__button .__link {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 132px;
    height: 100%;
    overflow: hidden;
    padding: 24px 26px;
    border: 1px solid #d9edf9;
    border-radius: 22px;
    background:
            radial-gradient(
                    circle at 90% 10%,
                    rgba(47, 183, 243, 0.15),
                    transparent 34%
            ),
            linear-gradient(
                    135deg,
                    #ffffff 0%,
                    #f3faff 100%
            );
    color: #0b3d71;
    text-decoration: none;
    box-shadow:
            0 12px 34px rgba(10, 70, 120, 0.08);
    transition:
            transform 0.35s ease,
            border-color 0.35s ease,
            box-shadow 0.35s ease,
            background 0.35s ease;
}

/* Голубая линия сбоку */

.article-navigation__button .__link::before {
    content: "";
    position: absolute;
    top: 20px;
    bottom: 20px;
    width: 5px;
    border-radius: 20px;
    background: linear-gradient(
            180deg,
            #2fb7f3,
            #0f63b6
    );
}

/* Подписи "Предыдущая статья" и "Следующая статья" */

.article-navigation__button .__link::after {
    position: relative;
    display: block;
    order: -1;
    margin-bottom: 10px;
    color: #268fc9;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.article-navigation__button_prev .__link::after {
    content: "Предыдущая статья";
}

.article-navigation__button_next .__link::after {
    content: "Следующая статья";
}

/* Левая карточка */

.article-navigation__button_prev .__link {
    padding-left: 72px;
}

.article-navigation__button_prev .__link::before {
    left: 0;
}

/* Стрелка влево */

.article-navigation__button_prev .__link span::before {
    content: "←";
    position: absolute;
    left: 25px;
    top: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(
            135deg,
            #0f63b6,
            #2fb7f3
    );
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 7px 16px rgba(15, 99, 182, 0.22);
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

/* Правая карточка */

.article-navigation__button_next .__link {
    align-items: flex-end;
    padding-right: 72px;
    text-align: right;
}

.article-navigation__button_next .__link::before {
    right: 0;
}

/* Стрелка вправо */

.article-navigation__button_next .__link span::after {
    content: "→";
    position: absolute;
    right: 25px;
    top: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(
            135deg,
            #0f63b6,
            #2fb7f3
    );
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 7px 16px rgba(15, 99, 182, 0.22);
    transform: translateY(-50%);
    transition: transform 0.3s ease;
}

/* Название статьи */

.article-navigation__button .__link span {
    position: relative;
    z-index: 2;
    color: #0b3d71;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
}

/* Убираем возможные старые стили icon */

.article-navigation__icon {
    display: block;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    background: none;
}

/* Hover */

.article-navigation__button .__link:hover {
    border-color: rgba(47, 183, 243, 0.7);
    background:
            radial-gradient(
                    circle at 90% 10%,
                    rgba(47, 183, 243, 0.22),
                    transparent 38%
            ),
            linear-gradient(
                    135deg,
                    #ffffff 0%,
                    #eaf7ff 100%
            );
    box-shadow:
            0 22px 48px rgba(15, 99, 182, 0.15);
    transform: translateY(-5px);
}

.article-navigation__button_prev .__link:hover span::before {
    transform: translate(-4px, -50%);
}

.article-navigation__button_next .__link:hover span::after {
    transform: translate(4px, -50%);
}

/* Focus для клавиатуры */

.article-navigation__button .__link:focus-visible {
    outline: 3px solid rgba(47, 183, 243, 0.35);
    outline-offset: 4px;
}

/* Планшеты и телефоны */

@media (max-width: 767.98px) {
    .article-navigation {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-top: 34px;
        margin-bottom: 38px;
    }

    .article-navigation__button .__link {
        min-height: 112px;
        border-radius: 18px;
    }

    .article-navigation__button_next .__link {
        align-items: flex-start;
        padding-right: 72px;
        text-align: left;
    }

    .article-navigation__button .__link span {
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    .article-navigation__button_prev .__link {
        padding: 20px 18px 20px 62px;
    }

    .article-navigation__button_next .__link {
        padding: 20px 62px 20px 18px;
    }

    .article-navigation__button_prev .__link span::before {
        left: 17px;
    }

    .article-navigation__button_next .__link span::after {
        right: 17px;
    }
}