/*
 * Copyright (c) 2026 Dick Olsson <hi@senzilla.io>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

:root {
	color-scheme: light dark;
	--bg: #bfbfbf;
	--fg: #000000;
	--muted: #444444;
	--link: #0000ee;
	--visited: #551a8b;
	--shadow: #6f6f6f;
	--highlight: #ffffff;
	--term-bg: var(--fg);
	--term-fg: var(--bg);
	--serif: "Times New Roman", Times, serif;
	--mono: Courier, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #26292c;
		--fg: #e8e8e8;
		--muted: #a0a0aa;
		--link: #8ab4f8;
		--visited: #c58af9;
		--shadow: #0e0f10;
		--highlight: #4a4f54;
		--term-bg: #1a1c1e;
		--term-fg: #c8c8c8;
	}
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	background: var(--bg);
	color: var(--fg);
	font-family: var(--serif);
	font-size: 17px;
	line-height: 1.55;
	margin: 1.75em 1.5em;
	max-width: 42em;
}

hr {
	border: 0;
	border-top: 1px solid var(--shadow);
	border-bottom: 1px solid var(--highlight);
	margin: 1.25em 0;
}

a:link,
a:visited {
	color: var(--link);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

a:visited {
	color: var(--visited);
}

/* The chrome carries no class, so the selector names the element */

body > header {
	font-size: 2em;
	font-weight: bold;
	letter-spacing: 0.05em;
	margin: 0 0 0.2em 0;
}

body > header a:link,
body > header a:visited {
	color: var(--fg);
	text-decoration: none;
}

nav {
	font-size: 0.95em;
}

h1, h2, h3, h4 {
	font-family: var(--serif);
	font-weight: bold;
	line-height: 1.2;
	margin: 1.5em 0 0.6em 0;
}

h1 {
	font-size: 1.75em;
}

/* The rule of a 1994 hr: a dark line over a light line */

h2 {
	border-top: 1px solid var(--shadow);
	box-shadow: inset 0 1px var(--highlight);
	font-size: 1.35em;
	padding-top: 0.6em;
}

h3 { font-size: 1.1em; }
h4 { font-size: 1em; }

p, li, dd, dt {
	margin-top: 0.5em;
	margin-bottom: 0.5em;
}

dt { font-weight: bold; }
dd { margin-left: 2em; }

table { border-collapse: collapse; }

code, pre, tt, kbd, samp, var {
	font-family: var(--mono);
	font-size: 0.92em;
}

/* A 1994 X11 terminal in a sunken Motif well */

pre {
	background: var(--term-bg);
	border: 2px solid;
	border-color: var(--shadow) var(--highlight) var(--highlight) var(--shadow);
	color: var(--term-fg);
	line-height: 1.4;
	overflow-x: auto;
	padding: 0.7em 0.9em;
}

pre code {
	font-size: 1em;
}

footer {
	color: var(--muted);
	font-size: 0.9em;
	font-style: italic;
}


/* Manual pages: mandoc(1) emits its own class names. */

table.head,
table.foot {
	font-size: 0.85em;
	width: 100%;
	color: var(--muted);
}

table.head {
	margin-bottom: 1em;
}

table.foot {
	margin-top: 1.5em;
}

table.head td {
	border-bottom: 1px solid var(--highlight);
	box-shadow: inset 0 -1px var(--shadow);
}

table.foot td {
	border-top: 1px solid var(--shadow);
	box-shadow: inset 0 1px var(--highlight);
}

td.head-vol,
td.foot-date {
	text-align: center;
}

td.head-rtitle,
td.foot-os {
	text-align: right;
}

h2.Ss {
	border: 0;
	box-shadow: none;
	padding: 0;
}

h1.Sh {
	font-size: 1.2em;
	margin-left: calc(-3.5em / 1.2);
	margin-top: 1.6em;
}

h2.Ss {
	font-size: 1.05em;
	margin-left: calc(-1.75em / 1.05);
}

a.permalink:link,
a.permalink:visited {
	color: inherit;
	text-decoration: none;
}

.manual-text {
	margin-left: 3.5em;
}

.manual-text > br:first-child {
	display: none;
}

table.Nm td {
	vertical-align: top;
}

table.Nm td:first-child {
	padding-right: 0.4em;
	white-space: nowrap;
}

.Bd-indent {
	margin-left: 2em;
}

.Nm, .Cm, .Fl, .Ic, .Fn, .Dv, .Er, .Ev {
	font-weight: bold;
}

.Ar, .Va, .Pa {
	font-family: var(--mono);
	font-style: italic;
}

.Em {
	font-style: italic;
}

@media (max-width: 40em) {
	.manual-text { margin-left: 0; }
	h1.Sh, h2.Ss { margin-left: 0; }
}

/* Aude: the wordmark in the banner's place (Documentation/Spec/brand.md, BRAND-7). */

body > header a:link,
body > header a:visited {
	background: url(wordmark.svg) no-repeat;
	color: transparent;
	display: block;
	height: 40px;
	overflow: hidden;
	white-space: nowrap;
	width: 128px;
}
