/* Visual language: a printed technical reference for a terminal program.
   Structure comes from hairline rules, alignment, and small-caps monospace
   labels. The captures are the only decorated objects on the page, so nothing
   else gets a gradient, a pill, or a shadow that competes with them. */

:root {
	--bg: #0a0d10;
	--panel: #0e1317;
	--panel2: #12181d;
	--panel3: #161e25;
	--rule: #1b232b;
	--rule2: #2a3540;
	--text: #e9eef3;
	--muted: #b5c0ca;
	--dim: #a2aeba;
	--faint: #8996a3;
	--cyan: #3ec9f5;
	--green: #63d69f;
	--amber: #f0bd63;
	--red: #ff8087;
	--violet: #b39bff;
	--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	--sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--head-h: 104px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--head-h) + 12px); }
body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
kbd { border: 1px solid var(--rule2); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; color: var(--text); }
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; }
p { margin: 0; }
ol, ul { margin: 0; padding-left: 20px; }

.wrap { width: min(1560px, calc(100% - 56px)); margin-inline: auto; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--panel2); padding: 10px 16px; }
.skip:focus { left: 0; }

/* Small-caps monospace label: the one recurring ornament on the page. */
.eyebrow, .grouphead, .stat span, table.grid th, .tag, .wiring b, .stepnum {
	font-family: var(--mono);
	font-size: 10.5px;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: var(--faint);
}

/* ------------------------------------------------------------ masthead */

header.masthead {
	position: sticky; top: 0; z-index: 40;
	background: rgba(10, 13, 16, 0.94);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--rule);
}
.masthead-inner { display: flex; align-items: baseline; gap: 20px; padding: 14px 0 0; flex-wrap: wrap; }
.masthead h1 { font-size: 17px; letter-spacing: -0.2px; }
.masthead h1 span { color: var(--faint); font-weight: 400; }
.masthead .sub { color: var(--dim); font-size: 12.5px; flex: 1 1 320px; }
.masthead .tools { display: flex; align-items: center; gap: 10px; }

button.ghost {
	font: inherit; font-size: 12px;
	background: none; color: var(--muted);
	border: 1px solid var(--rule2); border-radius: 3px;
	padding: 4px 9px; cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: var(--cyan); }

nav.sections { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; padding: 10px 0 9px; }
nav.sections::-webkit-scrollbar { display: none; }
nav.sections a {
	font-family: var(--mono); font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
	color: var(--faint); white-space: nowrap; padding-bottom: 2px; border-bottom: 1px solid transparent;
}
nav.sections a:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--rule2); }
nav.sections a.on { color: var(--cyan); border-bottom-color: var(--cyan); }

/* ------------------------------------------------------------ sections */

section { padding: 34px 0 8px; }
section + section { border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.section-head h2 { font-size: 20px; }
.section-head p { color: var(--dim); font-size: 13px; flex: 1 1 420px; }

.lede { font-size: 15.5px; color: var(--text); max-width: 78ch; }
.intro-body { display: grid; gap: 10px; margin-top: 12px; max-width: 92ch; }
.intro-body p { color: var(--muted); font-size: 13.5px; }
.note { color: var(--faint); font-size: 12px; border-left: 2px solid var(--rule2); padding-left: 10px; }

/* ------------------------------------------------------------ capture */

.captur { display: grid; grid-template-columns: minmax(0, 1fr) 388px; gap: 20px; align-items: start; }
.tabnav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule); }
.tabnav::-webkit-scrollbar { display: none; }
.tabnav button {
	font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.6px;
	background: none; border: 0; border-bottom: 2px solid transparent;
	color: var(--faint); padding: 8px 0 7px; cursor: pointer; white-space: nowrap;
}
.tabnav button:hover { color: var(--text); }
.tabnav button.on { color: var(--cyan); border-bottom-color: var(--cyan); }

.shotview {
	overflow: auto;
	max-height: calc(100vh - var(--head-h) - 190px);
	margin-top: 12px;
	border: 1px solid var(--rule2); background: #05070a;
	scrollbar-width: thin; scrollbar-color: var(--rule2) transparent;
}
.shotframe { position: relative; width: 100%; }
.shotframe img { display: block; width: 100%; height: auto; }
.caption { color: var(--faint); font-size: 12px; margin-top: 8px; }
.pan-hint { display: none; color: var(--faint); font-size: 12px; margin-top: 6px; font-family: var(--mono); }

.hotspot {
	position: absolute; border: 0; padding: 0; margin: 0; background: transparent;
	cursor: pointer; border-radius: 2px; transition: background 0.1s, box-shadow 0.1s;
}
.hotspot:hover { background: rgba(62, 201, 245, 0.14); box-shadow: inset 0 0 0 1px rgba(62, 201, 245, 0.4); }
.hotspot.on { background: rgba(62, 201, 245, 0.16); box-shadow: inset 0 0 0 1px rgba(62, 201, 245, 0.85), 0 0 22px rgba(62, 201, 245, 0.26); }
.hotspot.nav:hover { background: rgba(179, 155, 255, 0.16); box-shadow: inset 0 0 0 1px rgba(179, 155, 255, 0.5); }
.hotspot.self { cursor: default; }
.hotspot.self:hover { background: transparent; box-shadow: none; }

/* ------------------------------------------------------------ inspector */

.inspector { border: 1px solid var(--rule2); background: var(--panel); position: sticky; top: calc(var(--head-h) + 12px); }
.insp-head { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.insp-head .kind { font-family: var(--mono); font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--violet); }
.insp-head .name { font-family: var(--mono); font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }
.insp-body { padding: 12px 14px 16px; display: grid; gap: 12px; }
.insp-body p { font-size: 13px; color: var(--muted); }
.insp-body .guide { font-size: 12.5px; color: var(--dim); border-left: 2px solid var(--rule2); padding-left: 10px; }
.insp-empty { padding: 20px 14px; color: var(--faint); font-size: 13px; }

.wiring { display: grid; gap: 6px; }
.wiring div { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wiring code { font-size: 11.5px; color: var(--text); overflow-wrap: anywhere; }
.wiring .none { color: var(--faint); font-family: var(--mono); font-size: 11.5px; }
button.copy {
	font: inherit; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase;
	background: none; color: var(--faint); border: 1px solid var(--rule2); border-radius: 3px;
	padding: 2px 6px; cursor: pointer;
}
button.copy:hover { color: var(--cyan); border-color: var(--cyan); }

.chainlist { display: grid; gap: 4px; }
.chainlist div { font-family: var(--mono); font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.chainlist span.pos { color: var(--faint); }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.taglist button, .taglist a {
	font-family: var(--mono); font-size: 11px;
	border: 1px solid var(--rule2); border-radius: 3px; background: none;
	color: var(--muted); padding: 2px 7px; cursor: pointer;
}
.taglist button:hover, .taglist a:hover { color: var(--cyan); border-color: var(--cyan); text-decoration: none; }
.taglist button.on { color: var(--cyan); border-color: var(--cyan); }

/* ------------------------------------------------------------ grids */

.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(390px, 100%), 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.role-card { border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); padding: 16px 18px 18px; display: grid; gap: 10px; align-content: start; }
.role-card:target { background: var(--panel); }
.role-card .rc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.role-card .rc-head h3 { font-family: var(--mono); font-size: 14px; letter-spacing: 0.6px; }
.role-card .rc-head .model { font-family: var(--mono); font-size: 11.5px; color: var(--cyan); overflow-wrap: anywhere; }
.role-card .rc-head .think { font-family: var(--mono); font-size: 11px; color: var(--amber); }
.role-card p { font-size: 13px; color: var(--muted); }
.role-card .guide { font-size: 12.5px; color: var(--dim); border-left: 2px solid var(--rule2); padding-left: 10px; }

.pipe { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.stage { border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); padding: 14px 16px 16px; display: grid; gap: 8px; align-content: start; }
.stage .stepnum { color: var(--cyan); }
.stage h3 { font-size: 14px; }
.stage p { font-size: 12.5px; color: var(--muted); }
.stage .src { font-family: var(--mono); font-size: 10.5px; color: var(--faint); }

.flows { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr)); border-top: 1px solid var(--rule); }
.flow { border-bottom: 1px solid var(--rule); border-right: 1px solid var(--rule); padding: 16px 18px 18px; display: grid; gap: 10px; align-content: start; }
.flow h3 { font-size: 15px; }
.flow .sum { font-size: 13px; color: var(--muted); }
.flow ol { display: grid; gap: 5px; }
.flow ol li { font-size: 12.5px; color: var(--dim); }
.flow .keys { display: grid; gap: 4px; }
.flow .keys div { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 10px; font-size: 12.5px; color: var(--dim); }
.flow .keys code { color: var(--text); }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule2); }
table.grid td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); color: var(--muted); vertical-align: top; }
table.grid td.k { font-family: var(--mono); font-size: 12px; color: var(--text); white-space: nowrap; }
table.grid td.k.wrap { white-space: normal; overflow-wrap: anywhere; }
table.grid td .mono { font-family: var(--mono); font-size: 12px; color: var(--cyan); }
table.grid tr:hover td { background: var(--panel); }
.tablewrap { overflow-x: auto; }

.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 28px; }
.stats { display: flex; gap: 26px; flex-wrap: wrap; margin: 4px 0 14px; }
.stat { display: grid; }
.stat b { font-family: var(--mono); font-size: 17px; color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------ search */

.searchbar { display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule2); background: var(--panel2); padding: 5px 9px; border-radius: 3px; }
.searchbar input { font: inherit; font-family: var(--mono); font-size: 12px; background: none; border: 0; color: var(--text); outline: none; width: 190px; }
.searchbar input::placeholder { color: var(--faint); }
.searchbar .hintkey { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.results { position: absolute; z-index: 50; margin-top: 6px; right: 0; width: min(560px, 92vw); max-height: 60vh; overflow: auto; background: var(--panel2); border: 1px solid var(--rule2); display: none; }
.results.on { display: block; }
.results button {
	display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; width: 100%; text-align: left;
	font: inherit; font-size: 12.5px; background: none; border: 0; border-bottom: 1px solid var(--rule); color: var(--muted);
	padding: 8px 12px; cursor: pointer;
}
.results button:hover, .results button.cursor { background: var(--panel3); color: var(--text); }
.results button .rk { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--violet); }
.results button .rt { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.results .empty { padding: 12px; color: var(--faint); font-size: 12.5px; }
.searchhost { position: relative; }

/* ------------------------------------------------------------ footer */

footer { border-top: 1px solid var(--rule); margin-top: 26px; padding: 22px 0 40px; }
.colophon { display: grid; gap: 8px; font-size: 12px; color: var(--faint); }
.colophon code { color: var(--dim); }

#toast {
	position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(12px);
	background: var(--panel3); border: 1px solid var(--rule2); color: var(--text);
	font-family: var(--mono); font-size: 12px; padding: 7px 14px; border-radius: 3px;
	opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1180px) {
	.captur { grid-template-columns: minmax(0, 1fr); }
	.inspector { position: static; }
	.pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.shotview { max-height: none; }
}
@media (max-width: 720px) {
	.wrap { width: calc(100% - 28px); }
	.pipe, .roles-grid, .flows { grid-template-columns: minmax(0, 1fr); }
	.masthead .sub { display: none; }
	.searchbar input { width: 110px; }
	/* A 132-column terminal shrunk to phone width is unreadable, so the
	   capture keeps a legible size and the pane pans instead. Hotspots are
	   positioned in percentages, so they travel with it. */
	.shotframe { width: 900px; }
	.shotview { overscroll-behavior-x: contain; }
	.pan-hint { display: block; }
}
