body {
    font-family: 'Outfit', sans-serif;
    line-height: var(--article-line-height, 1.6);
    color: var(--text-main);
    background: var(--bg-gradient);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.article-container {
    max-width: 800px;
    margin: 120px auto 60px;
    padding: 0 20px;
}

.content-box {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: var(--article-padding, 40px);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: var(--article-h1-size, 2.5rem);
    margin-bottom: 10px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.article-hero-img {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 30px;
    border: 1px solid var(--glass-border);
    height: auto;
    display: block;
}

h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: var(--article-h2-size, 1.8rem);
    border-left: 4px solid var(--primary);
    padding-left: 15px;
}

h3 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-main);
    font-size: var(--article-h3-size, 1.4rem);
    font-weight: 700;
}

h4 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: var(--text-main);
    font-size: var(--article-h4-size, 1.2rem);
    font-weight: 600;
}

blockquote {
    border-left: 4px solid var(--accent);
    background: rgba(255, 255, 255, 0.05);
    margin: 20px 0;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-main);
}

code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary);
}

pre {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 20px;
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

th {
    background: rgba(79, 172, 254, 0.1);
    color: var(--primary);
    font-weight: 700;
}

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

p,
ul,
ol {
    margin-bottom: 20px;
    color: var(--text-muted);
    font-size: var(--article-body-size, 1.1rem);
    word-wrap: break-word;
    /* Prevent long words specifically */
    overflow-wrap: break-word;
    /* Modern standard */
}

.lead {
    font-size: 1.25rem;
    color: var(--text-main);
    font-weight: 500;
}

ul,
ol {
    padding-left: 20px;
}

li {
    margin-bottom: 10px;
}

strong {
    color: var(--text-main);
}

.cta-box {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--accent);
    padding: 20px;
    border-radius: 8px;
    margin-top: 40px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Ensure knowledge-card hover styles are not affected by article-style.css */
a.knowledge-card:hover {
    text-decoration: none;
}

/* Navigation Header & Sticky Layout */
.article-header {
    position: sticky;
    top: 95px;
    z-index: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 10px;
}

.back-btn {
    /* Reset sticky as parent handles it now, but for legacy pages without header it falls back */
    position: relative;
    top: auto;
    margin-bottom: 0;
    z-index: 1;
    /* Lower than dropdown if needed */

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 20px;

    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);

    border-radius: 50px;
    color: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.2);

    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
    white-space: nowrap;
}

.back-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 172, 254, 0.4);
    text-decoration: none;
}

/* Article Navigation Dropdown */
.article-nav {
    position: relative;
}

.article-nav summary {
    list-style: none;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.2);
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-nav summary::-webkit-details-marker {
    display: none;
}

.article-nav summary:hover,
.article-nav[open] summary {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 20px rgba(79, 172, 254, 0.4);
}

.article-nav nav {
    position: absolute;
    top: 120%;
    right: 0;
    width: 260px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: fadeIn 0.2s ease-out;
    max-height: 65vh;
    /* Limit height to 50% of viewport */
    overflow-y: auto;
    /* Enable vertical scrolling */
    overscroll-behavior: contain;
    /* Prevent scrolling parent page */
}

/* Custom Scrollbar for Dropdown */
.article-nav nav::-webkit-scrollbar {
    width: 6px;
}

.article-nav nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
    margin: 5px 0;
}

.article-nav nav::-webkit-scrollbar-thumb {
    background: rgba(79, 172, 254, 0.3);
    border-radius: 3px;
}

.article-nav nav::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 172, 254, 0.6);
}

.article-nav nav a {
    display: block;
    padding: 10px 15px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.article-nav nav a:hover {
    background: rgba(79, 172, 254, 0.1);
    color: var(--primary);
    text-decoration: none;
}

.logo-icon {
    margin-right: 0.5rem;

}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .logo-icon {
        margin-right: 0.3rem;
    }

    .article-header {
        top: 120px;
        flex-wrap: nowrap;
        /* Ensure they stay on same line */
    }

    .back-btn,
    .article-nav summary {
        padding: 8px 14px;
        font-size: 0.9rem;
    }

    /* On very small screens, maybe just icons? But text is requested. */
    .article-nav nav {
        right: -20px;
        /* Adjust for padding offset */
        width: 220px;
        max-height: 52vh;

        a {
            padding: 8px 12px;
            font-size: 0.85rem;
            border-radius: 8px;
        }
    }
}

/* References Section */
.references-section {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.references-section h3 {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 0;
    margin-bottom: 20px;
}

.references-section ul {
    list-style: none;
    padding-left: 0;
}

.references-section li {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    line-height: 1.5;
}

.references-section a {
    color: var(--text-muted);
    text-decoration: underline;
}

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