/* Light colors */
:root {
	--desk-color: #eee;
	--page-color: #fff;
	--text-color: #000;
	--ext-link-color: #00f;
	--int-link-color: #808;
	--var-color: #eee;
	--prevar-color: #ccc;
	--code-color: #666;
	--kbd-color: #333;
	--border-color: #000;
}

/* Dark colors */
@media (prefers-color-scheme: dark) {
	:root {
		--desk-color: #222;
		--page-color: #111;
		--text-color: #888;
		--ext-link-color: #448;
		--int-link-color: #844;
		--var-color: #484;
		--code-color: #666;
		--kbd-color: #999;
		--border-color: #888;
	}
	object {
		filter: invert(0.75);
	}
}

/* Smartphone */
@media screen {
	body {
		padding: 1ex;
		background-color: var(--page-color);
		color: var(--text-color);
		line-height: 1.5em;
		font-family: serif;
	}
	nav {
		position: relative;
	}
}

/* Desktop */
@media screen and (min-width: 80em) {
	html {
		background-color: var(--desk-color);
	}
	body {
		margin: 3em auto 6em auto;
		box-shadow: 0 0 20px var(--code-color);
		max-width: 50em;
		padding: 4em;
	}
	header {
		width: 50em;
		position: absolute;
		top: 0;
	}
	nav {
		position: fixed;
		top: 0;
		left: 0;
	}
}

/* Paged Media */
@media print {
	body {
		margin: 0;
		padding: 0;
		font-size: 9pt;
	}
	header, nav {
		visibility: hidden;
	}
}
@page {
	size: A4;
	margin: 4em 4em 8em 6em;
}
@page:left {
	@top-left {
		content: string(doctitle);
		font-style: italic;
	}
	@top-right {
		content: string(sectitle);
		font-style: italic;
	}
	@bottom-left {
		content: counter(page);
	}
}
@page:right {
	@top-right {
		content: string(doctitle);
		font-style: italic;
	}
	@top-left {
		content: string(sectitle);
		font-style: italic;
	}
	@bottom-right {
		content: counter(page);
	}
}

/* Navigation */

header ol {
	margin: 0;
	padding: 0;
	display: flex;
	justify-content: center;
	list-style-type: none;
	font-size: small;
}
header li {
	padding: 1em;
}
nav p {
	padding-left: 1em;
}
nav ol {
	list-style-type: none;
	padding-left: 1em;
}
nav a.current {
	font-weight: bold;
}

/* Headings */

h1 {
	string-set: doctitle content();
}
h2 {
	string-set: sectitle content();
	font-size: 100%;
	margin-top: 2em;
}
h3 {
	font-size: 100%;
	font-weight: normal;
}

/* Text */

:lang(de) q { quotes: "„" "“" "‚" "‘"; }
:lang(en) q { quotes: "“" "”" "‘" "’"; }

a {
	text-decoration: none;
	color: var(--ext-link-color);
}
a:visited {
	text-decoration: none;
	color: var(--ext-link-color);
}
a:hover {
	text-decoration: underline;
}
a[href^="#"] {
	color: var(--int-link-color);
}
a[href^="http:"] {
	text-decoration: underline wavy;
}
a[href^="https:"] {
	text-decoration: underline;
}
var {
	padding: 0 0.5ex;
	background-color: var(--var-color);
	border: 1px solid var(--var-color);
	border-radius: 1em;
}
del {
	text-decoration: line-through;
}
code {
	font-family: serif;
	font-style: italic;
}
dt {
	margin-top: 1em;
}
dt code {
	font-family: "Berkeley Mono", monospace;
	font-style: normal;
}

/* Keyboard */

kbd {
	font-family: "Berkeley Mono", monospace;
	font-size: 1em;
}

p kbd,
dd kbd,
table kbd {
	border: 1px solid var(--code-color);
	border-radius: 4px;
	padding: 1px;
}

/* Examples */

pre {
	padding: 1ex;
	color: var(--code-color);
	background-color: var(--desk-color);
	font-family: "Berkeley Mono", monospace;
	line-height: 1.25;
}
pre div {
	--background-color: var(--prevar-color);
	border-bottom: 1px solid var(--code-color); /* filename */
}
pre var {
	background-color: var(--prevar-color);
}
pre kbd {
	color: var(--kbd-color);
}
pre kbd:before {
	content: "> "; /* generic prompt */
}
.root kbd:before {
	content: "# "; /* superuser prompt */
}
.user kbd:before {
	content: "$ "; /* unpriviledged prompt */
}
.chroot kbd:before {
	content: "% "; /* changeroot prompt */
}
.code dt {
	color: var(--code-color);
	font-family: "Berkeley Mono", monospace;
}

/* Images */

figure {
	text-align: center;
	margin: 1em 0;
}
figcaption {
	margin-bottom: 1em;
	text-align: center;
}

/* Tables */

table {
	border-collapse: collapse;
	empty-cells: show;
	min-width: 100%;
	font-variant-numeric: tabular-nums;
}
caption {
	margin-bottom: 1em;
}
thead {
	border-bottom: 1px solid var(--border-color);
}
th {
	text-align: left;
	font-weight: normal;
	padding-top: 1em;
	border-bottom: 1px dotted var(--border-color);
}
td {
	vertical-align: top;
	padding-right: 1ex;
}

/* Table with visible lines */

.grid thead {
	border: none;
}
.grid thead td {
	text-align: center;
}
.grid tbody td {
	border: 1px solid var(--border-color);
	text-align: center;
	font-family: "Berkeley Mono", monospace;
}

/* Table for APIs */

.class tr {
	line-height: 1.25em;
}
.class td {
	white-space: pre;
}
.class td:first-child {
	white-space: nowrap;
}
.class td:nth-child(1),
.class td:nth-child(2),
.class td:nth-child(3) {
	font-family: "Berkeley Mono", monospace;
	color: var(--code-color);
}
.struct {
	border: 1px solid var(--code-color);
}
.struct th {
	padding-top: 0;
}
.struct th:nth-child(1),
.struct th:nth-child(2),
.struct th:nth-child(3) {
	font-family: "Berkeley Mono", monospace;
	color: var(--code-color);
}

/* Tooltips */

.tooltip {
	min-width: 10em;
	--max-width: 40em;
	position: absolute;
	top: -500px;
	left: 0;
	z-index: 100;
	visibility: hidden;
	border: 1px solid var(--border-color);
	padding: 1ex;
	overflow: hidden;
	background-color: var(--page-color);
	box-shadow: 1ex 1ex 3px rgba(0, 0, 0, 0.3);
}

.tooltip td:first-child {
	font-family: "Berkeley Mono", monospace;
	min-width: 3em;
}

/* LaTeX Logo */

.latex {
	letter-spacing: 1px;
}
.latex sup {
	text-transform: uppercase;
	letter-spacing: 1px;
	font-size: 0.85em;
	vertical-align: 0.15em;
	margin-left: -0.36em;
	margin-right: -0.15em;
}
.latex sub {
	text-transform: uppercase;
	vertical-align: baseline;
	position: relative;
	top: 0.5ex;
	margin-left: -0.1667em;
	margin-right: -0.125em;
	font-size: 1em;
}

/* Feedback */

#feedback {
	margin-top: 3em;
}

#feedback dt {
	border-top: 1px solid var(--border-color);
	font-size: small;
}
#feedback dd {
	margin: 1ex 0 2ex;
}
