/**
 * single-post.css
 * Стили для информационных статей (single-post.php)
 * Подключается только на is_singular('post')
 *
 * @package Dom_Incost
 */

/* ============================================================
   ПЕРЕМЕННЫЕ (переиспользуем из custom.css)
   ============================================================ */
:root {
    --post-sidebar-width: 300px;
    --post-toc-bg: #f8f9fa;
    --post-toc-border: #e2e8f0;
    --post-toc-accent: var(--color-primary, #2d6a4f);
    --post-toc-active-bg: rgba(45, 106, 79, 0.08);
    --post-author-bg: #fff;
    --post-author-border: #e2e8f0;
}

/* ============================================================
   HERO СЕКЦИЯ
   ============================================================ */
.article-hero {
    padding: 40px 0 32px;
    background: #fff;
}

.article-hero__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.article-hero__date {
    font-size: 14px;
    color: #6b7280;
}

.article-cat-badge {
    display: inline-block;
    padding: 3px 10px;
    background: var(--post-toc-active-bg);
    color: var(--post-toc-accent);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}
.article-cat-badge:hover {
    background: rgba(45, 106, 79, 0.15);
    color: var(--post-toc-accent);
}

.article-hero__title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 700;
    line-height: 1.25;
    color: #1a1a1a;
    margin: 0;
}

/* ============================================================
   FEATURED IMAGE
   ============================================================ */
.article-featured-image {
    padding: 0 0 32px;
}

.article-featured-image__img {
    width: 100%;
    max-height: 480px;
    object-fit: cover;
    border-radius: 12px;
    display: block;
}

/* ============================================================
   ОСНОВНАЯ ЗОНА
   ============================================================ */
.article-body {
    padding: 0 0 60px;
}

/* ============================================================
   ПЛАШКА АВТОРА
   ============================================================ */
.post-author-badge {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--post-author-bg);
    border: 1px solid var(--post-author-border);
    border-radius: 10px;
    margin-bottom: 28px;
}

.post-author-badge__photo {
    flex-shrink: 0;
}

.post-author-badge__img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    display: block;
}

.post-author-badge__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.post-author-badge__name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
}

.post-author-badge__position {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.3;
}

/* ============================================================
   TOC — МОБИЛЬНЫЙ COLLAPSE
   ============================================================ */
.article-toc-mobile {
    margin-bottom: 24px;
    border: 1px solid var(--post-toc-border);
    border-radius: 10px;
    overflow: hidden;
}

.article-toc-mobile__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--post-toc-bg);
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: left;
}

.article-toc-mobile__toggle .bi-list-ul {
    font-size: 18px;
    color: var(--post-toc-accent);
}

.article-toc-mobile__chevron {
    margin-left: auto;
    transition: transform 0.25s ease;
}

.article-toc-mobile__toggle[aria-expanded="true"] .article-toc-mobile__chevron {
    transform: rotate(180deg);
}

.article-toc-mobile__nav {
    padding: 12px 0;
    background: #fff;
}

/* ============================================================
   TOC — САЙДБАР DESKTOP
   ============================================================ */
.article-sidebar-sticky {
    position: sticky;
    top: 130px; /* Высота sticky header */
}

.post-toc {
    background: var(--post-toc-bg);
    border: 1px solid var(--post-toc-border);
    border-radius: 12px;
    overflow: hidden;
}

.post-toc__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--post-toc-border);
    background: #fff;
}

.post-toc__icon {
    font-size: 18px;
    color: var(--post-toc-accent);
}

.post-toc__title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}

.post-toc__nav {
    padding: 10px 0;
}

/* ============================================================
   TOC — ОБЩИЕ СТИЛИ СПИСКА (desktop + mobile)
   ============================================================ */
.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc-list--sub {
    padding-left: 16px;
}

.toc-item {
    /* Нет дополнительных стилей */
}

.toc-link {
    display: block;
    padding: 6px 18px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    line-height: 1.45;
    border-left: 3px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.toc-link:hover {
    color: var(--post-toc-accent);
    background: var(--post-toc-active-bg);
    text-decoration: none;
}

/* Активный пункт (добавляет JS) */
.toc-link.is-active {
    color: var(--post-toc-accent);
    background: var(--post-toc-active-bg);
    border-left-color: var(--post-toc-accent);
    font-weight: 600;
}

/* H3 — чуть меньше и светлее */
.toc-item--h3 .toc-link {
    font-size: 13px;
    color: #6b7280;
    padding-left: 10px;
}

.toc-item--h3 .toc-link:hover,
.toc-item--h3 .toc-link.is-active {
    color: var(--post-toc-accent);
}

/* ============================================================
   КОНТЕНТ СТАТЬИ (типографика для the_content())
   ============================================================ */
.article-text {
    font-size: 16px;
    line-height: 1.75;
    color: #374151;
}

.article-text h2 {
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 700;
    color: #1a1a1a;
    margin: 40px 0 16px;
    padding-top: 4px;
}

.article-text h3 {
    font-size: clamp(17px, 2vw, 21px);
    font-weight: 600;
    color: #1a1a1a;
    margin: 28px 0 12px;
}

.article-text p {
    margin-bottom: 16px;
}

.article-text ul,
.article-text ol {
    margin: 0 0 16px 20px;
    padding: 0;
}

.article-text li {
    margin-bottom: 6px;
}

.article-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0 16px;
}

.article-text a {
    color: var(--post-toc-accent);
    text-decoration: underline;
}

.article-text a:hover {
    text-decoration: none;
}

.article-text blockquote {
    border-left: 4px solid var(--post-toc-accent);
    padding: 12px 20px;
    margin: 24px 0;
    background: var(--post-toc-active-bg);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #4b5563;
}

.article-text table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

.table-scroll-wrapper table {
    margin-bottom: 0;
    min-width: 480px;
}

.article-text th,
.article-text td {
    padding: 10px 14px;
    border: 1px solid var(--post-toc-border);
    text-align: left;
}

.article-text th {
    background: var(--post-toc-bg);
    font-weight: 600;
}

/* ============================================================
   НАВИГАЦИЯ К ДРУГИМ СТАТЬЯМ
   ============================================================ */
.article-navigation {
    padding: 32px 0 48px;
    border-top: 1px solid var(--post-toc-border);
}

.article-nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    border: 1px solid var(--post-toc-border);
    border-radius: 10px;
    text-decoration: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.article-nav-link:hover {
    border-color: var(--post-toc-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.article-nav-link__label {
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-nav-link__title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.4;
}

.article-nav-link--next {
    text-align: right;
    margin-top: 12px;
}

@media (min-width: 768px) {
    .article-nav-link--next {
        margin-top: 0;
    }
}

/* ============================================================
   АДАПТИВНОСТЬ
   ============================================================ */
@media (max-width: 991px) {
    .article-hero {
        padding: 24px 0 20px;
    }

    .article-hero__title {
        font-size: 24px;
    }

    .article-body {
        padding-bottom: 40px;
    }
}

@media (max-width: 575px) {
    .post-author-badge {
        padding: 12px 14px;
    }

    .post-author-badge__img {
        width: 44px;
        height: 44px;
    }

    .article-text {
        font-size: 15px;
    }
}
