/* CAT owner's manual. Plain CSS, no build step. */

:root {
	--bg: #f4f3ef;
	--surface: #ffffff;
	--surface-2: #ecebe6;
	--ink: #1d1f24;
	--ink-2: #4a4d57;
	--ink-3: #6f7380;
	--rule: #d9d7cf;
	--accent: #2f6f8f;
	--accent-ink: #ffffff;
	--accent-soft: #dcebf2;
	--warm: #b8541c;
	--good: #2d7a3e;
	--bad: #b42a2a;
	--note-bg: #e7f0f5;
	--note-rule: #2f6f8f;
	--warn-bg: #fbeee2;
	--warn-rule: #b8541c;
	--tip-bg: #e8f3ea;
	--tip-rule: #2d7a3e;
	--bezel: #2b2d36;
	--bezel-2: #3a3d49;
	--key-bg: #2b2d36;
	--key-ink: #f4f3ef;
	--code-bg: #ecebe6;
	--shadow: 0 1px 2px rgba(20, 22, 28, .06), 0 6px 18px rgba(20, 22, 28, .08);
	--radius: 10px;
	--sidebar: 264px;
	--content: 820px;
	--font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	--pixel: "Silkscreen", var(--mono);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #15171c;
		--surface: #1d2027;
		--surface-2: #252932;
		--ink: #e9e8e3;
		--ink-2: #b9bac1;
		--ink-3: #8d909b;
		--rule: #333743;
		--accent: #7cbad6;
		--accent-ink: #10141a;
		--accent-soft: #1f3440;
		--warm: #e38a55;
		--good: #6cc483;
		--bad: #ee7b7b;
		--note-bg: #1b2a33;
		--note-rule: #7cbad6;
		--warn-bg: #33241a;
		--warn-rule: #e38a55;
		--tip-bg: #1b2d22;
		--tip-rule: #6cc483;
		--bezel: #0c0d11;
		--bezel-2: #2a2d38;
		--key-bg: #e9e8e3;
		--key-ink: #15171c;
		--code-bg: #252932;
		--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #15171c;
	--surface: #1d2027;
	--surface-2: #252932;
	--ink: #e9e8e3;
	--ink-2: #b9bac1;
	--ink-3: #8d909b;
	--rule: #333743;
	--accent: #7cbad6;
	--accent-ink: #10141a;
	--accent-soft: #1f3440;
	--warm: #e38a55;
	--good: #6cc483;
	--bad: #ee7b7b;
	--note-bg: #1b2a33;
	--note-rule: #7cbad6;
	--warn-bg: #33241a;
	--warn-rule: #e38a55;
	--tip-bg: #1b2d22;
	--tip-rule: #6cc483;
	--bezel: #0c0d11;
	--bezel-2: #2a2d38;
	--key-bg: #e9e8e3;
	--key-ink: #15171c;
	--code-bg: #252932;
	--shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
	color-scheme: dark;
}

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

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

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 17px/1.6 var(--font);
	overflow-x: hidden;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

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

/* ------------------------------------------------------------ top bar */

.topbar {
	position: sticky;
	top: 0;
	z-index: 30;
	display: flex;
	align-items: center;
	gap: 12px;
	height: 56px;
	padding: 0 16px;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--rule);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	color: var(--ink);
	text-decoration: none;
	font-family: var(--pixel);
	font-size: 15px;
	letter-spacing: .02em;
	white-space: nowrap;
}

.brand img { width: 30px; height: 30px; display: block; }

.brand small {
	font-family: var(--font);
	color: var(--ink-3);
	font-size: 13px;
	letter-spacing: 0;
}

.topbar .spacer { flex: 1; }

.icon-btn {
	display: inline-grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding: 0 10px;
	border: 1px solid var(--rule);
	border-radius: 8px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink-3); }
.menu-btn { display: none; }

/* ------------------------------------------------------------ layout */

.layout {
	display: grid;
	grid-template-columns: var(--sidebar) minmax(0, 1fr);
	max-width: calc(var(--sidebar) + var(--content) + 120px);
	margin: 0 auto;
}

.sidebar {
	position: sticky;
	top: 56px;
	align-self: start;
	height: calc(100vh - 56px);
	overflow-y: auto;
	padding: 24px 16px 40px;
	border-right: 1px solid var(--rule);
}

.sidebar h2 {
	margin: 20px 8px 6px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-3);
}
.sidebar h2:first-child { margin-top: 0; }

.sidebar ul { list-style: none; margin: 0; padding: 0; }

.sidebar a {
	display: block;
	padding: 6px 10px;
	border-radius: 7px;
	color: var(--ink-2);
	text-decoration: none;
	font-size: 15px;
	line-height: 1.35;
}
.sidebar a:hover { background: var(--surface-2); color: var(--ink); }
.sidebar a[aria-current="page"] {
	background: var(--accent-soft);
	color: var(--ink);
	font-weight: 700;
}

.sidebar .toc { margin: 2px 0 8px 12px; border-left: 2px solid var(--rule); }
.sidebar .toc a { font-size: 13.5px; padding: 3px 10px; color: var(--ink-3); }

main {
	min-width: 0;
	padding: 32px 40px 80px;
}

.content { max-width: var(--content); }

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

h1, h2, h3, h4 { line-height: 1.25; margin: 0; }

h1 {
	font-size: clamp(30px, 4vw, 40px);
	letter-spacing: -.01em;
	margin-bottom: 12px;
}

.lede { font-size: 19px; color: var(--ink-2); margin: 0 0 28px; }

h2 {
	font-size: 26px;
	margin: 56px 0 14px;
	padding-top: 20px;
	border-top: 1px solid var(--rule);
}
h3 { font-size: 20px; margin: 32px 0 10px; }
h4 { font-size: 17px; margin: 24px 0 8px; }

h2 .anchor, h3 .anchor {
	margin-left: 8px;
	color: var(--ink-3);
	text-decoration: none;
	opacity: 0;
	font-weight: 400;
}
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

p, ul, ol { margin: 0 0 14px; }
li { margin: 4px 0; }
li > ul, li > ol { margin: 4px 0 0; }

code {
	font-family: var(--mono);
	font-size: .86em;
	background: var(--code-bg);
	padding: 1px 5px;
	border-radius: 5px;
	overflow-wrap: anywhere;
}

pre {
	background: var(--code-bg);
	padding: 12px 14px;
	border-radius: 8px;
	overflow-x: auto;
	font-size: 14px;
	line-height: 1.5;
}
pre code { background: none; padding: 0; }

.screen-text {
	font-family: var(--mono);
	font-size: .86em;
	letter-spacing: .01em;
	background: var(--surface-2);
	border: 1px solid var(--rule);
	padding: 0 5px;
	border-radius: 4px;
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
	overflow-wrap: anywhere;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }

/* ------------------------------------------------------------ keys */

kbd.k {
	display: inline-block;
	min-width: 1.7em;
	padding: 0 .4em;
	border-radius: 5px;
	background: var(--key-bg);
	color: var(--key-ink);
	font: 700 .78em/1.75 var(--mono);
	text-align: center;
	vertical-align: .08em;
	box-shadow: 0 1px 0 rgba(0, 0, 0, .25);
}
kbd.k.round { border-radius: 999px; min-width: 1.75em; padding: 0; }
kbd.k.pill { border-radius: 999px; padding: 0 .65em; font-size: .7em; letter-spacing: .04em; }
kbd.k.pc {
	background: var(--surface);
	color: var(--ink);
	border: 1px solid var(--rule);
	box-shadow: 0 1px 0 var(--rule);
	font-weight: 500;
}

/* ------------------------------------------------------------ callouts */

.callout {
	margin: 18px 0;
	padding: 12px 16px;
	border-left: 4px solid var(--note-rule);
	background: var(--note-bg);
	border-radius: 0 8px 8px 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 2px; }
.callout.warn { border-color: var(--warn-rule); background: var(--warn-bg); }
.callout.tip { border-color: var(--tip-rule); background: var(--tip-bg); }

/* ------------------------------------------------------------ screenshots */

.shot { margin: 22px 0; }

.device {
	display: block;
	width: 100%;
	max-width: 520px;
	padding: 12px;
	border: 0;
	border-radius: 16px;
	background: linear-gradient(160deg, var(--bezel-2), var(--bezel) 55%);
	box-shadow: var(--shadow);
	cursor: zoom-in;
}
.device img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	border-radius: 4px;
	background: #000;
}

.shot figcaption {
	max-width: 520px;
	margin-top: 8px;
	color: var(--ink-3);
	font-size: 14.5px;
	line-height: 1.45;
}

.shots {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 18px 20px;
	margin: 22px 0;
}
.shots .shot { margin: 0; }
.shots .device { padding: 9px; border-radius: 12px; }

.shots.two { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 28px;
	align-items: start;
	margin: 22px 0;
}
.split .shot { margin: 0; }

/* ------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; margin: 16px 0 20px; }

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15.5px;
	line-height: 1.45;
}
th, td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--rule);
	text-align: left;
	vertical-align: top;
}
th {
	font-size: 13px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ink-3);
	border-bottom-width: 2px;
}
td.nowrap, th.nowrap { white-space: nowrap; }
td:first-child .screen-text { white-space: nowrap; overflow-wrap: normal; }
img.mark { display: block; width: 260px; max-width: 100%; border-radius: 4px; image-rendering: pixelated; }

/* ------------------------------------------------------------ status lists */

dl.status { margin: 16px 0 22px; border-top: 1px solid var(--rule); }
dl.status dt { margin: 0; padding: 12px 0 4px; }
dl.status dd { margin: 0; padding: 0 0 12px; border-bottom: 1px solid var(--rule); color: var(--ink); }
dl.status dt .screen-text { white-space: normal; }

/* ------------------------------------------------------------ cards */

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 14px;
	margin: 22px 0;
}

.card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--ink);
	text-decoration: none;
	transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card b { font-size: 17px; }
.card span { color: var(--ink-2); font-size: 14.5px; line-height: 1.45; }
.card img {
	width: 100%;
	aspect-ratio: 4 / 3;
	border-radius: 6px;
	margin-bottom: 6px;
	background: var(--bezel);
}

.hero {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
	gap: 32px;
	align-items: center;
	margin-bottom: 12px;
}
.hero .shot { margin: 0; }

.tag {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--ink-2);
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: .03em;
	vertical-align: .12em;
}
.tag.hw { background: var(--warn-bg); color: var(--warm); }
.tag.sim { background: var(--accent-soft); color: var(--accent); }

details {
	margin: 14px 0;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--surface);
}
details > summary {
	padding: 12px 16px;
	cursor: pointer;
	font-weight: 700;
}
details[open] > summary { border-bottom: 1px solid var(--rule); }
details > .body { padding: 6px 16px 10px; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li {
	position: relative;
	padding-left: 40px;
	margin: 10px 0;
}
.steps > li::before {
	counter-increment: step;
	content: counter(step);
	position: absolute;
	left: 0;
	top: 1px;
	display: grid;
	place-items: center;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--accent);
	color: var(--accent-ink);
	font-size: 13.5px;
	font-weight: 700;
}

.tree {
	font-family: var(--mono);
	font-size: 14px;
	line-height: 1.6;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	padding: 14px 18px;
	overflow-x: auto;
	white-space: pre;
}

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

.pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px;
	margin-top: 64px;
}
.pager a {
	padding: 14px 16px;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--surface);
	text-decoration: none;
	color: var(--ink);
}
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--ink-3); font-size: 13px; }
.pager .next { text-align: right; grid-column: 2; }

footer.site {
	margin-top: 40px;
	padding-top: 18px;
	border-top: 1px solid var(--rule);
	color: var(--ink-3);
	font-size: 14px;
}

/* ------------------------------------------------------------ lightbox */

.lightbox {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: none;
	place-items: center;
	padding: 16px;
	background: rgba(8, 9, 12, .86);
	cursor: zoom-out;
}
.lightbox.open { display: grid; }
.lightbox figure { margin: 0; max-width: min(1280px, 100%); }
.lightbox img {
	display: block;
	width: min(1280px, 100%);
	max-height: calc(100vh - 110px);
	object-fit: contain;
	image-rendering: pixelated;
	border-radius: 6px;
}
.lightbox figcaption { color: #d8d8d8; margin-top: 10px; font-size: 15px; text-align: center; }

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

@media (max-width: 960px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
	.menu-btn { display: inline-grid; }
	.sidebar {
		position: fixed;
		z-index: 40;
		top: 56px;
		left: 0;
		width: min(320px, 86vw);
		height: calc(100vh - 56px);
		background: var(--bg);
		border-right: 1px solid var(--rule);
		transform: translateX(-102%);
		transition: transform .2s ease;
		box-shadow: var(--shadow);
	}
	body.nav-open .sidebar { transform: none; }
	main { padding: 24px 16px 64px; }
	.hero, .split { grid-template-columns: minmax(0, 1fr); }
	.brand small { display: none; }
}

@media (max-width: 520px) {
	body { font-size: 16px; }
	h2 { font-size: 23px; }
	.pager { grid-template-columns: minmax(0, 1fr); }
	.pager .next { grid-column: 1; }
	.device { padding: 8px; border-radius: 12px; }
	.shots { grid-template-columns: minmax(0, 1fr); }
}

@media print {
	.topbar, .sidebar, .pager, .lightbox { display: none !important; }
	.layout { display: block; }
	main { padding: 0; }
	.device { box-shadow: none; cursor: default; }
	h2 { break-after: avoid; }
	.shot { break-inside: avoid; }
}
