/* Shared colors for WoodMart, WooCommerce and Kingsence storefront components. */
html:root {
	--ks-brand: #203865;
	--ks-brand-hover: #182a4d;
	--ks-ink: #232632;
	--ks-muted: #595959;
	--ks-paper: #fff;
	--ks-surface: #f5f5f4;
	--ks-edge: #dedfe3;
	--ks-rating: #9c6411;

	--wd-primary-color: var(--ks-brand);
	--wd-text-color: var(--ks-muted);
	--wd-title-color: var(--ks-ink);
	--wd-entities-title-color: var(--ks-ink);
	--wd-entities-title-color-hover: var(--ks-brand);
	--wd-link-color: var(--ks-ink);
	--wd-link-color-hover: var(--ks-brand);
	--wd-form-brd-color: var(--ks-edge);
	--btn-default-bgcolor: var(--ks-brand);
	--btn-default-bgcolor-hover: var(--ks-brand-hover);
	--btn-default-color: var(--ks-paper);
	--btn-default-color-hover: var(--ks-paper);
	--btn-accented-bgcolor: var(--ks-brand);
	--btn-accented-bgcolor-hover: var(--ks-brand-hover);
	--btn-accented-color: var(--ks-paper);
	--btn-accented-color-hover: var(--ks-paper);
}

/* Primary actions keep their styling even inside Elementor's local color schemes. */
body :is(.elementor-button, .single_add_to_cart_button, .checkout-button, #place_order):not(.btn-style-link, .btn-style-bordered) {
	background-color: var(--ks-brand);
	color: var(--ks-paper);
}

body :is(.elementor-button, .single_add_to_cart_button, .checkout-button, #place_order):not(.btn-style-link, .btn-style-bordered):hover {
	background-color: var(--ks-brand-hover);
	color: var(--ks-paper);
}

/* Match the desktop submenu, mobile drawer and other floating surfaces. */
body :is(.ks-shop-panel, .wd-dropdown-menu, .wd-dropdown, .select2-dropdown, .wd-side-hidden, .wd-toolbar, .wd-cookies-popup, .wd-popup, .modal-window) {
	background-color: var(--ks-paper);
	border-color: var(--ks-edge);
	color: var(--ks-muted);
}

body .ks-shop-panel.is-compact .ks-shop-group > ul {
	background-color: var(--ks-paper);
	border-color: var(--ks-edge);
}

body .ks-shop-panel a {
	color: var(--ks-ink);
}

body .ks-shop-panel :is(a:hover, a:focus-visible),
body .ks-shop-panel .ks-shop-group:is(:hover, :focus-within) > a,
body .mobile-nav .wd-nav-mobile :is(.current-menu-item, .current-menu-ancestor) > a {
	background-color: var(--ks-surface);
	color: var(--ks-brand);
}

body :is(.whb-header, .wd-toolbar) :is(.current-menu-item, .current-menu-ancestor, .wd-active) > a {
	color: var(--ks-brand);
}

body :is(.single-product-sidebar, .wd-shop-tools, .ks-filters-panel, .cart-totals-inner, .woocommerce-checkout-review-order, .woocommerce-checkout-payment) {
	background-color: var(--ks-surface);
	border-color: var(--ks-edge);
}

body.woocommerce-cart .elementor-element-637f73d5,
body.woocommerce-checkout .e-con:has(> .wd-order-table) {
	background-color: var(--ks-surface);
	border-color: var(--ks-edge);
}

body :is(.summary-inner, .wd-order-table > .elementor-widget-container) {
	background-color: var(--ks-paper);
}

body .footer-container {
	background-color: var(--ks-surface);
	color: var(--ks-muted);
}

/* Informational product labels share one treatment. Sale and stock states keep their own colors. */
body .product-labels .product-label:is(.new, .featured) {
	background-color: var(--ks-paper) !important;
	color: var(--ks-brand) !important;
}

body.woodmart-archive-shop .product-grid-item .product-element-bottom .price {
	color: var(--ks-brand);
}

body :is(.ks-catalog-rating-star, .ks-product-header-star) {
	color: var(--ks-rating);
}

body .ks-catalog-rating {
	color: var(--ks-ink);
}

body .ks-catalog-rating-count {
	color: var(--ks-muted);
}

/* Compact multi-line labels while keeping menu rows and controls easy to tap. */
body :is(.ks-shop-panel a, .mobile-nav .wd-nav-mobile a) {
	line-height: 1.3;
}

body.woodmart-archive-shop .product-grid-item .wd-entities-title,
body.woodmart-archive-shop .product-grid-item .wd-entities-title a {
	line-height: 1.3;
}

/* Keep the rating beside the price so an unrated tile never needs a blank row. */
body .product-grid-item .product-element-bottom:has(> .price):has(> .price) {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-rows: 1fr auto;
	column-gap: 6px;
	align-items: start;
}

body .product-grid-item .product-element-bottom:has(> .price) > :not(.price, .ks-catalog-rating) {
	grid-column: 1 / -1;
}

body .product-grid-item .product-element-bottom:has(> .price) > .price {
	grid-column: 1 / -1;
	align-self: end;
	margin-block-start: 0;
	text-align: start;
}

body .product-grid-item .product-element-bottom:has(> .price) > .price:has(~ .ks-catalog-rating) {
	grid-column: 1;
}

body .product-grid-item .product-element-bottom:has(> .price) > .ks-catalog-rating {
	grid-column: 2;
	align-self: end;
	justify-self: end;
	margin-block: 0;
}

body.single-product .summary-inner .product_title {
	line-height: 1.2;
}

body.single-product .woocommerce-product-details__short-description {
	line-height: 1.45;
}
