/* Article-specific styles for long-form content */

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */

/* Container for the progress bar - fixed to viewport top */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
}

/* The actual progress bar that fills as you scroll */
.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10b981, #34d399);
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Dark mode styling for progress bar */
body.dark-mode .reading-progress-bar {
    background: linear-gradient(90deg, #34d399, #6ee7b7);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.5);
}

/* ==========================================================================
   Site Header - Name/Logo + Navigation
   ========================================================================== */

/* Header container - sticky at top */
.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-color, #ffffff);
    border-bottom: 1px solid var(--color-border, #e2e8f0);
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
}

.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo - Icon + Text (matching main site) */
.site-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.site-logo:hover {
    opacity: 0.8;
}

.site-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(16, 185, 129, 0.2);
    border-radius: 8px;
    color: #10b981;
}

.site-logo-icon svg {
    width: 20px;
    height: 20px;
}

.site-logo-text {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text, #0f172a);
    letter-spacing: -0.01em;
}

/* Navigation on the right */
.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Divider between nav links and theme toggle */
.site-nav-divider {
    width: 1px;
    height: 24px;
    background: var(--color-border, #e2e8f0);
    margin: 0 0.75rem;
}

.site-nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-light, #64748b);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.site-nav-link:hover {
    background: var(--color-hover-bg, #f1f5f9);
    color: var(--color-text, #0f172a);
}

/* Active nav link with pill/button style (matching main site) */
.site-nav-link-active {
    background: var(--color-bg-subtle, #f1f5f9);
    color: var(--color-accent, #10b981);
    border: 1px solid var(--color-border, #e2e8f0);
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--color-text-light, #64748b);
    transition: background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
    background: var(--color-hover-bg, #f1f5f9);
    color: var(--color-text, #0f172a);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Show/hide correct icon based on theme */
.theme-icon-dark {
    display: none;
}

body.dark-mode .theme-icon-light {
    display: none;
}

body.dark-mode .theme-icon-dark {
    display: block;
}

/* Dark mode overrides for header */
body.dark-mode .site-header {
    background: var(--bg-color, #0f172a);
    border-color: #334155;
}

body.dark-mode .site-logo-text {
    color: #f1f5f9;
}

body.dark-mode .site-logo-icon {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

body.dark-mode .site-nav-divider {
    background: #334155;
}

body.dark-mode .site-nav-link {
    color: #94a3b8;
}

body.dark-mode .site-nav-link:hover {
    background: #1e293b;
    color: #f1f5f9;
}

body.dark-mode .site-nav-link-active {
    background: #1e293b;
    color: #34d399;
    border-color: #334155;
}

body.dark-mode .theme-toggle {
    color: #94a3b8;
}

body.dark-mode .theme-toggle:hover {
    background: #1e293b;
    color: #f1f5f9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .site-header-inner {
        padding: 0.875rem 1rem;
    }

    .site-logo-text {
        font-size: 1rem;
    }

    .site-logo-icon {
        width: 32px;
        height: 32px;
    }

    .site-logo-icon svg {
        width: 16px;
        height: 16px;
    }

    .site-nav {
        gap: 0.125rem;
    }

    .site-nav-link {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
}

/* Article Container */
.article-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
}

/* Article Header */
.article-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--color-border, #e2e8f0);
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: var(--color-text-light, #64748b);
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-meta svg {
    width: 16px;
    height: 16px;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.article-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--tag-bg, #f1f5f9);
    color: var(--tag-color, #475569);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.article-tag:hover {
    background: var(--tag-hover, #e2e8f0);
    transform: translateY(-1px);
}

.article-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--color-text, #0f172a);
}

.article-subtitle {
    font-size: 1.25rem;
    color: var(--color-text-light, #64748b);
    line-height: 1.6;
}

/* Article Content */
.article-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--color-text, #1e293b);
}

.article-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    color: var(--color-heading, #0f172a);
}

.article-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.4;
    color: var(--color-heading, #0f172a);
}

.article-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--color-heading, #0f172a);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content strong {
    font-weight: 700;
    color: var(--color-text, #0f172a);
}

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

.article-content a {
    color: var(--link-color, #10b981);
    text-decoration: underline;
    transition: color 0.2s;
}

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

/* Lists */
.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

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

.article-content ol li {
    list-style-type: decimal;
}

/* Blockquotes / Callouts */
.article-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem;
    border-left: 4px solid var(--callout-border, #10b981);
    background: var(--callout-bg, #f0fdf4);
    border-radius: 0.5rem;
    font-style: normal;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content blockquote strong:first-child {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--callout-title, #059669);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Code blocks */
.article-content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--code-bg, #1e293b);
    color: var(--code-text, #e2e8f0);
    border-radius: 0.75rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.article-content code {
    font-family: 'Courier New', Courier, monospace;
}

.article-content :not(pre)>code {
    padding: 0.2rem 0.4rem;
    background: var(--inline-code-bg, #f1f5f9);
    color: var(--inline-code-text, #0f172a);
    border-radius: 0.25rem;
    font-size: 0.9em;
}

/* Tables */
.article-content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
    font-size: 1rem;
}

.article-content th,
.article-content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--table-border, #e2e8f0);
}

.article-content th {
    background: var(--table-header, #f8fafc);
    font-weight: 600;
    color: var(--color-heading, #0f172a);
}

.article-content tr:last-child td {
    border-bottom: none;
}

/* Images */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 2rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.article-content figure {
    margin: 2rem 0;
}

.article-content figcaption {
    margin-top: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-text-light, #64748b);
    font-style: italic;
}

/* Figure row - for displaying multiple figures aligned side by side */
.article-content .figure-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin: 2rem 0;
}

.article-content .figure-row figure {
    flex: 1 1 300px;
    max-width: 100%;
    margin: 0;
}

.article-content .figure-row img {
    width: 100%;
    height: auto;
    margin: 0;
}

/* For single figures that should be on their own row */
.article-content figure.full-width {
    display: block;
    width: 100%;
}

/* Responsive: stack figures vertically on small screens */
@media (max-width: 600px) {
    .article-content .figure-row {
        flex-direction: column;
        align-items: center;
    }

    .article-content .figure-row figure {
        flex: 1 1 100%;
    }
}

/* Horizontal rule */
.article-content hr {
    margin: 3rem 0;
    border: none;
    border-top: 2px solid var(--color-border, #e2e8f0);
}

/* Navigation */
.article-nav {
    margin-bottom: 2rem;
}

.article-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--btn-bg, #f8fafc);
    color: var(--btn-color, #475569);
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid var(--btn-border, #e2e8f0);
    text-decoration: none;
}

.article-back-btn:hover {
    background: var(--btn-hover, #f1f5f9);
    transform: translateX(-4px);
}

.article-back-btn svg {
    width: 20px;
    height: 20px;
}

/* Dark mode support */
body.dark-mode {
    --color-text: #e2e8f0;
    --color-text-light: #94a3b8;
    --color-heading: #f1f5f9;
    --color-border: #334155;
    --link-color: #34d399;
    --link-hover: #10b981;
    --tag-bg: #1e293b;
    --tag-color: #cbd5e1;
    --tag-hover: #334155;
    --callout-border: #10b981;
    --callout-bg: #064e3b;
    --callout-title: #34d399;
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --inline-code-bg: #1e293b;
    --inline-code-text: #cbd5e1;
    --table-border: #334155;
    --table-header: #1e293b;
    --btn-bg: #1e293b;
    --btn-color: #cbd5e1;
    --btn-border: #334155;
    --btn-hover: #334155;
}

/* Responsive design */
@media (max-width: 768px) {
    .article-wrapper {
        padding: 1.5rem 1rem;
    }

    .article-title {
        font-size: 2rem;
    }

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

    .article-content h2 {
        font-size: 1.5rem;
    }

    .article-content h3 {
        font-size: 1.25rem;
    }

    .article-content pre {
        padding: 1rem;
        font-size: 0.8125rem;
    }

    .article-content table {
        font-size: 0.875rem;
    }

    .article-content th,
    .article-content td {
        padding: 0.5rem 0.75rem;
    }
}