/* ==========================================================================
   binu.uk — Cloud Architecture
   Plain CSS, no framework. Light/dark follow the OS so the adaptive
   draw.io diagrams always match the page around them.
   ========================================================================== */

:root {
  color-scheme: light dark;

  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --ink: #161d27;
  --ink-2: #384252;
  --muted: #677183;
  --rule: #e2e5ea;
  --rule-strong: #cfd4dc;
  --link: #1b4f8f;
  --link-hover: #0f335f;
  --accent: #b54708;
  --code-bg: #f3f4f6;
  --code-ink: #1f2937;
  --flow-bg: #121821;
  --flow-ink: #d7dee8;
  --flow-dim: #8793a3;
  --flow-hl: #f5b46b;
  --flow-border: #121821;
  --sls: #c2560b;
  --sls-tint: #fdf3ea;
  --ecs: #0b6f80;
  --ecs-tint: #e9f5f7;
  --note-bg: #f6f4ef;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 690px;
  --wide: 1180px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #131922;
    --surface-2: #19202a;
    --ink: #e6e9ee;
    --ink-2: #c4cbd5;
    --muted: #8d97a6;
    --rule: #252d39;
    --rule-strong: #33404f;
    --link: #8cb8f2;
    --link-hover: #b9d4f7;
    --accent: #f2a35e;
    --code-bg: #19202a;
    --code-ink: #d9e0e8;
    --flow-bg: #161c25;
    --flow-border: #2a3341;
    --flow-ink: #d7dee8;
    --flow-dim: #7d8898;
    --flow-hl: #f5b46b;
    --sls: #f59a4f;
    --sls-tint: #2a1d12;
    --ecs: #4fc3d4;
    --ecs-tint: #0f2529;
    --note-bg: #171d26;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; height: auto; }

a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 6px;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.container { width: min(var(--wide), 100% - 2 * var(--gutter)); margin-inline: auto; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: .5em;
  color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -.01em;
  font-size: 1.05rem; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-sep { color: var(--rule-strong); font-weight: 400; }
.brand-sub { color: var(--muted); font-weight: 500; }

.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
  display: block; padding: 8px 12px; border-radius: 6px;
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }

.progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0); background: var(--accent);
}

@media (max-width: 520px) {
  .brand-sub { display: none; }
  .brand-sep { display: none; }
  .site-nav a { padding: 8px 9px; font-size: .92rem; }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 96px; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: .9rem;
}
.site-footer .container {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  padding-block: 32px 40px;
}
.site-footer p { margin: 0; }
.site-footer code { font-size: .85em; }

/* ---------- Shared type ---------- */

.eyebrow {
  margin: 0 0 12px; color: var(--accent);
  font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
}
.lede { font-family: var(--font-serif); font-size: 1.25rem; line-height: 1.55; color: var(--ink-2); }

code, kbd, pre { font-family: var(--font-mono); }
:not(pre) > code {
  font-size: .86em; padding: .12em .38em; border-radius: 4px;
  background: var(--code-bg); color: var(--code-ink);
  border: 1px solid var(--rule); white-space: nowrap;
}

/* ---------- Home ---------- */

.home-hero { padding-block: 88px 56px; }
.home-hero h1 {
  margin: 0; max-width: 18ch;
  font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -.025em;
}
.home-hero .lede { max-width: 44rem; margin: 22px 0 0; }

.feature {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  overflow: hidden; box-shadow: var(--shadow);
}
.feature-media {
  display: block; background: var(--surface-2); border-right: 1px solid var(--rule);
  padding: 20px; align-self: stretch;
}
.feature-media img { display: block; width: 100%; border-radius: 6px; }
.feature-media img + img { margin-top: 12px; }
.feature-body { padding: 36px 36px 32px; display: flex; flex-direction: column; }
.feature-body h2 { margin: 0 0 14px; font-size: 1.6rem; line-height: 1.2; letter-spacing: -.015em; }
.feature-body h2 a { color: var(--ink); text-decoration: none; }
.feature-body h2 a:hover { color: var(--link); }
.feature-body p { margin: 0 0 16px; color: var(--ink-2); }
.feature-body .meta { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: .9rem; }
.read-more { font-weight: 600; text-decoration: none; }
.read-more::after { content: " →"; }

@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; }
  .feature-media { border-right: 0; border-bottom: 1px solid var(--rule); }
  .feature-body { padding: 26px 22px 24px; }
}

.section-head { margin: 80px 0 24px; }
.section-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.01em; }

.principles {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--rule); border: 1px solid var(--rule); border-radius: 12px; overflow: hidden;
}
.principles > div { background: var(--surface); padding: 26px 24px; }
.principles h3 { margin: 0 0 8px; font-size: 1.02rem; }
.principles p { margin: 0; color: var(--ink-2); font-size: .97rem; }
@media (max-width: 860px) { .principles { grid-template-columns: 1fr; } }

.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.post-list li { border-bottom: 1px solid var(--rule); }
.post-list a {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 24px; align-items: baseline;
  padding: 22px 0; color: var(--ink); text-decoration: none;
}
.post-list a:hover .post-title { color: var(--link); }
.post-title { font-weight: 650; font-size: 1.12rem; letter-spacing: -.005em; }
.post-date { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.post-summary { grid-column: 1 / -1; color: var(--ink-2); font-size: .97rem; max-width: 62rem; }
.post-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag {
  font-size: .76rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 2px 9px;
}
@media (max-width: 600px) {
  .post-list a { grid-template-columns: 1fr; }
}

/* ---------- Simple page (About, Architecture index, 404) ---------- */

.page { padding-top: 72px; }
.page-narrow { width: min(var(--measure), 100% - 2 * var(--gutter)); margin-inline: auto; }
.page h1 { margin: 0 0 18px; font-size: clamp(2rem, 4.5vw, 2.8rem); line-height: 1.1; letter-spacing: -.02em; }
.page .prose-simple { font-family: var(--font-serif); font-size: 1.12rem; line-height: 1.72; color: var(--ink); }
.page .prose-simple h2 { font-family: var(--font-sans); font-size: 1.3rem; margin: 2.2em 0 .6em; letter-spacing: -.01em; }
.page .prose-simple ul { padding-left: 1.2em; }
.page .prose-simple li { margin: .35em 0; }

/* ---------- Article ---------- */

.article-header {
  width: min(var(--measure), 100% - 2 * var(--gutter)); margin-inline: auto;
  padding-top: 72px; padding-bottom: 8px;
}
.article-header h1 {
  margin: 0; font-size: clamp(1.95rem, 4.4vw, 2.7rem); line-height: 1.12; letter-spacing: -.022em;
  text-wrap: balance;
}
.article-header .lede { margin: 22px 0 0; }
.byline {
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--rule);
  color: var(--muted); font-size: .92rem;
}
.byline strong { color: var(--ink); font-weight: 600; }
.byline .dot::before { content: "·"; margin-right: 18px; color: var(--rule-strong); }

/* Grid lets figures and tables break out of the reading measure. */
.prose {
  display: grid;
  grid-template-columns:
    [full-start] minmax(var(--gutter), 1fr)
    [wide-start] minmax(0, calc((var(--wide) - var(--measure)) / 2))
    [content-start] min(var(--measure), 100% - 2 * var(--gutter))
    [content-end] minmax(0, calc((var(--wide) - var(--measure)) / 2))
    [wide-end] minmax(var(--gutter), 1fr) [full-end];
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--ink);
  padding-top: 24px;
}
.prose > * { grid-column: content; }
.prose > .wide { grid-column: wide; }

.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 700; }

.prose h2, .prose h3, .prose h4 { font-family: var(--font-sans); color: var(--ink); text-wrap: balance; }
.prose h2 {
  font-size: clamp(1.55rem, 3vw, 1.95rem); line-height: 1.2; letter-spacing: -.018em;
  margin: 2.6em 0 .7em;
}
.prose h3 { font-size: 1.28rem; line-height: 1.3; letter-spacing: -.01em; margin: 2.1em 0 .55em; }
.prose h4 { font-size: 1.05rem; margin: 1.6em 0 .4em; }
.prose h2 + h3 { margin-top: .9em; }

.part-label {
  display: block; margin-bottom: 10px;
  font-size: .78rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
}
.part-label.sls { color: var(--sls); }
.part-label.ecs { color: var(--ecs); }

.prose hr {
  border: 0; height: 1px; background: var(--rule); margin: 3.2em 0 0;
}

/* Table of contents */
.toc {
  font-family: var(--font-sans); font-size: .95rem; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  margin: 8px 0 2.4em; padding: 0;
}
.toc summary {
  cursor: pointer; padding: 14px 20px; font-weight: 650; color: var(--ink);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 1.2rem; }
.toc[open] summary::after { content: "–"; }
.toc ol { margin: 0; padding: 0 20px 18px 40px; columns: 2; column-gap: 32px; }
.toc li { margin: 0 0 6px; break-inside: avoid; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--link); text-decoration: underline; }
@media (max-width: 680px) { .toc ol { columns: 1; } }

/* Figures */
.figure { margin: 1.6em 0 2.2em; font-family: var(--font-sans); }
.figure-frame {
  position: relative; display: block;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 12px;
  padding: clamp(8px, 1.6vw, 18px); box-shadow: var(--shadow);
}
.figure-frame img { display: block; width: 100%; height: auto; border-radius: 4px; }
.figure-frame:hover { border-color: var(--rule-strong); }
.zoom-hint {
  position: absolute; right: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--ink) 82%, transparent); color: var(--bg);
  font-size: .78rem; font-weight: 600; padding: 6px 10px; border-radius: 6px;
  pointer-events: none; opacity: .92;
}
@media (max-width: 600px) {
  .zoom-hint { right: 8px; bottom: 8px; font-size: .68rem; padding: 3px 7px; border-radius: 4px; }
  .flow, pre.code { font-size: .78rem; padding: 16px; }
}
.figure figcaption {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px;
  margin-top: 12px; padding-inline: 4px;
  color: var(--muted); font-size: .9rem; line-height: 1.5;
}
.figure figcaption strong { color: var(--ink); }

/* Request-flow blocks */
.flow {
  font-family: var(--font-mono); font-size: .875rem; line-height: 1.7;
  background: var(--flow-bg); color: var(--flow-ink);
  border: 1px solid var(--flow-border); border-radius: 10px; padding: 20px 22px; margin: 1.3em 0 1.6em;
  overflow-x: auto; white-space: pre; tab-size: 2;
}
.flow .k { color: var(--flow-hl); }
.flow .d { color: var(--flow-dim); }

pre.code {
  font-size: .86rem; line-height: 1.65;
  background: var(--flow-bg); color: var(--flow-ink);
  border: 1px solid var(--flow-border); border-radius: 10px; padding: 18px 20px; margin: 1.3em 0 1.6em; overflow-x: auto;
}
pre.code .c { color: var(--flow-dim); }
pre.code .s { color: #a5d6a7; }
pre.code .kw { color: #8ab4f8; }

/* Step walkthrough */
.steps { list-style: none; padding: 0 !important; counter-reset: step; margin: 1.4em 0 1.8em !important; }
.steps > li {
  counter-increment: step; position: relative;
  padding: 0 0 1.1em 3.1rem; margin: 0 !important;
  border-left: 1px solid var(--rule); margin-left: 1rem !important;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step); position: absolute; left: -1rem; top: .1em;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--rule-strong); color: var(--ink);
  font-family: var(--font-sans); font-size: .85rem; font-weight: 700;
}
.steps > li > strong:first-child { font-family: var(--font-sans); display: block; margin-bottom: .15em; }

/* Notes / asides */
.note {
  font-family: var(--font-sans); font-size: .98rem; line-height: 1.65;
  background: var(--note-bg); border: 1px solid var(--rule); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 16px 20px; margin: 1.6em 0;
  color: var(--ink-2);
}
.note p { margin: 0 0 .6em; }
.note p:last-child { margin-bottom: 0; }
.note-title { display: block; font-weight: 700; color: var(--ink); margin-bottom: 4px; }

/* Component responsibility list */
.components {
  list-style: none; padding: 0 !important; margin: 1.2em 0 1.8em !important;
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.6;
}
.components li {
  display: grid; grid-template-columns: 11.5rem 1fr; gap: 4px 20px;
  padding: 14px 0; margin: 0 !important; border-bottom: 1px solid var(--rule);
}
.components li > strong:first-child { color: var(--ink); }
.components li > span { color: var(--ink-2); }
@media (max-width: 600px) { .components li { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap {
  margin: 1.4em 0 2em; overflow-x: auto;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow);
}
table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-sans); font-size: .95rem; line-height: 1.5;
}
caption {
  caption-side: top; text-align: left; padding: 16px 20px 4px;
  color: var(--muted); font-size: .88rem;
}
th, td { text-align: left; vertical-align: top; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
thead th {
  position: sticky; top: 0;
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--rule-strong);
}
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 650; color: var(--ink); white-space: nowrap; width: 22%; }
td { color: var(--ink-2); }
th.col-sls { color: var(--sls); }
th.col-ecs { color: var(--ecs); }
tbody tr:hover td, tbody tr:hover th { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
@media (max-width: 700px) {
  table { min-width: 620px; }
  th, td { padding: 11px 14px; }
}

/* Trade-off entries */
.tradeoff {
  border-top: 1px solid var(--rule); padding-top: 1.4em; margin-top: 1.8em;
}
.tradeoff h3 { margin-top: 0 !important; }
.shift {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  font-family: var(--font-sans); font-size: .95rem; line-height: 1.55;
  margin: .4em 0 1.1em;
}
.shift > div { border-radius: 8px; padding: 12px 14px; border: 1px solid var(--rule); }
.shift .from { background: var(--sls-tint); }
.shift .to { background: var(--ecs-tint); }
.shift b { display: block; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 4px; }
.shift .from b { color: var(--sls); }
.shift .to b { color: var(--ecs); }
.example {
  font-family: var(--font-sans); font-size: .97rem; line-height: 1.6; color: var(--ink-2);
  border-left: 2px solid var(--rule-strong); padding: 2px 0 2px 16px; margin: 0 0 1em;
}
.example em { font-style: normal; font-weight: 700; color: var(--ink); }
@media (max-width: 600px) { .shift { grid-template-columns: 1fr; } }

/* Traffic growth ladder */
.ladder { list-style: none; padding: 0 !important; margin: 1.6em 0 2em !important; font-family: var(--font-sans); }
.ladder > li {
  display: grid; grid-template-columns: 9.5rem 1fr 1fr; gap: 0;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface);
  margin: 0 0 14px !important; overflow: hidden; box-shadow: var(--shadow);
}
.ladder .rate {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 18px; background: var(--surface-2); border-right: 1px solid var(--rule);
}
.ladder .rate strong { font-size: 1.35rem; letter-spacing: -.02em; line-height: 1.1; color: var(--ink); }
.ladder .rate span { font-size: .8rem; color: var(--muted); }
.ladder .col { padding: 16px 18px; font-size: .94rem; line-height: 1.55; color: var(--ink-2); }
.ladder .col + .col { border-left: 1px solid var(--rule); }
.ladder .col h4 {
  margin: 0 0 6px; font-size: .74rem; letter-spacing: .07em; text-transform: uppercase;
}
.ladder .col.s h4 { color: var(--sls); }
.ladder .col.e h4 { color: var(--ecs); }
.ladder .col ul { margin: 0; padding-left: 1.1em; }
.ladder .col li { margin: 3px 0; }
.ladder > li:not(:last-child) { position: relative; }
@media (max-width: 860px) {
  .ladder > li { grid-template-columns: 1fr; }
  .ladder .rate { flex-direction: row; align-items: baseline; gap: 10px; border-right: 0; border-bottom: 1px solid var(--rule); padding: 12px 18px; }
  .ladder .col + .col { border-left: 0; border-top: 1px solid var(--rule); }
}

/* Formula blocks */
.formula {
  font-family: var(--font-mono); font-size: .9rem; line-height: 1.6;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 10px;
  padding: 16px 20px; margin: .6em 0 1.4em; overflow-x: auto; white-space: pre-wrap;
}
.formula-label { font-family: var(--font-sans); font-size: .78rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin: 1.4em 0 0; }
.formula-label.sls { color: var(--sls); }
.formula-label.ecs { color: var(--ecs); }

/* Conceptual cost chart */
.chart { margin: 1.4em 0 2em; font-family: var(--font-sans); }
.chart-frame { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 18px 18px 10px; box-shadow: var(--shadow); }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis { stroke: var(--rule-strong); }
.chart .grid { stroke: var(--rule); }
.chart .lbl { fill: var(--muted); font-size: 13px; }
.chart .sls-line { stroke: var(--sls); }
.chart .ecs-line { stroke: var(--ecs); }
.chart .sls-fill { fill: var(--sls); }
.chart .ecs-fill { fill: var(--ecs); }
.chart .band { fill: var(--surface-2); }
.chart .ink { fill: var(--ink-2); font-size: 13px; }
.chart figcaption { color: var(--muted); font-size: .9rem; margin-top: 12px; padding-inline: 4px; }

/* Pull quote / conclusion */
.prose blockquote {
  margin: 1.8em 0; padding: 26px 30px;
  border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 10px 10px 0; box-shadow: var(--shadow);
  font-size: 1.28rem; line-height: 1.55; color: var(--ink);
}
.prose blockquote p { margin: 0; }

.article-end {
  font-family: var(--font-sans); font-size: .95rem; color: var(--muted);
  border-top: 1px solid var(--rule); margin-top: 3em; padding-top: 1.4em;
}

/* ---------- Diagram viewer (lightbox) ---------- */

.viewer {
  position: fixed; inset: 0; z-index: 200;
  display: none; flex-direction: column;
  background: var(--bg);
}
.viewer.open { display: flex; }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--rule); background: var(--surface);
  font-size: .92rem;
}
.viewer-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 8px; flex-shrink: 0; }
.viewer button, .viewer a.btn {
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--rule-strong);
  border-radius: 6px; padding: 6px 12px; text-decoration: none;
}
.viewer button:hover, .viewer a.btn:hover { border-color: var(--ink-2); }
.viewer-stage { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 16px; }
.viewer-stage img { display: block; max-width: none; margin: auto; }
@media (max-width: 600px) {
  .viewer-bar { padding: 8px 10px; gap: 8px; }
  .viewer-title { font-size: .85rem; }
  .viewer button, .viewer a.btn { font-size: .8rem; padding: 5px 9px; }
  .viewer-stage { padding: 10px; }
}
.viewer-stage.fit img { width: 100%; max-width: 100%; }

body.no-scroll { overflow: hidden; }

/* ---------- Print ---------- */

@media print {
  .site-header, .site-footer, .toc, .zoom-hint, .viewer { display: none !important; }
  body { background: #fff; color: #000; }
  .prose { display: block; font-size: 11pt; }
  .figure-frame, .table-wrap, .ladder > li { box-shadow: none; }
  a { color: inherit; }
}
