/* Article Reader Page Styles */

/* Article page breaks out of narrow container, centers itself */
.container:has(.article-two-col) {
    max-width: none;
}

/* Two-column layout */
.article-two-col {
    display: flex;
    gap: 32px;
    padding: 0 24px;
    max-width: 1800px;
    margin: 0 auto;
}

.article-main {
    flex: 2;
    min-width: 0;
    max-width: 1440px;
    overflow: hidden;
}

.article-page-sidebar {
    flex: 1;
    min-width: 200px;
    max-width: 340px;
    flex-shrink: 0;
    padding-top: 24px;
}

.article-page-sidebar .sidebar-article-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.article-page-sidebar .sidebar-article-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-article-thumb {
    width: 80px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-article-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-article-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary, #f0f0f0);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}

.sidebar-article-meta {
    font-size: 0.75rem;
    color: var(--text-secondary, #888);
}

@media (max-width: 900px) {
    .article-two-col {
        flex-direction: column;
        padding: 0 12px;
    }

    .article-page-sidebar {
        width: 100%;
    }
}

.article-hero {
    position: relative;
    width: 100%;
    max-height: 420px;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 28px;
}

.article-hero img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    display: block;
}

.article-title {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 16px;
    line-height: 1.3;
}

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

.article-author {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ccc;
}

.article-author img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.article-author-name {
    font-weight: 600;
    color: #fff;
}

.article-date {
    color: #888;
    font-size: 0.85rem;
}

.article-edited-badge {
    color: #aaa;
    font-size: 0.8rem;
    font-style: italic;
}

.article-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #888;
    font-size: 0.85rem;
    margin-left: auto;
}

.article-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Article Body Rendering */
.article-body {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px;
    line-height: 1.8;
    color: #ddd;
    font-size: 1.05rem;
}

.article-body p {
    margin: 0 0 20px;
}

.article-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.article-body h2::before {
    content: "";
    display: block;
    width: 4px;
    align-self: stretch;
    min-height: 1em;
    background: var(--accent-color, #ff1212);
    border-radius: 2px;
    flex-shrink: 0;
}

.article-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #eee;
    margin: 28px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-body h3::before {
    content: "";
    display: block;
    width: 3px;
    align-self: stretch;
    min-height: 0.9em;
    background: var(--accent-color, #ff1212);
    border-radius: 2px;
    flex-shrink: 0;
}

.article-body ul,
.article-body ol {
    margin: 0 0 20px 24px;
    padding: 0;
}

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

.article-body a {
    color: var(--accent-color, #ff1212);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body a:hover {
    color: #a0aaff;
}

.article-body strong {
    font-weight: 700;
    color: #fff;
}

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

.article-body u {
    text-decoration: underline;
    text-underline-offset: 3px;
}

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

/* Anchor links */
.article-body a.anchor-link {
    color: var(--accent-color, #ff1212);
    text-decoration: none;
}

.article-body a.anchor-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Code Blocks (article reader) */
.article-code-block {
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.article-code-block pre {
    margin: 0;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.35);
    overflow-x: auto;
}

.article-code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #c5c8c6;
    white-space: pre;
    tab-size: 4;
}

/* Override highlight.js background — we use our own */
.article-code-block pre code.hljs {
    background: transparent;
    padding: 0;
}

/* Inline Images */
.article-image-block {
    margin: 28px 0;
    text-align: center;
}

.article-image-block img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
}

.article-image-caption {
    margin-top: 8px;
    color: #999;
    font-size: 0.85rem;
    font-style: italic;
    text-align: center;
}

/* Embedded Media */
.article-embed-block {
    margin: 28px 0;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Iframe embed wrappers */
.article-embed-iframe-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.article-embed-iframe-wrap iframe {
    border: none;
    width: 100%;
    display: block;
}

.article-embed-video {
    aspect-ratio: 16 / 9;
}

.article-embed-video iframe {
    height: 100%;
}

.article-embed-audio {
    height: 160px;
}

.article-embed-audio iframe {
    height: 100%;
}

.article-embed-info {
    display: flex;
    align-items: center;
    margin-top: 8px;
    gap: 8px;
}

.article-embed-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-color, #ff1212);
    font-size: 0.8rem;
    text-decoration: none;
}

.article-embed-link:hover {
    text-decoration: underline;
}

/* Article Engagement Bar */
.article-engagement {
    max-width: 720px;
    margin: 40px auto;
    padding: 20px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Related Articles */
.article-related {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 16px;
}

.article-related h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 16px;
}

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

/* Article Preview Cards (used on /articles, channel, search) */
.article-preview-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.article-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.article-preview-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.article-preview-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.article-preview-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-preview-excerpt {
    font-size: 0.85rem;
    color: #999;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.article-preview-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.8rem;
    color: #888;
}

.article-preview-meta img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Top Articles (featured) */
.top-articles-section {
    margin-bottom: 48px;
}

.top-articles-section h2 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-articles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.top-article-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    aspect-ratio: 16 / 10;
}

.top-article-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-article-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px 14px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.top-article-overlay h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.top-article-overlay span {
    font-size: 0.8rem;
    color: #ccc;
}

.top-article-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(124, 138, 255, 0.9);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Latest Articles Section */
.latest-articles-section h2 {
    color: #fff;
    font-size: 1.3rem;
    margin-bottom: 20px;
}

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

/* My Articles - Draft/Published Cards */
.my-articles-section {
    margin-bottom: 40px;
}

.my-articles-section h2 {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.draft-badge {
    display: inline-block;
    background: rgba(255, 179, 0, 0.2);
    color: #ffb300;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.published-badge {
    display: inline-block;
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.my-article-card {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.my-article-card:hover {
    background: rgba(255, 255, 255, 0.07);
}

.my-article-card-thumb {
    width: 160px;
    min-height: 100px;
    flex-shrink: 0;
    overflow: hidden;
}

.my-article-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-article-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 0.8rem;
}

.my-article-card-info {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.my-article-card-title {
    font-weight: 600;
    color: #fff;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.my-article-card-stats {
    font-size: 0.8rem;
    color: #888;
    display: flex;
    gap: 12px;
}

.my-article-card-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.my-article-card-actions button {
    padding: 4px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.my-article-card-actions button:hover {
    opacity: 0.8;
}

.btn-article-edit {
    background: rgba(124, 138, 255, 0.2);
    color: var(--accent-color, #ff1212);
}

.btn-article-delete {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.no-articles-msg {
    color: #888;
    font-size: 0.9rem;
    padding: 16px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .article-title {
        font-size: 1.5rem;
    }

    .article-hero {
        max-height: 260px;
    }

    .article-hero img {
        height: 260px;
    }

    .top-articles-grid {
        grid-template-columns: 1fr;
    }

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

    .article-body {
        font-size: 1rem;
    }

    .my-article-card {
        flex-direction: column;
    }

    .my-article-card-thumb {
        width: 100%;
        min-height: 120px;
    }
}