/* TABLE & LEDGER — Design System */

:root {
    --ink: #1a1a18;
    --paper: #f5f2ed;
    --rust: #b5451b;
    --rust-light: #d4693a;
    --slate: #4a4a48;
    --warm-gray: #8a8780;
    --rule: #d4d0c8;
    --highlight: #fef3e0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }

body {
    font-family: 'Source Sans 3', Georgia, serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
}

.container { max-width: 820px; margin: 0 auto; padding: 0 2rem; }

/* --- HEADER / MASTHEAD --- */
header { padding: 3rem 0 2rem; border-bottom: 2px solid var(--ink); }

.masthead {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.brand {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.6rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand span { color: var(--rust); }

.tagline {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--warm-gray);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

nav {
    display: flex;
    gap: 2rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--rule);
}

nav a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate);
    text-decoration: none;
    transition: color 0.2s;
}

nav a:hover { color: var(--rust); }

/* --- SECTION LABELS --- */
.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rust);
}

/* --- ARTICLE HEADER --- */
.article-header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--rule);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.article-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--warm-gray);
}

.article-header h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.6rem;
    line-height: 1.15;
    font-weight: 400;
    margin-bottom: 1rem;
}

.article-lede {
    font-size: 1.15rem;
    color: var(--slate);
    line-height: 1.6;
    font-style: italic;
    border-left: 3px solid var(--rust);
    padding-left: 1.25rem;
    margin-top: 1.5rem;
}

/* --- ARTICLE BODY --- */
.article-body {
    padding: 2.5rem 0;
    max-width: 680px;
}

.article-body p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.8;
}

.article-body h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin: 2.5rem 0 1rem;
    color: var(--ink);
}

.article-body h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rust);
    margin: 2rem 0 0.75rem;
}

.article-body strong { color: var(--ink); font-weight: 600; }

.article-body ul, .article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.8;
}

.article-body blockquote {
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    padding: 1.5rem 0;
    margin: 2.5rem 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--ink);
}

.article-body code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    background: var(--highlight);
    padding: 0.15em 0.4em;
    border-radius: 2px;
}

.article-body pre {
    background: var(--ink);
    color: var(--paper);
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    border-radius: 2px;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-body a {
    color: var(--rust);
    text-decoration: none;
    border-bottom: 1px solid var(--rust-light);
    transition: border-color 0.2s;
}

.article-body a:hover {
    border-bottom-color: var(--rust);
}

.article-body hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}

/* --- PULLQUOTE (for custom HTML in markdown) --- */
.pullquote {
    border-top: 2px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    padding: 1.5rem 0;
    margin: 2.5rem 0;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.4rem;
    line-height: 1.4;
    color: var(--ink);
}

/* --- MUSING NOTE --- */
.musing-note {
    background: var(--highlight);
    border-left: 3px solid var(--rust);
    padding: 1rem 1.25rem;
    margin-bottom: 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--slate);
    line-height: 1.6;
}

/* --- STAT ROW --- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--rule);
    border: 1px solid var(--rule);
    margin: 2.5rem 0;
}

.stat {
    background: var(--paper);
    padding: 1.5rem;
    text-align: center;
}

.stat-number {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.4rem;
    color: var(--rust);
    line-height: 1;
    display: block;
    margin-bottom: 0.4rem;
}

.stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gray);
    line-height: 1.4;
}

/* --- STACK BLOCK --- */
.stack-block {
    background: var(--highlight);
    border-left: 3px solid var(--rust);
    padding: 1.5rem 1.5rem 1.5rem 1.5rem;
    margin: 2rem 0;
}

.stack-block h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rust);
    margin: 0 0 1rem 0;
}

.stack-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--rule);
    font-size: 0.9rem;
}

.stack-item:last-child { border-bottom: none; }

.stack-tool {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink);
}

.stack-role { color: var(--slate); }

/* --- FLOW BLOCK --- */
.flow-block {
    margin: 2rem 0;
    border: 1px solid var(--rule);
}

.flow-step {
    display: grid;
    grid-template-columns: 2rem 1fr;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rule);
    align-items: start;
}

.flow-step:last-child { border-bottom: none; }

.flow-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--rust);
    font-weight: 500;
    padding-top: 0.15rem;
}

.flow-text {
    font-size: 0.9rem;
    color: var(--slate);
    line-height: 1.6;
}

.flow-text strong { color: var(--ink); }

/* --- ARTICLE FOOTER --- */
.article-footer {
    border-top: 2px solid var(--ink);
    padding: 2rem 0;
    margin-top: 1rem;
}

.author-info {
    font-size: 0.9rem;
    color: var(--slate);
    margin-bottom: 1.5rem;
}

.author-info strong {
    display: block;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.1rem;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.back-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rust);
    text-decoration: none;
}

.back-link:hover { opacity: 0.7; }

/* --- BLOG INDEX --- */
.blog-header {
    padding: 3rem 0 2rem;
    border-bottom: 1px solid var(--rule);
}

.blog-header h1 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 400;
    margin-bottom: 0.75rem;
}

.blog-intro {
    font-size: 1rem;
    color: var(--slate);
    line-height: 1.6;
    max-width: 600px;
}

.post-list {
    padding: 1rem 0;
}

.post-entry {
    padding: 2rem 0;
    border-bottom: 1px solid var(--rule);
}

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

.post-entry-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.post-entry h2 {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.post-entry h2 a {
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s;
}

.post-entry h2 a:hover { color: var(--rust); }

.post-entry-lede {
    font-size: 0.95rem;
    color: var(--slate);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.read-link {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rust);
    text-decoration: none;
}

.read-link:hover { opacity: 0.7; }

/* --- SITE FOOTER --- */
footer {
    border-top: 2px solid var(--ink);
    padding: 2rem 0;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1rem;
    color: var(--ink);
    text-decoration: none;
}

.footer-brand span { color: var(--rust); }

.footer-links { display: flex; gap: 1.5rem; }

.footer-links a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gray);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--rust); }

/* --- RESPONSIVE --- */
@media (max-width: 700px) {
    html { font-size: 16px; }
    .article-header h1 { font-size: 1.9rem; }
    .masthead { flex-direction: column; gap: 0.25rem; }
    nav { gap: 1.25rem; }
    .stat-row { grid-template-columns: 1fr; }
    .stack-item { grid-template-columns: 1fr; gap: 0.25rem; }
    .blog-header h1 { font-size: 1.8rem; }
}
