/* ====== Article Page Styles ====== */

/* Reading Progress Bar */
.reading-progress {
    position: fixed;
    top: 65px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--line);
    z-index: 59;
    opacity: 0;
    visibility: hidden;
    transform-origin: left center;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.reading-progress.visible {
    opacity: 1;
    visibility: visible;
}

.reading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #00d4ff);
    transition: width 0.1s ease;
}

/* Article Container */
.article-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* Article Layout - Grid */
.article-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    position: relative;
}

/* Hero Section */
.hero {
    grid-column: 1 / -1;
    max-width: 900px;
    margin: 0 auto 40px;
}

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

.breadcrumbs a {
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s ease;
}

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

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

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

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 24px;
    font-size: 14px;
    color: var(--muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item i {
    font-size: 18px;
    color: var(--primary);
}

.article-title {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 24px;
    font-family: var(--font-tech);
    letter-spacing: -0.02em;
}

.article-tags-hero {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.tag-pill {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.tag-pill::before {
    transition: all 0.2s ease;
    content: "#";
    color: var(--primary);
}

.tag-pill:hover {
    background: var(--text);
    color: black;
    border-radius: 7px;
    transform: translateY(-2px);
}

.tag-pill:hover::before {
    color: black;
}

.hero-image {
    width: 100%;
    border-radius: var(--radius);
    aspect-ratio: 16/9;
    object-fit: cover;
    box-shadow: var(--shadow);
}

/* TOC Sidebar */
.toc-sidebar {
    position: relative;
    grid-column: 1;
}

.sidebar-column {
    grid-column: 1;
}

.sidebar-sticky {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

.toc-sticky {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}

/* Custom, subtle scrollbar for TOC sticky area */
.toc-sticky {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.toc-sticky::-webkit-scrollbar {
    width: 8px;
}
.toc-sticky::-webkit-scrollbar-track {
    background: transparent;
}
.toc-sticky::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.08);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.toc-sticky:hover::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.14);
}

.toc-title i {
    color: var(--primary);
}

.toc-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 15px;
    counter-reset: toc-counter;
}

.toc-nav a {
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 14px;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.4;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    overflow-wrap: anywhere;
    min-width: 0;
    text-decoration: none;
    counter-increment: toc-counter;
}

.toc-nav a::before {
    content: counter(toc-counter) ".";
    color: var(--primary);
    font-weight: 700;
    flex: 0 0 36px;
    width: 36px;
    text-align: left;
}

.toc-nav a:hover {
    background: var(--surface);
    color: var(--text);
}

.toc-nav a.active {
    background: var(--surface);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* Reading Controls */
.reading-controls {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.reading-controls h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.font-size-controls button {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.font-size-controls button:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.font-size-indicator {
    font-weight: 600;
    color: var(--primary);
}

/* Main Article Content */
.article-content {
    max-width: 800px;
    font-size: 18px;
    line-height: 1.8;
    color: var(--text);
}

.article-content h1,
.article-content h2{
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 48px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--line);
    scroll-margin-top: 100px;
}

.article-content p {
    margin-bottom: 24px;
    color: var(--text);
}

.article-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    background: var(--surface);
    border-radius: 6px;
    margin: 32px 0;
    font-style: italic;
    color: var(--muted);
}

.article-content code {
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-tech);
    font-size: 0.9em;
}

.article-content pre code {
    display: block;
    padding: 20px;
    overflow-x: auto;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.article-content ul,
.article-content ol {
    margin: 24px 0;
    padding-left: 28px;
}

.article-content li {
    margin-bottom: 12px;
}

.article-content a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-content a:hover {
    color: var(--link);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin: 32px 0;
    box-shadow: var(--shadow);
}

/* Action Bar */
.action-bar {
    grid-column: 1 / -1;
    max-width: 900px;
    margin: 48px auto;
    padding: 24px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.action-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
}

.action-title i {
    color: var(--primary);
}

.share-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-ui);
}

.share-btn i {
    font-size: 20px;
}

.share-copy {
    background: var(--surface);
    color: var(--text);
}

.share-copy:hover {
    background: var(--muted);
    transform: translateY(-2px);
}

.share-facebook {
    background: #055dd0;
    color: white;
}

.share-facebook:hover {
    background: #145dbf;
    transform: translateY(-2px);
}

.share-twitter {
    background: #000000;
    color: white;
}

.share-twitter:hover {
    background: #333333;
    transform: translateY(-2px);
}

.share-pdf {
    background: #dc3545;
    color: white;
}

.share-pdf:hover {
    background: #c82333;
    transform: translateY(-2px);
}

/* Related Articles Section */
.related-section {
    grid-column: 1 / -1;
    margin-top: 64px;
}

.section-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-tech);
}

.section-title i {
    color: var(--primary);
}

/* Article Cards Grid */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.article-card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.card-image {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    gap: 10px;
}

.card-tag {
    background: var(--surface);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
    text-transform: lowercase;
}
.card-tag:hover {
    background-color: white;
    color: black;
}
.card-tag::before {
    content: "#";
}

.card-date {
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.4;
    color: var(--text);
}

.card-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: black;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.card-button:hover {
    background: white;
    transform: translateX(4px);
    color: black;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(12, 138, 255, 0.4);
    z-index: 50;
}


/* Responsive Design */
@media (max-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .sidebar-column {
        order: -1;
    }

    .sidebar-sticky {
        position: relative;
        top: 0;
        max-height: none;
    }

    .article-content {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .article-container {
        padding: 20px 16px;
    }

    .article-title {
        font-size: 28px;
    }

    .article-meta {
        gap: 12px;
        font-size: 13px;
    }

    .content-heading {
        font-size: 24px;
        margin-top: 32px;
    }

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

    .share-buttons {
        flex-direction: column;
    }

    .share-btn {
        width: 100%;
        justify-content: center;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }

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

/* Ad tile */
.ad-tile {
    margin-top: 18px;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed var(--line);
    background: linear-gradient(180deg, rgba(0,0,0,0.02), transparent);
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}