:root {
    --bg: #ffffff;
    --bg-raised: #f6f7f9;
    --bg-secondary: #f1f3f6;
    --surface: #f7f8fa;
    --surface-hover: #eef2ff;
    --border: #d9dde5;
    --border-thin: #e8eaf0;
    --text: #252832;
    --text-dim: #626876;
    --text-bright: #101116;
    --text-muted: #626876;
    --text-quiet: #7a808d;
    --accent: #1557ff;
    --accent-dim: #1248cf;
    --accent-hover: #0b3ebd;
    --accent-light: #edf2ff;
    --red: #d6402f;
    --amber: #a96f00;
    --cyan: #087f8c;
    --purple: #7048a8;
    --navy: #17213a;
    --primary: #1557ff;
    --primary-hover: #0b3ebd;
    --success: #1d7a4a;
    --warning: #b66a00;
    --danger: #c9362a;
    --code-bg: #15171d;
}

html { font-size: 16px; }
body {
    margin: 0;
    padding: 0;
    background: #fff;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    line-height: 1.65;
}
body::before,
body::after { display: none; }

.publication-header {
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 68px;
    padding: 0 clamp(1.25rem, 4vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border-thin);
    backdrop-filter: blur(14px);
}
.publication-logo {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    color: var(--text-bright);
    text-decoration: none;
    letter-spacing: 0;
}
.publication-logo span { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; }
.publication-logo strong {
    font-family: 'Newsreader', serif;
    font-size: 1.55rem;
    font-weight: 700;
}
.publication-header nav {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    background: none;
    border: 0;
    backdrop-filter: none;
}
.publication-header nav a {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
}
.publication-header nav a:hover,
.publication-header nav a[aria-current="page"] { color: var(--text-bright); }

.research-hero,
.index-hero {
    max-width: 1120px;
    margin: 0 auto;
    padding: clamp(4rem, 9vw, 7.5rem) clamp(1.25rem, 4vw, 3rem) 3.5rem;
    border-bottom: 1px solid var(--border);
}
.section-label {
    display: inline-block;
    margin: 0 0 1.35rem;
    color: var(--red);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: none;
    text-transform: uppercase;
}
.research-hero h1,
.index-hero h1 {
    max-width: 980px;
    margin: 0;
    color: var(--text-bright);
    font-family: 'Newsreader', serif;
    font-size: clamp(2.75rem, 6.5vw, 5.75rem);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: 0;
}
.research-hero h1 { font-size: clamp(2.6rem, 5.5vw, 4.8rem); line-height: 1.02; }
.research-subtitle,
.index-hero > p:not(.section-label) {
    max-width: 760px;
    margin: 1.75rem 0 0;
    color: var(--text-dim);
    font-family: 'Newsreader', serif;
    font-size: clamp(1.15rem, 2.2vw, 1.45rem);
    line-height: 1.55;
}
.hero-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.1rem; }
.hero-tags:empty { display: none; }
.tag {
    padding: 0.25rem 0.55rem;
    color: #344054;
    background: #f2f4f7;
    border: 0;
    border-radius: 3px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: uppercase;
}
.research-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.6rem;
    color: var(--text-quiet);
    font-size: 0.78rem;
}
.research-meta span::before { content: '/'; margin-right: 0.7rem; color: #c0c4cc; }
.share-buttons { display: flex; gap: 1rem; margin-top: 1.4rem; }
.share-buttons a {
    padding: 0;
    color: var(--accent);
    background: none;
    border: 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-layout,
.article-layout:has(.toc-sidebar) {
    max-width: 1120px;
    margin: 0 auto;
    padding: 3.5rem clamp(1.25rem, 4vw, 3rem) 7rem;
    display: grid;
    grid-template-columns: minmax(150px, 210px) minmax(0, 760px);
    justify-content: space-between;
    gap: clamp(2.5rem, 6vw, 6rem);
}
.toc-sidebar {
    top: 100px;
    padding: 0 1rem 0 0;
    border: 0;
}
.toc-sidebar h3 {
    margin: 0 0 0.8rem;
    color: var(--text-bright);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0;
}
.toc-sidebar a { color: var(--text-quiet); font-size: 0.74rem; border-left-color: var(--border); }
.toc-sidebar a:hover,
.toc-sidebar a.active { color: var(--accent); border-left-color: var(--accent); }
.article-content { min-width: 0; overflow: visible; }
.article-content > :first-child { margin-top: 0; }
.article-content p,
.article-content li,
.article-content blockquote {
    font-family: 'Newsreader', serif;
    font-size: 1.14rem;
}
.article-content p { line-height: 1.72; }
.article-content h2,
.article-content h3,
.article-content h4 {
    color: var(--text-bright);
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0;
}
.article-content h2 {
    margin-top: 3.75rem;
    padding-top: 1rem;
    font-size: clamp(1.65rem, 3vw, 2.2rem);
    border-top: 2px solid var(--text-bright);
}
.article-content h3 { font-size: 1.28rem; }
.article-content a { color: var(--accent); }
.article-content strong { color: var(--text-bright); }
.article-content img,
.article-content video { max-width: 100%; height: auto; }
.screenshot,
.post-video,
figure img { border: 1px solid var(--border); border-radius: 4px; }
.screenshot-caption,
figcaption { margin: 0.55rem 0 1.5rem; color: var(--text-quiet); font-size: 0.78rem; }

.audio-player,
.callout,
.source-card,
.route-card,
.blueprint,
.skill-card,
.stat-card,
.decision-box {
    color: var(--text);
    background: var(--bg-raised);
    border-color: var(--border);
    border-radius: 4px;
    box-shadow: none;
}
.audio-player { padding: 1rem; }
.callout { border-left-color: var(--accent); }
.callout.warning,
.callout.warn { background: #fff8eb; border-left-color: var(--warning); }
.callout.success,
.callout.tip { background: #edf8f2; border-left-color: var(--success); }
.callout.info,
.callout.quote { background: #eef6f8; border-left-color: var(--cyan); }
.stat-number { color: var(--red); }

.table-wrapper,
.tbl-wrap { border-color: var(--border); border-radius: 4px; overflow-x: auto; }
table { background: #fff; }
thead,
table.cmp thead th { color: var(--text-bright); background: #f1f3f6; }
th { color: var(--text-bright); border-color: var(--border); }
td { border-color: var(--border-thin); }
tr:hover { background: #f8f9fb; }
code { color: #bfe1ff; background: var(--code-bg); }
pre,
.code-block,
.diagram,
.arch-diagram {
    color: #e7e9ee;
    background: #15171d;
    border-color: #2b2e37;
    border-radius: 4px;
}

.index-hero { padding-bottom: 4rem; }
.index-hero > p:not(.section-label) { max-width: 650px; }
.index-count {
    margin-top: 2.25rem;
    color: var(--text-quiet);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
}
.post-list { max-width: 1120px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem) 7rem; }
.post-card {
    position: relative;
    display: grid;
    grid-template-columns: 145px minmax(230px, 1fr) minmax(260px, 1.25fr) 110px;
    gap: 1.5rem;
    align-items: baseline;
    padding: 1.7rem 0;
    color: inherit;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.post-card-meta { color: var(--text-quiet); font-family: 'IBM Plex Mono', monospace; font-size: 0.68rem; }
.post-card h2 { margin: 0; font-family: 'Newsreader', serif; font-size: 1.45rem; line-height: 1.15; }
.post-card h2 a { color: var(--text-bright); text-decoration: none; }
.post-card p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--text-dim);
    font-family: 'Newsreader', serif;
    font-size: 0.98rem;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}
.read-link { color: var(--accent); font-size: 0.74rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.post-card:hover h2 a { color: var(--accent); }

.publication-footer {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2.5rem clamp(1.25rem, 4vw, 3rem);
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    color: var(--text-dim);
    background: #fff;
    border-top: 2px solid var(--text-bright);
}
.publication-footer > div { display: flex; flex-direction: column; gap: 0.3rem; }
.publication-footer strong { color: var(--text-bright); font-family: 'Newsreader', serif; font-size: 1.25rem; }
.publication-footer span { font-size: 0.78rem; }
.publication-footer nav { position: static; width: auto; height: auto; padding: 0; display: flex; gap: 1rem; background: none; border: 0; }
.publication-footer a { color: var(--text-dim); font-size: 0.75rem; }

@media (max-width: 820px) {
    .publication-header { min-height: 60px; }
    .publication-header nav { gap: 0.9rem; }
    .publication-header nav a:nth-last-child(-n+2) { display: none; }
    .publication-logo span { display: none; }
    .research-hero,
    .index-hero { padding-top: 4rem; }
    .article-layout,
    .article-layout:has(.toc-sidebar) { grid-template-columns: minmax(0, 1fr); padding-top: 2.5rem; }
    .toc-sidebar { display: none; }
    .post-card { grid-template-columns: 105px minmax(0, 1fr); gap: 0.75rem 1rem; }
    .post-card p { grid-column: 2; }
    .read-link { grid-column: 2; }
}

@media (max-width: 520px) {
    .publication-header nav a:not([aria-current="page"]) { display: none; }
    .research-hero h1,
    .index-hero h1 { font-size: 2.65rem; }
    .research-subtitle,
    .index-hero > p:not(.section-label) { font-size: 1.08rem; }
    .post-card { grid-template-columns: 1fr; padding: 1.5rem 0; }
    .post-card p,
    .read-link { grid-column: 1; }
    .publication-footer { flex-direction: column; }
}