:root {
	--ink: #212529;
	--body: #343a40;
	--muted: #6c757d;
	--line: #dee2e6;
	--paper: #ffffff;
	--accent: #17a673;
	--glow: rgba(39, 220, 148, 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

a { color: inherit; }

.skip-link {
	position: fixed;
	top: 10px;
	left: 10px;
	z-index: 20;
	padding: 8px 12px;
	background: var(--ink);
	color: white;
	transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 28px;
	min-height: 78px;
	padding: 0 max(28px, calc((100vw - 1120px) / 2));
	border-bottom: 1px solid var(--line);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	width: fit-content;
	font-weight: 600;
	text-decoration: none;
}

.brand-mark {
	display: grid;
	place-items: center;
	width: 36px;
	height: 36px;
	background: var(--ink);
	color: white;
	font-size: 12px;
	letter-spacing: -0.04em;
}

.site-header nav { display: flex; gap: 42px; }
.site-header nav a, .home-link { font-size: 15px; text-decoration: none; }
.site-header nav a:hover, .home-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.home-link { justify-self: end; border: 1px solid var(--line); padding: 10px 20px; }

main { border-top: 0; }

article {
	width: min(calc(100% - 40px), 750px);
	margin: 0 auto;
	padding: 54px 0 80px;
}

.article-header { margin-bottom: 28px; }
.article-label { margin: 0 0 20px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }

h1 {
	margin: 0 0 16px;
	font-size: clamp(42px, 5.2vw, 56px);
	font-weight: 700;
	line-height: 1.16;
	letter-spacing: -0.035em;
}

.dek { margin: 0 0 32px; color: var(--muted); font-size: 18px; font-weight: 400; line-height: 1.5; }

.article-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.author { display: flex; align-items: center; gap: 12px; }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: #f1f3f5; font-size: 13px; font-weight: 700; }
.author div, .date { display: flex; flex-direction: column; }
.author strong { font-size: 15px; }
.author span, .date span, .date time { color: var(--muted); font-size: 13px; }
.date { text-align: right; }

article > p,
article > ul,
article > ol,
article > blockquote:not(.tldr) {
	color: var(--body);
	font-size: 17px;
	font-weight: 300;
	line-height: 1.75;
}

article > p { margin: 0 0 24px; }

.tldr,
article > blockquote:not(.tldr) {
	margin: 28px 0 30px;
	padding: 5px 0 5px 20px;
	border-left: 3px solid var(--line);
	font-style: italic;
}

.tldr { color: #495057; font-size: 17px; line-height: 1.75; }

h2 {
	margin: 52px 0 18px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

article > ul { margin: -4px 0 28px; padding-left: 25px; }
article > ul li { margin-bottom: 10px; padding-left: 4px; }

code {
	padding: 0.12em 0.32em;
	border-radius: 4px;
	background: #f1f3f5;
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
	font-size: 0.9em;
}

.readme-sections {
	margin: 4px 0 28px;
	padding: 0;
	list-style: none;
	counter-reset: section;
}

.readme-sections li {
	counter-increment: section;
	margin-bottom: 20px;
}

.readme-sections strong { display: block; color: var(--ink); font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; }
.readme-sections strong::before { content: counter(section) ". "; }
.readme-sections span { display: block; margin-top: 5px; }

.diagram {
	position: relative;
	isolation: isolate;
	width: calc(100% + 110px);
	margin: 44px -55px 48px;
	padding: 30px 24px 18px;
	border: 1px solid rgba(33, 37, 41, 0.08);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.86);
	box-shadow: 0 24px 80px rgba(39, 220, 148, 0.09);
}

.diagram::before {
	content: "";
	position: absolute;
	z-index: -1;
	inset: 8% 10%;
	border-radius: 50%;
	background: radial-gradient(circle, var(--glow) 0%, rgba(39, 220, 148, 0.06) 38%, transparent 72%);
	filter: blur(24px);
}

.diagram svg { display: block; width: 100%; height: auto; overflow: visible; color: var(--ink); }
.diagram .node { fill: rgba(255, 255, 255, 0.88); stroke: currentColor; stroke-width: 2.2; }
.diagram .node-title { fill: currentColor; font-size: 19px; font-weight: 700; text-anchor: middle; }
.diagram .node-note { fill: var(--muted); font-size: 14px; text-anchor: middle; }
.diagram .connector { fill: none; stroke: currentColor; stroke-width: 2.2; }
.diagram .return { fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-dasharray: 6 7; }
.diagram .return-label, .diagram .edge-label { fill: var(--muted); font-size: 13px; }
.diagram .blocked { fill: var(--ink); }
.diagram .blocked-label { fill: white; font-size: 17px; font-weight: 700; text-anchor: middle; }
.diagram .end-label { fill: currentColor; font-size: 14px; font-weight: 700; writing-mode: vertical-rl; }
.diagram figcaption { margin-top: 12px; color: #8a8f94; font-size: 12px; letter-spacing: 0.04em; text-align: center; text-transform: uppercase; }

.readme-visual { display: grid; grid-template-columns: minmax(280px, 430px) 1fr; align-items: end; justify-content: center; gap: 56px; max-width: 680px; margin: 10px auto 20px; }
.readme-card { display: grid; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.88); }
.readme-card > * { padding: 15px 18px; border-bottom: 1px solid #b8bdc2; font-size: 14px; }
.readme-card > *:last-child { border-bottom: 0; }
.readme-card .gotcha { border-top: 2px solid var(--ink); font-weight: 700; }
.readme-callout { position: relative; padding-bottom: 8px; }
.readme-callout::before { content: ""; position: absolute; top: 9px; right: 100%; width: 48px; border-top: 1.5px solid var(--ink); }
.readme-callout strong, .readme-callout span { display: block; }
.readme-callout strong { font-size: 15px; }
.readme-callout span { margin-top: 8px; color: var(--muted); font-size: 13px; }

.diagram-audit .audit-center { fill: none; stroke: #cbd0d4; stroke-width: 1.7; stroke-dasharray: 5 7; }
.diagram-audit .center-label { fill: #8a8f94; font-size: 16px; font-weight: 700; text-anchor: middle; }

.report-table-wrap {
	margin: 30px 0 34px;
	overflow-x: auto;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: #fff;
}

.report-table {
	width: 100%;
	min-width: 650px;
	border-collapse: collapse;
	font-size: 14px;
}

.report-table th,
.report-table td {
	padding: 14px 16px;
	border-bottom: 1px solid var(--line);
	text-align: left;
}

.report-table th {
	background: #f8f9fa;
	color: var(--muted);
	font-size: 11px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.report-table tbody tr:last-child td { border-bottom: 0; }
.report-table td:first-child { font-weight: 550; }
.report-table td:nth-child(2),
.report-table td:nth-child(3) { white-space: nowrap; }

.status-pass {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: #0b7650;
	font-size: 12px;
	font-weight: 750;
	letter-spacing: 0.06em;
}

.status-pass::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 14px rgba(23, 166, 115, 0.55);
}

.trust-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px;
	margin: 4px 0 20px;
}

.trust-grid > div {
	display: flex;
	flex-direction: column;
	min-height: 190px;
	padding: 22px;
	border: 1px solid rgba(33, 37, 41, 0.14);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.8);
}

.trust-grid span {
	margin-bottom: 36px;
	color: var(--accent);
	font-size: 12px;
	font-weight: 750;
	letter-spacing: 0.12em;
}

.trust-grid strong { font-size: 20px; }
.trust-grid p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }

.closing-line { margin-top: 34px !important; font-size: 20px !important; font-weight: 500 !important; color: var(--ink) !important; }

.article-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 62px;
	padding-top: 24px;
	border-top: 1px solid var(--line);
	font-size: 14px;
}

.article-footer p { margin: 0; }
.article-footer a { font-weight: 600; text-underline-offset: 4px; }

@media (max-width: 860px) {
	.site-header { grid-template-columns: 1fr auto; }
	.site-header nav { display: none; }
	.diagram { width: 100%; margin-inline: 0; }
}

@media (max-width: 620px) {
	.site-header { min-height: 66px; padding-inline: 16px; }
	.brand > span:last-child { display: none; }
	.home-link { padding: 8px 13px; }
	article { width: min(calc(100% - 28px), 750px); padding-top: 38px; }
	h1 { font-size: 39px; }
	.article-meta { align-items: flex-start; }
	.author span { display: none; }
	.date { min-width: 100px; }
	.diagram { padding: 20px 8px 14px; overflow-x: auto; }
	.diagram svg { min-width: 620px; }
	.diagram-readme { overflow: visible; padding-inline: 20px; }
	.readme-visual { grid-template-columns: 1fr; gap: 26px; }
	.readme-callout { padding-left: 16px; border-left: 2px solid var(--ink); }
	.readme-callout::before { display: none; }
	.trust-stack { overflow: visible; padding-inline: 16px; }
	.trust-grid { grid-template-columns: 1fr; }
	.trust-grid > div { min-height: 0; }
	.trust-grid span { margin-bottom: 20px; }
	.article-footer { align-items: flex-start; gap: 20px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
