/**
 * Base layer: typography, links, forms, buttons, focus, layout containers.
 * Everything here is unopinionated about components.
 */

body {
	background: var(--aphq-color-sand-100);
	color: var(--aphq-color-gray-900);
	font-family: var(--aphq-font-sans);
	font-size: var(--aphq-text-base);
	line-height: var(--aphq-leading-normal);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Headings ------------------------------------------------------------- */

h1, h2, h3, h4 {
	font-family: var(--aphq-font-serif);
	color: var(--aphq-color-navy-900);
	line-height: var(--aphq-leading-tight);
	letter-spacing: -0.011em;
	text-wrap: balance;
	margin: 0 0 var(--aphq-space-md);
}

h1 { font-size: var(--aphq-text-4xl); }
h2 { font-size: var(--aphq-text-2xl); margin-top: var(--aphq-space-xl); }
h3 { font-size: var(--aphq-text-xl); margin-top: var(--aphq-space-lg); }
h4 { font-size: var(--aphq-text-lg); font-family: var(--aphq-font-sans); font-weight: 600; }

p { margin: 0 0 var(--aphq-space-md); }
p:last-child { margin-bottom: 0; }

/* Long prose gets a measure; anything wider is harder to read, not more premium. */
.aphq-prose {
	max-width: var(--aphq-content-width);
}

.aphq-prose > * + * {
	margin-top: var(--aphq-space-md);
}

.aphq-prose ul,
.aphq-prose ol {
	padding-left: 1.35em;
	margin: 0 0 var(--aphq-space-md);
}

.aphq-prose li + li {
	margin-top: var(--aphq-space-xs);
}

.aphq-lede {
	font-size: var(--aphq-text-lg);
	color: var(--aphq-color-gray-700);
	line-height: var(--aphq-leading-snug);
}

/* Links ---------------------------------------------------------------- */

a {
	color: var(--aphq-color-teal-600);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.16em;
}

a:hover {
	color: var(--aphq-color-teal-700);
}

/* Focus: never remove it, and never rely on colour alone. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--aphq-color-focus);
	outline-offset: 2px;
	border-radius: var(--aphq-radius-sm);
}

/* Visually hidden but available to assistive technology. */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Skip link ------------------------------------------------------------ */

.aphq-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	padding: var(--aphq-space-sm) var(--aphq-space-md);
	background: var(--aphq-color-navy-900);
	color: var(--aphq-color-white);
	border-radius: 0 0 var(--aphq-radius-md) 0;
}

.aphq-skip-link:focus {
	left: 0;
}

/* Layout --------------------------------------------------------------- */

.aphq-container {
	width: 100%;
	max-width: var(--aphq-wide-width);
	margin-inline: auto;
	padding-inline: var(--aphq-space-md);
}

.aphq-section {
	padding-block: var(--aphq-space-xl);
}

.aphq-section--tinted {
	background: var(--aphq-color-sand-200);
	border-block: 1px solid var(--aphq-color-gray-100);
}

/* Buttons -------------------------------------------------------------- */

.aphq-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--aphq-space-xs);
	min-height: 44px; /* touch target */
	padding: var(--aphq-space-sm) var(--aphq-space-lg);
	border: 1px solid transparent;
	border-radius: var(--aphq-radius-md);
	font-family: var(--aphq-font-sans);
	font-size: var(--aphq-text-base);
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.aphq-btn--primary {
	background: var(--aphq-color-teal-600);
	color: var(--aphq-color-white);
}

.aphq-btn--primary:hover {
	background: var(--aphq-color-teal-700);
	color: var(--aphq-color-white);
}

.aphq-btn--secondary {
	background: transparent;
	color: var(--aphq-color-navy-700);
	border-color: var(--aphq-color-gray-300);
}

.aphq-btn--secondary:hover {
	border-color: var(--aphq-color-navy-700);
	background: var(--aphq-color-white);
}

/* Forms ---------------------------------------------------------------- */

label {
	display: block;
	font-weight: 600;
	font-size: var(--aphq-text-sm);
	margin-bottom: var(--aphq-space-xs);
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
	width: 100%;
	min-height: 44px;
	padding: var(--aphq-space-xs) var(--aphq-space-sm);
	font: inherit;
	color: var(--aphq-color-gray-900);
	background: var(--aphq-color-white);
	border: 1px solid var(--aphq-color-gray-300);
	border-radius: var(--aphq-radius-sm);
}

fieldset {
	border: 0;
	padding: 0;
	margin: 0 0 var(--aphq-space-lg);
	min-width: 0;
}

legend {
	font-family: var(--aphq-font-serif);
	font-size: var(--aphq-text-lg);
	color: var(--aphq-color-navy-900);
	padding: 0;
	margin-bottom: var(--aphq-space-sm);
}

/* Media ---------------------------------------------------------------- */

img,
picture,
video {
	max-width: 100%;
	height: auto;
}

/* Images without intrinsic dimensions are the most common cause of CLS. */
img:not([width]):not([height]) {
	aspect-ratio: 16 / 9;
	object-fit: cover;
}
