/* Custom Header Anywhere — Brand Theme (site-wide)
 * Palette is taken from the KMS Corporation logo:
 *   crimson  #D9192D  (gradient #F2132C → #C31D2C)  → actions, accents, active states
 *   blue     #1446D8  ("CORPORATION")               → links, focus rings
 *   navy     #0B1F5C  (deepened blue)               → headings, top bar, footer
 *   charcoal #222021  ("SINCE 2020")                → body text
 * Colours are injected as --kms-* variables by CHA_Theme::vars(); the fallbacks
 * below keep the site on-brand even if the inline block is stripped by a cache plugin.
 * Everything is scoped to body.cha-brand so it never leaks into the WP admin.
 */

:root {
	--kms-primary: #D9192D;
	--kms-primary-dark: #B3121F;
	--kms-primary-light: #F2132C;
	--kms-secondary: #1446D8;
	--kms-navy: #0B1F5C;
	--kms-text: #222021;
	--kms-muted: #5B6070;
	--kms-border: #E3E6EF;
	--kms-soft: #F4F6FC;
	--kms-gradient: linear-gradient(90deg, #F2132C 0%, #D9192D 55%, #C31D2C 100%);
	--kms-primary-rgb: 217,25,45;
	--kms-secondary-rgb: 20,70,216;
	--kms-navy-rgb: 11,31,92;
}

/* ---------- Block-theme / Gutenberg palette hooks ---------- */
body.cha-brand {
	--wp--preset--color--primary: var(--kms-primary);
	--wp--preset--color--secondary: var(--kms-secondary);
	--wp--preset--color--accent: var(--kms-primary);
	--wp--preset--color--contrast: var(--kms-navy);
	--wp--preset--color--base: #ffffff;
	--e-global-color-primary: var(--kms-navy);
	--e-global-color-secondary: var(--kms-secondary);
	--e-global-color-accent: var(--kms-primary);
	--e-global-color-text: var(--kms-text);
}

/* ---------- Base ---------- */
body.cha-brand {
	color: var(--kms-text);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
body.cha-brand ::selection { background: var(--kms-primary); color: #fff; }
body.cha-brand :focus-visible {
	outline: 2px solid var(--kms-secondary);
	outline-offset: 2px;
}

/* ---------- Headings ---------- */
body.cha-brand :is(.entry-content, .page-content, .post-content, .widget, .entry-header, .page-header, .woocommerce-products-header) :is(h1, h2, h3, h4, h5, h6),
body.cha-brand :is(.entry-title, .page-title, .widget-title, .widgettitle, .woocommerce-loop-product__title, .comment-reply-title),
body.cha-brand :is(.entry-title, .page-title, .woocommerce-loop-product__title) a {
	color: var(--kms-navy);
}
/* Never force navy onto headings that sit on a coloured / image background. */
body.cha-brand :is(.has-background, .wp-block-cover, .wp-block-group.has-background, [class*="has-"][class*="-background-color"]) :is(h1, h2, h3, h4, h5, h6),
body.cha-brand :is(h1, h2, h3, h4, h5, h6).has-text-color {
	color: inherit;
}

/* ---------- Links (content areas only, so menus / cards keep their own style) ---------- */
body.cha-brand :is(.entry-content, .page-content, .post-content, .comment-content, .widget, .woocommerce-product-details__short-description) a:not(.button):not(.btn):not(.wp-element-button):not(.wp-block-button__link):not(.elementor-button) {
	color: var(--kms-secondary);
	text-decoration-color: rgba(var(--kms-secondary-rgb), .35);
	text-underline-offset: 3px;
	transition: color .2s ease, text-decoration-color .2s ease;
}
body.cha-brand :is(.entry-content, .page-content, .post-content, .comment-content, .widget, .woocommerce-product-details__short-description) a:not(.button):not(.btn):not(.wp-element-button):not(.wp-block-button__link):not(.elementor-button):hover {
	color: var(--kms-primary);
	text-decoration-color: currentColor;
}

/* ---------- Buttons ---------- */
body.cha-brand :is(
	.button, .btn, a.button, button.button, input.button,
	input[type="submit"], input[type="button"], button[type="submit"],
	.wp-block-button__link, .wp-element-button,
	.elementor-button, .et_pb_button, .fusion-button,
	.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
	.woocommerce #respond input#submit, .woocommerce a.button.alt, .woocommerce button.button.alt
):not(.cha-quote-btn):not(.cha-toggle):not(.cha-search-toggle) {
	background-color: var(--kms-primary);
	background-image: none;
	color: #fff;
	border: 2px solid var(--kms-primary);
	border-radius: 6px;
	font-weight: 700;
	letter-spacing: .01em;
	box-shadow: 0 4px 14px rgba(var(--kms-primary-rgb), .25);
	transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .2s ease, box-shadow .25s ease;
}
body.cha-brand :is(
	.button, .btn, a.button, button.button, input.button,
	input[type="submit"], input[type="button"], button[type="submit"],
	.wp-block-button__link, .wp-element-button,
	.elementor-button, .et_pb_button, .fusion-button,
	.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
	.woocommerce #respond input#submit, .woocommerce a.button.alt, .woocommerce button.button.alt
):not(.cha-quote-btn):not(.cha-toggle):not(.cha-search-toggle):is(:hover, :focus-visible) {
	background-color: var(--kms-navy);
	border-color: var(--kms-navy);
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(var(--kms-navy-rgb), .25);
}
/* Outline button variants keep an outline look in brand colours. */
body.cha-brand :is(.is-style-outline > .wp-block-button__link, .button.outline, .btn-outline) {
	background: transparent;
	color: var(--kms-primary);
	border-color: var(--kms-primary);
	box-shadow: none;
}
body.cha-brand :is(.is-style-outline > .wp-block-button__link, .button.outline, .btn-outline):hover {
	background: var(--kms-primary);
	color: #fff;
}

/* ---------- Forms ---------- */
body.cha-brand :is(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="password"], input[type="search"], textarea, select) {
	border-color: var(--kms-border);
	border-radius: 6px;
	transition: border-color .2s ease, box-shadow .2s ease;
}
body.cha-brand :is(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="number"], input[type="password"], input[type="search"], textarea, select):focus {
	border-color: var(--kms-secondary);
	box-shadow: 0 0 0 3px rgba(var(--kms-secondary-rgb), .18);
	outline: none;
}
body.cha-brand :is(input[type="checkbox"], input[type="radio"], progress) { accent-color: var(--kms-primary); }
body.cha-brand ::placeholder { color: var(--kms-muted); opacity: .8; }

/* ---------- Content details ---------- */
body.cha-brand :is(.entry-content, .page-content, .post-content) blockquote,
body.cha-brand .wp-block-quote {
	border-left: 4px solid var(--kms-primary);
	background: var(--kms-soft);
	padding: 1rem 1.25rem;
	border-radius: 0 8px 8px 0;
}
body.cha-brand :is(.entry-content, .page-content, .post-content) hr,
body.cha-brand .wp-block-separator {
	border-color: var(--kms-border);
}
body.cha-brand :is(.entry-content, .page-content, .post-content) table :is(th) {
	background: var(--kms-navy);
	color: #fff;
	border-color: var(--kms-navy);
}
body.cha-brand :is(.entry-content, .page-content, .post-content) table :is(td) { border-color: var(--kms-border); }
body.cha-brand :is(.entry-content, .page-content, .post-content) table tbody tr:nth-child(even) td { background: var(--kms-soft); }
body.cha-brand :is(.entry-content, .page-content, .post-content) :is(ul, ol) li::marker { color: var(--kms-primary); }
body.cha-brand :is(.entry-content, .page-content, .post-content) mark { background: rgba(var(--kms-primary-rgb), .12); color: inherit; }

/* ---------- Pagination & tags ---------- */
body.cha-brand :is(.page-numbers, .nav-links a, .pagination a, .pagination span) {
	border-radius: 6px;
	transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
body.cha-brand :is(.page-numbers.current, .nav-links .current, .pagination .current),
body.cha-brand :is(a.page-numbers:hover, .nav-links a:hover, .pagination a:hover) {
	background: var(--kms-primary);
	border-color: var(--kms-primary);
	color: #fff;
}
body.cha-brand :is(.tagcloud a, .wp-block-tag-cloud a, .tags-links a, .post-tags a) {
	background: var(--kms-soft);
	color: var(--kms-navy);
	border: 1px solid var(--kms-border);
	border-radius: 999px;
	padding: 4px 12px;
	text-decoration: none;
}
body.cha-brand :is(.tagcloud a, .wp-block-tag-cloud a, .tags-links a, .post-tags a):hover {
	background: var(--kms-navy);
	border-color: var(--kms-navy);
	color: #fff;
}

/* ---------- WooCommerce ---------- */
body.cha-brand .woocommerce :is(.price, .amount, ul.products li.product .price) { color: var(--kms-primary-dark); }
body.cha-brand .woocommerce span.onsale { background: var(--kms-primary); color: #fff; }
body.cha-brand .woocommerce :is(.woocommerce-message, .woocommerce-info) { border-top-color: var(--kms-secondary); }
body.cha-brand .woocommerce :is(.woocommerce-message, .woocommerce-info)::before { color: var(--kms-secondary); }
body.cha-brand .woocommerce .star-rating span::before { color: var(--kms-primary); }

/* ---------- Footer (optional: "Style site footer in brand navy") ---------- */
body.cha-brand-footer :is(footer.site-footer, #colophon, .site-footer, #footer, footer#footer, .footer-area, .wp-site-blocks > footer) {
	background: var(--kms-navy);
	color: rgba(255,255,255,.82);
	border-top: 4px solid var(--kms-primary);
}
body.cha-brand-footer :is(footer.site-footer, #colophon, .site-footer, #footer, footer#footer, .footer-area, .wp-site-blocks > footer) :is(h1, h2, h3, h4, h5, h6, .widget-title, .widgettitle) {
	color: #fff;
}
body.cha-brand-footer :is(footer.site-footer, #colophon, .site-footer, #footer, footer#footer, .footer-area, .wp-site-blocks > footer) a {
	color: #fff;
	text-decoration-color: rgba(255,255,255,.35);
}
body.cha-brand-footer :is(footer.site-footer, #colophon, .site-footer, #footer, footer#footer, .footer-area, .wp-site-blocks > footer) a:hover {
	color: #fff;
	text-decoration-color: var(--kms-primary-light);
}
body.cha-brand-footer :is(footer.site-footer, #colophon, .site-footer, #footer, footer#footer, .footer-area, .wp-site-blocks > footer) :is(.site-info, .copyright, .footer-bottom) {
	border-top: 1px solid rgba(255,255,255,.14);
	color: rgba(255,255,255,.7);
}

/* ---------- Respect user preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	body.cha-brand * { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
