/* ==========================================================================
   1. БАЗОВЫЕ НАСТРОЙКИ, СБРОС И ПЕРЕМЕННЫЕ (RESET & VARIABLES)
   ========================================================================== */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --text-color: #334155;
    --text-dark: #1a1a1a;
    --text-muted: #64748b;
    --bg-main: #f4f7f6;
    --bg-light: #f8fafc;
    --border-color: #e2e8f0;
    --container-width: 1300px;
    /* Цвет зоны overscroll над sticky-шапкой (должен совпадать с header) */
    --overscroll-bg: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    background-color: #ffffff;
    overscroll-behavior: none;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-main);
    overscroll-behavior: none;
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Контент скроллится здесь; шапка внутри — может уехать с «резинкой» */
.app-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
    background-color: var(--bg-main);
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: all 0.3s ease;
}

a:hover {
    color: #003d82;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

section {
    padding: 60px 0;
}

/* Сетки макетов страниц */
main.container {
    position: relative;
    z-index: 1;
}

.main-content-wrapper {
    padding: 40px 0;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.content-left {
    flex: 1;
    min-width: 300px;
}

.content-right {
    width: 320px;
    min-width: 280px;
}

/* Общие элементы типографики и секций */
.section-title {
    font-size: 2rem;
    margin-bottom: 30px;
    border-left: 4px solid var(--primary-color);
    padding-left: 15px;
    color: var(--text-dark);
}

.page-header {
    margin-bottom: 35px;
    padding: 4px 0 4px 20px;
    border-left: 4px solid #0b1f33;
    background: transparent !important;
    box-shadow: none !important;
}

.page-header .page-title {
    font-size: 2.6rem;
    line-height: 1.25;
    font-weight: 700;
    margin: 0;
    color: #0b1f33;
    letter-spacing: -0.5px;
}

.page-header .page-date {
    margin-top: 10px;
    color: #6c757d;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.content-divider {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 40px 0;
}

.search-page-main .content-divider {
    margin: 30px 0;
}

/* Алерт-информер ошибок */
.alert-danger {
    color: #e53e3e;
    background-color: #fff5f5;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #fed7d7;
}

/* ==========================================================================
   2. КНОПКИ (BUTTONS)
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    border: none;
    transition: background 0.3s, color 0.3s;
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff !important;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-news {
    margin-top: 15px;
    background: var(--primary-color);
    color: #fff !important;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color) !important;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #fff !important;
}

.btn-block {
    display: block;
    width: 100%;
    margin-top: 20px;
}

.btn-small {
    padding: 6px 15px;
    font-size: 14px;
}

/* Кнопка "Читать далее" внутри карточки поиска */
.search-read-more {
    align-self: flex-start;
    padding: 6px 16px;
    font-size: 0.9rem;
}

/* ==========================================================================
   3. ШАПКА И МНОГОУРОВНЕВОЕ МЕНЮ (HEADER & NAV)
   ========================================================================== */
/*
  В потоке скролла: при rubber-band уезжает вместе со страницей.
  .is-pinned — сразу возвращается и держится сверху при скролле вниз.
*/
.site-header {
    position: relative;
    z-index: 10000;
    background: #ffffff !important;
    width: 100%;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.site-header.is-pinned {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

.site-header-spacer {
    display: none;
    width: 100%;
    flex-shrink: 0;
    pointer-events: none;
}

.site-header-spacer.is-active {
    display: block;
}

header .header-top {
    position: relative;
    z-index: 1002;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    /* Нельзя padding: 15px 0 — затирает отступы .container у краёв */
    padding: 15px 24px;
    border-bottom: 1px solid #eee;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

header .main-nav {
    position: relative;
    z-index: 1001;
    background: #ffffff;
    padding: 5px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
    line-height: 1.2;
    text-transform: uppercase;
    flex: 1 1 auto;
    min-width: 0;
}

.logo span {
    font-size: 0.85rem;
    color: #666;
    font-weight: normal;
    display: block;
    text-transform: none;
    margin-top: 4px;
}

.logo-text {
    min-width: 0;
}

.logo img {
    height: 50px;
    width: auto;
    flex-shrink: 0;
}

/* Кнопка «бургер» — на планшетах и телефонах */
.nav-toggle {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 56px;
    height: 52px;
    padding: 6px 8px;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    background: #f0f7ff;
    cursor: pointer;
    flex-shrink: 0;
    z-index: 1005;
}

.nav-toggle-bars {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 22px;
    height: 16px;
}

.nav-toggle-bar {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle-label {
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.site-header.nav-open .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.site-header.nav-open .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.site-header.nav-open .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-backdrop {
    display: none;
}

.mobile-nav-tools {
    display: none;
}

/* Пункты из «Еще» — только в мобильном меню */
.mobile-only-nav {
    display: none !important;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-actions .bvi-open {
    white-space: nowrap;
    font-size: 0.88rem;
}

.eye-link {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    color: #333;
    font-size: 0.9rem;
    margin-right: 15px;
}

.eye-link:hover {
    color: var(--primary-color);
}

/* Стили формы поиска */
.header-search-form {
    display: flex;
    align-items: center;
    position: relative;
    background-color: #f5f7fa;
    border: 1px solid #dcdfe6;
    border-radius: 6px;
    padding: 2px 4px;
    transition: all 0.3s ease;
    max-width: 220px;
}

.header-search-form:focus-within {
    border-color: #0d4cd3;
    background-color: #fff;
    box-shadow: 0 0 0 2px rgba(13, 76, 211, 0.15);
}

.header-search-form input[type="text"] {
    border: none;
    background: transparent;
    outline: none;
    padding: 6px 8px;
    font-size: 14px;
    width: 100%;
    color: #333;
}

.header-search-form input[type="text"]::placeholder {
    color: #909399;
}

.search-submit-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #606266;
    transition: color 0.2s ease;
}

.search-submit-btn:hover {
    color: #0d4cd3;
}

/* Списки навигации */
.nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 25px;
    align-items: center;
    justify-content: center;
}

.nav-list > li {
    position: relative;
}

.nav-list a, .nav-list .opener {
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 12px 0;
    display: block;
    color: #333;
}

.nav-list a:hover, .nav-list .opener:hover {
    color: var(--primary-color);
}

.nav-list .opener::after {
    content: ' ▼';
    font-size: 0.6rem;
    vertical-align: middle;
    color: #888;
    margin-left: 4px;
}

/* Раскрывающийся Dropdown */
.nav-list ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #ffffff;
    min-width: 280px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border-radius: 0 0 8px 8px;
    border-top: 3px solid var(--primary-color);
    padding: 10px 0;
    z-index: 9999;
}

.nav-list li:hover > ul {
    display: block;
    animation: fadeInMenu 0.2s ease-in-out;
}

.nav-list ul li a {
    font-weight: 500;
    font-size: 0.85rem;
    padding: 10px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s, padding-left 0.2s;
    color: #444;
}

.nav-list ul li a:hover {
    background: #f8f9fa;
    color: var(--primary-color);
    padding-left: 25px;
}

.nav-list ul li:last-child a {
    border-bottom: none;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   4. HERO ЗОНА И ВИДЖЕТЫ-КАТЕГОРИИ (HERO & WIDGETS)
   ========================================================================== */
.hero {
    /* Фон вернули для визуала + затемнение для читаемости заголовка */
    background: linear-gradient(rgba(10, 30, 60, 0.82), rgba(10, 30, 60, 0.88)), url('/static/icon/logo2.png') center/cover;
    color: #fff;
    padding: 60px 20px 100px;
    text-align: center;
}

.hero-single-image img {
    width: 100%;
    height: auto;
    display: block;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-slider-container {
    max-width: 1260px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Сетка виджетов на главной */
.widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: -50px;
    position: relative;
    z-index: 10;
}

.widget {
    background: #ffffff;
    padding: 30px 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    font-weight: bold;
    font-size: 1.1rem;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    border-bottom: 4px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #333;
}

.widget:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    color: var(--primary-color);
}

.widget-icon {
    font-size: 1.6rem;
    line-height: 1;
}

/* Важные объявления (Promo-слайдер) */
.promo-block {
    position: relative; 
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 15px;
    margin-bottom: 15px;
}

.promo-slides-container {
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.promo {
    background: #ffeaa7;
    color: #d35400;
    margin: 0 !important; 
    padding: 20px 60px !important;
    text-align: center;
    font-weight: bold;
    border-radius: 8px;
    font-size: 1.1rem;
    border-left: 5px solid #d35400;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    box-sizing: border-box;
    width: 100%;
}

.promo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.05); 
    color: #333; 
    border: none;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.3s ease, color 0.3s ease;
    user-select: none;
}

.promo-prev { left: 15px; }
.promo-next { right: 15px; }

.promo-nav:hover {
    color: #000; 
    background: rgba(0, 0, 0, 0.12); 
}

.promo-slide {
    display: none;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.promo-slide.active {
    display: block;
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   5. СЛАЙДЕР НАПРАВЛЕНИЙ И ТАБЫ СПЕЦИАЛЬНОСТЕЙ
   ========================================================================== */
.spec-section {
    padding-top: 20px;
    padding-bottom: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid #cbd5e1;
    background: #fff;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
    color: #475569;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.specs-slider-container {
    position: relative;
    width: 100%;
}

.specs-slider {
    position: relative;
    z-index: 1;
    margin: 0 -10px;
}

/* Маскировка скрытия до инициализации Slick */
.specs-slider:not(.slick-initialized) {
    display: flex;
    overflow: hidden; 
    gap: 20px;
    flex-wrap: nowrap;
}

.specs-slider:not(.slick-initialized) .spec-slide {
    flex: 0 0 25%;
    max-width: 25%;
}

.spec-slide {
    padding: 15px 10px;
    display: flex !important;
    height: auto !important;
}

.slick-track {
    display: flex !important;
    align-items: stretch !important;
}

.spec-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s;
    display: flex !important;
    flex-direction: column;
    justify-content: space-between;
    height: 100% !important;
    width: 100%;
    box-sizing: border-box;
}

.spec-card:hover {
    transform: translateY(-5px);
}

.spec-img {
    height: 180px;
    background-color: #e2e8f0;
    background-position: center;
    background-size: cover;
}

.spec-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}

.spec-code {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.spec-title {
    font-weight: bold;
    font-size: 14px !important;
    line-height: 1.4 !important;
    margin-bottom: 15px;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 80px; /* Фиксация высоты заголовка */
}

.spec-meta {
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.spec-content .btn {
    margin-top: auto;
}

/* Изящные круглые стрелки Slick Carousel */
.specs-slider .slick-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 0 !important;
    color: transparent !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.specs-slider .slick-arrow::before {
    font-size: 18px;
    color: #333;
    font-family: Arial, sans-serif;
    display: block;
    text-align: center;
    line-height: 42px;
}

.specs-slider .slick-prev { left: 10px; }
.specs-slider .slick-prev::before { content: "❮"; }

.specs-slider .slick-next { right: 10px; }
.specs-slider .slick-next::before { content: "❯"; }

.specs-slider .slick-arrow:hover {
    background: #ffffff !important;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.08);
}

/* ==========================================================================
   6. ЛЕНТА НОВОСТЕЙ И КАРТОЧКИ (NEWS & CARDS)
   ========================================================================== */
.news-main-container {
    margin-top: 40px;
    margin-bottom: 40px;
}

.news-section {
    padding-top: 20px;
    padding-bottom: 20px;
}

.news-wrapper {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.news-container {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

/* Главный блок новости */
.news-main {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-light);
    position: relative;
    display: flex;
    flex-direction: column;
}

.news-main-img {
    width: 100%;
    height: 350px;
    overflow: hidden;
    position: relative;
    border-radius: 8px;
}

.news-main-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.news-main-img.no-image {
    background: #e4ecfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-main-img.no-image img {
    height: 180px;
    width: auto;
    opacity: 0.3;
    object-fit: contain;
}

.news-main-content {
    padding: 30px;
}

.news-main-content h3 {
    font-size: 1.5rem;
    margin: 10px 0;
    line-height: 1.3;
}

.news-date {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 5px;
    display: inline-block;
}

/* Сетка обычных новостей, поиска и архивов */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.news-item {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 15px;
    background: var(--bg-light);
    border-radius: 10px;
    transition: background 0.3s;
}

.news-item:hover {
    background: #f1f5f9;
}

.news-item-img {
    width: 100px;
    height: 80px;
    border-radius: 8px;
    background-color: #cbd5e1;
    overflow: hidden;
    flex-shrink: 0;
}

.news-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.news-item-img.no-image {
    background: #e4ecfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-item-img.no-image img {
    height: 70px;
    width: auto;
    opacity: 0.3;
    object-fit: contain;
}

.news-item-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
}

/* Универсальная полноценная карточка новости */
.news-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.news-card-img {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.news-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.news-card:hover .news-card-img img {
    transform: scale(1.05);
}

.news-card-img.no-image {
    background: #e4ecfd;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-card-img.no-image img {
    height: 80px;
    width: auto;
    opacity: 0.3;
    object-fit: contain;
}

.news-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.news-card-body h3 {
    font-size: 1.25rem;
    color: #0b1f33;
    margin: 0 0 12px 0;
    line-height: 1.4;
    font-weight: 700;
}

.news-card-body h3 a {
    color: inherit;
}

.news-card-body h3 a:hover {
    color: #0d4cd3;
}

.news-card-text {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.news-card-body .btn {
    align-self: flex-start;
    padding: 6px 16px;
    font-size: 0.9rem;
    margin-top: auto;
}

.load-more-container {
    text-align: center;
    margin-top: 20px;
}

/* ==========================================================================
   7. ВНУТРЕННИЕ СТРАНИЦЫ И ВЫВОД КОНТЕНТА (DETAILED PAGES & WYSIWYG)
   ========================================================================== */

/* Основной контейнер страницы новости */

.menu-main-container,
.submenu-main-container,
.post-main-container,
.search-main-container {
    margin-top: 40px;
    margin-bottom: 40px;
}

.page-title {
    margin-bottom: 20px;
    font-size: 2rem;
    color: #0b1f33;
}

/* Текстовые обертки редактора контента */
.rich-text-content,
.menu-text-content,
.submenu-text-content,
.post-content {
    line-height: 1.6;
    font-size: 1.1rem;
    color: #333333;
}

.post-content {
    margin-bottom: 40px;
}

.rich-text-content p,
.menu-text-content p,
.submenu-text-content p,
.post-content p {
    margin-top: 1.3rem;
    margin-bottom: 1.3rem;
}

.post-content h2,
.post-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111111;
}

/* Возвращаем маркеры списков из WYSIWYG админки */
.post-content ul {
    list-style-type: disc !important;
    padding-left: 25px;
    margin-bottom: 20px;
}

.post-content ol {
    list-style-type: decimal !important;
    padding-left: 25px;
    margin-bottom: 20px;
}

.post-content li {
    margin-bottom: 8px;
}

/* Сетка для дочерних кнопок подменю */
.submenu-links-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
}

/* Обертка галереи картинок PhotoSwipe */
.post-gallery-wrapper {
    margin-top: 30px;
}

.gallery-title {
    margin-bottom: 20px;
}

.demo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.gallery-link {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    height: 150px;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-link:hover .gallery-img {
    transform: scale(1.05);
}

/* Элементы поиска */
.search-results-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: #0b1f33;
}

.search-results-header { margin-bottom: 25px; }
.search-main-title { font-size: 2rem; }
.search-alert { margin-bottom: 20px; }

.no-results {
    font-size: 1.1rem;
    color: #6c757d;
    margin-top: 20px;
    font-style: italic;
}

/* ==========================================================================
   8. СТРАНИЦА АРХИВА (ARCHIVE TREE BLOCK)
   ========================================================================== */

.archive-main-container {
    margin-top: 40px;
    margin-bottom: 40px;
}

.archive-year-wrapper {
    margin-bottom: 15px;
    border: 1px solid #e4ecfd;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
}

.archive-year-toggler {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8faff;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.archive-year-toggler:hover {
    background: #e4ecfd;
}

.archive-year-toggler h3 {
    margin: 0;
    color: #0b1f33;
    font-size: 1.3rem;
}

.archive-year-toggler .arrow-indicator {
    transition: transform 0.2s ease;
    display: inline-block;
    color: #0d4cd3;
}

.archive-months-list {
    display: none;
    list-style: none;
    padding: 10px 20px;
    margin: 0;
    border-top: 1px solid #e4ecfd;
    background: #fff;
}

.archive-months-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f5;
}

.archive-months-list li:last-child {
    border-bottom: none;
}

.archive-months-list a {
    color: #0d4cd3;
    text-decoration: none;
    font-size: 1.05rem;
    display: inline-block;
    transition: color 0.2s ease;
}

.archive-months-list a:hover {
    color: #2d73bc;
}

.archive-posts-section {
    margin-top: 40px;
}

.archive-section-title {
    font-size: 1.8rem;
    color: #0b1f33;
    margin-bottom: 25px;
    border-left: 4px solid #0d4cd3;
    padding-left: 15px;
}

/* ==========================================================================
   9. ПАРТНЕРЫ И РЕСУРСЫ (PARTNERS BLOCK)
   ========================================================================== */
.gosuslugi-section {
    padding-top: 20px;
    padding-bottom: 40px;
}

/* Виджет POS Госуслуг ломается от глобального img { max-width: 100% } */
.gosuslugi-section img {
    max-width: none;
    height: auto;
}

.gosuslugi-section #js-show-iframe-wrapper {
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
}

.gosuslugi-section #js-show-iframe-wrapper .bf-92 {
    width: 100%;
}

.partners-section {
    padding-top: 0;
}

.partners-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

/* По умолчанию — только первая строка (4 колонки) */
.partners-grid:not(.is-expanded) .partner-item:nth-child(n+5) {
    display: none;
}

.partner-item {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    /* Высота по картинке — текст на баннере не обрезается */
    height: auto;
    min-height: 0;
    font-weight: bold;
    color: #64748b;
    font-size: 1.1rem;
    text-align: center;
    transition: transform 0.2s, border-color 0.2s, color 0.2s;
    cursor: pointer;
}

.partner-item a {
    display: block;
    width: 100%;
    line-height: 0;
}

.partner-item:hover {
    transform: scale(1.03);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.partner-item img {
    width: 100%;
    height: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
}

.partners-catalog-btn {
    text-align: center;
}

.partners-catalog-btn .btn[hidden] {
    display: none !important;
}

/* ==========================================================================
   10. ФУТЕР / ПОДВАЛ (FOOTER)
   ========================================================================== */
footer {
    background: #111827;
    color: #cbd5e1;
    padding: 30px 0 30px;
    margin-top: 60px;
    font-size: 0.9rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 50px;
}

.footer-col h4 {
    color: #fff;
    margin-bottom: 25px;
    font-size: 1.1rem;
    border-bottom: 2px solid #334155;
    padding-bottom: 15px;
    text-transform: uppercase;
}

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

.footer-col ul li a {
    color: #cbd5e1;
    transition: color 0.2s, padding-left 0.2s;
}

.footer-col ul li a:hover {
    color: #38bdf8;
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    padding: 15px 0 15px;
    border-top: 1px solid #334155;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.socials {
    display: flex;
    gap: 15px;
}

.socials a {
    background: #334155;
    padding: 8px 15px;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    transition: background 0.3s;
}

.socials a:hover {
    background: #38bdf8;
}

/* ==========================================================================
   11. АДАПТИВНОСТЬ И ОСОБЫЕ МЕДИА-ЗАПРОСЫ (MEDIA QUERIES)
   ========================================================================== */

/* Телефон и узкий планшет: бургер с ~900px */
@media (max-width: 900px) {
    .header-top {
        padding: 12px 20px;
    }

    .logo {
        font-size: 0.95rem;
        gap: 10px;
    }

    .logo img {
        height: 40px;
        width: 40px;
        object-fit: contain;
    }

    .logo-text {
        overflow: visible;
    }

    .logo span {
        font-size: 0.72rem;
        line-height: 1.3;
        display: block;
        margin-top: 3px;
        color: #64748b;
    }

    .header-actions--desktop {
        display: none !important;
    }

    .nav-toggle {
        display: flex !important;
        margin-right: 2px;
    }

    /* На мобилке «Еще» убираем, пункты уже в общем списке */
    .nav-list > .item-more {
        display: none !important;
    }

    .nav-list > .mobile-only-nav {
        display: block !important;
        width: 100%;
        border-bottom: 1px solid #eef2f7;
    }

    header .main-nav {
        display: none;
        position: fixed;
        top: var(--mobile-header-height, 64px);
        left: 16px;
        right: 16px;
        z-index: 1001;
        padding: 0;
        max-width: 480px;
        margin: 0 auto;
    }

    header .main-nav.is-open {
        display: block;
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        top: var(--mobile-header-height, 64px);
        background: rgba(15, 23, 42, 0.35);
        z-index: 1000;
    }

    .nav-backdrop[hidden] {
        display: none !important;
    }

    body.nav-open {
        overflow: hidden;
    }

    body.nav-open .app-scroll {
        overflow: hidden;
    }

    .nav-panel {
        max-height: min(70vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
        border: 1px solid #e2e8f0;
    }

    .mobile-nav-tools {
        display: block;
        padding: 12px 14px 10px;
        border-bottom: 1px solid #eef2f7;
    }

    .header-search-form--mobile {
        max-width: none;
        width: 100%;
        margin-bottom: 10px;
    }

    .mobile-nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }

    .mobile-nav-links .bvi-open {
        font-size: 0.85rem;
        font-weight: 600;
        color: #334155;
    }

    .nav-list {
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        justify-content: flex-start;
        padding: 4px 0 8px;
    }

    .nav-list > li {
        width: 100%;
        border-bottom: 1px solid #eef2f7;
    }

    .nav-list a,
    .nav-list .opener {
        padding: 11px 14px;
        font-size: 0.95rem;
    }

    .nav-list .opener {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .nav-list .opener::after {
        content: '+';
        font-size: 1.1rem;
        color: var(--primary-color);
        margin-left: 8px;
    }

    .nav-list .has-dropdown.open > .opener::after {
        content: '−';
    }

    .nav-list li:hover > ul {
        display: none;
    }

    .nav-list ul {
        position: static;
        display: none;
        min-width: 0;
        box-shadow: none;
        border-radius: 0;
        border-top: none;
        padding: 0 0 6px;
        background: #f8fafc;
    }

    .nav-list .has-dropdown.open > ul {
        display: block;
    }

    .nav-list ul li a {
        padding: 10px 14px 10px 22px;
        font-size: 0.9rem;
    }
}

/* Шире 900px: обычное горизонтальное меню */
@media (min-width: 901px) {
    .nav-toggle,
    .mobile-nav-tools,
    .nav-backdrop,
    .mobile-only-nav {
        display: none !important;
    }

    header .main-nav {
        display: block !important;
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        max-width: none;
        margin: 0;
    }

    .nav-panel {
        max-height: none;
        overflow: visible;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
}

@media (max-width: 992px) {
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        gap: 8px;
        padding: 4px 2px 14px;
        margin-bottom: 16px;
        scrollbar-width: thin;
    }

    .tabs::-webkit-scrollbar {
        height: 4px;
    }

    .tabs::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    .tab-btn {
        flex: 0 0 auto;
        scroll-snap-align: start;
        white-space: nowrap;
        font-size: 0.88rem;
        min-height: 44px;
        padding: 11px 16px;
    }

    section {
        padding: 32px 0;
    }

    .section-title {
        font-size: 1.4rem;
        margin-bottom: 18px;
        padding-left: 12px;
    }

    .widgets,
    .partners-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Первая строка на 2 колонках */
    .partners-grid:not(.is-expanded) .partner-item:nth-child(n+3) {
        display: none;
    }

    .news-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        margin-bottom: 24px;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .main-content-wrapper {
        flex-direction: column;
    }

    .content-right {
        width: 100%;
    }

    .hero {
        padding: 32px 16px 64px;
    }

    .hero h1 {
        font-size: 1.5rem;
        letter-spacing: 0.4px;
        margin-bottom: 18px;
        line-height: 1.25;
    }

    .widgets {
        margin-top: -36px;
        gap: 12px;
    }

    .widget {
        padding: 18px 12px;
        font-size: 0.92rem;
        gap: 8px;
        min-height: 110px;
        justify-content: center;
    }

    .widget-icon {
        font-size: 1.5rem;
        line-height: 1;
    }

    .promo {
        padding: 14px 46px !important;
        font-size: 0.92rem;
        line-height: 1.4;
    }

    .promo-prev { left: 8px; }
    .promo-next { right: 8px; }

    .news-wrapper {
        padding: 24px 18px;
        border-radius: 12px;
    }

    .news-main-img {
        height: 240px;
    }

    .news-main-content {
        padding: 18px;
    }

    .news-main-content h3 {
        font-size: 1.2rem;
    }

    .news-item {
        gap: 14px;
        padding: 12px;
    }

    .news-item-img {
        width: 96px;
        height: 76px;
    }

    .spec-section {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

@media (max-width: 768px) {
    .hero-single-image {
        display: none;
    }

    .hero {
        padding: 36px 18px 52px;
        background-position: center;
        min-height: 160px;
        display: flex;
        align-items: center;
    }

    .hero .container {
        width: 100%;
    }

    .hero h1 {
        margin-bottom: 0;
        font-size: 1.35rem;
    }

    .widgets {
        margin-top: -28px;
    }

    .specs-slider .slick-arrow { width: 36px; height: 36px; }
    .specs-slider .slick-arrow::before { line-height: 34px; font-size: 14px; }
    .specs-slider .slick-prev { left: 5px; }
    .specs-slider .slick-next { right: 5px; }

    .page-header .page-title {
        font-size: 1.6rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .spec-card {
        border-radius: 10px;
    }
}

@media (max-width: 600px) {
    /* Виджеты остаются 2×2 — так удобнее на телефоне */
    .partners-grid,
    .footer-grid {
        grid-template-columns: 1fr;
    }

    /* Первая строка в одну колонку */
    .partners-grid:not(.is-expanded) .partner-item:nth-child(n+2) {
        display: none;
    }

    .hero {
        padding: 28px 16px 44px;
        min-height: 140px;
    }

    .hero h1 {
        font-size: 1.2rem;
        letter-spacing: 0.2px;
    }

    .news-wrapper {
        padding: 16px 14px;
    }

    .news-item {
        flex-direction: row;
        text-align: left;
        align-items: center;
    }

    .news-item-img {
        width: 88px;
        height: 72px;
        flex-shrink: 0;
    }

    .logo {
        font-size: 0.85rem;
    }

    .logo span {
        display: block;
        font-size: 0.65rem;
        line-height: 1.25;
    }

    .widgets {
        margin-top: -22px;
        gap: 10px;
    }

    .widget {
        padding: 16px 10px;
        font-size: 0.86rem;
        min-height: 100px;
        border-bottom-width: 3px;
    }

    .widget-icon {
        font-size: 1.35rem;
    }

    .promo {
        padding: 12px 40px !important;
        font-size: 0.88rem;
    }

    .promo-nav {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .promo-prev { left: 4px; }
    .promo-next { right: 4px; }

    .gosuslugi-section {
        padding-left: 0;
        padding-right: 0;
        padding-top: 8px;
        padding-bottom: 24px;
    }

    header .main-nav {
        left: 12px;
        right: 12px;
    }

    .news-main-img {
        height: 200px;
    }

    .news-main-content {
        padding: 14px;
    }

    .news-main-content h3 {
        font-size: 1.1rem;
    }

    .btn-news,
    .btn-outline.btn-block {
        width: 100%;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .tab-btn {
        font-size: 0.82rem;
        padding: 10px 14px;
    }
}

/* Базовые стили для контейнера картинки */
figure.image {
    display: table;
    clear: both;
    text-align: center;
    margin: 0.9em auto; /* По умолчанию центрируем картинку с подписью */
    max-width: 100%;
}

figure.image img {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* Подпись под картинкой (caption) */
figure.image figcaption {
    display: table-caption;
    caption-side: bottom;
    padding: 6px 10px;
    font-size: 13px;
    color: #666;
    text-align: center;
    word-break: break-word;
}

/* --- Выравнивание по центру (Center) --- */
figure.image.image-style-align-center,
figure.image.image-style-block-align-center,
figure.image.image_resized[style*="margin-left: auto"][style*="margin-right: auto"] {
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
}

/* --- Выравнивание по левому краю (Left / Float Left) --- */
figure.image.image-style-align-left,
figure.image.image-style-block-align-left,
figure.image.image-style-side {
    float: left !important;
    margin-right: 1.5em !important;
    margin-bottom: 1em !important;
    margin-left: 0 !important;
}

/* --- Выравнивание по правому краю (Right / Float Right) --- */
figure.image.image-style-align-right,
figure.image.image-style-block-align-right {
    float: right !important;
    margin-left: 1.5em !important;
    margin-bottom: 1em !important;
    margin-right: 0 !important;
}

/* Сброс обтекания после блоков с float */
.ck-content::after,
article::after {
    content: "";
    display: table;
    clear: both;
}