/* ==========================================================================
   1. БАЗОВЫЕ СТИЛИ (Для компьютеров и общего отображения)
   ========================================================================== */
body { 
    margin: 0; 
    padding: 0; 
    background-color: #74b9ff; 
    font-family: 'Consolas', 'Segoe UI', Monaco, 'Courier New', monospace, sans-serif; 
    color: #2b2d42; 
    min-height: 100vh; 
}

.blog-container { 
    max-width: 800px; 
    margin: 0 auto; 
    padding: 40px 20px; 
    text-align: center; 
}

.blog-header { 
    background: #fff; 
    padding: 30px; 
    border: 4px solid #2b2d42; 
    box-shadow: 8px 8px 0 #2b2d42; 
    border-radius: 24px; 
    margin-bottom: 30px; 
}

.blog-header h1 { 
    font-size: 2.8rem; 
    margin: 0 0 10px 0; 
    text-transform: uppercase; 
    word-wrap: break-word; /* Защита от вылезания длинных слов */
}

.subtitle { 
    font-size: 1.2rem; 
    color: #636e72; 
    margin: 0; 
}

/* Изначальное состояние карточки для анимации появления */
.post-card { 
    background: #fff; 
    border: 4px solid #2b2d42; 
    box-shadow: 8px 8px 0 #2b2d42; 
    border-radius: 24px; 
    padding: 35px; 
    margin-bottom: 40px; 
    text-align: left; 
    opacity: 0;
    transform: translateY(30px) rotate(0deg); 
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}

/* Класс, включаемый через JS при прокрутке */
.post-card.visible {
    opacity: 1;
}

.post-tag { 
    display: inline-block; 
    background: #e17055; 
    color: white; 
    padding: 5px 12px; 
    border-radius: 8px; 
    font-size: 0.9rem; 
    font-weight: bold; 
    margin-bottom: 15px; 
    text-transform: uppercase; 
    border: 2px solid #2b2d42; 
}

.post-title { 
    font-size: 1.8rem; 
    margin-top: 0; 
    color: #ff7675; 
    word-wrap: break-word;
}

.post-content { 
    font-size: 1.2rem; 
    line-height: 1.8; 
}

.comments-section { 
    margin-top: 25px; 
    border-top: 3px dashed #2b2d42; 
    padding-top: 20px; 
}

/* Меню-ссылки */
.filter-menu { 
    display: flex; 
    justify-content: center; 
    gap: 15px; 
    margin-bottom: 30px; 
    flex-wrap: wrap; 
}

.filter-btn { 
    background: #ffffff; 
    color: #2b2d42; 
    border: 3px solid #2b2d42; 
    padding: 10px 20px; 
    font-size: 1.1rem; 
    font-weight: bold; 
    border-radius: 16px; 
    cursor: pointer; 
    box-shadow: 4px 4px 0px #2b2d42; 
    text-decoration: none; 
    transition: all 0.1s ease; 
}

.filter-btn:hover { 
    background: #ffeaa7; 
}

.filter-btn.active { 
    background: #ffeaa7; 
    transform: translate(2px, 2px); 
    box-shadow: 2px 2px 0px #2b2d42; 
}

/* Оформление инлайн-кнопок внутри постов */
.post-card .filter-btn {
    display: inline-block;
    height: auto;             
    min-height: 44px;         
    line-height: 1.4;         
    box-sizing: border-box;   
    white-space: normal;      
    text-align: center;
}

.global-footer { 
    width: 100%; 
    text-align: center; 
    margin-top: 40px; 
    color: white; 
    font-weight: bold; 
    padding-bottom: 20px;
}

.sloth-avatar { 
    font-size: 5rem; 
    display: inline-block; 
    margin-bottom: 10px; 
    animation: swing 3s infinite ease-in-out; 
    transform-origin: top center; 
}

@keyframes swing { 
    0% { transform: rotate(10deg); } 
    50% { transform: rotate(-10deg); } 
    100% { transform: rotate(10deg); } 
}

/* ==========================================================================
   2. КНОПКА «НАВЕРХ» — СУПЕР ЗАЩИТА ДЛЯ МОБИЛЬНЫХ И ПК
   ========================================================================== */
#backToTop {
    position: fixed !important;
    bottom: 30px !important;    
    right: 20px !important;     
    width: 50px !important;     
    height: 50px !important;    
    background-color: rgba(58, 154, 217, 0.85) !important; 
    color: #ffffff !important;            
    border: none !important;
    border-radius: 50% !important;
    font-size: 24px !important;  
    cursor: pointer !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    z-index: 2147483647 !important; 
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-bottom: 4px !important;
    pointer-events: auto !important; 
    -webkit-tap-highlight-color: transparent !important; 
    user-select: none !important;
}

#backToTop:hover {
    background-color: rgba(42, 130, 190, 1) !important;
    opacity: 1 !important;
}

#backToTop.show {
    opacity: 1 !important;
    visibility: visible !important;
}

/* ==========================================================================
   3. АДАПТИВНОСТЬ ДЛЯ ТЕЛЕФОНОВ И ПЛАНШЕТОВ
   ========================================================================== */
@media (max-width: 768px) {
    .blog-container {
        padding: 20px 10px; 
    }
    
    .blog-header {
        padding: 20px 15px; 
        margin-bottom: 20px;
    }

    .blog-header h1 {
        font-size: 1.8rem; 
    }

    .subtitle {
        font-size: 1rem; 
    }

    .post-card {
        padding: 20px; 
        margin-bottom: 25px;
        box-shadow: 5px 5px 0 #2b2d42; 
    }

    .post-title {
        font-size: 1.4rem; 
    }

    .post-content {
        font-size: 1rem; 
        line-height: 1.6;
    }
    
    .filter-btn {
        padding: 8px 15px; 
        font-size: 1rem;
    }

    /* Исправление наплывов кнопок «Читать и комментировать» */
    .post-card .filter-btn {
        font-size: 0.8rem !important; 
        padding: 8px 12px;            
        display: block !important;               
        width: 100% !important;
    }
    
    .post-card div[style*="margin-top: 15px"] {
        margin-top: 10px !important;
    }

    /* Мобильные размеры для стрелочки */
    #backToTop {
        width: 46px !important;
        height: 46px !important;
        font-size: 20px !important;
        bottom: 25px !important;
        right: 15px !important;
    }
}
