/**
 * AdProMax — base layer.
 * Reset, document typography, accessibility utilities, focus states, print.
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

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

body {
	margin: 0;
	background: var(--apm-bg);
	color: var(--apm-text);
	font-family: var(--apm-font-body);
	font-size: var(--apm-size-body);
	line-height: var(--apm-lh-body);
	-webkit-font-smoothing: antialiased;
	/* clip, not hidden: `overflow-x: hidden` computes overflow-y to `auto`, which turns
	   the element into a scroll container and breaks position: sticky on the header. */
	overflow-x: clip;
}

img,
picture,
video,
canvas,
svg,
iframe {
	max-width: 100%;
	height: auto;
	display: block;
}

svg {
	height: auto;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

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

a:hover,
a:focus {
	color: var(--apm-brand-hover);
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--apm-font-heading);
	font-weight: 800;
	letter-spacing: var(--apm-ls-tight);
	line-height: var(--apm-lh-heading);
	color: var(--apm-text-strong);
	text-wrap: balance;
	margin-block: 0 var(--apm-space-sm);
}

p {
	margin-block: 0 var(--apm-space-md);
	text-wrap: pretty;
}

/* Arabic sets letter-spacing to 0 — negative tracking breaks joined script. */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] h4,
[dir="rtl"] h5,
[dir="rtl"] h6,
[dir="rtl"] p,
[dir="rtl"] li,
[dir="rtl"] a,
[dir="rtl"] button,
[dir="rtl"] summary,
[dir="rtl"] span,
[dir="rtl"] dt,
[dir="rtl"] dd {
	letter-spacing: 0;
}

/* JetBrains Mono has no Arabic coverage; in RTL a mono string falls back to a system
   monospace that renders Arabic with fixed per-glyph advances. Latin/numeric strings
   opt back in with dir="ltr". */
[dir="rtl"] .apm-mono:not([dir="ltr"]) {
	font-family: var(--apm-font-arabic);
}

.apm-mono {
	font-family: var(--apm-font-mono);
	font-variant-numeric: tabular-nums;
}

/* ---- Focus ---------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--apm-focus-width) solid var(--apm-brand);
	outline-offset: var(--apm-focus-offset);
	border-radius: var(--apm-radius-sm);
}

.apm-dark :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline-color: var(--apm-pink-soft);
}

::selection {
	background: var(--apm-brand-tint);
	color: var(--apm-text-strong);
}

/* ---- Screen-reader utilities ---------------------------------------- */

.screen-reader-text,
.apm-sr-only {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus,
.apm-skip-link:focus {
	background-color: var(--apm-white);
	border-radius: var(--apm-radius);
	box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
	clip: auto !important;
	clip-path: none;
	color: var(--apm-brand-hover);
	display: block;
	font-size: 14px;
	font-weight: 700;
	height: auto;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	line-height: normal;
	padding: 14px 20px;
	text-decoration: none;
	width: auto;
	z-index: 100000;
}

/* ---- Reduced motion -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

html {
	scroll-behavior: smooth;
}

/* ---- Print ----------------------------------------------------------- */

@media print {
	.apm-site-header,
	.apm-site-footer,
	.apm-skip-link,
	.apm-toc,
	.apm-share,
	.apm-cta-band,
	.apm-related,
	.apm-post-nav,
	#comments,
	.apm-pagination {
		display: none !important;
	}

	body {
		background: #fff;
		color: #000;
		font-size: 12pt;
	}

	.apm-entry-content a[href^="http"]::after {
		content: " (" attr(href) ")";
		font-size: 9pt;
		word-break: break-all;
	}

	.apm-entry-content {
		max-width: none;
	}

	h1,
	h2,
	h3 {
		break-after: avoid;
	}

	pre,
	blockquote,
	table,
	figure {
		break-inside: avoid;
	}
}
