/* Frontend foundation. Preserve browser/WP headings, lists and content margins. */
body {
	margin: 0;
	background: var(--cargo-surface);
	color: var(--cargo-ink);
	font-family: var(--cargo-font-body);
	font-size: var(--cargo-text-base);
	line-height: var(--cargo-leading-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* Scoped instead of a universal Preflight: do not reset WP toolbar/plugin UI. */
:where(.cargo-theme-container, .cargo-layout),
:where(.cargo-theme-container, .cargo-layout) *,
:where(.cargo-theme-container, .cargo-layout) *::before,
:where(.cargo-theme-container, .cargo-layout) *::after {
	box-sizing: border-box;
}

:where(.cargo-theme-container, .cargo-layout) :where(h1, h2, h3, h4, h5, h6) {
	font-family: var(--cargo-font-heading);
	line-height: var(--cargo-leading-heading);
	overflow-wrap: anywhere;
}

:where(.cargo-theme-container, .cargo-layout) a {
	color: var(--cargo-link);
	text-underline-offset: 0.2em;
}
:where(.cargo-theme-container, .cargo-layout) a:hover {
	color: var(--cargo-link-hover);
}

:where(.cargo-theme-container, .cargo-layout) :where(button, input, select, textarea) {
	font: inherit;
	color: inherit;
	max-width: 100%;
}
:where(.cargo-theme-container, .cargo-layout) :where(button, input[type="submit"], input[type="button"]) {
	cursor: pointer;
}
:where(.cargo-theme-container, .cargo-layout) :where(button, input, select, textarea):disabled {
	cursor: default;
}

/* Opt-in control foundation; native content/plugin controls keep their design. */
.cargo-control {
	border: var(--cargo-border-width) solid var(--cargo-border-strong);
	border-radius: var(--cargo-radius-md);
	padding: var(--cargo-space-2) var(--cargo-space-3);
	background: var(--cargo-card);
	color: var(--cargo-ink);
}
textarea.cargo-control { resize: vertical; }
.cargo-control::placeholder { color: var(--cargo-muted); opacity: 1; }
button.cargo-control:hover:not(:disabled) { background: var(--cargo-soft); }

:where(.cargo-theme-container, .cargo-layout) :where(img, video, svg) {
	max-width: 100%;
	height: auto;
}
:where(.cargo-theme-container, .cargo-layout) :where(pre, .wp-block-table) {
	max-width: 100%;
	overflow-x: auto;
}
:where(.cargo-theme-container, .cargo-layout) :where(code, pre) {
	font-family: var(--cargo-font-mono);
}
:where(.cargo-theme-container, .cargo-layout) :where(p, li, dd, address, a) {
	overflow-wrap: anywhere;
}
:where(.cargo-theme-container, .cargo-layout) :focus-visible,
.cargo-control:focus-visible {
	outline: var(--cargo-focus-width) solid var(--cargo-focus);
	outline-offset: var(--cargo-focus-offset);
}

/* WordPress accessibility utility: hidden text remains available to readers. */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	white-space: nowrap;
}
.screen-reader-text:focus {
	clip-path: none;
	height: auto;
	margin: 0;
	padding: var(--cargo-space-3);
	width: auto;
	white-space: normal;
	background: var(--cargo-card);
	color: var(--cargo-ink);
	z-index: var(--cargo-z-header);
}

/* No reveal/JS-dependent visibility; reduced motion includes scrolling. */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	:where(.cargo-theme-container, .cargo-layout),
	:where(.cargo-theme-container, .cargo-layout) *,
	:where(.cargo-theme-container, .cargo-layout) *::before,
	:where(.cargo-theme-container, .cargo-layout) *::after {
		animation: none !important;
		transition: none !important;
		scroll-behavior: auto !important;
	}
}
