/* ==========================================================================
   MSM Tools — help center (the /help/ hub and the articles)
   Loaded on help screens only. Colours come from the theme's tokens, with
   the same zero-specificity floor tools.css sets for any other theme, so
   dark mode follows the theme without rules of its own here.
   ========================================================================== */

:where(html) {
	--msm-brand-rgb: 13, 124, 109;
	--msm-brand: rgb(var(--msm-brand-rgb));
	--msm-brand-soft: rgba(var(--msm-brand-rgb), 0.08);
	--bg-surface: #ffffff;
	--bg-surface-alt: #f5f4f1;
	--card-border: rgba(231, 229, 228, 0.9);
	--text-primary: #1c1917;
	--text-secondary: #57534e;
	--text-muted: #78716c;
	--input-bg: #ffffff;
	--radius-md: 16px;
	--radius-sm: 12px;
}

:where(body.dark) {
	--msm-brand-rgb: 45, 212, 191;
	--bg-surface: #1c1917;
	--bg-surface-alt: #292524;
	--card-border: #3f3b38;
	--text-primary: #fafaf9;
	--text-secondary: #a8a29e;
	--text-muted: #948d88;
	--input-bg: #292524;
}

.msm-help-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.msm-help-arrow {
	color: var(--text-muted);
	flex: 0 0 auto;
}

[dir="rtl"] .msm-help-arrow {
	transform: scaleX(-1);
}

/* --------------------------------------------------------------------------
   Hub
   -------------------------------------------------------------------------- */
.msm-help-hub .section {
	padding-block-start: 40px;
}

.msm-help-search {
	position: relative;
	max-width: 640px;
	margin: 0 auto 10px;
}

.msm-help-search-icon {
	position: absolute;
	inset-inline-start: 18px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	pointer-events: none;
}

.msm-help-search input[type="search"] {
	box-sizing: border-box;
	width: 100%;
	min-height: 54px;
	padding-block: 14px;
	padding-inline: 50px 18px;
	border: 1px solid var(--card-border);
	border-radius: var(--radius-md);
	background: var(--input-bg);
	color: var(--text-primary);
	font: inherit;
	font-size: 1rem;
}

.msm-help-search input[type="search"]:focus {
	outline: 2px solid var(--msm-brand);
	outline-offset: 2px;
	border-color: transparent;
}

.msm-help-status {
	min-height: 1.4em;
	margin: 0 0 22px;
	color: var(--text-secondary);
	font-size: 0.9rem;
	text-align: center;
}

.msm-help-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
	gap: 20px;
	align-items: start;
}

.msm-help-topic {
	padding: 22px 24px;
	border: 1px solid var(--card-border);
	border-radius: 20px;
	background: var(--bg-surface);
	scroll-margin-top: 90px;
}

.msm-help-topic-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 8px;
}

.msm-help-topic-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: var(--radius-sm);
	background: var(--msm-brand-soft);
	color: var(--msm-brand);
}

.msm-help-topic h2 {
	margin: 0;
	font-size: 1.2rem;
}

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

.msm-help-list li {
	margin: 0;
	border-top: 1px solid var(--card-border);
}

.msm-help-list li:first-child {
	border-top: 0;
}

.msm-help-list a {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding-block: 11px;
	color: var(--text-primary);
	font-size: 0.95rem;
	line-height: 1.45;
	text-decoration: none;
}

.msm-help-list a:hover,
.msm-help-list a:focus-visible {
	color: var(--msm-brand);
}

.msm-help-list a:hover .msm-help-arrow {
	color: var(--msm-brand);
}

.msm-help-empty {
	margin-top: 4px;
	padding: 26px;
	border: 1px solid var(--card-border);
	border-radius: 20px;
	background: var(--bg-surface);
	color: var(--text-secondary);
	text-align: center;
}

.msm-help-empty p {
	margin: 0;
}

.msm-help-stuck {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-top: 28px;
	padding: 24px 28px;
	border: 1px solid var(--card-border);
	border-radius: 20px;
	background: var(--bg-surface);
}

.msm-help-stuck h2 {
	margin: 0 0 4px;
	font-size: 1.2rem;
}

.msm-help-stuck p {
	margin: 0;
	color: var(--text-secondary);
}

.msm-help-stuck-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.msm-help-stuck .btn-action,
.msm-help-contact .btn-action {
	text-decoration: none;
}

/* --------------------------------------------------------------------------
   Article
   -------------------------------------------------------------------------- */
.msm-help-article.section {
	padding-block: 28px 70px;
}

.msm-help-layout {
	display: grid;
	grid-template-columns: minmax(0, 760px) 300px;
	justify-content: space-between;
	gap: 48px;
	align-items: start;
	margin-top: 18px;
}

.msm-help-main {
	min-width: 0;
}

.msm-help-title {
	margin: 0 0 8px;
	font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.4rem);
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.msm-help-meta {
	margin: 0 0 20px;
	color: var(--text-muted);
	font-size: 0.88rem;
}

.msm-help-applies {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 18px;
	padding: 14px 18px;
	border: 1px solid var(--card-border);
	border-radius: var(--radius-md);
	background: var(--bg-surface);
}

.msm-help-applies-label {
	color: var(--text-secondary);
	font-size: 0.82rem;
	font-weight: 600;
}

.msm-help-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.msm-help-chip {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	padding-inline: 14px;
	border: 1px solid var(--card-border);
	border-radius: 999px;
	background: var(--bg-surface);
	color: var(--text-primary);
	font-size: 0.88rem;
	font-weight: 500;
	text-decoration: none;
}

a.msm-help-chip:hover {
	border-color: var(--msm-brand);
	color: var(--msm-brand);
}

.msm-help-chip.is-more {
	color: var(--text-secondary);
	background: var(--bg-surface-alt);
}

.msm-help-short {
	margin-bottom: 26px;
	padding: 16px 20px;
	border-inline-start: 4px solid var(--msm-brand);
	border-radius: var(--radius-sm);
	background: var(--msm-brand-soft);
	color: var(--text-primary);
	line-height: 1.65;
}

/* The theme's breadcrumb is centred for the page header; here it heads a
   left-aligned article. */
.msm-help-article .msm-breadcrumbs {
	justify-content: flex-start;
	margin-bottom: 0;
}

/* The theme separates a tool's article from the tool above it with a
   dashed rule; here the short answer already does that job. */
.msm-help-content.article-content {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
	font-size: 1rem;
}

.msm-help-content > :first-child {
	margin-top: 0;
}

.msm-help-content h2 {
	margin-top: 1.8em;
}

.msm-help-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 1.2em 0;
	font-size: 0.95rem;
}

.msm-help-content th,
.msm-help-content td {
	padding: 10px 12px;
	border-bottom: 1px solid var(--card-border);
	text-align: start;
	vertical-align: top;
}

.msm-help-content th {
	color: var(--text-secondary);
	font-weight: 600;
}

.msm-help-content .msm-help-table {
	overflow-x: auto;
}

.msm-help-vote {
	margin-top: 36px;
	padding-top: 20px;
	border-top: 1px solid var(--card-border);
}

.msm-help-vote-ask {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
}

.msm-help-vote-q {
	font-weight: 600;
}

.msm-help-vote-buttons {
	display: inline-flex;
	gap: 8px;
}

.msm-help-vote .btn-action[aria-pressed="true"] {
	border-color: var(--msm-brand);
	background: var(--msm-brand-soft);
	color: var(--msm-brand);
}

.msm-help-vote-thanks {
	margin: 12px 0 0;
	color: var(--text-secondary);
}

/* Sidebar */
.msm-help-side {
	position: sticky;
	top: 20px;
	display: grid;
	gap: 14px;
}

.msm-help-card {
	padding: 16px 18px;
	border: 1px solid var(--card-border);
	border-radius: var(--radius-md);
	background: var(--bg-surface);
}

.msm-help-card h2 {
	margin: 0 0 10px;
	color: var(--text-muted);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.69rem;
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.msm-help-side-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.msm-help-side-list a {
	display: block;
	padding-block: 8px;
	color: var(--text-secondary);
	font-size: 0.92rem;
	line-height: 1.45;
	text-decoration: none;
}

.msm-help-side-list a:hover {
	color: var(--msm-brand);
}

.msm-help-contact p {
	margin: 0 0 12px;
	color: var(--text-secondary);
	font-size: 0.9rem;
	line-height: 1.55;
}

.msm-help-contact .btn-action {
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
}

.msm-help-all {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding-inline: 4px;
	color: var(--msm-brand);
	font-weight: 600;
	font-size: 0.92rem;
	text-decoration: none;
}

@media (max-width: 991px) {
	.msm-help-layout {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.msm-help-side {
		position: static;
	}
}

@media (max-width: 600px) {
	.msm-help-topic,
	.msm-help-stuck {
		padding: 18px;
	}

	.msm-help-stuck-actions,
	.msm-help-stuck-actions .btn-action {
		width: 100%;
		justify-content: center;
	}
}
