/* Main Content */
main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* Hero Section */
.blog-hero {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.blog-hero::before {
    content: '';
    position: absolute;
    top: -2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(0, 255, 136, 0.15) 0%, transparent 70%);
    z-index: -1;
}

.blog-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #00ff88 50%, #00ccff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 600px;
    margin: 0 auto;
}

/* Categories Filter */
.categories-filter {
    margin-bottom: 3rem;
    text-align: center;
}

.categories-filter h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1.5rem;
}

.categories-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.category-link {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.category-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.2), transparent);
    transition: left 0.6s ease;
}

.category-link:hover::before {
    left: 100%;
}

.category-link:hover,
.category-link.active {
    background: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.3);
    color: #00ff88;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.15);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    grid-auto-rows: 1fr; /* Ключевое свойство для одинаковой высоты */
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Post Card */
.post-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    position: relative;
    display: flex; /* Добавляем flex */
    flex-direction: column; /* Вертикальное расположение */
    height: 100%; /* Занимаем всю высоту грида */
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.05) 0%, rgba(0, 204, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.post-card:hover::before {
    opacity: 1;
}

.post-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 255, 136, 0.2);
    box-shadow: 0 20px 40px rgba(0, 255, 136, 0.1);
}

.post-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.no-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 255, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

.post-content {
    padding: 1.5rem;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Растягиваем контент */
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.category {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 204, 255, 0.2));
    color: #00ff88;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.date,
.read-time {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.post-title {
    margin-bottom: 1rem;
}

.post-title a {
    color: #ffffff;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    display: block;
    transition: all 0.3s ease;
}

.post-card:hover .post-title a {
    color: #00ff88;
}

.post-excerpt {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1; /* Заполняем оставшееся место */
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto; /* Прижимаем к низу */
}

.post-stats {
    display: flex;
    gap: 1rem;
}

.views {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #00ff88;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    position: relative;
}

.read-more::after {
    content: '→';
    transition: transform 0.3s ease;
}

.read-more:hover {
    color: #00ccff;
}

.read-more:hover::after {
    transform: translateX(5px);
}

/* Loading Indicator */
#loading-indicator {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #00ff88;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

/* Footer */
footer {
    background: rgba(10, 10, 10, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 0;
    text-align: center;
    backdrop-filter: blur(10px);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00ff88, #00ccff);
    border: none;
    border-radius: 50%;
    color: #0a0a0a;
    font-size: 1.25rem;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.3);
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 255, 136, 0.5);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        grid-auto-rows: 1fr; /* Добавляем для одинаковой высоты */
    }
}

@media (max-width: 768px) {
    .navbar-nav {
        display: none;
    }

    .container {
        padding: 2rem 1rem;
    }

    .categories-list {
        gap: 0.75rem;
    }

    .category-link {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* 2 карточки в ряд на планшетах */
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr; /* Одинаковая высота карточек */
        gap: 1.5rem;
    }

    .post-meta {
        gap: 0.75rem;
    }

    .post-title a {
        font-size: 1.25rem;
    }

    .scroll-top {
        bottom: 1rem;
        right: 1rem;
        width: 45px;
        height: 45px;
    }
}

/* Для мобильных устройств - 2 в ряд */
@media (max-width: 640px) {
    .container {
        padding: 1.5rem 0.75rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr; /* Добавляем для одинаковой высоты */
        gap: 1rem;
    }

    .post-card {
        border-radius: 15px;
    }

    .post-image {
        height: 180px;
    }

    .post-content {
        padding: 1rem;
    }

    .post-title a {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .post-excerpt {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }

    .category {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .date,
    .read-time,
    .views {
        font-size: 0.75rem;
    }

    .read-more {
        font-size: 0.8rem;
    }
}

/* Для очень маленьких экранов - все еще 2 в ряд, но с минимальными отступами */
@media (max-width: 480px) {
    .blog-hero {
        margin-bottom: 2.5rem;
    }

    .blog-title {
        font-size: 2.5rem;
    }

    .categories-filter {
        margin-bottom: 2rem;
    }

    .container {
        padding: 1.5rem 0.5rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr; /* Добавляем для одинаковой высоты */
        gap: 0.75rem;
    }

    .post-content {
        padding: 0.875rem;
    }

    .post-image {
        height: 150px;
    }

    .post-title a {
        font-size: 1rem;
    }

    .post-excerpt {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        margin-bottom: 1rem;
    }

    .post-meta {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .category {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .date,
    .read-time,
    .views {
        font-size: 0.7rem;
    }

    .read-more {
        font-size: 0.75rem;
    }

    /* Оптимизация кнопок категорий для мобильных */
    .categories-list {
        gap: 0.5rem;
    }

    .category-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* Для iPhone SE и подобных маленьких экранов */
@media (max-width: 375px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr; /* Добавляем для одинаковой высоты */
        gap: 0.5rem;
    }

    .post-content {
        padding: 0.75rem;
    }

    .post-image {
        height: 130px;
    }

    .post-title a {
        font-size: 0.95rem;
    }

    .post-excerpt {
        font-size: 0.8rem;
        -webkit-line-clamp: 1; /* Только одна строка на очень маленьких экранах */
    }

}