:root {
    --bg: #161a21;
    --surface: #1e232e;
    --border: #2a3142;
    --accent: #5daced;
    --accent2: #f5a623;
    --text: #d4dae8;
    --text-muted: #6b7591;
    --text-dim: #3d4560;
    --code-bg: #13171f;
    --heading: #eef1f8;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 17px;
    line-height: 1.8;
    min-height: 100vh;
}


.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 28px 100px;
    position: relative;
    z-index: 1;
}

/* HEADER */
header {
    border-bottom: 1px solid var(--border);
    padding: 64px 0 48px;
    margin-bottom: 56px;
}

.label {
    font-family: 'Noto Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--accent);
    opacity: 0.3;
    max-width: 60px;
}

h1 {
    font-family: 'Noto', serif;
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 900;
    color: var(--heading);
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 20px;
}

h1 span {
    color: var(--accent);
}

.subtitle {
    font-family: 'Source Serif 4', serif;
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-muted);
    font-weight: 300;
    max-width: 600px;
    line-height: 1.6;
}

.meta {
    margin-top: 28px;
    display: flex;
    gap: 28px;
    font-family: 'Noto Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.08em;
}
.meta span { color: var(--text-muted); }

/* SECTIONS */
section {
    margin-bottom: 64px;
}

h2 {
    font-family: 'Noto', serif;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 24px;
    padding-top: 8px;
    display: flex;
    align-items: center;
    gap: 14px;
}
h2::before {
    content: attr(data-n);
    font-family: 'Noto Mono', monospace;
    font-size: 11px;
    color: var(--accent2);
    border: 1px solid var(--accent2);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}

h3 {
    font-family: 'Noto Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent2);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 36px 0 14px;
}

p {
    margin-bottom: 18px;
    color: var(--text);
}

/* LINKS */
a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(93, 172, 237, 0.2);
    transition: all 0.2s ease;
}

a:hover {
    border-bottom-color: var(--accent);
    background: rgba(93, 172, 237, 0.05);
}

/* CALLOUT BOXES */
.callout {
    border-left: 3px solid var(--accent);
    background: var(--surface);
    padding: 18px 22px;
    margin: 28px 0;
    border-radius: 0 4px 4px 0;
}
.callout.warn {
    border-left-color: var(--accent2);
}
.callout p { margin: 0; font-size: 0.95rem; }
.callout-label {
    font-family: 'Noto Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.callout.warn .callout-label { color: var(--accent2); }

/* CODE BLOCKS */
pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 22px 24px;
    overflow-x: auto;
    margin: 24px 0 32px;
    position: relative;
}
pre::before {
    content: attr(data-lang);
    position: absolute;
    top: 10px;
    right: 14px;
    font-family: 'Noto Mono', monospace;
    font-size: 10px;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
code {
    font-family: 'Noto Mono', monospace;
    font-size: 13.5px;
    line-height: 1.7;
    color: #c9d1e8;
}
p code, li code {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--accent);
}

/* Syntax highlight colors */
.kw  { color: #c792ea; }
.fn  { color: #82aaff; }
.str { color: #c3e88d; }
.cm  { color: #546e7a; font-style: italic; }
.num { color: #f78c6c; }
.ty  { color: #ffcb6b; }
.op  { color: #89ddff; }

/* DIAGRAM */
.diagram {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 28px;
    margin: 28px 0;
    overflow-x: auto;
}

.pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    min-width: 600px;
    margin-bottom: 10px;
}

.pipe-step {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 14px;
    font-family: 'Noto Mono', monospace;
    font-size: 11.5px;
    color: var(--text);
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
}
.pipe-step.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(93, 172, 237, 0.06);
}
.pipe-step small {
    display: block;
    color: var(--text-dim);
    font-size: 9.5px;
    margin-top: 3px;
}
.pipe-arrow {
    color: var(--text-dim);
    font-size: 18px;
    padding: 0 6px;
    flex-shrink: 0;
}
.pipe-step .num { color: var(--accent); }
.pipe-step .num { color: var(--accent2); }
.pipe-step .num { color: var(--amber); }

.pipe-step .title {
    font-family: var(--sans);
    font-size: .82rem;
    font-weight: 600;
    color: #fff;
    display: block;
    margin-bottom: .3rem;
}

.pipe-step .desc {
    font-family: var(--sans);
    font-size: .7rem;
    color: var(--text2);
    line-height: 1.4;
}

.pipe-step.buffer {
    display: inline-block;
    margin-top: .5rem;
    font-family: var(--mono);
    font-size: .65rem;
    color: var(--green);
    background: rgba(52,211,153,.08);
    border: 1px solid rgba(52,211,153,.2);
    border-radius: 4px;
    padding: .1rem .4rem;
}

.diagram-caption {
    font-size: 12px;
    color: var(--text-dim);
    font-family: 'Noto Mono', monospace;
    text-align: center;
    margin-top: 14px;
    letter-spacing: 0.05em;
}

/* FORMULA */
.formula {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px 24px;
    margin: 20px 0;
    font-family: 'Noto Mono', monospace;
    font-size: 13px;
    color: #e4c97b;
    text-align: center;
}

/* TABLE */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 14px;
}
th {
    font-family: 'Noto Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}
td {
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    color: var(--text);
    vertical-align: top;
}
tr:hover td { background: var(--surface); }
td code { font-size: 12px; }

/* DIVIDER */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 48px 0;
}

/* FOOTER */
footer {
    font-family: 'Noto Mono', monospace;
    font-size: 11px;
    color: var(--text-dim);
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    letter-spacing: 0.06em;
}

/* ANIMATIONS */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
header { animation: fadeIn 0.6s ease both; }
section { animation: fadeIn 0.5s ease both; }
section:nth-child(2) { animation-delay: 0.08s; }
section:nth-child(3) { animation-delay: 0.14s; }
section:nth-child(4) { animation-delay: 0.20s; }
section:nth-child(5) { animation-delay: 0.26s; }
section:nth-child(6) { animation-delay: 0.32s; }

/* Local font fallbacks and article-specific overrides */
body { font-family: 'Noto Serif', Georgia, serif; }
h1, h2 { font-family: 'Noto Serif', serif; }
h3, .label, .meta, pre, code, th, .diagram-caption, footer { font-family: 'Noto Mono', monospace; }

ul {
    margin: 0 0 18px 0;
    padding-left: 24px;
}
ul li {
    margin-bottom: 6px;
    color: var(--text);
    line-height: 1.7;
}

.toc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 24px 28px;
    margin-bottom: 56px;
}
.toc-title {
    font-family: 'Noto Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}
.toc ol {
    margin: 0;
    padding-left: 20px;
    counter-reset: none;
}
.toc li {
    font-family: 'Noto Mono', monospace;
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.toc a {
    color: var(--text-muted);
    border-bottom: none;
}
.toc a:hover { color: var(--accent); background: none; }

.badge {
    display: inline-block;
    font-family: 'Noto Mono', monospace;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-right: 6px;
    margin-bottom: 4px;
}
.badge-blue  { color: var(--accent);  border-color: var(--accent);  background: rgba(93,172,237,.07); }
.badge-amber { color: var(--accent2); border-color: var(--accent2); background: rgba(245,166,35,.07); }
.badge-green { color: #6dcc8a;        border-color: #6dcc8a;        background: rgba(109,204,138,.07); }

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 20px 0 32px;
}
.class-card {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 12px 14px;
}
.class-card .cn {
    font-family: 'Noto Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
}
.class-card .cd {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.sample-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin: 24px 0;
}
.sample-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px 18px;
    transition: border-color .2s;
}
.sample-card:hover { border-color: var(--accent); }
.sample-card .sc-title {
    font-family: 'Noto Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
    display: block;
    margin-bottom: 8px;
}
.sample-card .sc-desc {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.sample-card .sc-tags {
    margin-top: 10px;
}

.arch-layer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 20px 0 32px;
}
.layer-row {
    display: flex;
    gap: 4px;
}
.layer-box {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    border-radius: 4px;
    font-family: 'Noto Mono', monospace;
    font-size: 11.5px;
    line-height: 1.4;
}
.layer-app   { background: rgba(93,172,237,.12);  border: 1px solid rgba(93,172,237,.3);  color: #a8d4f0; }
.layer-rhi   { background: rgba(245,166,35,.10);  border: 1px solid rgba(245,166,35,.4);  color: #f0c870; }
.layer-back  { background: rgba(109,204,138,.10); border: 1px solid rgba(109,204,138,.3); color: #8dd8a8; }
.layer-hw    { background: rgba(100,100,140,.12); border: 1px solid rgba(100,100,140,.3); color: #a0a0c4; }
.layer-arrow {
    text-align: center;
    color: var(--text-dim);
    font-size: 16px;
    line-height: 1;
    padding: 2px 0;
}