/* The palette, type and stepped corners every page shares: the homepage and the blog
   (site.css), the docs and package pages (docs/docs.css), and the API reference, whose
   tool puts this file at the top of the style.css it writes (tools/doc/cairn-doc.ts). */
/* Digits in the pixel font come from the system monospace: Pixelify's are hard to read at label
   sizes. These faces join the Pixelify Sans family (fonts.css, linked before this file) for 0-9
   only; declared later, they win for those. A separate digits-only family first in the stack
   breaks WebKit, which then measures every character of the run too narrow. */
@font-face { font-family: "Pixelify Sans"; font-weight: 100 500; size-adjust: 92%; unicode-range: U+30-39;
	src: local("SF Mono"), local("SFMono-Regular"), local("Menlo"), local("Menlo-Regular"), local("Consolas"), local("DejaVu Sans Mono"); }
@font-face { font-family: "Pixelify Sans"; font-weight: 600 900; size-adjust: 92%; unicode-range: U+30-39;
	src: local("SF Mono Semibold"), local("SFMono-Semibold"), local("Menlo Bold"), local("Menlo-Bold"), local("Consolas Bold"), local("DejaVu Sans Mono Bold"); }

:root {
	--bg: #161937;
	--fg: #e6e2f6;
	--muted: #a29fca;
	--rule: #2d3062;
	--ink: #0c0e26;
	--panel: #1d2047;
	--shadow: #0c0e26;
	--chip: #2a2d5e;
	--accent: #9cc8e8;
	--gold: #f2c46a;
	--px: 4px;
	--pixel: "Pixelify Sans", ui-monospace, monospace;
	--mono: ui-monospace, "SF Mono", Menlo, monospace;
	color-scheme: dark;
}

/* Stepped corners: the shape every panel, stone and frame shares. */
.px {
	--s: var(--px);
	clip-path: polygon(
		0 calc(var(--s) * 2), var(--s) calc(var(--s) * 2), var(--s) var(--s), calc(var(--s) * 2) var(--s), calc(var(--s) * 2) 0,
		calc(100% - var(--s) * 2) 0, calc(100% - var(--s) * 2) var(--s), calc(100% - var(--s)) var(--s), calc(100% - var(--s)) calc(var(--s) * 2), 100% calc(var(--s) * 2),
		100% calc(100% - var(--s) * 2), calc(100% - var(--s)) calc(100% - var(--s) * 2), calc(100% - var(--s)) calc(100% - var(--s)), calc(100% - var(--s) * 2) calc(100% - var(--s)), calc(100% - var(--s) * 2) 100%,
		calc(var(--s) * 2) 100%, calc(var(--s) * 2) calc(100% - var(--s)), var(--s) calc(100% - var(--s)), var(--s) calc(100% - var(--s) * 2), 0 calc(100% - var(--s) * 2)
	);
}

/* Cairn's map (tools/map) and API reference (tools/doc): Pixelify Sans for headings and labels, a
   serif for prose, stepped corners on panels and frames. The palette and the corners are the
   site's (site/public/tokens.css), which the tools put at the top of the style.css they write.
   Each kind of evidence has one colour, used wherever it appears; a gap is the same chip, dashed
   and empty. */
:root {
	/* The ladder, strongest first. */
	--proved: #9cc8e8;
	--fuzzed: #82b896;
	--tested: #6f8fc0;
	--seen: #8a84c4;
	--assumed: #f2c46a;
	--broken: #ec7a62;
	--untested: #5a5a96;
	--retired: #3a3d70;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font: 17px/1.6 ui-serif, "New York", Georgia, serif;
	-webkit-font-smoothing: antialiased;
	overflow-x: clip;
}
a { color: var(--accent); text-underline-offset: 3px; }
code { font: 0.84em var(--mono); background: var(--chip); padding: 1px 5px; border-radius: 2px; overflow-wrap: anywhere; }
h1, h2, h3, .pix, nav, .m, .hl, .tile, th, .eyebrow { font-variant-ligatures: none; } /* Pixelify draws "fi" as a broken glyph */
p { margin: 0 0 12px; }

/* The bar: the site, the map, its pages. */
.bar { max-width: 1120px; margin: 0 auto; padding: 20px 16px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font: 15px/1.3 var(--pixel); }
.bar .home { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; }
.bar .home img { width: 22px; height: 22px; image-rendering: pixelated; }
.bar a { color: var(--muted); text-decoration: none; }
.bar a:hover, .bar a.on { color: var(--fg); }
.bar a.on { box-shadow: inset 0 -3px 0 var(--gold); }
.bar .sep { color: var(--rule); }

main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 72px; }
header.page { margin: 40px 0 28px; max-width: 760px; }
.eyebrow { font: 600 14px/1.3 var(--pixel); color: var(--gold); letter-spacing: 0.04em; margin-bottom: 8px; }
h1 { font: 700 48px/1.05 var(--pixel); margin: 0 0 14px; color: #f3efff; letter-spacing: 0.02em; text-shadow: 3px 3px 0 #2b2d6a; }
.lede { font-size: 20px; line-height: 1.5; }
h2 { font: 600 22px/1.2 var(--pixel); margin: 56px 0 16px; display: flex; align-items: center; gap: 12px; position: relative; }
h2::before { content: ""; width: 20px; height: 20px; flex: none; background: url("icon.svg") center / contain no-repeat; image-rendering: pixelated; }
h2 .n { color: var(--muted); font-weight: 400; }
h2 canvas.sprig { position: absolute; right: 0; bottom: 0; width: 138px; height: 42px; image-rendering: pixelated; pointer-events: none; }
h3 { font: 600 19px/1.3 var(--pixel); margin: 0; }
.muted { color: var(--muted); }
.prose { max-width: 760px; }

/* Evidence chips. A pass is filled with its colour; a gap is dashed and empty; a failure is red. */
.m {
	display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
	font: 600 13px/1 var(--pixel); letter-spacing: 0.03em;
	padding: 4px 7px 5px; color: var(--ink); background: var(--c, var(--chip));
}
.m.gap { background: none; color: var(--muted); box-shadow: inset 0 0 0 2px var(--rule); background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--rule) 55%, transparent) 5px 7px); font-weight: 400; }
.m.fail { --c: var(--broken); }
.m.proved { --c: var(--proved); } .m.fuzzed { --c: var(--fuzzed); } .m.tested { --c: var(--tested); } .m.seen { --c: var(--seen); } .m.assumed { --c: var(--assumed); }
.m.fail { background: var(--broken); }
.marks { display: flex; flex-wrap: wrap; gap: 6px; }

/* The headline: the strongest rung a claim holds. */
.hl { display: inline-flex; align-items: center; gap: 7px; font: 600 14px/1 var(--pixel); color: var(--fg); white-space: nowrap; }
.hl::before { content: ""; width: 12px; height: 12px; background: var(--c); flex: none; }
.hl.proved { --c: var(--proved); } .hl.fuzzed { --c: var(--fuzzed); } .hl.tested { --c: var(--tested); } .hl.seen { --c: var(--seen); }
.hl.assumed { --c: var(--assumed); } .hl.broken { --c: var(--broken); color: var(--broken); } .hl.untested { --c: none; } .hl.untested::before { box-shadow: inset 0 0 0 2px var(--muted); }
.hl.retired { --c: var(--retired); color: var(--muted); }

/* The summary at the top of the map. */
.summary { margin: 0 0 8px; filter: drop-shadow(var(--px) var(--px) 0 var(--ink)); }
.summary .card { background: var(--panel); padding: 22px 24px 20px; box-shadow: inset 0 0 0 var(--px) var(--chip); }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.tile { border-top: 6px solid var(--c); padding-top: 10px; }
.tile.proved { --c: var(--proved); } .tile.fuzzed { --c: var(--fuzzed); } .tile.tested { --c: var(--tested); } .tile.seen { --c: var(--seen); } .tile.assumed { --c: var(--assumed); }
.tile .k { font: 600 15px/1.2 var(--pixel); }
.tile .v { font: 700 30px/1.15 var(--pixel); }
.tile .v small { font-size: 16px; color: var(--muted); font-weight: 400; }
.tile .v .bad { color: var(--broken); font-size: 16px; }
.tile .d { font-size: 14px; color: var(--muted); line-height: 1.35; margin-top: 4px; }
.spread { display: flex; height: 14px; margin: 22px 0 8px; gap: 2px; }
.spread i { flex: var(--n) 1 0; background: var(--c); }
.spread i.untested { background: none; box-shadow: inset 0 0 0 2px var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; }
.legend .hl { font-size: 13px; }
.legend b { font: 600 14px var(--pixel); margin-left: -2px; }
.inputs { font-size: 14.5px; color: var(--muted); margin: 14px 0 0; }

/* Tables: gaps, the claims index, the evidence page. */
.wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15.5px; }
th { font: 600 13px var(--pixel); color: var(--muted); text-align: left; letter-spacing: 0.04em; padding: 0 12px 6px 0; white-space: nowrap; vertical-align: bottom; }
td { padding: 9px 12px 9px 0; border-top: 2px solid var(--rule); vertical-align: top; }
td.id, .id { font: 600 15px var(--pixel); color: var(--gold); white-space: nowrap; text-decoration: none; }
td.kind { font: 14px var(--pixel); color: var(--muted); }
td.slot { text-align: left; }
td.slot .m { font-size: 12px; }
tr.retired td { opacity: 0.55; }
tr.group td { border-top: 0; padding-top: 22px; font: 600 15px var(--pixel); color: var(--muted); }
.thm div { white-space: nowrap; font-size: 14px; }
.ok { color: var(--fuzzed); } .bad { color: var(--broken); }
.gaps td.what { white-space: nowrap; }
.gaps tr.broken td.what .m { background: var(--broken); color: var(--ink); box-shadow: none; }
.none { color: var(--muted); font-style: italic; }

/* A claim on a page. */
.claim { margin: 0 0 22px; padding: 20px 22px; background: var(--panel); box-shadow: inset 0 0 0 var(--px) var(--chip); scroll-margin-top: 16px; }
.claim:target { box-shadow: inset 0 0 0 var(--px) var(--gold); }
.claim .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.claim .head .id { font-size: 19px; }
.claim .head .hl { margin-left: auto; }
.claim .body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 20px 28px; }
.claim .body.wide { grid-template-columns: minmax(0, 1fr); }
.claim .said b { font: 600 13px var(--pixel); color: var(--muted); letter-spacing: 0.04em; display: block; }
.claim .said p { margin-bottom: 10px; }
.claim .retired-why { color: var(--muted); }
dl.ev { margin: 6px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: start; font-size: 15px; line-height: 1.45; }
dl.ev dt { margin: 0; }
dl.ev dd { margin: 0; color: var(--muted); }
.claim details { margin-top: 10px; font-size: 14.5px; }
.claim summary { cursor: pointer; font: 14px var(--pixel); color: var(--muted); }
.claim .src { font-size: 14px; margin-top: 10px; }
.finding { color: var(--broken); font-size: 15px; }
.finding.soft { color: var(--gold); }

/* Screenshots, framed like the site's videos: an ink box with stepped corners. */
.shot { margin: 0; }
.shot .box { background: var(--ink); padding: var(--px); display: inline-block; max-width: 100%; }
.shot img { display: block; max-width: 100%; height: auto; }
.shot figcaption { font: 13px/1.3 var(--pixel); color: var(--muted); margin-top: 6px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.pair .shot { min-width: 0; }
.pair .shot .box { display: block; }
.hero { margin: 0 0 8px; }
.hero .box { max-width: min(100%, 640px); }

/* A flow's filmstrip: each frame of its witness, left to right, scrolling when it runs long. */
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin-top: 14px; }
.strip .shot { flex: 0 0 min(300px, 72vw); }
.strip .shot .box { display: block; }
.strip .arrow { align-self: center; font: 600 18px var(--pixel); color: var(--muted); flex: none; }
ol.witness { margin: 4px 0 10px; padding-left: 22px; font-size: 15.5px; }
ol.witness li::marker { font: 13px var(--pixel); color: var(--muted); }

/* The ladder on the evidence page. */
ol.ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 820px; }
ol.ladder li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: baseline; }

footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 48px; font: 14px/1.4 var(--pixel); color: var(--muted); }

@media (max-width: 760px) {
	:root { --px: 3px; }
	h1 { font-size: 36px; }
	.lede { font-size: 18px; }
	.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.claim { padding: 16px; }
	.claim .body { grid-template-columns: minmax(0, 1fr); }
	.claim .head .hl { margin-left: 0; }
	h2 canvas.sprig { width: 92px; height: 28px; }
	table.claims thead { display: none; }
	table.claims tr { display: block; border-top: 2px solid var(--rule); padding: 8px 0; }
	table.claims td { display: inline-block; border: 0; padding: 2px 8px 2px 0; }
	table.claims td.slot:empty { display: none; }
}

/* A move's before and after sit under its text, at about their own size. */
.claim > .pair { margin-top: 16px; max-width: 1000px; }
.claim > .shot { margin-top: 16px; }
