/*
 * File: article.css (FIXED VERSION)
 * Description: Styles exclusive to the blog article page LAYOUT.
 * ИСПРАВЛЕНО: Кнопки соцсетей теперь видны на всех экранах
*/

/* ========================================
   ГЛОБАЛЬНЫЕ ИСПРАВЛЕНИЯ ДЛЯ МОБИЛЬНЫХ
   ======================================== */

/* Предотвращаем горизонтальный скролл на всех устройствах */
body {
    overflow-x: hidden;
}

/* Контейнер не должен выходить за границы */
.container {
    max-width: 100%;
}

/* Все изображения адаптивны */
img {
    max-width: 100%;
    height: auto;
}

/* --- Breadcrumbs Navigation --- */
.hero-breadcrumbs {
    position: absolute; 
    top: 0; 
    left: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.4); 
    padding: 10px 0;
    font-size: 14px;
    z-index: 5; 
}
.hero-breadcrumbs .container {
    color: #fff;
    text-align: left; 
}
.hero-breadcrumbs a {
    color: #ccc;
    text-decoration: none;
    margin-right: 5px;
    transition: color 0.2s ease;
}
.hero-breadcrumbs a:hover {
    text-decoration: underline;
}
.hero-breadcrumbs a:hover span {
    color: #fff;
}
.hero-breadcrumbs span {
    color: #ccc;
}

/* --- Article Hero Banner --- */
.article-hero {
    position: relative; 
    height: 55vh;
    background-size: cover;
    background-position: center;
    background-attachment: fixed; 
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    padding-top: 40px; 
}
.hero-title-box {
    background-color: rgba(0, 0, 0, 0.55);
    padding: 20px 30px;
    border-radius: 8px;
    z-index: 6; 
}
.article-hero h1 {
    font-size: 42px;
    max-width: 800px;
    margin: 0;
}

/* --- Meta Info Bar --- */
.meta-info-bar {
    background-color: rgba(0, 0, 0, 0.4); 
    padding: 15px 0;
    position: absolute; 
    bottom: 0; 
    width: 100%;
    z-index: 5; 
}
.meta-grid {
    display: flex;
    flex-wrap: wrap; 
    justify-content: flex-start; 
    gap: 30px; 
    align-items: center;
}
.meta-item {
    width: auto; 
    font-size: 15px;
    color: #fff; 
    text-align: left; 
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
}
.meta-item .meta-label {
    opacity: 0.8;
}
.meta-item .meta-value {
    color: #fff;
}

/* ========================================
   🔧 ИСПРАВЛЕНО: Article Layout 
   ======================================== */

.article-layout {
    display: grid;
    grid-template-columns: 80px 1fr 300px; /* ✅ Добавили колонку для кнопок слева */
    gap: 20px; 
    padding: 20px 0 40px 0; 
    align-items: start; 
}

/* --- Article Content Styling --- */
.article-content {
    background-color: #fff;
    padding: 30px; 
    border-radius: 8px;
    line-height: 1.7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: relative; 
    text-align: left; 
}

/* ========================================
   🔧 ИСПРАВЛЕНО: Share Links (Кнопки соцсетей)
   ======================================== */

.share-links {
    position: sticky; /* ✅ Теперь sticky, а не absolute */
    top: calc(var(--header-height) + 30px); /* ✅ Прилипают при скролле */
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
    height: fit-content; /* ✅ Высота по содержимому */
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    /* ✅ FIXED: Убираем обводку для кнопки */
    border: none;
    outline: none;
    cursor: pointer;
}
.share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.share-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}
.share-btn.facebook { background-color: #3b5998; }
.share-btn.twitter { background-color: #00acee; }
.share-btn.whatsapp { background-color: #25d366; }
.share-btn.telegram { 
    background-color: #0088cc; 
}
.share-btn.pinterest { 
    background-color: #bd081c; 
}
.share-btn.copy-link { 
    background-color: #777;
}
/* ✅ Анимация успешного копирования */
.share-btn.copy-link.copied {
    background-color: #28a745 !important;
}

/* --- Scroll Margin for Anchor Links --- */
.article-content h2, .article-content h3 {
    scroll-margin-top: calc(var(--header-height) + 15px);
}

/* --- Sidebar Styling --- */
.sidebar-right {
    width: 300px; 
    display: flex;
    flex-direction: column;
    gap: 0; /* Убираем gap чтобы sticky работал */
}

.sidebar-scrollable {
    /* Эта часть прокручивается обычно */
}

/* --- Sticky Ad Block in Sidebar --- */
.sidebar-ad-sticky {
    position: -webkit-sticky; /* Для Safari */
    position: sticky;
    top: 80px; /* Отступ от верха при фиксации (под шапкой) */
    margin-top: 0; /* Без отступа сверху */
    min-height: 100px; /* Минимальная высота для контента */
    width: 100%; /* Полная ширина сайдбара */
    z-index: 1; /* Над обычным контентом, но под шапкой */
}
.sidebar-search {
    display: flex;
    margin-bottom: 25px;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background-color: #fff;
}
.sidebar-search input[type="search"] {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    outline: none;
    font-size: 15px;
}
.sidebar-search button {
    background-color: #17bcf4;
    color: #fff;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.sidebar-search button:hover {
    background-color: #0f9ac7;
}

/* --- Tags Widget --- */
.tags-widget {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px; 
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.tags-widget h4 {
    margin-top: 0;
    font-size: 16px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 1px solid #f4f4f4;
    margin-bottom: 10px;
    font-weight: 700;
}
.tags-list {
    display: flex;
    flex-wrap: wrap; 
    gap: 8px; 
    justify-content: center;
}
.tag-link {
    display: inline-block;
    background-color: #f4f4f4; 
    color: #555; 
    padding: 5px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px; 
    transition: background-color 0.2s, color 0.2s;
    border: 1px solid #eee;
}
.tag-link:hover {
    background-color: #ff8300; 
    color: #fff;
    border-color: #ff8300;
}

/* Ad Placeholder Styles */
.ad-placeholder-telegram {
    background-color: #17bcf4;
    border-radius: 12px;
    text-align: center;
    padding: 25px;
    margin-bottom: 25px;
}
.ad-placeholder-telegram a {
    text-decoration: none;
    color: #fff;
}
.telegram-icon {
    font-size: 40px;
    margin-bottom: 10px;
}
.ad-placeholder-telegram strong {
    display: block;
    font-size: 20px;
    margin-bottom: 5px;
    font-weight: 700;
}
.ad-placeholder-telegram span {
    font-size: 16px;
    opacity: 0.9;
}
.ad-placeholder-card {
    background-color: #fff;
    padding: 20px;
    text-align: center;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.ad-placeholder-card img {
    max-width: 100%;
    margin-bottom: 15px;
}
.ad-placeholder-card strong {
    display: block;
    font-size: 18px;
    margin-bottom: 5px;
}
.ad-placeholder-card p {
    margin: 0;
    font-size: 14px;
    color: #777;
}

/* --- Related Articles Section --- */
.related-articles-section {
    background-color: #fff;
    border-top: 1px solid #eee;
    text-align: center;
}
.related-articles-section h2 {
    font-size: 32px;
    color: #333;
    margin-bottom: 30px;
}

/* ======================================= */
/* MEDIA QUERIES for Article Page */
/* ======================================= */

@media (max-width: 1200px) {
    /* ✅ На средних экранах убираем колонку для кнопок */
    .article-layout {
        grid-template-columns: 1fr 280px; 
        gap: 30px;
    }
    
    .share-links {
        display: none; /* ✅ Прячем кнопки на средних экранах */
    }
    
    .sidebar-right {
        width: 280px; 
    }
}

@media (max-width: 1024px) {
    .article-hero h1 {
        font-size: 36px;
    }
    .hero-breadcrumbs {
        top: 0; 
    }
    
    .meta-grid {
        justify-content: center;
        gap: 15px;
    }
    
    .meta-item {
        width: auto; 
        text-align: center;
    }
}

@media (max-width: 768px) {
    .article-layout {
        grid-template-columns: 1fr; /* ✅ Одна колонка на мобильных */
        gap: 0;
        padding-top: 0px; 
    }

    .share-links {
        display: none; /* ✅ Кнопки скрыты на мобильных */
    }

    .sidebar-right {
        position: static;
        padding-top: 0;
        padding: 0 15px; 
        margin-top: 30px; 
        width: 100%;
        display: flex; 
        flex-direction: column;
        align-items: center; 
    }
    
    .sidebar-ad-sticky {
        position: static;
    }
    
    .sidebar-search, 
    .tags-widget, 
    .ad-placeholder-telegram,
    .ad-placeholder-card {
        width: 100%;
        max-width: 300px;
    }

    .article-content {
        padding: 20px 15px;
        margin-top: 20px;
        /* ✅ ИСПРАВЛЕНИЕ: Предотвращаем overflow */
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .article-hero {
        height: 40vh;
        background-attachment: scroll; 
        padding-top: 40px;
        /* ✅ ИСПРАВЛЕНИЕ: Убираем overflow */
        overflow: hidden;
    }
    .article-hero h1 {
        font-size: 28px;
        line-height: 1.3;
        /* ✅ ИСПРАВЛЕНИЕ: Ограничиваем ширину */
        max-width: 100%;
        padding: 0 15px;
        word-wrap: break-word;
    }
    
    /* ✅ ИСПРАВЛЕНИЕ: Hero title box адаптивность */
    .hero-title-box {
        max-width: calc(100% - 30px);
        padding: 15px 20px;
    }
    
    .meta-grid {
        gap: 10px;
        /* ✅ ИСПРАВЛЕНИЕ: Переносим на несколько строк */
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .meta-item {
        /* ✅ ИСПРАВЛЕНИЕ: Ограничиваем ширину */
        max-width: 100%;
        font-size: 13px;
        white-space: normal; /* Позволяем перенос */
    }
    
    /* ✅ ИСПРАВЛЕНИЕ: Breadcrumbs адаптивность */
    .hero-breadcrumbs {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

    /* changing headings on hover */

.article-content h2, 
.article-content h3 {
    background: linear-gradient(90deg, #333 0%, #333 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 100%;
    transition: background-position 0.6s ease, background-image 0.6s ease;
}

.article-content h2:hover, 
.article-content h3:hover {
    background-image: linear-gradient(90deg, #7b2cbf 0%, #c77dff 30%, #ff6b9d 60%, #ff8c42 100%);
    background-position: -100% 0;
}

    /*  */