/* SPDX-License-Identifier: LicenseRef-Proprietary */
/* Copyright (C) 2024-2026 Tonic */

/* The handbook (/help, dock/www/help.html). Written for reading: 18 px text, lines of about 70
   characters, every control 44 px. Purple marks what explains (the prompt colour of the apps). */

.dh {
	--dh-text: #1f2937;
	--dh-muted: #4b5563;
	--dh-line: #e5e7eb;
	--dh-soft: #f9fafb;
	--dh-prompt: #6b21a8;
	--dh-prompt-bg: #faf5ff;
	--dh-prompt-line: #e9d5ff;
	color: var(--dh-text);
	background: #ffffff;
}

.dh-wrap {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 16px;
	box-sizing: border-box;
}

.dh-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.dh a {
	color: var(--dh-prompt);
}

/* ── The bar: the handbook's name and its search ───────────────────────────── */

.dh-bar {
	border-bottom: 1px solid var(--dh-line);
	background: var(--dh-soft);
}

.dh-bar-in {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 24px;
	padding-top: 10px;
	padding-bottom: 10px;
}

.dh .dh-home {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 19px;
	font-weight: 600;
	color: var(--dh-text);
	text-decoration: none;
}

.dh-search {
	flex: 1 1 280px;
	max-width: 560px;
	display: flex;
	gap: 8px;
}

.dh-search input {
	flex: 1;
	min-width: 0;
	min-height: 44px;
	padding: 0 12px;
	font: inherit;
	font-size: 17px;
	color: var(--dh-text);
	background: #ffffff;
	border: 1px solid #9ca3af;
	border-radius: 8px;
}

.dh-search button,
.dh .dh-back-btn {
	min-height: 44px;
	padding: 0 16px;
	font: inherit;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	background: #374151;
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

/* ── The way back to the app ───────────────────────────────────────────────── */

.dh-back {
	margin: 16px 0 0;
	padding: 6px 6px 6px 16px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	font-size: 16px;
	background: var(--dh-soft);
	border: 1px solid var(--dh-line);
	border-radius: 10px;
}

/* ── Chapters, text, "on this page" ────────────────────────────────────────── */

.dh-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px 40px;
	padding-top: 24px;
	padding-bottom: 64px;
}

@media (min-width: 900px) {
	.dh-body:has(.dh-nav) {
		grid-template-columns: 260px minmax(0, 1fr);
	}
}

@media (min-width: 1200px) {
	.dh-body.dh-with-toc {
		grid-template-columns: 260px minmax(0, 1fr) 220px;
	}
}

.dh-nav,
.dh-toc {
	font-size: 16px;
}

.dh-nav ul,
.dh-toc ul {
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
}

.dh-nav li a,
.dh-toc li a {
	min-height: 44px;
	padding: 8px 12px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	color: var(--dh-text);
	text-decoration: none;
	border-radius: 8px;
}

.dh-nav li a:hover,
.dh-toc li a:hover {
	background: var(--dh-soft);
}

.dh .dh-on {
	font-weight: 600;
	background: var(--dh-prompt-bg);
	color: var(--dh-prompt);
}

.dh-apps {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}

.dh-apps a {
	min-height: 44px;
	padding: 0 16px;
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--dh-line);
	border-radius: 999px;
	color: var(--dh-text);
	text-decoration: none;
}

.dh-group {
	margin: 8px 12px 4px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--dh-muted);
}

@media (min-width: 1200px) {
	.dh-toc {
		position: sticky;
		top: 16px;
		align-self: start;
	}

	/* The website's header stays on top (77 px); the list stops below it. */
	.oc .dh-toc {
		top: 93px;
	}
}

.dh-main {
	min-width: 0;
	font-size: 18px;
	line-height: 1.65;
}

.dh-main h1 {
	margin: 0 0 12px;
	font-size: 34px;
	line-height: 1.2;
}

.dh-main h2 {
	margin: 32px 0 8px;
	font-size: 24px;
	line-height: 1.3;
}

.dh-main h3 {
	margin: 24px 0 6px;
	font-size: 20px;
}

/* The website's stylesheet sets paragraphs to no margin; a chapter needs the space between them. */
.dh-main p,
.dh-main ul,
.dh-main ol {
	margin: 0 0 14px;
}

.dh-main li {
	margin-bottom: 4px;
}

.dh-main ul,
.dh-main ol {
	padding-left: 24px;
}

.dh-main ul.dh-list {
	padding-left: 0;
}

.dh-lead {
	font-size: 19px;
	color: var(--dh-muted);
}

.dh-article {
	max-width: 70ch;
}

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

.dh-article table {
	display: block;
	overflow-x: auto;
	border-collapse: collapse;
}

.dh-article th,
.dh-article td {
	padding: 6px 10px;
	border: 1px solid var(--dh-line);
}

.dh-crumbs {
	margin: 0 0 8px;
	font-size: 15px;
	color: var(--dh-muted);
}

.dh-note {
	padding: 10px 14px;
	font-size: 16px;
	background: var(--dh-soft);
	border: 1px solid var(--dh-line);
	border-radius: 8px;
}

/* The section the explanation panel sent the reader to stands out. */
.dh-section {
	scroll-margin-top: 16px;
	margin: 0 -16px;
	padding: 0 16px;
	border-radius: 12px;
}

/* A section the reader jumps to starts below the website's header. */
.oc .dh-section {
	scroll-margin-top: 93px;
}

.dh-section:target {
	background: var(--dh-prompt-bg);
	padding-top: 4px;
	padding-bottom: 12px;
}

.dh-section:target h2 {
	margin-top: 12px;
}

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

.dh-list li {
	padding: 12px 0;
	border-bottom: 1px solid var(--dh-line);
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.dh-list li > a {
	font-weight: 600;
	min-height: 32px;
	display: inline-flex;
	align-items: center;
}

.dh-list li > span {
	font-size: 16px;
	color: var(--dh-muted);
}

.dh-list .dh-where {
	font-size: 14px;
}

.dh-pager {
	margin-top: 40px;
	padding-top: 16px;
	border-top: 1px solid var(--dh-line);
	display: flex;
	justify-content: space-between;
	gap: 16px;
	font-size: 16px;
}

.dh-pager a {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	font-weight: 600;
	text-decoration: none;
}
