/* Medium Style Typography Theme */
:root {
    --bg-color: #ffffff;
    --text-color: #242424;
    --text-muted: #6b6b6b;
    --nav-border: #f2f2f2;
    --code-bg: #f9f9f9;
    
    --font-sans: 'Helvetica Neue', Arial, sans-serif;
    --font-serif: 'Charter', Georgia, serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-serif);
    font-size: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5vw;
    border-bottom: 1px solid var(--nav-border);
    font-family: var(--font-sans);
}
.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    text-decoration: none;
    color: var(--text-color);
    letter-spacing: -0.5px;
}
.nav-link {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}
.nav-link:hover {
    color: var(--text-color);
}

/* Main Container */
.article-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 20px 5rem;
}

/* Header */
.article-header {
    margin-bottom: 2.5rem;
}
.article-header h1 {
    font-family: var(--font-sans);
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}
.subtitle {
    font-family: var(--font-sans);
    font-size: 1.3rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}
.meta {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
}
.author { font-weight: 600; }
.date { color: var(--text-muted); }

/* TOC */
.toc {
    position: fixed;
    left: calc(50% - 360px - 220px); /* 50% - half content - toc width - margin */
    top: 150px;
    width: 180px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    background: transparent;
    border: none;
    padding-right: 10px;
    font-family: var(--font-sans);
    z-index: 10;
}

/* Custom scrollbar for TOC */
.toc::-webkit-scrollbar {
    width: 4px;
}
.toc::-webkit-scrollbar-track {
    background: transparent;
}
.toc::-webkit-scrollbar-thumb {
    background: #e0e0e0;
    border-radius: 10px;
}
.toc::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

.toc-title {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 0.75rem;
}

.toc a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: all 0.2s;
    display: block;
    line-height: 1.4;
}

.toc a:hover {
    color: #1a8917;
}

.toc ul ul {
    margin-top: 0.25rem;
    margin-left: 1rem;
    border-left: 1px solid var(--nav-border);
    padding-left: 0.75rem;
}

.toc ul ul a {
    font-size: 0.75rem;
}

/* Content Typography */
.content h2 {
    font-family: var(--font-sans);
    font-size: 2.2rem;
    font-weight: 700;
    margin: 3.5rem 0 1rem;
    letter-spacing: -0.5px;
}
.content h3 {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2.5rem 0 1rem;
}
.content p {
    margin-bottom: 1.5rem;
}
.content hr {
    border: none;
    text-align: center;
    margin: 3rem 0;
}
.content hr::before {
    content: "...";
    letter-spacing: 12px;
    font-size: 24px;
    color: var(--text-color);
    line-height: 1;
}

/* Generic Visual Placeholder Styles */
.figure {
    margin: 2rem 0;
    padding: 2rem 1rem;
    background: #fbfbfb;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.caption {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0;
    text-align: center;
}

/* Diagrams inside figures */
.diagram-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-sans);
    font-weight: bold;
}
.box {
    border: 2px solid var(--text-color);
    padding: 10px 20px;
    background: white;
}
.box.highlight {
    background: #1a8917; /* Medium Green */
    color: white;
    border-color: #1a8917;
}
.node {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 20px;
    background: white;
}
.new-node {
    border: 2px solid #1a8917;
    padding: 10px;
    border-radius: 20px;
    color: white;
    background: #1a8917;
}

/* Code Blocks */
pre {
    background-color: var(--code-bg);
    padding: 1.25rem 1.5rem;
    border-radius: 3px;
    overflow-x: auto;
    margin-bottom: 2rem;
    border-left: 3px solid rgba(0,0,0,0.1);
}
code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #444;
}
p code {
    background: rgba(0,0,0,0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

/* Footer */
.article-footer {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--nav-border);
    text-align: center;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Call to Action Button */
.cta-container {
    margin: 2.5rem 0;
    text-align: center;
}
.cta-button {
    display: inline-block;
    background: #1a8917;
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(26, 137, 23, 0.2);
}
.cta-button:hover {
    background: #157012;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 137, 23, 0.3);
}

@media (max-width: 1200px) {
    .toc {
        position: static;
        width: 100%;
        margin: 2rem 0;
        padding: 1.5rem;
        background: #fbfbfb;
        border: 1px solid var(--nav-border);
        border-radius: 8px;
    }

    .toc-title {
        font-size: 0.9rem;
        color: var(--text-color);
    }

    .toc a {
        color: #1a8917;
        font-size: 1rem;
    }

    .toc ul ul {
        border-left: none;
        padding-left: 1.5rem;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .article-header h1 {
        font-size: 2.2rem;
    }
    .subtitle {
        font-size: 1.1rem;
    }
    .content h2 {
        font-size: 1.8rem;
    }
    .content h3 {
        font-size: 1.3rem;
    }
    
    .top-nav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }

    body {
        font-size: 18px;
    }

    pre {
        padding: 1rem;
    }

    .diagram-row {
        flex-wrap: wrap;
        justify-content: center;
    }
}
/* Sub-sections */
.sub-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px dashed var(--nav-border);
}

.sub-section h3 {
    margin-top: 0;
}

/* Comparison Grid for Graph */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.comp-box {
    background: #fbfbfb;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 1.5rem;
}

.comp-box h4 {
    font-family: var(--font-sans);
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #1a8917;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comp-box pre {
    margin-bottom: 0;
    font-size: 0.75rem;
    background: white;
}

/* Search Layout for Graph */
.search-flex {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.search-item {
    background: #fbfbfb;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 1.5rem;
}

.search-item h4 {
    font-family: var(--font-sans);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #1a8917;
}

/* Circular Diagram */
.circular-diagram {
    padding: 1.5rem;
    border: 2px dashed #ccc;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 0.8rem;
    margin: 0 auto;
}

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

/* Triplet Table Styles */
.triplet-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    background: white;
}

.triplet-table th {
    background: #f1f1f1;
    font-weight: 700;
    padding: 8px;
    border: 1px solid #ddd;
    text-align: center;
}

.triplet-table td {
    padding: 8px;
    border: 1px solid #ddd;
    text-align: center;
}
