/**
 * Base — CSS custom properties (design system), reset, and typography.
 *
 * This file is the single source of truth for Hearth Kitchen's design
 * tokens (brief §33). Change a value here (or override it via the
 * Customizer — see inc/customizer.php) and it cascades everywhere: no
 * color, spacing, radius, or font size is hard-coded in any component
 * stylesheet loaded after this one.
 */

/* ---------------------------------------------------------------------
 * Design tokens
 * ------------------------------------------------------------------- */
:root {
	/* Color — warm, editorial, food-forward. Original palette; not
	   copied from any existing site. */
	--hk-color-bg: #faf7f2;
	--hk-color-surface: #ffffff;
	--hk-color-surface-alt: #f3ede2;
	--hk-color-text: #2a231c;
	--hk-color-text-muted: #6e6255;
	--hk-color-border: #e6ddcf;
	--hk-color-accent: #c1552c;
	--hk-color-accent-dark: #9c4522;
	--hk-color-accent-contrast: #ffffff;
	--hk-color-focus: #c1552c;

	/* Typography — system font stack by default: zero external font
	   requests, zero render-blocking origins, instant text paint. A
	   self-hosted display face can be added later by overriding
	   --hk-font-display only (see Phase 1 §6). */
	--hk-font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
	--hk-font-display: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;

	/* Fluid type scale (clamp: min, preferred, max) */
	--hk-text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8rem);
	--hk-text-sm: clamp(0.875rem, 0.85rem + 0.15vw, 0.95rem);
	--hk-text-base: clamp(1rem, 0.97rem + 0.2vw, 1.0625rem);
	--hk-text-lg: clamp(1.125rem, 1.08rem + 0.3vw, 1.25rem);
	--hk-text-xl: clamp(1.375rem, 1.3rem + 0.5vw, 1.625rem);
	--hk-text-2xl: clamp(1.75rem, 1.6rem + 0.9vw, 2.25rem);
	--hk-text-3xl: clamp(2.1rem, 1.85rem + 1.4vw, 2.9rem);
	--hk-text-4xl: clamp(2.6rem, 2.2rem + 2.2vw, 3.75rem);
	--hk-line-tight: 1.15;
	--hk-line-snug: 1.35;
	--hk-line-normal: 1.6;

	/* Spacing scale */
	--hk-space-1: 0.25rem;
	--hk-space-2: 0.5rem;
	--hk-space-3: 0.75rem;
	--hk-space-4: 1rem;
	--hk-space-5: 1.5rem;
	--hk-space-6: 2rem;
	--hk-space-7: 3rem;
	--hk-space-8: 4.5rem;

	/* Radius / shadow */
	--hk-radius-sm: 6px;
	--hk-radius-md: 10px;
	--hk-radius-lg: 18px;
	--hk-radius-pill: 999px;
	--hk-shadow-sm: 0 1px 2px rgba(30, 20, 10, 0.06);
	--hk-shadow-md: 0 6px 20px -4px rgba(30, 20, 10, 0.18);

	/* Layout */
	--hk-container-max: 1280px;
	--hk-container-pad: clamp(1rem, 4vw, 2.5rem);
	--hk-header-height: 72px;
	--hk-border-width: 1px;
}

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

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

body {
	margin: 0;
	background-color: var(--hk-color-bg);
	color: var(--hk-color-text);
	font-family: var(--hk-font-body);
	font-size: var(--hk-text-base);
	line-height: var(--hk-line-normal);
	-webkit-font-smoothing: antialiased;
}

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

img {
	/* Explicit width/height attributes (set by wp_get_attachment_image)
	   reserve space; this just guards any image missing them. */
	background-color: var(--hk-color-surface-alt);
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--hk-font-display);
	line-height: var(--hk-line-tight);
	font-weight: 700;
	margin: 0 0 var(--hk-space-3);
	color: var(--hk-color-text);
}

h1 {
	font-size: var(--hk-text-4xl);
}

h2 {
	font-size: var(--hk-text-3xl);
}

h3 {
	font-size: var(--hk-text-2xl);
}

h4 {
	font-size: var(--hk-text-xl);
}

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

ul,
ol {
	margin: 0 0 var(--hk-space-4);
	padding-inline-start: var(--hk-space-5);
}

a {
	color: inherit;
	text-decoration-color: var(--hk-color-accent);
	text-underline-offset: 0.15em;
}

a:not([class]) {
	color: var(--hk-color-accent-dark);
}

a:hover {
	text-decoration-thickness: 2px;
}

button,
input,
select,
textarea {
	font-family: inherit;
	font-size: 100%;
}

button {
	cursor: pointer;
}

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

.skip-link {
	position: absolute;
	top: -100px;
	left: var(--hk-space-3);
	z-index: 10000;
	background: var(--hk-color-text);
	color: var(--hk-color-accent-contrast);
	padding: var(--hk-space-3) var(--hk-space-4);
	border-radius: var(--hk-radius-sm);
	transition: top 0.15s ease-out;
}

.skip-link:focus {
	top: var(--hk-space-3);
}

:focus-visible {
	outline: 3px solid var(--hk-color-focus);
	outline-offset: 2px;
}

/* Only apply the strong focus ring to keyboard users; mouse users don't
   see a ring on click (:focus-visible handles this natively). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
	outline: 3px solid var(--hk-color-focus);
	outline-offset: 2px;
	border-radius: var(--hk-radius-sm);
}

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