/* Основные стили */
body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: #ffffff;
    color: #333333;
}

/* Анимация появления */
body {
    opacity: 0;
    animation: fadeIn 1s forwards;
}

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

/* Баннер */
.banner {
    background-color: #f9f9f9;
    color: #333333;
    padding: 30px 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.banner h1 {
    margin: 0;
    font-size: 32px;
    color: #3498db;
}

.banner p {
    margin: 10px 0 0 0;
    font-size: 18px;
    color: #555555;
}

.banner a {
    color: #3498db;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.banner a:hover {
    color: #2980b9;
}

/* Стрелка назад */
.back-arrow {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: #3498db;
    color: #fff;
    padding: 10px 15px;
    border-radius: 50px;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background-color 0.3s, transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
}

.back-arrow:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.back-arrow i {
    margin-right: 8px;
    font-size: 16px;
}

/* Сортировка по категориям */
.sort-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: #f9f9f9;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sort-container label {
    font-size: 16px;
    color: #555;
    margin-bottom: 12px;
    font-weight: 500;
}

.categories-scroll {
    display: flex;
    overflow-x: auto;
    padding: 10px 0;
    gap: 10px;
    scrollbar-width: none; /* Firefox */
    width: 100%;
}

.categories-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

.category-item {
    flex: 0 0 auto;
    padding: 10px 15px;
    background-color: #e0e0e0;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, color 0.3s;
}

.category-item.selected {
    background-color: #3498db;
    color: #fff;
    transform: scale(1.05);
}

.category-item i {
    font-size: 18px;
}

/* Сетка постов */
.post-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    transition: all 0.3s ease-in-out;
}

@media (max-width: 600px) {
    .post-grid {
        grid-template-columns: 1fr;
    }

    /* Если добавлен класс .grid-2x2, переключаем на 2 столбца */
    .grid-2x2 .post-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Пост */
.post-summary {
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
    opacity: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.post-summary:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.post-summary img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: height 0.3s ease-in-out;
}

@media (max-width: 600px) {
    .post-summary img {
        height: 150px;
    }
}

.post-summary .post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.post-summary h2 {
    font-size: 20px;
    margin: 0 0 10px 0;
    color: #333;
}

.post-summary h2 a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

.post-summary h2 a:hover {
    color: #3498db;
}

.post-summary p {
    flex: 1;
    font-size: 14px;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.post-summary .read-more {
    align-self: flex-start;
    padding: 8px 12px;
    background-color: #ffcc00;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.read-more:hover {
    background-color: #ff9900;
}

/* Прелоадер */
.loader {
    display: none; /* Скрыт по умолчанию */
    justify-content: center;
    align-items: center;
    margin: 20px auto;
}

.loader .spinner {
    border: 4px solid #f3f3f3; /* Светлый фон */
    border-top: 4px solid #3498db; /* Акцентный цвет */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

footer {
    text-align: center;
    padding: 20px 0;
    font-size: 14px;
    color: #999999;
}



/* Адаптивность */
@media (max-width: 600px) {
    .banner h1 {
        font-size: 24px;
    }

    .banner p {
        font-size: 16px;
    }

    .back-arrow {
        padding: 8px 12px;
        top: 10px;
        left: 10px;
    }

    .back-arrow i {
        font-size: 14px;
    }

    main {
        padding: 20px 10px;
    }

    .sort-container label {
        font-size: 14px;
    }

    .category-item {
        padding: 8px 12px;
        gap: 6px;
    }

    .category-item i {
        font-size: 16px;
    }

    .post-summary h2 {
        font-size: 16px;
    }

    .post-summary p {
        font-size: 12px;
    }

    .post-summary .read-more {
        font-size: 12px;
        padding: 6px 10px;
    }

    .bottom-menu a {
        font-size: 12px;
    }

    .bottom-menu a i {
        font-size: 20px;
    }
}

