/* =========================================================================
   Ashbrooke Allied Support — main stylesheet
   Accessibility-first: AAA contrast defaults, Atkinson Hyperlegible,
   visitor font scaling (html[data-fontsize]) and high contrast mode
   (html[data-contrast="high"]). Colours come from CSS variables printed
   by the Customizer (see functions.php) with safe fallbacks here.
   ========================================================================= */

/* ---------- Fonts: Atkinson Hyperlegible (Braille Institute) ---------- */
@font-face {
	font-family: 'Atkinson Hyperlegible';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Atkinson Hyperlegible';
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/atkinson-hyperlegible-latin-400-italic.woff2') format('woff2');
}
@font-face {
	font-family: 'Atkinson Hyperlegible';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'Atkinson Hyperlegible';
	font-style: italic;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/atkinson-hyperlegible-latin-700-italic.woff2') format('woff2');
}

/* ---------- Variables (fallbacks; Customizer overrides in <head>) ----- */
:root {
	--ab-text: #1f2933;
	--ab-headings: #4a154b;
	--ab-bg: #ffffff;
	--ab-bg-alt: #f5f1f7;
	--ab-link: #6b1f68;
	--ab-button-bg: #5c195a;
	--ab-button-text: #ffffff;
	--ab-accent: #2f6b12;
	--ab-font-size: 19px;
	--ab-scale: 1.25;
	--ab-focus: #b35900;
	--ab-error: #9b1c1c;
	--ab-error-bg: #fdecec;
	--ab-success: #14532d;
	--ab-success-bg: #ecfdf3;
	--ab-border: #d7d2dc;
}

/* Visitor font scaling — toolbar sets html[data-fontsize] */
html { font-size: var(--ab-font-size); }
html[data-fontsize='125'] { font-size: calc(var(--ab-font-size) * 1.25); }
html[data-fontsize='150'] { font-size: calc(var(--ab-font-size) * 1.5); }
html[data-fontsize='175'] { font-size: calc(var(--ab-font-size) * 1.75); }
html[data-fontsize='200'] { font-size: calc(var(--ab-font-size) * 2); }

/* High contrast mode — toolbar sets html[data-contrast="high"] */
html[data-contrast='high'] {
	--ab-text: #ffffff;
	--ab-headings: #ffffff;
	--ab-bg: #000000;
	--ab-bg-alt: #121212;
	--ab-link: #ffd500;
	--ab-button-bg: #ffd500;
	--ab-button-text: #000000;
	--ab-accent: #ffd500;
	--ab-focus: #00e5ff;
	--ab-border: #777777;
	--ab-error: #ff8585;
	--ab-error-bg: #2a0000;
	--ab-success: #7fff9e;
	--ab-success-bg: #00220c;
}
html[data-contrast='high'] img { background: #ffffff; padding: 0.5rem; border-radius: 0.25rem; }

/* Smooth in-page scrolling, only for people who haven't opted out */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
html { scroll-padding-top: 1.5rem; }

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

body {
	margin: 0;
	font-family: 'Atkinson Hyperlegible', 'Segoe UI', Arial, sans-serif;
	font-size: 1rem;
	line-height: 1.65;
	color: var(--ab-text);
	background: var(--ab-bg);
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
	color: var(--ab-headings);
	line-height: 1.25;
	margin: 0 0 0.75em;
	max-width: 32ch;
}
h1 { font-size: calc(1rem * var(--ab-scale) * var(--ab-scale) * var(--ab-scale)); }
h2 { font-size: calc(1rem * var(--ab-scale) * var(--ab-scale)); }
h3 { font-size: calc(1rem * var(--ab-scale)); }

p, ul, ol { margin: 0 0 1.25em; max-width: 70ch; }

a {
	color: var(--ab-link);
	text-decoration: underline;
	text-decoration-thickness: 0.09em;
	text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 0.18em; }

/* Highly visible keyboard focus everywhere */
:focus-visible {
	outline: 4px solid var(--ab-focus);
	outline-offset: 3px;
	border-radius: 2px;
}

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

/* ---------- Utility ---------------------------------------------------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.skip-link:focus {
	position: fixed;
	top: 0.5rem; left: 0.5rem;
	width: auto; height: auto;
	margin: 0;
	padding: 1rem 1.5rem;
	clip-path: none;
	white-space: normal;
	background: var(--ab-button-bg);
	color: var(--ab-button-text);
	font-weight: 700;
	z-index: 1000;
	text-decoration: none;
}

.ab-container { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.ab-narrow { max-width: 50rem; }

/* ---------- Accessibility toolbar -------------------------------------- */
.ab-toolbar {
	background: var(--ab-headings);
	color: #ffffff;
	padding: 0.4rem 0;
}
html[data-contrast='high'] .ab-toolbar { background: #121212; border-bottom: 2px solid var(--ab-border); }

.ab-toolbar-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
}
.ab-toolbar-label { font-weight: 700; font-size: 0.9rem; }
.ab-toolbar-group { display: inline-flex; gap: 0.35rem; }

.ab-toolbar-btn {
	font: inherit;
	font-size: 0.9rem;
	font-weight: 700;
	min-height: 44px;
	min-width: 44px;
	padding: 0.3rem 0.8rem;
	border: 2px solid #ffffff;
	border-radius: 0.4rem;
	background: transparent;
	color: #ffffff;
	cursor: pointer;
}
.ab-toolbar-btn:hover { background: rgba(255, 255, 255, 0.18); }
.ab-toolbar-btn[aria-pressed='true'] { background: #ffffff; color: var(--ab-headings); }
html[data-contrast='high'] .ab-toolbar-btn[aria-pressed='true'] { background: #ffd500; color: #000000; border-color: #ffd500; }

/* ---------- Header / navigation ---------------------------------------- */
.ab-header {
	background: var(--ab-bg);
	padding: 1.25rem 0;
}
html[data-contrast='high'] .ab-header { border-bottom: 2px solid var(--ab-border); }

.ab-header-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.custom-logo-link { display: inline-block; }
.custom-logo { max-height: 72px; width: auto; display: block; }

.ab-nav-toggle {
	display: none;
	font: inherit;
	font-weight: 700;
	min-height: 44px;
	padding: 0.5rem 1rem;
	border: 2px solid var(--ab-headings);
	border-radius: 0.4rem;
	background: var(--ab-bg);
	color: var(--ab-headings);
	cursor: pointer;
}

.ab-nav-list {
	list-style: none;
	display: grid;
	grid-template-columns: repeat(3, max-content);
	justify-content: end;
	gap: 0.35rem 0.25rem;
	margin: 0;
	padding: 0;
}
.ab-nav-list a { text-align: center; }
.ab-nav-list a {
	display: inline-block;
	padding: 0.6rem 0.9rem;
	font-weight: 700;
	text-decoration: none;
	color: var(--ab-headings);
	border-radius: 0.4rem;
}
.ab-nav-list a:hover { background: var(--ab-bg-alt); text-decoration: underline; }
.ab-nav-list a[aria-current='true'] {
	background: var(--ab-headings);
	color: var(--ab-bg);
}
html[data-contrast='high'] .ab-nav-list a { color: var(--ab-link); }
html[data-contrast='high'] .ab-nav-list a[aria-current='true'] { background: var(--ab-link); color: #000000; }

@media (max-width: 56rem) {
	.ab-nav-toggle { display: inline-block; }
	.ab-nav { width: 100%; text-align: center; }
	.ab-nav-list { display: none; }
	.ab-nav-list.is-open { display: flex; flex-direction: column; width: 100%; padding-top: 0.5rem; }
	.ab-nav-list a { display: block; padding: 0.9rem 1rem; text-align: center; }
}

/* ---------- Sections ---------------------------------------------------- */
.ab-section { padding: 4rem 0; }
.ab-section-alt { background: var(--ab-bg-alt); }

.ab-hero {
	background: var(--ab-bg-alt);
	padding: 4.5rem 0;
}

.ab-hero h1 { margin-bottom: 1rem; }
.ab-hero-sub {
	display: block;
	margin-top: 0.4rem;
	font-size: 0.6em;
	color: var(--ab-accent);
}
.ab-lead { font-size: 1.12rem; }
.ab-hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }

/* ---------- Buttons ----------------------------------------------------- */
.ab-button {
	display: inline-block;
	font-weight: 700;
	font-size: 1.05rem;
	min-height: 44px;
	padding: 0.85rem 1.8rem;
	border: 3px solid var(--ab-button-bg);
	border-radius: 0.5rem;
	background: var(--ab-button-bg);
	color: var(--ab-button-text);
	text-decoration: none;
	cursor: pointer;
}
.ab-button:hover { filter: brightness(1.18); text-decoration: underline; }
.ab-button-outline { background: transparent; color: var(--ab-button-bg); }
.ab-button-outline:hover { background: var(--ab-button-bg); color: var(--ab-button-text); }
html[data-contrast='high'] .ab-button-outline { color: var(--ab-link); border-color: var(--ab-link); }

/* ---------- Lists ------------------------------------------------------- */
.ab-list { padding-left: 1.4rem; }
.ab-list li { margin-bottom: 0.55rem; }
.ab-list li::marker { color: var(--ab-accent); font-weight: 700; }

/* ---------- Services grid ----------------------------------------------- */
.ab-services {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
	gap: 1.5rem;
	margin-top: 1.5rem;
}
.ab-service {
	background: var(--ab-bg-alt);
	border-left: 6px solid var(--ab-accent);
	border-radius: 0.4rem;
	padding: 1.5rem;
}
.ab-service h3 { margin-bottom: 0.5rem; }
.ab-service p { margin-bottom: 0; }
html[data-contrast='high'] .ab-service { border: 2px solid var(--ab-border); border-left-width: 6px; }

/* ---------- Contact ------------------------------------------------------ */
.ab-contact-details {
	list-style: none;
	padding: 0;
	margin: 0 0 2.5rem;
	font-size: 1.2rem;
}
.ab-contact-details li { margin-bottom: 0.6rem; }
.ab-contact-label { font-weight: 700; color: var(--ab-headings); margin-right: 0.4rem; }

/* ---------- Form --------------------------------------------------------- */
.ab-form { max-width: 40rem; }
.ab-field { margin-bottom: 1.4rem; }
.ab-field label {
	display: block;
	font-weight: 700;
	margin-bottom: 0.4rem;
	color: var(--ab-headings);
}
.ab-required { color: var(--ab-error); }

.ab-field input,
.ab-field textarea {
	font: inherit;
	width: 100%;
	min-height: 48px;
	padding: 0.7rem 0.9rem;
	color: var(--ab-text);
	background: var(--ab-bg);
	border: 2px solid var(--ab-headings);
	border-radius: 0.4rem;
}
html[data-contrast='high'] .ab-field input,
html[data-contrast='high'] .ab-field textarea { border-color: var(--ab-border); }

.ab-hp { position: absolute !important; left: -9999px; top: -9999px; }

.ab-form-status {
	border-radius: 0.4rem;
	border: 2px solid;
	padding: 1rem 1.25rem;
	margin-bottom: 1.5rem;
	font-weight: 700;
}
.ab-form-status p { margin: 0; }
.ab-form-status-success { color: var(--ab-success); background: var(--ab-success-bg); border-color: var(--ab-success); }
.ab-form-status-error { color: var(--ab-error); background: var(--ab-error-bg); border-color: var(--ab-error); }

.ab-recaptcha-note { font-size: 0.85rem; }
.grecaptcha-badge { visibility: hidden; }

/* ---------- Footer ------------------------------------------------------- */
.ab-footer {
	background: var(--ab-headings);
	color: #ffffff;
	padding: 3rem 0;
	text-align: center;
}
html[data-contrast='high'] .ab-footer { background: #121212; border-top: 2px solid var(--ab-border); }

.ab-footer a { color: #ffffff; }
html[data-contrast='high'] .ab-footer a { color: var(--ab-link); }
.ab-footer-tagline { font-size: 1.2rem; font-weight: 700; margin-left: auto; margin-right: auto; }
.ab-footer-contact { font-size: 1.1rem; margin-left: auto; margin-right: auto; }
.ab-footer-legal { margin: 1.5rem auto 0; font-size: 0.9rem; }

.ab-social {
	list-style: none;
	display: flex;
	justify-content: center;
	gap: 1rem;
	padding: 0;
	margin: 1.5rem auto;
}
.ab-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	color: #ffffff;
}
.ab-social a:hover { background: rgba(255, 255, 255, 0.18); }
html[data-contrast='high'] .ab-social a { color: var(--ab-link); border-color: var(--ab-link); }

/* ---------- Reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ---------- Print -------------------------------------------------------- */
@media print {
	.ab-toolbar, .ab-nav, .skip-link { display: none !important; }
}
