/* ===========================================================
   supplychain.wiki — Living Blueprint
   Scandinavian functional + flat-design diagrammatic
   =========================================================== */

:root {
    --bg: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-pill: #f1f5f9;
    --border: #e2e8f0;
    --border-strong: #d1d9e0;
    --ink: #1e293b;
    --slate: #64748b;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.04);
    --accent-pill: rgba(37, 99, 235, 0.12);
    --green: #16a34a;
    --amber: #d97706;
    --teal: #0d9488;
    --violet: #7c3aed;

    --font-head: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
    --font-body: "Literata", Georgia, "Times New Roman", serif;
    --font-mono: "Fira Code", ui-monospace, "SF Mono", Menlo, monospace;
    --font-meta: "DM Sans", "Inter", system-ui, sans-serif;

    --read-width: 660px;
    --toc-width: 240px;
    --gutter: 64px;

    --shadow-card: 0 1px 0 rgba(15, 23, 42, 0.04);
    --shadow-tooltip: 0 12px 32px rgba(15, 23, 42, 0.12);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 96px;
}

body {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 28px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    opacity: 0;
    animation: page-reveal 600ms ease 80ms forwards;
}

@keyframes page-reveal {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ----- Reading progress bar ------------------------------- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent);
    z-index: 60;
    transition: width 80ms linear;
}

/* ----- Masthead ------------------------------------------- */
.masthead {
    position: sticky;
    top: 3px;
    z-index: 40;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.masthead-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 14px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.brand-mark {
    display: inline-flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: var(--surface-pill);
    border-radius: 8px;
}

.brand-text {
    font-family: var(--font-head);
    font-size: 17px;
    letter-spacing: -0.01em;
}

.brand-text strong {
    font-weight: 700;
}

.brand-tld {
    color: var(--slate);
    font-weight: 500;
}

.masthead-nav {
    font-family: var(--font-meta);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.masthead-nav a {
    color: var(--ink);
    text-decoration: none;
    transition: color 160ms ease;
}

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

.masthead-meta {
    color: var(--slate);
    font-size: 13px;
    padding-left: 28px;
    border-left: 1px solid var(--border);
}

/* ----- Page layout ---------------------------------------- */
.page {
    max-width: 1320px;
    margin: 0 auto;
    padding: 64px 40px 120px;
    display: grid;
    grid-template-columns: var(--toc-width) minmax(0, 1fr);
    gap: var(--gutter);
}

/* ----- Sidebar TOC ---------------------------------------- */
.toc {
    position: sticky;
    top: 96px;
    align-self: start;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 12px;
    font-family: var(--font-meta);
}

.toc::-webkit-scrollbar {
    width: 4px;
}
.toc::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.toc-heading {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.toc-eyebrow {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--slate);
    margin-bottom: 6px;
}

.toc-title {
    display: block;
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.toc-line {
    position: absolute;
    top: 90px;
    left: 7px;
    width: 4px;
    height: calc(100% - 200px);
    pointer-events: none;
}

.toc-line-path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: toc-draw 800ms ease 200ms forwards;
}

@keyframes toc-draw {
    to { stroke-dashoffset: 0; }
}

.toc-list {
    list-style: none;
    position: relative;
    padding-left: 24px;
}

.toc-item {
    position: relative;
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 22px;
}

.toc-marker {
    position: absolute;
    left: -22px;
    top: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    transform: scale(0);
    animation: marker-pop 400ms cubic-bezier(0.25, 1.4, 0.4, 1) forwards;
    transition: border-color 200ms ease, background 200ms ease;
}

.toc-item:nth-child(1) .toc-marker { animation-delay: 350ms; }
.toc-item:nth-child(2) .toc-marker { animation-delay: 430ms; }
.toc-item:nth-child(3) .toc-marker { animation-delay: 510ms; }
.toc-item:nth-child(4) .toc-marker { animation-delay: 590ms; }
.toc-item:nth-child(5) .toc-marker { animation-delay: 670ms; }
.toc-item:nth-child(6) .toc-marker { animation-delay: 750ms; }

@keyframes marker-pop {
    to { transform: scale(1); }
}

.toc-item.is-active .toc-marker {
    border-color: var(--accent);
    background: var(--accent);
}

.toc-item > a {
    display: inline-block;
    color: var(--ink);
    text-decoration: none;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 200ms ease, color 200ms ease;
}

.toc-item.is-active > a {
    background: var(--accent);
    color: #ffffff;
}

.toc-item > a:hover {
    color: var(--accent);
}

.toc-item.is-active > a:hover {
    color: #ffffff;
}

.toc-sub {
    list-style: none;
    margin-top: 6px;
    padding-left: 12px;
}

.toc-sub li {
    font-size: 13px;
    line-height: 20px;
    color: var(--slate);
    margin: 4px 0;
}

.toc-sub a {
    color: var(--slate);
    text-decoration: none;
    transition: color 160ms ease;
}

.toc-sub a:hover {
    color: var(--accent);
}

.toc-footnote {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    line-height: 19px;
    color: var(--slate);
}

/* ----- Reading column ------------------------------------- */
.reading {
    max-width: var(--read-width);
    margin: 0 auto;
    width: 100%;
    position: relative;
}

.reading > article {
    border-left: 1px solid var(--border-strong);
    padding-left: 36px;
}

/* Article header */
.article-head {
    margin-bottom: 56px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.kicker {
    font-family: var(--font-meta);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.kicker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-pill);
}

.article-title {
    font-family: var(--font-head);
    font-size: 56px;
    line-height: 60px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 24px;
}

.lede {
    font-family: var(--font-body);
    font-size: 21px;
    line-height: 32px;
    color: var(--ink);
    margin-bottom: 28px;
    font-style: italic;
}

.article-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-family: var(--font-meta);
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--slate);
    background: var(--surface-subtle);
}

.meta-pill code {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--accent);
}

.meta-pill-status {
    color: var(--green);
    border-color: rgba(22, 163, 74, 0.25);
    background: rgba(22, 163, 74, 0.06);
}

.meta-pill-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
}

/* Sections */
.section {
    margin-bottom: 56px;
    scroll-margin-top: 96px;
}

.section h2 {
    font-family: var(--font-head);
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 20px;
    padding-top: 8px;
    border-radius: 4px;
    transition: background 1500ms ease;
}

.section.is-pulsed h2 {
    background: rgba(37, 99, 235, 0.05);
}

.section h3 {
    font-family: var(--font-head);
    font-size: 18px;
    line-height: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-top: 36px;
    margin-bottom: 16px;
}

.section p {
    margin-bottom: 18px;
}

.section em {
    font-style: italic;
    color: var(--ink);
}

.section strong {
    font-weight: 700;
}

.section a:not(.xref):not(.actor-card) {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.3);
    transition: border-color 200ms ease;
}

.section a:not(.xref):not(.actor-card):hover {
    border-bottom-color: var(--accent);
}

/* ----- Flow list ------------------------------------------ */
.flow-list {
    list-style: none;
    margin: 24px 0 28px;
    padding: 0;
}

.flow-list li {
    display: flex;
    gap: 16px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-subtle);
    margin-bottom: 10px;
    align-items: flex-start;
}

.flow-list-token {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
}

.flow-list-token[data-tone="material"] { background: var(--teal); }
.flow-list-token[data-tone="info"]     { background: var(--accent); }
.flow-list-token[data-tone="finance"]  { background: var(--amber); }

.flow-list li > div {
    font-size: 16px;
    line-height: 26px;
}

/* ----- Callout -------------------------------------------- */
.callout {
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    padding: 16px 20px;
    border-radius: 0 6px 6px 0;
    margin: 28px 0;
    font-family: var(--font-body);
}

.callout-eyebrow {
    font-family: var(--font-meta);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 6px;
}

/* ----- Annotations / footnote markers --------------------- */
.annotation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin: 0 2px 0 1px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    font-family: var(--font-meta);
    font-weight: 600;
    font-size: 10px;
    line-height: 16px;
    cursor: help;
    vertical-align: super;
    font-style: normal;
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.annotation:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
}

.annotation-tooltip {
    position: fixed;
    max-width: 280px;
    padding: 12px 14px;
    background: var(--ink);
    color: #ffffff;
    border-radius: 6px;
    font-family: var(--font-meta);
    font-size: 13px;
    line-height: 19px;
    box-shadow: var(--shadow-tooltip);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: none;
    z-index: 70;
}

.annotation-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.annotation-tooltip::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 16px;
    width: 10px;
    height: 10px;
    background: var(--ink);
    transform: rotate(45deg);
}

/* ----- Actor grid ----------------------------------------- */
.actor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 24px 0 28px;
}

.actor-card {
    position: relative;
    display: block;
    padding: 16px 18px 16px 24px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    text-decoration: none;
    color: var(--ink);
    overflow: hidden;
    transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
    box-shadow: var(--shadow-card);
}

.actor-card-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
}

.actor-card[data-category="supplier"] .actor-card-stripe     { background: var(--teal); }
.actor-card[data-category="manufacturer"] .actor-card-stripe { background: var(--violet); }
.actor-card[data-category="logistics"] .actor-card-stripe    { background: var(--teal); }
.actor-card[data-category="warehouse"] .actor-card-stripe    { background: var(--accent); }
.actor-card[data-category="retailer"] .actor-card-stripe     { background: var(--accent); }
.actor-card[data-category="customer"] .actor-card-stripe     { background: var(--green); }

.actor-card-icon {
    display: inline-flex;
    color: var(--slate);
    margin-bottom: 8px;
}

.actor-card h4 {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    margin-bottom: 4px;
}

.actor-card p {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 21px;
    color: var(--slate);
    margin: 0;
}

.actor-card:hover {
    background: var(--accent-soft);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

/* ----- Cross-reference inline ----------------------------- */
.xref {
    color: var(--accent);
    text-decoration: none;
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 3px;
    border-bottom: 1px dashed rgba(37, 99, 235, 0.4);
    font-family: var(--font-body);
    transition: background 200ms ease;
    cursor: help;
}

.xref:hover {
    background: var(--accent-pill);
}

/* ----- Diagram zone (full-width breakout) ----------------- */
.diagram-zone {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: var(--surface-subtle);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 56px 40px;
    margin-top: 24px;
    margin-bottom: 24px;
    position: relative;
}

.diagram-zone-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.diagram-head {
    margin-bottom: 24px;
    text-align: center;
}

.diagram-eyebrow {
    font-family: var(--font-meta);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--slate);
    margin-bottom: 8px;
}

.diagram-title {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 10px;
}

.diagram-caption {
    font-family: var(--font-meta);
    font-size: 13px;
    line-height: 20px;
    color: var(--slate);
    max-width: 640px;
    margin: 0 auto;
}

.legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 6px;
    color: var(--ink);
    font-weight: 500;
}

.legend::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 2px solid currentColor;
}

.legend.logistics    { color: var(--teal); }
.legend.manufacturing { color: var(--violet); }
.legend.retail       { color: var(--accent); }

.diagram-canvas {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    overflow-x: auto;
}

.diagram {
    display: block;
    width: 100%;
    height: auto;
    min-width: 760px;
}

.diagram-node rect {
    transition: filter 200ms ease;
    opacity: 0;
}

.diagram-zone.is-revealed .diagram-node rect {
    opacity: 1;
    transition: opacity 400ms ease, filter 200ms ease;
}

.diagram-zone.is-revealed .diagram-node:nth-of-type(1) rect { transition-delay: 0ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(2) rect { transition-delay: 100ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(3) rect { transition-delay: 200ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(4) rect { transition-delay: 300ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(5) rect { transition-delay: 400ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(6) rect { transition-delay: 500ms; }
.diagram-zone.is-revealed .diagram-node:nth-of-type(7) rect { transition-delay: 600ms; }

.diagram-node text {
    opacity: 0;
}

.diagram-zone.is-revealed .diagram-node text {
    opacity: 1;
    transition: opacity 400ms ease 700ms;
}

.node-title {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 700;
    fill: var(--ink);
}

.node-sub {
    font-family: var(--font-meta);
    font-size: 11px;
    fill: var(--slate);
}

.diagram-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    opacity: 0;
}

.diagram-zone.is-revealed .diagram-path {
    opacity: 1;
    animation: path-draw 700ms ease forwards;
}

.diagram-zone.is-revealed .diagram-paths path:nth-of-type(1) { animation-delay: 800ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(2) { animation-delay: 900ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(3) { animation-delay: 1000ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(4) { animation-delay: 1100ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(5) { animation-delay: 1200ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(6) { animation-delay: 1300ms; }
.diagram-zone.is-revealed .diagram-paths path:nth-of-type(7) { animation-delay: 1400ms; }

@keyframes path-draw {
    to { stroke-dashoffset: 0; }
}

/* ----- Code block ----------------------------------------- */
.code-block {
    background: var(--surface-pill);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 18px;
    overflow-x: auto;
    margin: 22px 0 24px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 22px;
    color: var(--ink);
}

.code-block code {
    font-family: var(--font-mono);
}

.code-comment {
    color: var(--slate);
    font-style: italic;
}

/* Inline code pills */
code {
    font-family: var(--font-mono);
    font-size: 14px;
    background: var(--surface-pill);
    padding: 1px 6px;
    border-radius: 3px;
    color: var(--ink);
}

/* ----- Progress track (downstream cadence) ---------------- */
.progress-track {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 24px 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg);
}

.progress-stage {
    position: relative;
    padding: 14px 18px 14px 22px;
    background: var(--bg);
    border-right: 1px solid var(--border);
}

.progress-stage:last-child {
    border-right: none;
}

.progress-stage::after {
    content: "";
    position: absolute;
    top: 0;
    right: -10px;
    bottom: 0;
    width: 0;
    height: 0;
    border-top: 24px solid transparent;
    border-bottom: 24px solid transparent;
    border-left: 10px solid var(--bg);
    z-index: 2;
    transition: border-left-color 200ms ease;
}

.progress-stage:last-child::after { display: none; }

.progress-stage.is-complete {
    background: rgba(22, 163, 74, 0.08);
}
.progress-stage.is-complete::after {
    border-left-color: rgba(22, 163, 74, 0.08);
}

.progress-stage.is-active {
    background: var(--accent-pill);
    box-shadow: inset 0 -2px 0 var(--accent), 0 0 0 1px rgba(37, 99, 235, 0.2);
}
.progress-stage.is-active::after {
    border-left-color: var(--accent-pill);
}

.progress-stage-num {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--slate);
    margin-bottom: 4px;
}

.progress-stage.is-complete .progress-stage-num { color: var(--green); }
.progress-stage.is-active .progress-stage-num   { color: var(--accent); }

.progress-stage-label {
    display: block;
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 2px;
}

.progress-stage-time {
    display: block;
    font-family: var(--font-meta);
    font-size: 12px;
    color: var(--slate);
}

.figcaption {
    font-family: var(--font-meta);
    font-size: 13px;
    line-height: 20px;
    color: var(--slate);
    text-align: center;
    margin-top: 8px;
    margin-bottom: 28px;
}

/* ----- Topology grid -------------------------------------- */
.topology-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin: 22px 0 28px;
}

.topology-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px;
    background: var(--bg);
    transition: border-color 200ms ease, transform 200ms ease;
}

.topology-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.topology-svg {
    display: block;
    width: 100%;
    height: 64px;
    margin-bottom: 10px;
}

.topology-card h4 {
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 4px;
}

.topology-card p {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 22px;
    color: var(--slate);
    margin: 0;
}

/* ----- Metric grid ---------------------------------------- */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
    margin: 24px 0 28px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg);
}

.metric-cell {
    padding: 18px 20px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.metric-cell:nth-child(2n) { border-right: none; }
.metric-cell:nth-last-child(-n+2) { border-bottom: none; }

.metric-label {
    font-family: var(--font-meta);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--slate);
    margin-bottom: 6px;
}

.metric-value {
    font-family: var(--font-head);
    font-size: 36px;
    line-height: 40px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin-bottom: 6px;
}

.metric-unit {
    font-size: 18px;
    font-weight: 500;
    color: var(--slate);
    margin-left: 4px;
}

.metric-note {
    font-family: var(--font-meta);
    font-size: 12px;
    line-height: 18px;
    color: var(--slate);
    margin: 0;
}

/* ----- Resilience list ------------------------------------ */
.resilience-list {
    list-style: none;
    margin: 22px 0 28px;
    padding: 0;
    counter-reset: resilience;
}

.resilience-list li {
    position: relative;
    padding: 12px 16px 12px 48px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    counter-increment: resilience;
    font-size: 16px;
    line-height: 24px;
}

.resilience-list li::before {
    content: counter(resilience, decimal-leading-zero);
    position: absolute;
    left: 14px;
    top: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent);
    font-weight: 500;
}

/* ----- Glossary ------------------------------------------- */
.section-glossary {
    background: var(--surface-subtle);
    border-radius: 8px;
    padding: 28px;
    margin-left: -28px;
    margin-right: -28px;
}

.glossary-list {
    margin: 16px 0 0;
}

.glossary-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.glossary-row:first-of-type { border-top: 1px solid var(--border); }

.glossary-row dt {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.glossary-row dt code {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    color: var(--accent);
    background: transparent;
    padding: 0;
}

.glossary-row dd {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 24px;
    color: var(--ink);
}

/* ----- Article foot --------------------------------------- */
.article-foot {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-family: var(--font-meta);
    font-size: 13px;
    line-height: 20px;
    color: var(--slate);
}

/* ----- Page foot ------------------------------------------ */
.page-foot {
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    padding: 32px 0;
}

.page-foot-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-family: var(--font-meta);
    font-size: 13px;
    color: var(--slate);
}

/* ----- Responsive ----------------------------------------- */
@media (max-width: 1024px) {
    .page {
        grid-template-columns: 1fr;
        padding: 48px 28px 96px;
        gap: 0;
    }
    .toc {
        position: relative;
        top: 0;
        height: auto;
        max-height: none;
        margin-bottom: 40px;
        padding-bottom: 24px;
        border-bottom: 1px solid var(--border);
    }
    .toc-line { display: none; }
    .toc-list { padding-left: 12px; }
    .toc-marker { display: none; }
    .reading > article { padding-left: 0; border-left: none; }
    .article-title { font-size: 40px; line-height: 44px; }
    .actor-grid, .topology-grid, .metric-grid { grid-template-columns: 1fr; }
    .progress-track { grid-template-columns: 1fr; }
    .progress-stage { border-right: none; border-bottom: 1px solid var(--border); }
    .progress-stage::after { display: none; }
    .glossary-row { grid-template-columns: 1fr; gap: 4px; }
    .masthead-meta { display: none; }
    .masthead-nav a:not(.masthead-meta) { display: none; }
    .masthead-nav a:nth-of-type(1),
    .masthead-nav a:nth-of-type(4) { display: inline; }
    .page-foot-inner { flex-direction: column; padding: 0 28px; }
    .section-glossary { margin-left: 0; margin-right: 0; padding: 20px; }
}

@media (max-width: 600px) {
    .article-title { font-size: 32px; line-height: 38px; }
    .lede { font-size: 18px; line-height: 28px; }
    .diagram-zone { padding: 32px 16px; }
}
