/* ============================================
   TMF Theme - Custom Styles
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
	--tmf-primary: #16232A;
	--tmf-secondary: #006F8B;
	--tmf-accent: #FF5B04;
	--tmf-accent-hover: #E04F00;
	--tmf-dark-teal: #0C464C;
	--tmf-blue: #2472B9;
	--tmf-light-bg: #F5F7F8;
	--tmf-white: #FFFFFF;
	--tmf-muted: #717182;
	--tmf-border: #DEE9EC;
	--tmf-input-bg: #F3F3F5;
	--tmf-text-secondary: #49555D;
	--tmf-text-tertiary: #5C6970;
	--tmf-radius-sm: 0.125rem;
	--tmf-radius-md: 0.375rem;
	--tmf-radius-lg: 0.5rem;
	--tmf-radius-xl: 0.75rem;
	--tmf-radius-2xl: 1rem;
	--tmf-radius-full: 9999px;
	--tmf-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--tmf-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
	--tmf-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
	--tmf-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
	--tmf-header-height: 72px;
	--tmf-utility-bar-height: 36px;
}

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

body {
	font-family: 'Funnel Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-weight: 400;
	line-height: 1.5;
	color: var(--tmf-primary);
	background-color: var(--tmf-white);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* --- Skip to Content Link --- */
.skip-to-content {
	position: absolute;
	top: -100%;
	left: 50%;
	transform: translateX(-50%);
	background: var(--tmf-accent);
	color: var(--tmf-white);
	padding: 0.75rem 1.5rem;
	border-radius: var(--tmf-radius-lg);
	font-weight: 600;
	z-index: 9999;
	text-decoration: none;
	transition: top 0.2s;
}

.skip-to-content:focus {
	top: 0.5rem;
}

/* --- Focus Indicators (WCAG) --- */
*:focus-visible {
	outline: 2px solid var(--tmf-accent);
	outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--tmf-accent);
	outline-offset: 2px;
}

/* --- Utility Bar --- */
.tmf-utility-bar {
	background-color: var(--tmf-primary);
	color: rgba(255, 255, 255, 0.9);
	height: var(--tmf-utility-bar-height);
	font-size: 0.75rem;
}

.tmf-utility-bar a {
	color: rgba(255, 255, 255, 0.9);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	transition: color 0.2s;
}

.tmf-utility-bar a:hover {
	color: var(--tmf-white);
}

.tmf-utility-bar svg {
	width: 0.75rem;
	height: 0.75rem;
}

/* --- Header --- */
/* Make the template-part wrapper sticky so the header sticks properly */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 50;
}

.tmf-header {
	background: var(--tmf-white);
	z-index: 50;
	box-shadow: var(--tmf-shadow-sm);
}

.tmf-header-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--tmf-header-height);
}

/* --- Logo --- */
.tmf-logo {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	text-decoration: none;
	flex-shrink: 0;
}

.tmf-logo img {
	width: 6rem;
	height: 5rem;
	border-radius: var(--tmf-radius-xl);
	object-fit: contain;
}

.tmf-logo-text {
	font-size: 1.2rem;
	letter-spacing: 0.04em;
	font-weight: 500;
	color: var(--tmf-secondary);
}

@media (max-width: 480px) {
	.tmf-logo-text {
		display: none;
	}
}

/* --- Desktop Navigation --- */
.tmf-nav {
	display: none;
	align-items: center;
	gap: 0.25rem;
}

@media (min-width: 1024px) {
	.tmf-nav {
		display: flex;
	}
}

.tmf-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.tmf-nav li {
	margin: 0;
}

.tmf-nav a {
	padding: 0.5rem 1rem;
	font-size: 1rem;
	font-weight: 500;
	color: rgba(22, 35, 42, 0.8);
	text-decoration: none;
	border-radius: var(--tmf-radius-full);
	transition: all 0.2s;
}

.tmf-nav a:hover {
	background-color: var(--tmf-primary);
	color: var(--tmf-white);
}

.tmf-nav a:active {
	background-color: var(--tmf-accent);
	color: var(--tmf-white);
	transform: scale(0.95);
}

.tmf-nav a[aria-current="page"],
.tmf-nav a.is-active {
	color: var(--tmf-accent);
	font-weight: 700;
	background-color: rgba(255, 91, 4, 0.06);
	font-weight: 600;
}

/* --- Header Actions --- */
.tmf-header-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

/* --- Icon Buttons --- */
.tmf-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	border-radius: var(--tmf-radius-full);
	border: none;
	background: transparent;
	color: rgba(22, 35, 42, 0.6);
	cursor: pointer;
	transition: all 0.2s;
}

.tmf-icon-btn:hover {
	color: var(--tmf-accent);
	background-color: rgba(255, 91, 4, 0.05);
}

.tmf-icon-btn svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* --- CTA Button --- */
.tmf-btn-primary {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.375rem 1.25rem;
	background-color: var(--tmf-accent);
	color: var(--tmf-white);
	border: none;
	border-radius: var(--tmf-radius-lg);
	font-weight: 700;
	font-size: 1.175rem;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	box-shadow: var(--tmf-shadow-sm);
	transition: background-color 0.2s;
}

.tmf-btn-primary:hover {
	background-color: var(--tmf-accent-hover);
	color: var(--tmf-white);
}

.tmf-btn-outline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1.25rem;
	background-color: transparent;
	color: var(--tmf-primary);
	border: 1px solid var(--tmf-border);
	border-radius: var(--tmf-radius-lg);
	font-weight: 500;
	font-size: 1rem;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
}

.tmf-btn-outline:hover {
	border-color: var(--tmf-primary);
	background-color: var(--tmf-light-bg);
}

.tmf-btn-white {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.5rem;
	background-color: var(--tmf-white);
	color: var(--tmf-primary);
	border: none;
	border-radius: var(--tmf-radius-lg);
	font-weight: 600;
	font-size: 1rem;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
}

.tmf-btn-white:hover {
	background-color: var(--tmf-light-bg);
}

.tmf-btn-white-outline {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.625rem 1.5rem;
	background-color: transparent;
	color: var(--tmf-white);
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-radius: var(--tmf-radius-lg);
	font-weight: 600;
	font-size: 1rem;
	font-family: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
}

.tmf-btn-white-outline:hover {
	background-color: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.6);
}

/* --- Mobile Menu Toggle (visible < 1024px) --- */
.tmf-mobile-toggle {
	display: inline-flex;
}

@media (min-width: 1024px) {
	.tmf-mobile-toggle {
		display: none;
	}
}

/* --- Desktop CTA (hidden < 1024px) --- */
.tmf-header-cta {
	display: none;
}

@media (min-width: 1024px) {
	.tmf-header-cta {
		display: inline-flex;
	}
}

/* --- Search Overlay --- */
.tmf-search-overlay {
	position: fixed;
	inset: 0;
	z-index: 60;
	background: rgba(22, 35, 42, 0.8);
	backdrop-filter: blur(4px);
	display: none;
}

.tmf-search-overlay.is-open {
	display: block;
}

.tmf-search-overlay-inner {
	background: var(--tmf-white);
	box-shadow: var(--tmf-shadow-xl);
}

.tmf-search-overlay-content {
	max-width: 1280px;
	margin: 0 auto;
	padding: 1.5rem;
}

.tmf-search-field-wrapper {
	position: relative;
	max-width: 48rem;
	margin: 0 auto;
}

.tmf-search-input {
	width: 100%;
	background: var(--tmf-light-bg);
	border: 1px solid var(--tmf-border);
	border-radius: var(--tmf-radius-xl);
	padding: 1.25rem 3rem;
	font-size: 1.1rem;
	font-family: inherit;
	color: var(--tmf-primary);
	transition: border-color 0.2s, box-shadow 0.2s;
}

.tmf-search-input:focus {
	outline: none;
	border-color: transparent;
	box-shadow: 0 0 0 2px var(--tmf-accent);
}

.tmf-search-input::placeholder {
	color: rgba(22, 35, 42, 0.3);
}

.tmf-search-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: rgba(22, 35, 42, 0.3);
}

.tmf-search-icon svg {
	width: 1.25rem;
	height: 1.25rem;
}

.tmf-search-close {
	position: absolute;
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	color: rgba(22, 35, 42, 0.4);
	cursor: pointer;
	padding: 0.25rem;
	border-radius: var(--tmf-radius-full);
	transition: color 0.2s;
}

.tmf-search-close:hover {
	color: var(--tmf-primary);
}

/* --- Mobile Navigation --- */
.tmf-mobile-nav {
	display: none;
	background: var(--tmf-white);
	border-top: 1px solid var(--tmf-border);
	box-shadow: var(--tmf-shadow-lg);
}

.tmf-mobile-nav.is-open {
	display: block;
}

@media (min-width: 1024px) {
	.tmf-mobile-nav.is-open {
		display: none;
	}
}

.tmf-mobile-nav-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0.75rem 1.5rem;
}

.tmf-mobile-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tmf-mobile-nav li {
	margin: 0;
}

.tmf-mobile-nav a {
	display: block;
	padding: 0.875rem 1rem;
	border-radius: var(--tmf-radius-lg);
	font-weight: 500;
	color: rgba(22, 35, 42, 0.8);
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.tmf-mobile-nav a:hover {
	background-color: var(--tmf-light-bg);
}

.tmf-mobile-nav a[aria-current="page"],
.tmf-mobile-nav a.is-active {
	background-color: rgba(255, 91, 4, 0.05);
	color: var(--tmf-accent);
	border-left: 3px solid var(--tmf-accent);
	font-weight: 600;
}

.tmf-mobile-nav-footer {
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid var(--tmf-border);
}

.tmf-mobile-nav-contact {
	margin-top: 0.75rem;
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0 1rem;
	font-size: 0.875rem;
	color: rgba(22, 35, 42, 0.6);
}

.tmf-mobile-nav-contact a {
	display: inline;
	padding: 0;
	font-size: 0.875rem;
	color: rgba(22, 35, 42, 0.6);
}

.tmf-mobile-nav-contact a:hover {
	color: var(--tmf-accent);
	background: none;
}

/* --- Footer --- */
.tmf-footer {
	background-color: var(--tmf-primary);
	color: var(--tmf-white);
}

.tmf-footer-inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 3.5rem 1.5rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 2.5rem;
}

@media (min-width: 768px) {
	.tmf-footer-inner {
		grid-template-columns: 1fr 1fr;
	}
}

@media (min-width: 1024px) {
	.tmf-footer-inner {
		grid-template-columns: 1fr 1fr 1fr 1fr;
	}
}

.tmf-footer-brand {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.25rem;
}

.tmf-footer-brand img {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: var(--tmf-radius-xl);
	object-fit: contain;
}

.tmf-footer-brand-name {
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.2;
	color: var(--tmf-white);
}

.tmf-footer-brand-sub {
	font-size: 0.65rem;
	letter-spacing: 0.04em;
	font-weight: 500;
	color: rgba(255, 255, 255, 0.6);
}

.tmf-footer p {
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.875rem;
	line-height: 1.7;
}

.tmf-footer h3 {
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.6);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	margin-bottom: 1.25rem;
}

.tmf-footer-links {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
}

.tmf-footer-links li {
	margin: 0;
}

.tmf-footer-links a {
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.85);
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	transition: color 0.2s;
}

.tmf-footer-links a:hover {
	color: var(--tmf-accent);
}

.tmf-footer-links svg {
	width: 0.75rem;
	height: 0.75rem;
}

.tmf-footer-links a::before {
	content: "";
	display: inline-block;
	width: 0.4rem;
	height: 0.4rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	flex-shrink: 0;
}

.tmf-footer-contact-item {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.85);
	margin-bottom: 0.75rem;
}

.tmf-footer-contact-item a {
	color: rgba(255, 255, 255, 0.85);
	text-decoration: none;
	transition: color 0.2s;
}

.tmf-footer-contact-item a:hover {
	color: var(--tmf-accent);
}

.tmf-footer-contact-icon {
	color: var(--tmf-accent);
	flex-shrink: 0;
}

.tmf-footer-contact-icon svg {
	width: 1rem;
	height: 1rem;
}

/* --- Footer Bottom Bar --- */
.tmf-footer-bottom {
	max-width: 1280px;
	margin: 0 auto;
	padding: 1.25rem 1.5rem;
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.75rem;
	color: rgba(255, 255, 255, 0.5);
}

@media (min-width: 640px) {
	.tmf-footer-bottom {
		flex-direction: row;
		justify-content: space-between;
	}
}

.tmf-footer-bottom a {
	color: rgba(255, 255, 255, 0.5);
	text-decoration: none;
	transition: color 0.2s;
}

.tmf-footer-bottom a:hover {
	color: var(--tmf-accent);
}

.tmf-footer-bottom-links {
	display: flex;
	gap: 1.25rem;
}

/* --- Screen Reader Only --- */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

/* --- ReadSpeaker Button --- */
.rsbtn.rs_skip {
	max-width: calc(1280px - 3rem);
	margin: 1rem auto !important;
}
.tmf-readspeaker-section + .tmf-solutions-section {
	margin-block-start: 0 !important;
}

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

/* --- High Contrast (OS-level) --- */
@media (prefers-contrast: more) {
	:root {
		--tmf-accent: #CC4800;
		--tmf-border: rgba(0, 0, 0, 0.3);
		--tmf-muted: #333333;
	}

	*:focus-visible {
		outline-width: 3px;
	}

	img {
		filter: contrast(1.15);
	}
}

@media (forced-colors: active) {
	.tmf-btn-primary,
	.tmf-btn-outline,
	.tmf-btn-white {
		border: 1px solid ButtonText;
	}

	.tmf-nav a[aria-current="page"],
	.tmf-nav a.is-active {
		border-bottom: 2px solid LinkText;
	}
}
/* --- WCAG AA: ensure white-on-orange buttons pass contrast (18.66px bold = large text, 3:1 OK) --- */
.has-accent-background-color .wp-block-button__link,
.wp-block-button__link.has-accent-background-color,
.wp-block-button__link[style*="background-color:#FF5B04"],
.wp-block-button__link[style*="background-color: #FF5B04"] {
	font-weight: 700 !important;
	font-size: clamp(1.1rem, 1rem + 0.25vw, 1.25rem) !important;
}

/* Orange text on white also needs bold + size */
.wp-block-button__link[style*="color:#FF5B04"],
.wp-block-button__link[style*="color: #FF5B04"] {
	font-weight: 700 !important;
	font-size: clamp(1.1rem, 1rem + 0.25vw, 1.25rem) !important;
}

/* Any link or text using accent orange on white needs bold for WCAG AA */
a[style*="color:#FF5B04"],
a[style*="color: #FF5B04"],
a[style*="color: rgb(255, 91, 4)"] {
	font-weight: 700 !important;
}

/* --- Block Style Overrides --- */
.is-style-tmf-primary .wp-block-button__link {
	background-color: var(--tmf-accent);
	color: var(--tmf-white);
	border-radius: var(--tmf-radius-lg);
	font-weight: 500;
	padding: 0.625rem 1.5rem;
	transition: background-color 0.2s;
}

.is-style-tmf-primary .wp-block-button__link:hover {
	background-color: var(--tmf-accent-hover);
}

.is-style-tmf-outline .wp-block-button__link {
	background-color: transparent;
	color: var(--tmf-primary);
	border: 1px solid var(--tmf-border);
	border-radius: var(--tmf-radius-lg);
	font-weight: 500;
	padding: 0.625rem 1.5rem;
	transition: all 0.2s;
}

.is-style-tmf-outline .wp-block-button__link:hover {
	border-color: var(--tmf-primary);
	background-color: var(--tmf-light-bg);
}

.is-style-tmf-ghost .wp-block-button__link {
	background-color: transparent;
	color: var(--tmf-primary);
	border: none;
	font-weight: 500;
	padding: 0.625rem 1.5rem;
}

.is-style-tmf-ghost .wp-block-button__link:hover {
	background-color: var(--tmf-light-bg);
}

/* --- Section Styles --- */
.is-style-tmf-section-light {
	background-color: var(--tmf-light-bg);
}

.is-style-tmf-section-dark {
	background-color: var(--tmf-primary);
	color: var(--tmf-white);
}

/* --- WordPress Block Editor Compatibility --- */
.wp-block-navigation .wp-block-navigation-item__content {
	font-weight: 500;
}

.wp-block-navigation .wp-block-navigation-item--is-current .wp-block-navigation-item__content {
	color: var(--tmf-accent);
}

/* --- Live Search Results --- */
.tmf-live-results {
	max-height: 400px;
	overflow-y: auto;
	margin-top: 1rem;
}

.tmf-live-results-loading {
	color: var(--tmf-muted);
	font-size: 0.875rem;
	padding: 1rem 0;
}

.tmf-live-results-empty {
	color: var(--tmf-muted);
	font-size: 0.9375rem;
	padding: 1rem 0;
}

.tmf-live-results-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tmf-live-result-item a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--tmf-border);
	color: var(--tmf-primary);
	text-decoration: none;
	transition: color 0.15s;
}

.tmf-live-result-item a:hover,
.tmf-live-result-item a:focus {
	color: var(--tmf-secondary);
}

.tmf-live-result-title {
	font-weight: 500;
	font-size: 0.9375rem;
}

.tmf-live-result-type {
	font-size: 0.75rem;
	color: var(--tmf-muted);
	background: var(--tmf-light-bg);
	padding: 0.125rem 0.5rem;
	border-radius: var(--tmf-radius-sm);
	white-space: nowrap;
}

.tmf-live-results-footer {
	padding: 0.75rem 0;
	text-align: center;
}

.tmf-live-results-footer a {
	color: var(--tmf-secondary);
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
}

.tmf-live-results-footer a:hover {
	text-decoration: underline;
}
