/* The help pages (templates/site/help.html): the topics tree beside the
   article, the search box above the article with its list of hits
   (js/help-search.js), the article's own typography, and on a phone-width
   window the tree in a Help topics box above the article (js/help.js
   closes it there).
   Colours come from the site's theme properties (mattercad.css and
   css/site-theme.css), so light and dark both apply. */

.mc-help {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: 32px;
	align-items: start;
}

.mc-help-topics {
	position: sticky;
	top: 16px;
	max-height: calc(100vh - 32px);
	overflow: auto;
	padding: 12px 8px;
	border: 1px solid var(--mc-border);
	border-radius: var(--mc-radius);
	background: var(--mc-surface);
}

.mc-help-topics > summary {
	display: none;
}

.mc-help-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mc-help-nav ul ul {
	margin: 2px 0 4px 12px;
	padding-left: 8px;
	border-left: 1px solid var(--mc-border);
}

.mc-help-nav a {
	display: block;
	padding: 5px 8px;
	border-radius: 6px;
	color: var(--mc-text);
	font-size: 14px;
	line-height: 1.35;
	text-decoration: none;
}

.mc-help-nav a:hover {
	color: var(--mc-accent);
	background: var(--mc-accent-soft);
}

.mc-help-nav a.is-current {
	color: var(--mc-accent);
	background: var(--mc-accent-soft);
	font-weight: 600;
}

.mc-help-page {
	min-width: 0;
}

/* The search box, as wide as the article; its hits drop below it, over
   the page. */
.mc-help-search {
	position: relative;
	max-width: 820px;
	margin-bottom: 16px;
}

.mc-help-search-input {
	box-sizing: border-box;
	font-size: 15px;
}

.mc-help-search-input:disabled {
	color: var(--mc-text-dim);
	cursor: not-allowed;
}

.mc-help-search-results {
	position: absolute;
	z-index: 20;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: min(70vh, 560px);
	margin: 0;
	padding: 4px;
	overflow-y: auto;
	list-style: none;
	border: 1px solid var(--mc-border);
	border-radius: var(--mc-radius);
	background: var(--mc-surface);
	box-shadow: var(--mc-dialog-shadow);
}

.mc-help-search-results[hidden] {
	display: none;
}

.mc-help-search-row a {
	display: block;
	padding: 8px 10px;
	border-radius: 6px;
	color: var(--mc-text);
	text-decoration: none;
}

.mc-help-search-row a:hover,
.mc-help-search-row.is-active a {
	background: var(--mc-accent-soft);
}

.mc-help-search-title {
	display: block;
	color: var(--mc-ink);
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.35;
}

.mc-help-search-snippet {
	display: block;
	margin-top: 2px;
	color: var(--mc-text-dim);
	font-size: 13.5px;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

/* The visitor's words: the accent, never a background, so they stay clear
   on the highlighted row too. */
.mc-help-search-snippet mark {
	color: var(--mc-accent);
	background: none;
	font-weight: 600;
}

.mc-help-search-empty {
	padding: 10px 12px;
	color: var(--mc-text-dim);
	font-size: 14px;
}

.mc-help-crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
	font-size: 14px;
}

.mc-help-crumbs a {
	color: var(--mc-text-dim);
}

.mc-help-crumbs a:hover {
	color: var(--mc-accent);
}

.mc-help-crumb-sep {
	color: var(--mc-border);
}

.mc-help-article {
	max-width: 820px;
	color: var(--mc-text);
	font-size: 16px;
	line-height: 1.6;
	overflow-wrap: break-word;
}

.mc-help-article h1,
.mc-help-article h2,
.mc-help-article h3,
.mc-help-article h4 {
	color: var(--mc-ink);
	line-height: 1.25;
	margin: 1.6em 0 0.5em;
	scroll-margin-top: 16px;
}

.mc-help-article h1 {
	margin-top: 0;
	font-size: 30px;
}

.mc-help-article h2 {
	font-size: 22px;
}

.mc-help-article h3 {
	font-size: 18px;
}

.mc-help-article a {
	color: var(--mc-accent);
}

.mc-help-article a:hover {
	color: var(--mc-accent-hover);
}

.mc-help-article img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 12px 0;
	border-radius: 8px;
}

.mc-help-article code {
	padding: 1px 5px;
	border-radius: 4px;
	background: var(--mc-code-bg);
	font-size: 0.9em;
}

.mc-help-article pre {
	padding: 12px 14px;
	overflow-x: auto;
	border-radius: 8px;
	background: var(--mc-code-bg);
}

.mc-help-article pre code {
	padding: 0;
	background: none;
}

.mc-help-article table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	margin: 12px 0;
}

.mc-help-article th,
.mc-help-article td {
	padding: 6px 10px;
	border: 1px solid var(--mc-border);
	text-align: left;
	vertical-align: top;
}

.mc-help-article th {
	background: var(--mc-bg);
	color: var(--mc-ink);
}

.mc-help-article blockquote {
	margin: 12px 0;
	padding: 4px 14px;
	border-left: 3px solid var(--mc-accent);
	color: var(--mc-text-dim);
}

.mc-help-back {
	margin-top: 32px;
	font-size: 14px;
}

/* The header's own break: the tree moves above the article, in a box the
   visitor opens. */
@media (max-width: 720px) {
	.mc-help {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.mc-help-topics {
		position: static;
		max-height: none;
		padding: 0;
	}

	.mc-help-topics > summary {
		display: list-item;
		padding: 10px 14px;
		color: var(--mc-ink);
		font-weight: 600;
		cursor: pointer;
	}

	.mc-help-topics[open] > summary {
		border-bottom: 1px solid var(--mc-border);
	}

	.mc-help-nav {
		padding: 8px;
	}

	.mc-help-article h1 {
		font-size: 26px;
	}
}
