/**
 * WP Expertz — Base Styles
 *
 * Foundational resets and defaults only. No component design, no section
 * layout, no page-specific styling — that begins in Phase 3B+. Every value
 * here references a token from tokens.css rather than a raw number/color.
 */

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

/* ---------------------------------------------------------------
 * BODY DEFAULTS
 * ------------------------------------------------------------- */
html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: var(--text-body-size);
	line-height: var(--text-body-line);
	font-weight: 400;
	color: var(--color-text-primary);
	background-color: var(--color-background);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

@media (max-width: 767px) {
	body {
		font-size: var(--text-body-size-mobile);
		line-height: var(--text-body-line-mobile);
	}
}

/* ---------------------------------------------------------------
 * TYPOGRAPHY DEFAULTS
 * ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--font-display);
	color: var(--color-text-primary);
	margin: 0 0 var(--space-16) 0;
}

h1 {
	font-size: var(--text-h1-size);
	line-height: var(--text-h1-line);
	font-weight: var(--text-h1-weight);
	letter-spacing: -0.01em;
}

h2 {
	font-size: var(--text-h2-size);
	line-height: var(--text-h2-line);
	font-weight: var(--text-h2-weight);
	letter-spacing: -0.01em;
}

h3 {
	font-size: var(--text-h3-size);
	line-height: var(--text-h3-line);
	font-weight: var(--text-h3-weight);
}

h4 {
	font-size: var(--text-h4-size);
	line-height: var(--text-h4-line);
	font-weight: var(--text-h4-weight);
}

@media (max-width: 767px) {
	h1 { font-size: var(--text-h1-size-mobile); line-height: var(--text-h1-line-mobile); }
	h2 { font-size: var(--text-h2-size-mobile); line-height: var(--text-h2-line-mobile); }
	h3 { font-size: var(--text-h3-size-mobile); line-height: var(--text-h3-line-mobile); }
	h4 { font-size: var(--text-h4-size-mobile); line-height: var(--text-h4-line-mobile); }
}

p {
	margin: 0 0 var(--space-16) 0;
}

small {
	font-size: var(--text-body-sm-size);
	line-height: var(--text-body-sm-line);
}

/* ---------------------------------------------------------------
 * LINKS
 * ------------------------------------------------------------- */
a {
	color: var(--color-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
	transition: color var(--transition-base);
}

a:hover {
	color: var(--color-primary-dark);
}

/* ---------------------------------------------------------------
 * IMAGES & MEDIA
 * ------------------------------------------------------------- */
img,
svg,
video {
	max-width: 100%;
	height: auto;
	display: block;
}

/* ---------------------------------------------------------------
 * FORM ELEMENTS — minimal baseline only.
 * Full form-system styling (Phase 2, Section 26) arrives with the
 * form component build in a later Phase 3 stage.
 * ------------------------------------------------------------- */
button,
input,
textarea,
select {
	font-family: inherit;
	font-size: 100%;
}

button {
	cursor: pointer;
}

/* ---------------------------------------------------------------
 * FOCUS-VISIBLE BASELINE (accessibility-safe default)
 * Component-specific focus treatments (Phase 2, Section 25/26) will
 * refine this further; this ensures nothing is ever focus-invisible
 * even before those components exist.
 * ------------------------------------------------------------- */
:focus-visible {
	outline: 2px solid var(--color-accent);
	outline-offset: 2px;
}

/* Never remove focus indication without an equally visible replacement. */
:focus:not(:focus-visible) {
	outline: none;
}

/* ---------------------------------------------------------------
 * SCREEN-READER-ONLY UTILITY
 * Genuinely necessary now: skip-link and future accessible labels
 * depend on this existing from the start, not bolted on later.
 * ------------------------------------------------------------- */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	position: fixed;
	top: var(--space-8);
	left: var(--space-8);
	width: auto;
	height: auto;
	padding: var(--space-8) var(--space-16);
	background: var(--color-primary);
	color: var(--color-text-on-dark);
	z-index: 100000;
	clip: auto;
	text-decoration: none;
	border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------
 * CONTAINER / LAYOUT FOUNDATION
 * Minimal width system only — full grid/section layout patterns
 * (Phase 2, Section 5) are implemented alongside actual sections.
 *
 * CONTAINER WIDTH CORRECTION (Phase 3A review):
 * Because box-sizing: border-box is applied globally, a naive
 * `max-width: var(--container-main); padding-left/right: <gutter>`
 * pairing causes the horizontal padding to be subtracted FROM the
 * 1140px max-width, leaving only ~1012px of actual usable content
 * width at desktop — not the intended ~1140px.
 *
 * Fix: max-width is expressed as the content width PLUS twice the
 * gutter at each breakpoint, using calc() against the existing
 * tokens (no new hard-coded literals introduced). This keeps the
 * usable inner content width equal to --container-main at every
 * breakpoint while padding still creates the responsive gutters,
 * all from the same token set.
 * ------------------------------------------------------------- */
.wp-expertz-container {
	width: 100%;
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--space-page-x-mobile);
	padding-right: var(--space-page-x-mobile);
	max-width: calc(var(--container-main) + (2 * var(--space-page-x-mobile)));
}

@media (min-width: 768px) {
	.wp-expertz-container {
		padding-left: var(--space-page-x-tablet);
		padding-right: var(--space-page-x-tablet);
		max-width: calc(var(--container-main) + (2 * var(--space-page-x-tablet)));
	}
}

@media (min-width: 1200px) {
	.wp-expertz-container {
		padding-left: var(--space-page-x-desktop);
		padding-right: var(--space-page-x-desktop);
		max-width: calc(var(--container-main) + (2 * var(--space-page-x-desktop)));
	}
}

.wp-expertz-container--reading {
	max-width: var(--container-reading);
}

/* ---------------------------------------------------------------
 * REDUCED MOTION
 * Global baseline — respected from the start rather than retrofitted
 * once animated components exist (Phase 2, Section 29).
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---------------------------------------------------------------
 * 404 PAGE (Phase 3J QA fix)
 * Minimal, in base.css since it's the one page-type with no other
 * scoped stylesheet reliably loaded on it (front-page/service/case-study
 * conditions in enqueue.php don't cover a 404 URL).
 * ------------------------------------------------------------- */
.wpx-404 {
	text-align: center;
	padding-top: var(--space-section-y-mobile);
	padding-bottom: var(--space-section-y-mobile);
}

@media (min-width: 768px) {
	.wpx-404 { padding-top: var(--space-section-y-tablet); padding-bottom: var(--space-section-y-tablet); }
}
@media (min-width: 1200px) {
	.wpx-404 { padding-top: var(--space-section-y-desktop); padding-bottom: var(--space-section-y-desktop); }
}

.wpx-404__message {
	color: var(--color-text-secondary);
	margin-bottom: var(--space-24);
}

.wpx-404__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-16);
}
