:root {
    --primary-red: #cc0000;
    --dark-grey: #1a1a1a;
    --light-grey: #f4f4f4;
    --text-color: #333;
    --white: #ffffff;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background-color: var(--white);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Навигация */
.navbar {
    background: var(--dark-grey);
    color: var(--white);
    padding: 1rem 0;
    border-bottom: 4px solid var(--primary-red);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--white);
    letter-spacing: 1px;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
}

nav a {
    color: var(--white);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: 600;
}

.btn-join {
    background: var(--primary-red);
    padding: 8px 15px;
    border-radius: 3px;
}

/* Hero Section */
.hero {
    padding: 80px 0;
    background: var(--light-grey);
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero span {
    color: var(--primary-red);
}

.hero-btns {
    margin-top: 30px;
}

.btn-primary {
    background: var(--primary-red);
    color: white;
    padding: 12px 25px;
    text-decoration: none;
    margin-right: 10px;
    font-weight: bold;
}

.btn-send {
    background: var(--primary-red);
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    margin-right: 10px;
    font-weight: bold;
    border-radius: 3px;
    border-color: var(--primary-red);
    cursor: pointer;
}

.modal-header h1 {
    color: #1a1a1a;
}

.btn-secondary {
    background: var(--dark-grey);
    color: var(--white);
    padding: 11px 25px;
    text-decoration: none;
    font-weight: bold;
}

/* Сетка новостей */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    padding: 60px 20px;
}

.card {
    border-bottom: 1px solid #ddd;
    padding-bottom: 20px;
}

.category {
    color: var(--primary-red);
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: bold;
}

.card h3 {
    margin: 10px 0;
    font-size: 1.4rem;
}

footer {
    background: var(--dark-grey);
    color: #ccc;
    text-align: center;
    padding: 40px 0;
    margin-top: 50px;
}

/* Макет в стиле LIS */
.articles-layout {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Основная часть шире сайдбара */
    gap: 40px;
    padding-top: 50px;
    padding-bottom: 50px;
}

/* Главная карточка */
.feature-card {
    border: 1px solid #e0e0e0;
    margin-bottom: 30px;
    transition: 0.3s;
}

.feature-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.image-placeholder {
    width: 100%;
    height: 350px;
    background: #ccc; /* Сюда вставишь картинку */
}

.card-content {
    padding: 25px;
}

.tag {
    display: inline-block;
    background: var(--primary-red);
    color: white;
    padding: 2px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.feature-card h2 {
    font-size: 2.2rem;
    margin: 10px 0;
    line-height: 1.2;
}

/* Вспомогательная сетка */
.sub-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
}

/* Контейнер для ряду статей */
.articles-row {
    display: flex;
    flex-direction: row; /* Вишикувати в ряд */
    flex-wrap: wrap;     /* Дозволити перенос на телефонах */
    gap: 20px;           /* Відступ між колонками */
    width: 100%;
    margin-top: 20px;
}

/* Стиль посилання-обгортки */
.article-link {
    text-decoration: none;
    color: inherit;
    /* На великих екранах займає трохи менше половини (враховуючи gap) */
    flex: 1 1 calc(50% - 10px); 
    display: flex; /* Щоб картка всередині тягнулася */
    width: calc(50% - 10px); 
    text-decoration: none;
    display: block;
}

/* Налаштування для мобільних (щоб знову стали один під одним) */
@media (max-width: 768px) {
    .article-link {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* Коригуємо саму картку */
.compact-card {
    padding: 20px;
    background: #f9f9f9;
    border-top: 3px solid var(--primary-red);
    width: 100%; /* Тепер вона розтягується по ширині посилання */
    display: flex;
    flex-direction: column;
    box-sizing: border-box; /* Щоб падінги не роздували ширину */
    max-width: none; /* Щоб нічого не обмежувало статтю всередині її 50% */
    word-break: keep-all; 
    overflow-wrap: break-word; 
    font-size: 1rem;
}

.compact-card h4 {
    font-size: 1.1rem;
    margin: 10px 0;
    line-height: 1.4;
}

/* Сайдбар */
.sidebar-title {
    border-bottom: 2px solid var(--dark-grey);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 1.1rem;
}

.news-list {
    list-style: none;
    padding: 0;
}

.news-list li {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

.news-list .date {
    color: var(--primary-red);
    font-weight: bold;
    margin-right: 10px;
}

.news-list a {
    text-decoration: none;
    color: var(--dark-grey);
}

.news-list a:hover {
    text-decoration: underline;
}

.banner-box {
    background: var(--dark-grey);
    color: white;
    padding: 25px;
    margin-top: 30px;
    text-align: center;
}



.card-image-container {
    width: 100%;
    height: 450px; /* Фиксированная высота как в твоем старом placeholder */
    overflow: hidden; /* Обрезает все, что выходит за границы */
}

.feature-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ЭТО ВАЖНО: картинка заполнит блок, сохраняя пропорции, не сжимаясь */
    display: block;
    transition: transform 0.5s ease; /* Эффект при наведении */
}

/* Эффект легкого увеличения при наведении на карточку (как на современных порталах) */
.feature-card:hover .feature-img {
    transform: scale(1.05);
}


/* Панель */
.side-panel {
    position: fixed;
    top: 0;
    right: -350px; /* Изначально спрятана справа */
    width: 300px;
    height: 100%;
    background: var(--dark-grey);
    color: white;
    z-index: 1001;
    transition: 0.4s ease; /* Плавность выезда */
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0,0,0,0.3);
}

/* Класс, который мы будем добавлять через JS */
.side-panel.open {
    right: 0;
}

/* Затемнение фона */
.side-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none; /* Скрыто по умолчанию */
    z-index: 1000;
}

.side-overlay.active {
    display: block;
}

/* Кнопки внутри панели */
.side-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    margin-bottom: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.side-btn {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px;
    border-bottom: 1px solid #333;
    transition: 0.3s;
}

.side-btn:hover {
    background: var(--primary-red);
}

/* Модалка */
.modal {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0); /* Начинаем с прозрачного */
    align-items: center;
    justify-content: center;
    transition: background-color 0.4s ease; /* Плавный фон */
}

.modal.active {
    display: flex;
    background-color: rgba(0,0,0,0.7); /* Темнеет */
}

.modal-content {
    background-color: var(--white);
    padding: 30px;
    width: 90%;
    max-width: 500px;
    border-top: 5px solid var(--primary-red);
    
    /* Начальное состояние для анимации */
    opacity: 0;
    transform: translateY(30px) scale(0.9); /* Сдвинуто вниз и уменьшено */
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1); /* Плавный вылет */
}

.modal.active .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1); /* Возвращается в центр и в полный размер */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Форма */

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.contact-form input, .contact-form textarea {
    padding: 10px;
    border: 1px solid #ccc;
    font-family: inherit;
}

.contact-form textarea {
    height: 120px;
    resize: vertical;
}

.btn-message {
    border: 1px solid var(--primary-red);
    padding: 8px 15px;
    cursor: pointer;
}

.close-btn {
    background: none;
    border: none;
    color: var(--dark-grey);
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
    color: var(--primary-red);
}




/* Стили для страницы статьи */
.article-page {
    max-width: 800px; /* Сужаем для удобства чтения */
    margin: 40px auto;
}

.article-header {
    text-align: center;
    margin-bottom: 30px;
}

.article-header h1 {
    font-size: 2.8rem;
    line-height: 1.2;
    margin: 15px 0;
    display: block;
    clear: both;
    width: 100%;
    margin-bottom: 30px;
}

.article-meta {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.article-main-image {
    margin-bottom: 40px;
}

.article-main-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.image-caption {
    font-size: 0.85rem;
    color: #777;
    font-style: italic;
    margin-top: 10px;
    text-align: center;
}

/* Оформление самого текста */
.article-content {
    font-family: 'Lora', serif; /* Шрифт с засечками для лонгридов */
    font-size: 1.2rem;
    line-height: 1.8;
    color: #222;
}

.lead {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--dark-grey);
    border-left: 5px solid var(--primary-red);
    padding-left: 20px;
    margin-bottom: 30px;
}

blockquote {
    font-size: 1.5rem;
    font-style: italic;
    color: var(--primary-red);
    margin: 40px 0;
    padding: 0 40px;
    text-align: center;
    border: none;
}

.article-footer {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}



/* --- МОБІЛЬНА АДАПТИВНІСТЬ --- */

/* 1. Загальні виправлення для всіх екранів (захист від скролу) */
html, body {
    overflow-x: hidden;
    width: 100%;
    margin: 0;
    padding: 0;
}

* {
    box-sizing: border-box; /* Щоб падінги не розпирали блоки */
}

h1, h2, h3, h4 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* 2. Основний запит для смартфонів та планшетів */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden; /* Забороняємо боковий скрол */
        height: auto;
    }
    
    .hero {
        min-height: auto; /* Прибираємо обмеження по висоті */
        padding-bottom: 30px;
    }
    .container {
        padding: 0 15px;
        width: 100%;
    }

    /* Навігація: лого зверху, кнопки в ряд під ним */
    .navbar .container {
        flex-direction: row; /* Повертаємо в рядок */
        justify-content: space-between;
        align-items: center;
        padding: 5px 15px;
    }

    .logo {
        font-size: 1.2rem; /* Трохи менше лого, щоб влізло */
    }

    nav ul {
        margin: 0;
        gap: 8px; /* Зменшуємо відстань між кнопками */
    }

    .btn-join, .btn-message {
        padding: 6px 10px; /* Компактніші кнопки */
        font-size: 0.8rem;
    }

    .hero-btns {
        display: flex;
        flex-direction: row; /* Ставимо в рядок */
        justify-content: center;
        gap: 10px;
        width: 100%;
        margin-top: 20px;
    }

    .hero-btns .btn-primary, .hero-btns .btn-secondary {
        flex: 1; /* Кнопки однакової ширини */
        max-width: 150px;
        padding: 10px 5px;
        font-size: 0.9rem;
        margin: 0;
        text-align: center;
    }

    .hero h1 {
        font-size: 1.5rem !important; /* Зменшуємо, щоб влізло в один рядок */
        line-height: 1.3;
        white-space: normal; /* Дозволяє перенос, але тільки між словами */
        text-align: center;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 0;
    }

    /* Hero секція */
    .hero {
        padding: 40px 10px;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    /* Кнопки в Hero ставимо одна під одною, якщо не влазять */
    .hero-btns {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .btn-primary, .btn-secondary {
        margin: 0;
        width: 100%;
        max-width: 280px;
    }

    /* СІТКА СТАТЕЙ: все в одну колонку */
    .articles-layout {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr !important;
        padding-top: 20px;
    }

    /* Велика картка */
    .feature-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
    }

    .card-image-container {
        height: 220px; /* Оптимально для мобілки */
    }

    .feature-card h2 {
        font-size: 1.4rem;
    }

    /* Сітка малих карток (sub-grid) */
    .sub-grid {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr !important;
        gap: 15px;
        width: 100%;
    }

    .compact-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }

    /* Сайдбар (старі новини) */
    .sidebar {
        width: 100%;
        margin-top: 30px;
    }

    /* Модальне вікно (Зв'язок) */
    .modal-content {
        width: 92%;
        padding: 20px;
        margin: 10px;
    }
}

/* 3. Додатково для дуже маленьких екранів */
@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }
    
    nav a {
        font-size: 0.8rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }
}




/* Кнопки швидкої навігації (як у Telegram) */
#scroll-nav {
    position: fixed !important; /* ЗАВЖДИ на екрані */
    bottom: 30px; /* Відступ знизу */
    right: 20px;  /* Відступ справа */
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 99999 !important; /* Поверх усього */
}

#scroll-nav button {
    width: 50px; /* Трохи більші для зручності пальців */
    height: 50px;
    background-color: #e63946;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    
    /* Анімація появи */
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px); /* Виїжджатиме знизу */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Коли кнопка активна */
#scroll-nav button.show {
    opacity: 0.85;
    visibility: visible;
    transform: translateY(0);
}

#scroll-nav button.show:hover {
    opacity: 1;
    background-color: #333;
}

/* Адаптація для мобілок (щоб не перекривали контент) */
@media (max-width: 768px) {
    #scroll-nav {
        bottom: 20px;
        right: 15px;
    }
    #scroll-nav button {
        width: 45px;
        height: 45px;
        font-size: 20px;
    }
}



/* Основний контейнер хедера (вже має display: flex) */
.header-nav {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Розносить кнопку і лого по різних боках */
    padding: 10px 20px;
    background: #fff; /* Твій фон хедера */
    border-bottom: 2px solid var(--primary-red); /* Твоя червона лінія */
}

/* --- СТИЛІ КНОПКИ ПОВЕРНЕННЯ (зліва) --- */
.back-button {
    text-decoration: none;
    color: var(--primary-red); /* Твій червоний колір */
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: opacity 0.3s ease;
}

.back-button:hover {
    opacity: 0.7;
    text-decoration: underline;
}

.back-button .arrow {
    margin-right: 8px;
    font-size: 1.2rem;
}

/* --- СТИЛІ ОНОВЛЕНОГО ЛОГОТИПУ (справа) --- */
.logo-container {
    align-items: center;
    transform: scale(1.05);
    position: relative;
    left: -50px;
    margin-left: 15px;
    max-width: 1100px; /* Така ж ширина, як у твого тексту */
    padding: 0 20px;   /* Відступи від країв екрана */
    display: flex;
    justify-content: flex-start; /* Логотип буде зліва, але в межах контенту */
    padding-left: 1%;
}

.logo-img {
    height: 70px; /* Фіксуємо висоту логотипу, щоб хедер був охайним */
    width: auto;   /* Ширина підлаштовується автоматично (не спотворює пропорції) */
    display: block;
    border: none;
    transition: transform 0.3s ease; /* Додамо ефект при наведенні */
    cursor: pointer;
}

article, main {
    margin-top: 40px !important; /* Примусово відсуваємо текст вниз від хедера */
}

/* --- АДАПТИВНІСТЬ (для мобільних) --- */
@media (max-width: 600px) {
    /* Ховаємо текст "На головну", залишаємо тільки стрілку ← */
    .back-text {
        display: none;
    }
    
    .logo-img {
        height: 60px; /* Трохи зменшуємо лого на маленьких екранах */
    }

    .logo-container {
        padding-left: 15%;
}
}
