/* =========================================================================
   2 · RESET — modern reset + overflow safety + accessibility utilities
   Reference: RESPONSIVE-DESIGN-RESEARCH §3.5 + V4-BUILD-SPEC §3.5
   ========================================================================= */

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

/* Overflow safety net — kills the #1 "horizontal scroll on phones" complaint.
   `clip` keeps `position: sticky` working unlike `hidden`. */
html, body {
	overflow-x: clip;
	max-width: 100%;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
	margin: 0;
	font-family: var(--jj-font-sans);
	font-size: var(--fs-base);
	line-height: 1.6;
	color: var(--jj-text);
	background: var(--jj-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	min-height: 100vh;
	min-height: 100dvh;
}

/* Media — never wider than container; aspect preserved by default */
img, video, svg, picture, iframe, embed, object {
	max-width: 100%;
	height: auto;
	display: block;
}

img, picture {
	font-style: italic;          /* Alt-text styling when image broken */
	background-repeat: no-repeat;
	background-size: cover;
}

button {
	font: inherit;
	color: inherit;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
}

input, select, textarea {
	font: inherit;
}

a {
	color: var(--jj-primary);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--jj-primary-deep); }

:focus-visible {
	outline: 3px solid var(--jj-accent-gold);
	outline-offset: 3px;
	border-radius: 2px;
}

::selection {
	background: var(--jj-accent-gold);
	color: var(--jj-text);
}

hr {
	border: 0;
	border-top: 1px solid var(--jj-border);
	margin: var(--sp-12) 0;
}

pre, code {
	overflow-wrap: anywhere;
	word-break: break-word;
}

/* Touch targets — 48×48 floor on primary interactives. WCAG 2.2 + Apple HIG. */
:where(
	a.jj-btn,
	button.jj-btn,
	input[type="submit"],
	.jj-header__menu-toggle,
	.jj-header__search-toggle
) {
	min-height: 48px;
}

/* Screen-reader-only utility — visible on focus */
.screen-reader-text {
	position: absolute !important;
	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 {
	background: var(--jj-accent-gold);
	color: var(--jj-text);
	clip: auto;
	clip-path: none;
	display: block;
	width: auto;
	height: auto;
	padding: var(--sp-3) var(--sp-4);
	left: 1rem;
	top: 1rem;
	position: absolute;
	z-index: 9999;
	font-weight: 600;
	border-radius: var(--radius-md);
	text-decoration: none;
}

/* Skip-to-content link */
.jj-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--jj-primary);
	color: #fff !important;
	padding: var(--sp-3) var(--sp-4);
	z-index: 9999;
	text-decoration: none;
	font-weight: 600;
}
.jj-skip-link:focus {
	left: 1rem;
	top: 1rem;
}

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