/* ================================================================
   Kemeishop Child — WooCommerce Custom Styles
   Migrated from ta-project-glam
   ================================================================ */

/* ── Icomoon icon font ─────────────────────────────────────────── */
@font-face {
	font-family: "icomoon";
	src: url("../../icomoon/fonts/icomoon.eot?1pvhs7");
	src: url("../../icomoon/fonts/icomoon.eot?1pvhs7#iefix") format("embedded-opentype"),
	     url("../../icomoon/fonts/icomoon.ttf?1pvhs7") format("truetype"),
	     url("../../icomoon/fonts/icomoon.woff?1pvhs7") format("woff"),
	     url("../../icomoon/fonts/icomoon.svg?1pvhs7#icomoon") format("svg");
	font-weight: normal;
	font-style: normal;
	font-display: block;
}

[class^="icon-"], [class*=" icon-"] {
	font-family: "icomoon" !important;
	speak: never;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

.icon-newspaper-o:before  { content: "\e90c"; }
.icon-shopping-bag:before { content: "\e909"; }
.icon-whatsapp:before     { content: "\e90a"; }

/* ── Out of Stock badge ─────────────────────────────────────────
   Rendered inside .inside-wc-product-image (a grid container),
   so grid-item stretching must be cancelled explicitly.          */
.ks-oos-badge {
	/* Constrain grid stretching */
	align-self: start !important;
	justify-self: start !important;
	/* Overlay position — top-left of image */
	position: relative;
	z-index: 10;
	/* Visual */
	display: inline-block !important;
	background: rgba(30, 30, 30, 0.72);
	color: var(--ks-gray-200);
	font-family: var(--ks-font-body);
	font-size: 0.68rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 3px 8px;
	margin: 8px;
	border-radius: var(--ks-radius-xs);
	border: 1px solid rgba(255,255,255,0.08);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	line-height: 1.4;
}

/* ── Archive / Shop page ───────────────────────────────────────── */
.archive div#page,
.post-type-archive-product div#page {
	width: 100%;
	max-width: 100%;
}

.archive .products li,
.post-type-archive-product .products li {
	border: 1px solid var(--ks-gray-100);
	padding: 0 15px 15px 15px !important;
	transition: var(--ks-transition);
}

.archive .products li:hover,
.post-type-archive-product .products li:hover {
	box-shadow: var(--ks-shadow-sm);
}

.archive .products li .star-rating,
.post-type-archive-product .products li .star-rating {
	display: block;
	margin: 4px auto 2px;
	font-size: 0.8em;
}

.archive .products li a.add_to_cart_button,
.post-type-archive-product .products li a.add_to_cart_button {
	display: none !important;
}

.archive .products li span.price ins,
.post-type-archive-product .products li span.price ins {
	color: var(--ks-red);
	font-weight: 700 !important;
}

/* ── Product category banner ───────────────────────────────────── */
.product-cat-header-image-wrapper {
	width: 100%;
	margin-bottom: 24px;
}

.product-cat-header-image-wrapper img {
	width: 100%;
	height: auto;
	display: block;
}

/* ── Single product — WhatsApp + Order Now buttons ─────────────── */
.ta-order-buttons {
	display: flex;
	gap: 12px;
	margin-top: 16px;
	clear: both;
}

.single-product a.whatsapp-order,
.single-product a.order-now {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 1;
	padding: 14px 16px;
	font-family: var(--ks-font-body);
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	text-decoration: none;
	border-radius: var(--ks-radius-sm);
	transition: var(--ks-transition);
	box-shadow: var(--ks-shadow-xs);
}

.single-product a.whatsapp-order {
	background: var(--ks-green);
}

.single-product a.whatsapp-order:hover {
	background: #1ebe5c;
	color: #fff;
	transform: translateY(-1px);
	box-shadow: var(--ks-shadow-sm);
}

.single-product a.order-now {
	background: var(--ks-dark-3);
	color: var(--ks-white);
}

.single-product a.order-now:hover {
	background: var(--ks-dark-2);
	color: var(--ks-white);
	transform: translateY(-1px);
	box-shadow: var(--ks-shadow-sm);
}

/* ── Archive sidebar ───────────────────────────────────────────── */
.archive .sidebar .widget-title,
.single-product .sidebar .widget-title {
	border-bottom: 1px solid var(--ks-gray-200);
	padding-bottom: 12px;
	margin-bottom: 18px;
}

.archive .sidebar ul.menu > li,
.single-product .sidebar ul.menu > li {
	border-bottom: 1px solid var(--ks-gray-100);
	padding: 10px 0;
	margin: 0;
}

.archive .sidebar ul.sub-menu,
.single-product .sidebar ul.sub-menu {
	margin-top: 0;
	margin-left: 0;
	display: none;
}

.archive .sidebar li.menu-item-has-children > a::after,
.single-product .sidebar li.menu-item-has-children > a::after {
	content: "›";
	float: right;
	padding-right: 15px;
	font-size: 18px;
}

.archive .sidebar li.menu-item-has-children:hover ul.sub-menu,
.single-product .sidebar li.menu-item-has-children:hover ul.sub-menu {
	display: block;
}

/* ================================================================
   PRODUCT LOOP TILES — Image hover swap + card polish
   ================================================================ */

/* Image container: CSS grid square.
   display:grid makes the container a block-level box so width:100% fills
   the parent <a>, giving aspect-ratio something to work with. */
.woocommerce ul.products li.product .inside-wc-product-image {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-rows: 1fr;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--ks-gray-50);
}

/* Stack every direct child in the same grid cell */
.woocommerce ul.products li.product .inside-wc-product-image > * {
	grid-column: 1;
	grid-row: 1;
	min-width: 0;
	min-height: 0;
}

/* Pictures fill the cell */
.woocommerce ul.products li.product .inside-wc-product-image picture {
	display: block;
	width: 100%;
	height: 100%;
	opacity: 1;
	transition: opacity 0.35s ease;
}

/* All images fill their picture */
.woocommerce ul.products li.product .inside-wc-product-image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Secondary/hover picture: hidden by default, rendered on top via DOM order */
.woocommerce ul.products li.product .inside-wc-product-image picture:has(img.secondary-image) {
	opacity: 0;
	transition: opacity 0.35s ease;
}

/* Hover swap — only when a secondary image actually exists */
.woocommerce ul.products li.product:hover .inside-wc-product-image:has(img.secondary-image) picture:has(img.secondary-image) {
	opacity: 1;
}

.woocommerce ul.products li.product:hover .inside-wc-product-image:has(img.secondary-image) picture:not(:has(img.secondary-image)) {
	opacity: 0;
}

/* Card base */
/* Full-card touch target — pseudo-element on the image link covers the whole card.
   Badges and buttons sit above it via z-index. */
.woocommerce ul.products li.product {
	background: var(--ks-white);
	border: 1px solid var(--ks-gray-100);
	border-radius: var(--ks-radius);
	overflow: hidden;
	position: relative;
	transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.woocommerce ul.products li.product a.woocommerce-loop-product__link::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 0;
}

/* Keep badges and urgency label above the overlay */
.woocommerce ul.products li.product .onsale,
.woocommerce ul.products li.product .ks-urgency-badge,
.woocommerce ul.products li.product .ks-oos-badge {
	position: relative;
	z-index: 1;
}

.woocommerce ul.products li.product:hover {
	box-shadow: var(--ks-shadow);
	transform: translateY(-3px);
}

/* Product title */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--ks-font-body);
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--ks-dark);
	text-align: center;
	padding: 0 8px;
	margin-bottom: 6px;
}

/* Price */
.woocommerce ul.products li.product .price {
	text-align: center;
	color: var(--ks-gray-600);
	font-size: 0.9rem;
	display: flex;
	align-items: baseline;
	justify-content: center;
	flex-wrap: wrap;
	gap: 4px 8px;
}

.woocommerce ul.products li.product .price ins {
	color: var(--ks-red);
	font-weight: 700;
	font-size: 1.05rem;
	text-decoration: none;
}

.woocommerce ul.products li.product .price del {
	color: var(--ks-gray-400);
	font-size: 0.78rem;
	text-decoration: line-through;
}

/* ── Urgency badge — "Only X left" ─────────────────────────────── */
.ks-urgency-badge {
	display: inline-block;
	background: #fff3cd;
	color: #7a4f00;
	border: 1px solid #f5c542;
	font-family: var(--ks-font-body);
	font-size: 0.7rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: var(--ks-radius-xs);
	margin-top: 4px;
	letter-spacing: 0.02em;
}

/* Sale badge — small understated pill, bottom-left of image.
   Use !important on position values to beat WooCommerce/GP specificity. */
.woocommerce ul.products li.product .onsale {
	background: var(--ks-red) !important;
	color: #fff !important;
	font-family: var(--ks-font-body);
	font-size: 0.72rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.03em;
	border-radius: var(--ks-radius-xs) !important;
	padding: 3px 8px !important;
	top: 8px !important;
	right: 8px !important;
	bottom: auto !important;
	left: auto !important;
	margin: 0 !important;
	width: auto !important;
	min-width: unset !important;
	height: auto !important;
	min-height: unset !important;
	line-height: 1.4 !important;
	text-align: center;
	border: none !important;
}

/* ── Out-of-stock archive tiles ────────────────────────────────────
   WC adds .outofstock to li.product when stock=0.
   OOS products render a plain a.button ("Read more"), not
   a.add_to_cart_button, so the rule above doesn't catch them.
   Hide the button and dim the card so it reads as unavailable.   */
.woocommerce ul.products li.product.outofstock a.button {
	display: none !important;
}

.woocommerce ul.products li.product.outofstock .inside-wc-product-image {
	opacity: 0.6;
}

.woocommerce ul.products li.product.outofstock:hover {
	box-shadow: none !important;
	transform: none !important;
}

/* Prevent overflow on homepage product grids */
.ta-products .woocommerce ul.products {
	overflow: visible;
}

.ta-products .woocommerce ul.products li.product {
	box-sizing: border-box;
}

/* ── Quick order form (sidebar shortcode) ──────────────────────── */
.single-product .ta-quick-order-form-wrapper {
	margin: 15px 0;
	padding: 25px;
	background: var(--ks-gray-50);
	box-shadow: var(--ks-shadow-xs);
	border-radius: var(--ks-radius);
}

.single-product .ta-quick-order-form-wrapper .wpforms-title {
	text-align: center;
}
