/**
 * Base: reset, typography, utilities and shared components.
 * All values come from tokens.css.
 */

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

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

body {
	margin: 0;
	overflow-x: clip;
	background: var(--ph-color-bg);
	color: var(--ph-color-text);
	font-family: var(--ph-font-body);
	font-size: var(--ph-fs-body);
	line-height: var(--ph-lh-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0;
	color: inherit;
	font-family: var(--ph-font-heading);
	font-weight: var(--ph-fw-heading);
	line-height: 1.12;
}

p {
	margin: 0;
}

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

a {
	color: var(--ph-forest);
}

button {
	font: inherit;
	color: inherit;
}

/* Focus — visible, on-brand. Dark contexts switch --ph-focus to gold. */
:focus-visible {
	outline: 2px solid var(--ph-focus, var(--ph-forest));
	outline-offset: 3px;
}

main:focus {
	outline: none;
}

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

.ph-container {
	width: 100%;
	max-width: calc(var(--ph-container) + var(--ph-gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--ph-gutter);
}

.site-main--default {
	padding-top: calc(var(--ph-header-h) + var(--ph-space-xl));
	padding-bottom: var(--ph-space-2xl);
}

/* Anchor targets: land below the fixed (compact) header. Smooth scrolling
   only for visitors who have not asked for reduced motion. */
section[id],
footer[id] {
	scroll-margin-top: calc(var(--ph-header-h-compact) + var(--ph-space-s));
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

/* Accessibility helpers ---------------------------------------------------- */

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

.skip-link:focus {
	--ph-focus: var(--ph-gold);

	position: fixed !important;
	top: calc(var(--wp-admin--admin-bar--height, 0px) + 0.75rem);
	left: 0.75rem;
	z-index: var(--ph-z-skip);
	width: auto;
	height: auto;
	margin: 0;
	padding: 0.875rem 1.25rem;
	clip: auto;
	clip-path: none;
	border-radius: 0.5rem;
	background: var(--ph-deep);
	color: var(--ph-cream);
	font-weight: 600;
	text-decoration: none;
}

/* Shared components -------------------------------------------------------- */

/* Buttons: colours come from --ph-btn-* so each context can restyle them. */
.ph-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--ph-tap);
	padding: 0 1.375rem;
	border: 1px solid var(--ph-btn-border, var(--ph-forest));
	border-radius: var(--ph-radius-pill);
	background: var(--ph-btn-bg, var(--ph-forest));
	color: var(--ph-btn-fg, var(--ph-cream));
	font-family: var(--ph-font-body);
	font-size: var(--ph-fs-nav);
	font-weight: 500;
	letter-spacing: 0.01em;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition:
		background-color var(--ph-dur-base) var(--ph-ease-out),
		border-color var(--ph-dur-base) var(--ph-ease-out),
		color var(--ph-dur-base) var(--ph-ease-out);
}

.ph-button:hover {
	--ph-btn-bg: var(--ph-deep);
	--ph-btn-border: var(--ph-deep);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-delay: 0s !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
		scroll-behavior: auto !important;
	}
}
