/**
 * KB Hub Theme Overrides
 *
 * Lower priority CSS layer for theme overrides.
 * This file provides a foundation for theme developers to override KB Hub styles
 * without modifying plugin files directly.
 *
 * @package Devora_KB_Hub
 * @since 1.0.0
 *
 * USAGE:
 * To override KB Hub styles in your theme, create a file at:
 * your-theme/kb-hub-overrides.css
 *
 * Then enqueue it with higher priority than the plugin's CSS:
 *
 * function my_theme_enqueue_kb_overrides() {
 *     wp_enqueue_style(
 *         'my-theme-kb-overrides',
 *         get_template_directory_uri() . '/kb-hub-overrides.css',
 *         array( 'devora-kb-hub-layout-presets' ),
 *         '1.0.0'
 *     );
 * }
 * add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_kb_overrides', 20 );
 *
 * Alternatively, you can override CSS variables directly:
 *
 * :root {
 *     --dkh-link-color: #your-color;
 *     --dkh-font-size-base: 18px;
 * }
 */

@layer kb-hub-theme-overrides {
	/* Theme developers can add overrides here or in their own stylesheet */
	
	/* Force plugin variables to take precedence in KB Hub contexts */
	.devora-kb-hub-homepage,
	.devora-kb-archive,
	.devora-kb-hub-single-article {
		/* Override theme fonts if needed */
		font-family: var(--dkh-font-family, inherit) !important;
	}
	
	/* Ensure buttons maintain KB styling even if theme has strong button styles */
	.devora-kb-hub-homepage button,
	.devora-kb-archive button,
	.devora-kb-hub-single-article button {
		font-size: var(--dkh-font-size-base, 16px) !important;
		font-family: var(--dkh-font-family, inherit) !important;
	}
	
	/* Ensure headings maintain KB styling */
	.devora-kb-hub-homepage h1,
	.devora-kb-hub-homepage h2,
	.devora-kb-hub-homepage h3,
	.devora-kb-archive h1,
	.devora-kb-archive h2,
	.devora-kb-archive h3,
	.devora-kb-hub-single-article h1,
	.devora-kb-hub-single-article h2,
	.devora-kb-hub-single-article h3 {
		font-family: var(--dkh-font-family, inherit) !important;
	}
	
	/* Prevent theme from overriding KB link colors */
	.devora-kb-hub-homepage a:not(.button-primary):not(.kb-button-primary),
	.devora-kb-archive a:not(.button-primary):not(.kb-button-primary),
	.devora-kb-hub-single-article a:not(.button-primary):not(.kb-button-primary) {
		color: var(--dkh-link-color, #121b29) !important;
	}
	
	.devora-kb-hub-homepage a:not(.button-primary):not(.kb-button-primary):hover,
	.devora-kb-archive a:not(.button-primary):not(.kb-button-primary):hover,
	.devora-kb-hub-single-article a:not(.button-primary):not(.kb-button-primary):hover {
		color: var(--dkh-link-hover-color, #75c2b3) !important;
	}
	
	/* Prevent theme from overriding card backgrounds */
	.kb-homepage-section .kb-card,
	.kb-archive-content .kb-card,
	.kb-article-content .kb-card,
	.kb-related-articles .kb-card {
		background: var(--dkh-article-card-bg, #ffffff) !important;
	}
	
	/* Prevent theme from overriding button colors in KB contexts */
	.devora-kb-hub-homepage .button-primary,
	.devora-kb-hub-homepage .kb-button-primary,
	.devora-kb-archive .button-primary,
	.devora-kb-archive .kb-button-primary,
	.devora-kb-hub-single-article .button-primary,
	.devora-kb-hub-single-article .kb-button-primary {
		background: var(--dkh-button-primary-color, #9ed1be) !important;
		border-color: var(--dkh-button-primary-color, #9ed1be) !important;
	}
	
	.devora-kb-hub-homepage .button-primary:hover,
	.devora-kb-hub-homepage .kb-button-primary:hover,
	.devora-kb-archive .button-primary:hover,
	.devora-kb-archive .kb-button-primary:hover,
	.devora-kb-hub-single-article .button-primary:hover,
	.devora-kb-hub-single-article .kb-button-primary:hover {
		background: var(--dkh-button-primary-hover, #005a87) !important;
		border-color: var(--dkh-button-primary-hover, #005a87) !important;
	}
	
	/* Ensure proper box-sizing for all KB Hub elements */
	.devora-kb-hub-homepage *,
	.devora-kb-hub-homepage *::before,
	.devora-kb-hub-homepage *::after,
	.devora-kb-archive *,
	.devora-kb-archive *::before,
	.devora-kb-archive *::after,
	.devora-kb-hub-single-article *,
	.devora-kb-hub-single-article *::before,
	.devora-kb-hub-single-article *::after {
		box-sizing: border-box;
	}
}

