/*
 * The documentation sub-sites in the visual language of cadviewer.store.
 *
 * The ten sub-sites share one theme (hugo-theme-techdoc) and one stylesheet,
 * theme.min.css. This file is loaded after it and restyles what it draws;
 * the pages themselves are generated exactly as before. It is added at build
 * time by docker/build-subsites.sh, from docker/subsite-overlay.
 *
 * The tokens are those of web/styles/tailwind.css.
 */

:root {
	--bg: #f6f5f1;
	--bg-panel: #ffffff;
	--bg-elev: #fbfaf6;
	--ink: #0b0a1f;
	--ink-2: #2a2845;
	--ink-3: #6b6a86;
	--ink-4: #a8a7bb;
	--line: #e6e3d8;
	--line-2: #d3d0c2;
	--grid: rgb(9 0 70 / 0.06);
	--accent: #f66011;
	--accent-strong: #e8540a;
	--link: #c2440a;
	--font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
		Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
		Consolas, monospace;
	--radius-control: 6px;
	--radius-frame: 10px;

	color-scheme: light;
	font-family: var(--font-sans);
	font-size: 100%;
	line-height: 1.7;
	color: var(--ink);
	font-feature-settings: normal;
	-webkit-font-feature-settings: normal;
}

:root[data-theme="dark"] {
	--bg: #07041f;
	--bg-panel: #0d0a30;
	--bg-elev: #11103a;
	--ink: #f3f1e7;
	--ink-2: #cfcde0;
	--ink-3: #8987a8;
	--ink-4: #5b597b;
	--line: rgb(255 255 255 / 0.08);
	--line-2: rgb(255 255 255 / 0.16);
	--grid: rgb(255 255 255 / 0.05);
	--link: #ff8a4c;

	color-scheme: dark;
}

/* ---------------------------------------------------------------- page */

html,
body {
	height: auto;
	min-height: 100%;
}

body {
	background-color: var(--bg);
	background-image:
		linear-gradient(to right, var(--grid) 1px, transparent 1px),
		linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
	background-size: 48px 48px;
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

.container {
	height: auto;
	min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-sans);
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.25;
	color: var(--ink);
}

h1 {
	font-size: 2.1rem;
	letter-spacing: -0.025em;
}

h2 {
	font-size: 1.55rem;
}

h3 {
	font-size: 1.25rem;
}

h4 {
	font-size: 1.1rem;
}

h5,
h6 {
	font-size: 1rem;
}

a {
	color: var(--link);
	text-decoration: none;
}

a:focus,
a:active,
a:hover {
	color: var(--accent);
	text-decoration: underline;
	text-underline-offset: 3px;
}

hr {
	background-color: var(--line);
	height: 1px;
}

/* ------------------------------------------------- bar to the main site */

.notification:empty {
	display: none;
}

.docs-sitebar {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 0.45rem 1.5rem;
	background: var(--ink);
	color: #f3f1e7;
	font-family: var(--font-mono);
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1.6;
}

:root[data-theme="dark"] .docs-sitebar {
	background: #000;
}

.docs-sitebar nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.4rem;
	margin-right: auto;
}

.docs-sitebar a {
	color: inherit;
	opacity: 0.78;
}

.docs-sitebar a:hover {
	color: inherit;
	opacity: 1;
	text-decoration: none;
}

.docs-sitebar a.docs-sitebar-home {
	opacity: 1;
	color: var(--accent);
}

.docs-theme {
	appearance: none;
	border: 1px solid rgb(255 255 255 / 0.25);
	border-radius: var(--radius-control);
	background: transparent;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	padding: 0.15rem 0.6rem;
	cursor: pointer;
}

.docs-theme:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* --------------------------------------------------------- site header */

.container > header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 1.5rem;
	height: auto;
	padding: 0.9rem 1.5rem;
	color: var(--ink);
	background: var(--bg-panel);
	border-bottom: 1px solid var(--line);
}

.container > header > div:first-child {
	line-height: 0;
}

.container > header img {
	width: 150px;
}

:root[data-theme="dark"] .container > header > div:first-child a {
	display: inline-block;
	padding: 0.35rem 0.6rem;
	border-radius: var(--radius-control);
	background: #f6f5f1;
}

.container > header #ax_header_title {
	position: static;
	min-width: 0;
	padding-left: 1.5rem;
	border-left: 1px solid var(--line-2);
}

.container > header h1 {
	display: block;
	margin: 0;
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1.4;
	color: var(--ink-2);
}

.container > header .version {
	font-family: var(--font-mono);
	font-size: 0.72rem;
	color: var(--ink-3);
}

.container > header .description {
	margin: 0;
	flex-basis: 100%;
	color: var(--ink-3);
	font-size: 0.9rem;
}

.global-menu {
	color: var(--ink-2);
	background: var(--bg-panel);
	border-bottom: 1px solid var(--line);
	padding: 0.35rem 1.5rem;
	font-size: 0.9rem;
}

.global-menu ul.sub-menu li {
	background: var(--bg-panel);
	border: 1px solid var(--line);
}

.global-menu ul.sub-menu li a {
	color: var(--ink-2);
}

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

.content-container {
	align-items: flex-start;
}

main {
	flex: 1 1 0;
	min-width: 0;
	max-width: 62rem;
	padding: 2.5rem 3rem 3rem;
}

.sidebar {
	flex: 0 0 300px;
	position: sticky;
	top: 0;
	max-height: 100vh;
	overflow-x: hidden;
	overflow-y: auto;
	font-size: 0.875rem;
	line-height: 1.5;
	background: var(--bg-elev);
	border-right: 1px solid var(--line);
	scrollbar-width: thin;
}

.sidebar #xs_container {
	display: none;
}

.sidebar #s_container {
	left: 0;
	top: 0;
	height: auto;
	padding: 0.75rem 0.75rem 0.5rem;
	border-bottom: 1px solid var(--line);
}

.sidebar a {
	color: var(--ink-2);
	padding: 0.45rem 2.4rem 0.45rem 1rem;
	border-left: 2px solid transparent;
	border-bottom: 1px solid var(--line);
}

.sidebar a:hover {
	color: var(--ink);
	background: var(--bg-panel);
	border-left: 2px solid var(--line-2);
	text-decoration: none;
}

.sidebar nav > ul > li li a {
	padding-left: 1.9rem;
}

.sidebar nav > ul ul > li li a {
	padding-left: 2.8rem;
}

.sidebar .active > a {
	color: var(--ink);
	font-weight: 600;
	background: var(--bg-panel);
	border-left: 2px solid var(--accent);
}

.sidebar .slide-menu .has-sub-menu > a span.mark {
	top: 50%;
	right: 0.5rem;
	height: 1.4rem;
	width: 1.4rem;
	margin-top: -0.7rem;
	line-height: 1.4rem;
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--ink-3);
	background: transparent;
	border: 1px solid var(--line-2);
	border-radius: var(--radius-control);
}

.sidebar .slide-menu .has-sub-menu > a span.mark:hover {
	color: var(--accent);
	border-color: var(--accent);
}

@media screen and (max-width: 860px) {
	.content-container {
		flex-flow: column nowrap;
		align-items: stretch;
	}

	main {
		flex: 0 0 auto;
		max-width: 100%;
		min-width: 0;
		padding: 1.5rem 1rem 2rem;
	}

	.sidebar {
		flex: 0 0 auto;
		order: 1;
		position: static;
		max-height: none;
		border-right: 0;
		border-top: 1px solid var(--line);
	}

	.container > header #ax_header_title {
		padding-left: 0;
		border-left: 0;
	}

	.docs-sitebar {
		padding: 0.45rem 1rem;
		gap: 0.75rem;
	}
}

/* ------------------------------------------------------------- content */

main * + h1,
main * + h2 {
	margin-top: 2.4rem;
}

main * + h3,
main * + h4,
main * + h5,
main * + h6 {
	margin-top: 1.8rem;
}

main > h1:first-child,
main > h2:first-child {
	padding-bottom: 0.9rem;
	border-bottom: 1px solid var(--line);
}

main img {
	border-radius: var(--radius-control);
}

table {
	border: 1px solid var(--line);
	border-radius: var(--radius-frame);
	background: var(--bg-panel);
	font-size: 0.92rem;
	line-height: 1.5;
}

th,
td {
	border-top: 1px solid var(--line);
	border-right: 1px solid var(--line);
	padding: 0.6rem 0.8rem;
}

th {
	background: var(--bg-elev);
	color: var(--ink-2);
	font-family: var(--font-mono);
	font-size: 0.74rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

tr:nth-child(even) th,
tr:nth-child(even) td {
	background: var(--bg-elev);
}

blockquote {
	margin-left: 0;
	margin-right: 0;
	color: var(--ink-2);
	background-color: var(--bg-panel);
	border: 1px solid var(--line);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius-control);
}

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

code {
	padding: 0.12rem 0.35rem;
	border: 1px solid var(--line);
	border-radius: 4px;
	background-color: var(--bg-panel);
	color: var(--ink);
}

kbd {
	background-color: var(--ink);
	color: var(--bg);
}

pre {
	padding: 1rem 1.2rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-frame);
	background-color: var(--bg-panel);
	color: var(--ink);
	line-height: 1.6;
}

pre code {
	padding: 0;
	border: 0;
	background-color: transparent;
	font-size: 1em;
}

figcaption {
	color: var(--ink-3);
	font-size: 0.9rem;
	line-height: 1.6;
}

.panel {
	border-radius: var(--radius-frame);
}

.panel-primary {
	border: 1px solid var(--line);
	background: var(--bg-panel);
}

.button {
	font-size: 0.95rem;
	font-weight: 600;
	padding: 0.6rem 1.1rem;
	border-radius: var(--radius-control);
	color: #fff;
	background: var(--accent);
}

.button:hover {
	color: #fff;
	background: var(--accent-strong);
}

.table_of_contents {
	border: 1px solid var(--line);
	border-radius: var(--radius-frame);
	background: var(--bg-panel);
}

.table_of_contents li {
	border-top: 1px solid var(--line);
}

/* A gist brings its own light stylesheet; it keeps a light panel in dark. */
.gist .gist-file {
	border-color: var(--line-2) !important;
	border-radius: var(--radius-frame) !important;
	overflow: hidden;
}

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

main > footer {
	margin-top: 3rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}

.pagination {
	font-weight: 500;
	gap: 1rem;
}

.pagination a {
	display: inline-block;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--line-2);
	border-radius: var(--radius-control);
	background: var(--bg-panel);
	color: var(--ink);
}

.pagination a:hover {
	border-color: var(--accent);
	color: var(--accent);
	text-decoration: none;
}

.edit-meta,
.powered {
	color: var(--ink-3);
	font-family: var(--font-mono);
	font-size: 0.72rem;
	letter-spacing: 0.02em;
}

.backtothetop {
	color: var(--accent);
}

.docs-sitefoot {
	padding: 1.25rem 1.5rem;
	border-top: 1px solid var(--line);
	background: var(--bg-panel);
	color: var(--ink-3);
	font-size: 0.82rem;
	line-height: 1.7;
}

.docs-sitefoot p {
	margin: 0;
}
