/* Article layout — blog index and individual post pages.
   Depends on /assets/css/style.css for all custom-property tokens.
   Token mapping from old inline styles:
     --bg-color       → --bg
     --text-color     → --text-primary
     --text-body      → --text-primary
     --text-muted     → --text-muted   (exists in main system)
     --link-color     → --accent
     --border-color   → --border
*/

/* ========== PAGE SCAFFOLD ========== */

/* Thin top nav: back-link on the left, nothing else needed. */
.article-nav {
    display: flex;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.article-nav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.18s ease;
}

.article-nav a svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.article-nav a:hover {
    color: var(--accent);
}

/* Dark-mode toggle pinned top-right so it doesn't compete with the reading
   column; matches the panel button's role without the sidebar chrome. */
.dark-toggle-fixed {
    position: fixed;
    top: var(--space-4);
    right: var(--space-5);
    z-index: 200;
}

/* Reuse .dark-toggle from style.css but remove the width:100% that the
   sidebar version needs — the fixed variant is self-sizing. display:flex is
   restated because style.css hides .dark-toggle at <=860px for the homepage's
   bottom-bar layout; the blog keeps its toggle at every width. The gap keeps
   label and track apart once space-between has no width to distribute. */
.dark-toggle-fixed .dark-toggle {
    display: flex;
    width: auto;
    margin-top: 0;
    padding: 8px 12px;
    gap: var(--space-3);
}

/* ========== READING COLUMN ========== */

/* Centered column shared by blog index and article body. */
.reading-column {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-6);
}

/* ========== BLOG HEADER ========== */

.blog-header {
    text-align: center;
    padding: 56px var(--space-5) var(--space-6);
    margin: 0 auto;
    max-width: 720px;
}

/* Builder-bot monogram crest. Fixed square so the canvas backing store can be
   sized once from clientWidth. On wide viewports it floats in the top-left
   corner whitespace beside the reading column; below 1080px that whitespace
   would collide with the column, so it returns to centered flow above the title. */
.spark-mark {
    width: 136px;
    height: 136px;
    display: block;
    position: absolute;
    top: 72px;
    left: var(--space-5);
}

@media (max-width: 1080px) {
    .spark-mark {
        position: static;
        margin: 0 auto var(--space-4);
    }
}

.blog-header h1 {
    margin: 0;
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: var(--lh-tight);
}

.blog-header .tagline {
    color: var(--text-muted);
    margin-top: var(--space-4);
    font-size: var(--fs-md);
}

/* ========== POST LIST (blog.html) ========== */

.blog-posts {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.blog-post {
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}

.blog-post:last-child {
    border-bottom: none;
}

.blog-post a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.blog-post a:hover h2 {
    color: var(--accent);
}

.blog-post h2 {
    margin: 0 0 var(--space-2) 0;
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.18s ease;
}

.blog-date {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    margin-bottom: var(--space-3);
    font-variant-numeric: tabular-nums;
}

.blog-excerpt {
    color: var(--text-muted);
    line-height: var(--lh-relaxed);
    font-size: var(--fs-md);
}

/* ========== ARTICLE HEADER ========== */

.article-header {
    text-align: center;
    padding: 56px var(--space-5) var(--space-5);
    margin: 0 auto;
    max-width: 720px;
}

.article-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.article-header .author {
    color: var(--text-primary);
    margin-top: var(--space-4);
    font-size: var(--fs-md);
}

.article-header .date {
    color: var(--text-muted);
    margin-top: var(--space-2);
    font-size: var(--fs-base);
}

/* ========== ARTICLE BODY ========== */

/* Prose defaults for the reading column. */
.blog-content {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.75;
}

.blog-content p {
    margin: 1.5em 0;
}

.blog-content h2 {
    margin: 2.5em 0 1em;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-primary);
}

.blog-content ul,
.blog-content ol {
    padding-left: 1.5em;
    margin: 1.25em 0;
}

.blog-content li {
    margin: 0.5em 0;
}

/* Blockquote — left rule, muted background, no color shift on text. */
.blog-content blockquote {
    border-left: 2px solid var(--border);
    margin: 1.5em 0;
    padding: 1em 1.5em;
    font-style: italic;
    background: rgba(128, 128, 128, 0.06);
}

.blog-content blockquote cite {
    display: block;
    margin-top: 0.5em;
    font-size: 0.9em;
    font-style: normal;
    opacity: 0.8;
}

/* Footnote superscripts use accent so they read as interactive. */
sup {
    color: var(--accent);
    font-weight: 500;
}

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

sup a:hover {
    text-decoration: underline;
}

/* ========== SITUATION AWARENESS TAXONOMY ========== */

/* Inset box for the SA error taxonomy table in the post. */
.sa-taxonomy {
    border: 1px solid var(--border);
    padding: 1.5em;
    margin: 1.5em 0;
    background: rgba(128, 128, 128, 0.06);
    text-align: center;
}

.sa-taxonomy h4 {
    margin: 0 0 0.75em;
    font-size: 1em;
    font-weight: 600;
    text-align: left;
    color: var(--text-primary);
}

.sa-taxonomy ul {
    margin: 0;
    padding-left: 1.5em;
    text-align: left;
    list-style-type: none;
}

.sa-taxonomy li::before {
    content: "– ";
}

.sa-taxonomy li {
    margin: 0.35em 0;
    font-size: 0.95em;
    white-space: nowrap;
    color: var(--text-primary);
}

.sa-level {
    margin-bottom: 1.25em;
}

.sa-level:last-child {
    margin-bottom: 0;
}

/* ========== REFERENCES ========== */

.references {
    margin-top: 3em;
    padding-top: 1.5em;
    border-top: 1px solid var(--border);
}

.references h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 1em;
    color: var(--text-primary);
}

.references ol {
    padding-left: 1.5em;
    margin: 0;
}

.references li {
    margin: 0.75em 0;
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text-primary);
}

.references a {
    word-break: break-word;
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: rgba(5, 150, 105, 0.4);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.18s ease;
}

.references a:hover {
    text-decoration-color: var(--accent);
}

/* Revision note below the references, muted so it reads as colophon, not content. */
.edited-note {
    margin-top: 2em;
    font-size: 0.85em;
    font-style: italic;
    color: var(--text-muted);
}

/* ========== TABLE OF CONTENTS (fixed left sidebar) ========== */

/* Hidden at widths where it would overlap the reading column. */
.toc {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: var(--space-4) 20px;
    z-index: 100;
    max-width: 200px;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.toc.visible {
    opacity: 1;
}

.toc h4 {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-eyebrow);
    margin: 0 0 var(--space-3);
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin: var(--space-2) 0;
}

.toc a {
    color: var(--text-primary);
    font-size: var(--fs-sm);
    text-decoration: none;
    display: block;
    padding: 4px 0 4px 12px;
    margin-left: -12px;
    border-left: 2px solid transparent;
    opacity: 0.7;
    transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.toc a:hover {
    opacity: 1;
}

/* Accent border marks the currently-visible section. */
.toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    opacity: 1;
}

@media (max-width: 1400px) {
    .toc { display: none; }
}

/* ========== FOOTER NAV ========== */

/* Reuses the .nav pattern from the old pages but without the raw <section> wrapper. */
.article-footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-5) var(--space-5) var(--space-6);
    border-top: 1px solid var(--border);
    max-width: 720px;
    margin: var(--space-6) auto 0;
}

.article-footer-nav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.18s ease;
}

.article-footer-nav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.article-footer-nav a:hover {
    color: var(--accent);
}

/* ========== NOT FOUND ========== */

.not-found-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.not-found {
    max-width: 560px;
    padding: var(--space-6) var(--space-5);
    text-align: center;
}

.not-found-code {
    margin: 0 0 var(--space-3);
    color: var(--accent);
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: var(--tracking-eyebrow);
}

.not-found h1 {
    margin: 0 0 var(--space-4);
    color: var(--text-primary);
    font-size: 2rem;
    line-height: 1.1;
}

.not-found p:not(.not-found-code) {
    margin: 0 auto var(--space-5);
    color: var(--text-secondary);
    font-size: var(--fs-base);
    line-height: 1.7;
}

.not-found-link {
    color: var(--accent);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 600px) {
    .blog-header h1 {
        font-size: 1.8rem;
    }

    .article-header h1 {
        font-size: 1.5rem;
    }

    .sa-taxonomy {
        padding: var(--space-4);
    }

    .sa-taxonomy li {
        white-space: normal;
    }

    .dark-toggle-fixed {
        top: var(--space-3);
        right: var(--space-3);
    }
}
