:root {
	--tj-color-bg: var(--wp--preset--color--bg, #f4f1ed);
	--tj-color-surface: var(--wp--preset--color--surface, #faf7f2);
	--tj-color-surface-2: var(--wp--preset--color--surface-2, #ffffff);
	--tj-color-ink: var(--wp--preset--color--ink, #18221f);
	--tj-color-ink-2: var(--wp--preset--color--ink-2, #2b3433);
	--tj-color-muted: var(--wp--preset--color--mute, #5f6766);
	--tj-color-rule: var(--wp--preset--color--rule, #ddd7cb);
	--tj-color-primary: var(--wp--preset--color--primary, #2f5f65);
	--tj-color-primary-soft: var(--wp--preset--color--primary-soft, #dce8e8);
	--tj-color-accent: var(--wp--preset--color--accent, #b27b53);
	--tj-radius-card: 8px;
	--tj-radius-button: 999px;
	--tj-focus-ring: 0 0 0 3px color-mix(in srgb, var(--tj-color-primary) 35%, transparent);
}

/* Native navigation and form focus stay immediate until the theme script is ready. */
html {
	scroll-behavior: auto;
}

html.tj-has-js {
	scroll-behavior: smooth;
}

body {
	background: var(--tj-color-bg);
	color: var(--tj-color-ink);
}

body.admin-bar .tj-skip-link {
	top: 32px;
}

.tj-skip-link {
	position: absolute;
	left: var(--wp--preset--spacing--30, 1rem);
	top: var(--wp--preset--spacing--30, 1rem);
	z-index: 100000;
	transform: translateY(-150%);
	border: 1px solid var(--tj-color-rule);
	border-radius: var(--tj-radius-button);
	background: var(--tj-color-surface-2);
	color: var(--tj-color-ink);
	padding: 0.75rem 1rem;
	text-decoration: none;
	box-shadow: var(--wp--preset--shadow--md, 0 12px 32px rgba(21, 32, 28, 0.08));
}

.tj-skip-link:focus {
	transform: translateY(0);
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--tj-color-primary);
	outline-offset: 3px;
	box-shadow: var(--tj-focus-ring);
}

:where(.wp-block-button__link) {
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

body.tj-no-feature-motion :where(.wp-block-button__link) {
	transition: none;
}

body.tj-feature-motion :where(.wp-block-button__link):hover {
	transform: translateY(-1px);
}

:where(.wp-block-group, .wp-block-columns, .wp-block-cover) {
	box-sizing: border-box;
}

:where(.wp-block-cover) {
	overflow: hidden;
}

:where(.wp-block-image img) {
	display: block;
	height: auto;
	max-width: 100%;
}

:where(.wp-block-navigation__responsive-container.is-menu-open) {
	padding: var(--wp--preset--spacing--40, 1.5rem);
}

:where(.wp-block-details summary) {
	cursor: pointer;
	font-weight: 600;
}

/* Shared primary-link presentation for the default and alternate headers. */
.tj-primary-nav {
	display: flex;
	gap: var(--wp--preset--spacing--30, 1rem);
	align-items: center;
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
}

.tj-primary-nav a {
	color: var(--tj-color-ink);
	text-decoration: none;
	transition: color 160ms ease, text-decoration-color 160ms ease;
}

.tj-primary-nav a:hover,
.tj-primary-nav a:focus-visible {
	color: var(--tj-color-primary);
	text-decoration: underline;
	text-underline-offset: 4px;
}

:where(.wp-block-details > :last-child) {
	margin-bottom: 0;
}

body.tj-no-feature-pattern-ornaments .is-style-monolith-meta,
body.tj-no-feature-pattern-ornaments .eyebrow {
	letter-spacing: 0.08em;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*, *::before, *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.001ms !important;
	}
}

/* ─────────────────────────────────────────────────────────────────
 * Sticky mobile CTA bar — fixed-bottom, mobile only, feature-gated
 * Auto-rendered via TJ_Theme::render_sticky_mobile_cta() when the
 * sticky_mobile_cta feature flag is on. Hidden by default; the
 * @media + body class combo makes it visible only on phones.
 * ───────────────────────────────────────────────────────────────── */

.tj-sticky-cta {
	display: none;
}

@media (max-width: 782px) {
	body.tj-feature-sticky-mobile-cta .tj-sticky-cta {
		display: flex;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		z-index: 90;
		align-items: center;
		gap: 12px;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
		background: var(--wp--preset--color--surface-2, var(--wp--preset--color--surface));
		border-top: 1px solid var(--wp--preset--color--rule);
		box-shadow: 0 -4px 14px rgba(21, 32, 28, 0.08);
	}

	body.tj-feature-sticky-mobile-cta.admin-bar .tj-sticky-cta {
		bottom: 0;
	}

	.tj-sticky-cta__eyebrow {
		flex: 0 0 auto;
		font-family: var(--wp--preset--font-family--sans, ui-sans-serif, system-ui, sans-serif);
		font-size: 11px;
		font-weight: 500;
		letter-spacing: 0.1em;
		text-transform: uppercase;
		color: var(--wp--preset--color--mute);
		display: none;
	}

	@media (min-width: 481px) {
		.tj-sticky-cta__eyebrow { display: inline; }
	}

	.tj-sticky-cta__primary {
		flex: 1 1 auto;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		background: var(--wp--preset--color--primary);
		color: var(--wp--preset--color--bg);
		padding: 12px 18px;
		border-radius: 999px;
		font-family: var(--wp--preset--font-family--sans, ui-sans-serif, system-ui, sans-serif);
		font-size: 15px;
		font-weight: 600;
		letter-spacing: 0.01em;
		text-decoration: none;
		white-space: nowrap;
		transition: background 0.15s ease;
	}

	.tj-sticky-cta__primary:hover,
	.tj-sticky-cta__primary:focus-visible {
		background: var(--wp--preset--color--ink);
	}

	.tj-sticky-cta__secondary {
		flex: 0 0 auto;
		font-family: var(--wp--preset--font-family--sans, ui-sans-serif, system-ui, sans-serif);
		font-size: 14px;
		font-weight: 500;
		color: var(--wp--preset--color--ink);
		text-decoration: none;
		padding: 8px 4px;
	}

	.tj-sticky-cta__secondary:hover,
	.tj-sticky-cta__secondary:focus-visible {
		color: var(--wp--preset--color--primary);
		text-decoration: underline;
		text-underline-offset: 3px;
	}

	/* Ensure page content doesn't sit under the sticky bar */
	body.tj-feature-sticky-mobile-cta {
		padding-bottom: 70px;
	}
}

@media (max-width: 782px) {
	body.admin-bar .tj-skip-link {
		top: 46px;
	}

	:where(header.wp-block-template-part > .wp-block-group, header .wp-block-group:first-child) {
		padding-inline: var(--wp--preset--spacing--30, 1rem) !important;
	}

	:where(header .wp-block-group) {
		gap: var(--wp--preset--spacing--20, 0.75rem);
	}

	:where(.wp-block-buttons) {
		width: 100%;
	}

	:where(.wp-block-button, .wp-block-button__link) {
		width: 100%;
	}

	:where(.wp-block-button__link) {
		text-align: center;
	}

	/* Hide primary nav on mobile until a proper hamburger ships.
	   Mobile users have the CTA button in the header + footer nav for now. */
	.tj-primary-nav {
		display: none;
	}
}

/* The default header uses editable core Navigation; alternate headers retain their layout. */
.tj-default-header .tj-default-navigation {
	display: flex;
}

@media (max-width: 782px) {
	.tj-default-header .tj-default-header__row {
		flex-wrap: wrap;
	}

	.tj-default-header .tj-default-header__brand {
		flex: 1;
		min-width: 0;
		overflow-wrap: anywhere;
	}

	.tj-default-header .tj-default-header__action {
		flex-basis: 100%;
	}

	/* Extend core's mobile layout to the theme's existing header breakpoint. */
	.tj-default-header .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none;
	}

	.tj-default-header .wp-block-navigation__responsive-container-open {
		display: flex;
	}
}
