/* ==============================
   Общие стили
============================= */
html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* убираем горизонтальный скролл */
}

body {
    background: url("../images/blue.jpg") no-repeat center center/cover;
    background-size: cover;
    color: #004080; /* цвет текста светлой темы */
    transition: background 0.5s, color 0.5s;
    flex: 1;
}

body.dark {
    background: url("../images/dark.jpg") no-repeat center center;
    background-size: cover;
    color: #fff; /* цвет текста темной темы */
}

/* ==============================
   Header
============================= */
header {
    background: rgba(0,64,128,0.9);
    width: 100%;
    box-sizing: border-box;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
}

header h1 {
    margin: 0;
    font-size: 20px;
    color: #fff; /* заголовок белый */
}

/* Контейнер кнопки темы и меню */
.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Кнопка темы */
.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
}

.theme-btn img {
    width: 30px;
    height: 30px;
    transition: transform 0.3s;
}

.theme-btn:hover img {
    transform: rotate(20deg);
}

/* Бургер */
.menu-toggle {
    font-size: 28px;
    background: none;
    border: none;
    color: #fff; /* белый бургер */
    cursor: pointer;
}

/* Меню */
nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 60px;
    right: 10px;
    background: rgba(0,64,128,0.95);
    border-radius: 8px;
    padding: 10px;
    z-index: 1000;
}

nav a {
    color: #fff; /* меню белым */
    padding: 8px 12px;
    text-decoration: none;
    font-weight: bold;
    display: block;
}

nav a.active {
    color: #ffd700;
    text-decoration: underline;
}

nav a:hover {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

nav.show {
    display: flex;
}

/* ==============================
   Контейнер контента
============================= */
.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 20px;
    flex: 1;
}

/* ==============================
   Новости
============================= */
.news {
    display: flex;
    flex-wrap: wrap; /* Элементы могут переходить на новую строку */
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
}

.card {
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background: rgba(255,255,255,0.9);
    color: #004080;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s, background 0.5s, color 0.5s;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* верхнее выравнивание */
    width: 100%; /* по умолчанию карточка будет на 100% ширины */
    max-width: 350px; /* ограничиваем ширину */
    height: auto;
    margin: 0 auto;
}

body.dark .card {
    background: rgba(0,0,0,0.7);
    color: #fff; /* цвет текста в темной теме белый */
}

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

/* Стили для изображения новости */
.news-image {
    width: 100%; /* Изображение на всю ширину блока */
    height: auto;
    display: block;
    margin-bottom: 15px;
    border-radius: 8px;
}

.card h3 {
    margin-top: 10px;
}

.card p {
    margin: 10px 0 0 0;
    font-size: 14px;
    line-height: 1.4;
    color: inherit;
    flex-grow: 1;
}

/* ==============================
   Дата публикации
============================= */
.card .date {
    font-size: 12px;
    margin-top: 10px;
    text-align: right; /* Сдвигаем в правый край */
    color: inherit;
    font-style: italic;
    padding-top: 5px; /* Добавляем небольшой отступ сверху */
}

/* ==============================
   Класс для новостей с длинным контентом
============================= */
.card.full-width {
    width: 100%; /* Новость с длинным контентом занимает 100% ширины */
    max-width: none; /* Убираем максимальную ширину */
    flex-grow: 1; /* Позволяет блоку растягиваться */
}

/* ==============================
   Footer
============================= */
footer {
    background: rgba(0,64,128,0.95);
    color: #fff !important; /* текст всегда белый */
    text-align: center;
    padding: 15px;
    position: relative;
    z-index: 50;
}

/* Темная тема футера */
body.dark footer {
    background: rgba(0,0,50,0.95);
    color: #ffd700 !important;
}

/* ==============================
   Адаптивность
============================= */
/* Для больших экранов (от 992px и выше) */
@media (min-width: 992px) {
    .news {
        justify-content: space-between; /* Новости в два ряда */
    }

    .card.full-width {
        max-width: 100%; /* Новости с классом full-width занимают 100% ширины */
    }

    .card {
        width: 45%; /* Каждая карточка занимает 45% ширины */
    }
}

/* Для экранов от 768px до 991px */
@media (max-width: 991px) and (min-width: 768px) {
    .card {
        width: 48%; /* Каждая карточка занимает 48% ширины */
    }
}

/* Для экранов меньше 768px */
@media (max-width: 767px) {
    .news {
        flex-direction: column; /* Все новости в одну колонку */
        align-items: center;
    }

    .card {
        width: 100%; /* Каждая карточка на всю ширину экрана */
        box-sizing: border-box; /* чтобы не было переполнения */
        padding: 10px; /* уменьшаем отступы */
    }
}
