/* ═══════════════════════════════════════════════════════════
   Article CSS — skrini.ru PHP blog engine
   Dark theme: #0F172A bg, Inter font, #6366F1 accent
   Inherits CSS custom properties from blog.css
   ═══════════════════════════════════════════════════════════ */

/* ───────────── Breadcrumbs ───────────── */
.section--breadcrumbs {
    padding: 24px 0 0;
}

.breadcrumbs ol {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.breadcrumbs li:not(:last-child)::after {
    content: '/';
    color: var(--text-muted);
    opacity: 0.5;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumbs a:hover {
    color: var(--accent-hover);
}

.breadcrumbs span {
    color: var(--text-muted);
}

/* ───────────── Articles Header (index page) ───────────── */
.section--articles-header {
    padding: 48px 0 0;
}

.articles-header {
    text-align: center;
    margin-bottom: 40px;
}

.articles-header__title {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.articles-header__description {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ───────────── Category Filter Tabs ───────────── */
.articles-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 8px;
}

.articles-filter__item {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.articles-filter__item:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background: var(--bg-secondary);
}

.articles-filter__item.is-active {
    color: white;
    background: var(--accent);
    border-color: var(--accent);
}

/* ───────────── Articles Grid ───────────── */
.section--articles-grid {
    padding: 48px 0 80px;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 32px;
}

.articles-empty {
    text-align: center;
    padding: 80px 0;
    color: var(--text-secondary);
}

.articles-empty p {
    margin-bottom: 24px;
    font-size: 18px;
}

/* ───────────── Article Card ───────────── */
.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.article-card__image {
    display: block;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.article-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.article-card:hover .article-card__image img {
    transform: scale(1.05);
}

.article-card__content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-card__category {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 12px;
}

.article-card__title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.article-card__title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}

.article-card__title a:hover {
    color: var(--accent-hover);
}

.article-card__excerpt {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: auto;
}

.article-card__read-time::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

/* ───────────── Single Article: Header / Hero ───────────── */
.article__header {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 0 40px;
    text-align: center;
}

.article__category-badge {
    display: inline-block;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-subtle);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 100px;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all var(--transition);
}

.article__category-badge:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-hover);
}

.article__title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.article__meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.article__date,
.article__read-time,
.article__author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article__read-time::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 50%;
}

.article__excerpt {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 680px;
    margin: 0 auto;
}

/* ───────────── Article Layout: Content + Sidebar ───────────── */
.article__layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 48px;
    max-width: 1100px;
    margin: 0 auto;
    padding-bottom: 64px;
}

/* ───────────── Sidebar ───────────── */
.article__sidebar {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Sidebar CTA */
.sidebar-cta {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.sidebar-cta__content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sidebar-cta__icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.sidebar-cta__icon svg {
    width: 100%;
    height: 100%;
}

.sidebar-cta__text {
    display: flex;
    flex-direction: column;
}

.sidebar-cta__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-cta__subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.sidebar-cta__btn {
    display: block;
    text-align: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: var(--accent);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}

.sidebar-cta__btn:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
}

/* ───────────── Table of Contents (Sidebar) ───────────── */
.toc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.toc-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 2px;
}

.toc-list a,
.toc-link {
    display: block;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all var(--transition);
    line-height: 1.4;
}

.toc-list a:hover,
.toc-link:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.toc-list a.active,
.toc-link.active {
    color: var(--accent-hover);
    border-left-color: var(--accent);
    background: var(--accent-subtle);
}

.toc-list a.toc-h3,
.toc-item--level-3 a {
    padding-left: 24px;
    font-size: 12px;
}

/* ───────────── Article Body (typography) ───────────── */
.article__content {
    max-width: var(--article-width);
    min-width: 0;
}

.article__featured-image {
    margin: 0 0 32px;
    border-radius: var(--radius);
    overflow: hidden;
}

.article__featured-image img {
    width: 100%;
    display: block;
}

.article-body {
    font-size: 17px;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-body h2 {
    font-size: 28px;
    font-weight: 800;
    margin: 48px 0 20px;
    color: var(--text-primary);
    line-height: 1.3;
    scroll-margin-top: 80px;
}

.article-body h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 36px 0 16px;
    color: var(--text-primary);
    line-height: 1.3;
    scroll-margin-top: 80px;
}

.article-body h4 {
    font-size: 18px;
    font-weight: 700;
    margin: 28px 0 12px;
    color: var(--text-primary);
}

.article-body p {
    margin: 0 0 20px;
    color: var(--text-primary);
}

.article-body strong {
    font-weight: 700;
    color: var(--text-primary);
}

.article-body em {
    font-style: italic;
}

.article-body a {
    color: var(--accent-hover);
    text-decoration: underline;
    text-decoration-color: rgba(99, 102, 241, 0.3);
    text-underline-offset: 3px;
    transition: all var(--transition);
}

.article-body a:hover {
    color: var(--text-primary);
    text-decoration-color: var(--text-primary);
}

/* Lists */
.article-body ul,
.article-body ol {
    margin: 0 0 24px;
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.article-body ul li {
    list-style-type: disc;
}

.article-body ul li::marker {
    color: var(--accent);
}

.article-body ol li::marker {
    color: var(--accent);
    font-weight: 600;
}

/* Blockquote */
.article-body blockquote {
    margin: 32px 0;
    padding: 20px 24px;
    background: var(--accent-subtle);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.article-body blockquote p {
    margin: 0;
    color: var(--text-primary);
    font-style: italic;
}

/* Code */
.article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    font-size: 0.88em;
    padding: 2px 8px;
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent-hover);
}

.article-body pre {
    margin: 24px 0;
    padding: 20px 24px;
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    position: relative;
}

.article-body pre code {
    display: block;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre;
}

/* Code copy button (injected by components.js) */
.code-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.code-copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.code-copy-btn.copied {
    color: var(--success);
    border-color: var(--success);
}

/* Tables */
.article-body table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    font-size: 15px;
}

.article-body th,
.article-body td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.article-body th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.article-body td {
    color: var(--text-secondary);
}

.article-body tr:hover td {
    background: var(--bg-card);
}

/* Images in body */
.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 24px 0;
}

.article-body figure {
    margin: 32px 0;
}

.article-body figcaption {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 12px;
}

/* Horizontal rule */
.article-body hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 48px 0;
}

/* ───────────── Share Buttons ───────────── */
.article__share {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    margin-top: 32px;
    border-top: 1px solid var(--border);
}

.article__share-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.share-btn svg {
    width: 22px;
    height: 22px;
}

.share-btn:hover {
    color: var(--accent-hover);
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.share-btn.copied {
    color: var(--success);
    border-color: var(--success);
}

.share-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--success);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--success);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.share-tooltip.visible {
    opacity: 1;
}

/* ───────────── CTA Block ───────────── */
.section--cta {
    padding: 64px 0;
}

.cta-block {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
}

.cta-block__title {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.cta-block__text {
    font-size: 17px;
    color: var(--text-secondary);
    margin-bottom: 28px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* ───────────── Related Articles ───────────── */
.section--related {
    padding: 64px 0 80px;
}

.section__title {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    margin-bottom: 40px;
}

.text-center {
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

/* ───────────── Sections ───────────── */
.section {
    padding: 48px 0;
}

/* ───────────── Author Card (optional, for future) ───────────── */
.author-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 40px;
}

.author-card__avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.author-card__info {
    flex: 1;
}

.author-card__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.author-card__bio {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ───────────── Responsive ───────────── */
@media (max-width: 1024px) {
    .article__layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .article__sidebar {
        position: static;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        max-height: none;
    }

    .sidebar-cta {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .article__header {
        padding: 32px 0 24px;
    }

    .article__title {
        font-size: 28px;
    }

    .article__sidebar {
        grid-template-columns: 1fr;
    }

    .article-body {
        font-size: 16px;
    }

    .article-body h2 {
        font-size: 24px;
        margin-top: 36px;
    }

    .article-body h3 {
        font-size: 20px;
        margin-top: 28px;
    }

    .cta-block {
        padding: 40px 24px;
    }

    .articles-filter {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 16px;
    }

    .articles-filter::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 480px) {
    .article__meta {
        flex-direction: column;
        gap: 8px;
    }

    .article__share {
        flex-wrap: wrap;
    }
}

/* ───────────── Print ───────────── */
@media print {
    .header,
    .footer,
    .reading-progress,
    .article__sidebar,
    .sidebar-cta,
    .section--cta,
    .section--related,
    .article__share,
    .mobile-menu,
    .mobile-menu-btn {
        display: none !important;
    }

    .article__layout {
        grid-template-columns: 1fr;
    }

    .article-body {
        font-size: 12pt;
        color: #000;
    }

    .article-body a {
        color: #000;
        text-decoration: underline;
    }

    .article-body a::after {
        content: ' (' attr(href) ')';
        font-size: 10pt;
        color: #666;
    }
}

/* ───────────── Animations ───────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
