/**
 * Somuse Theme - WooCommerce Stylesheet
 *
 * Provides styling for WooCommerce components aligned with Somuse design tokens.
 * Default WooCommerce general visual skin is disabled; this file provides clean, minimal styling.
 *
 * @package Somuse
 */

/* -- Token Mapping & CSS Variables -- */

:root {
	--woocommerce: var(--wp--preset--color--contrast);
	--wc-primary: var(--wp--preset--color--contrast);
	--wc-secondary: var(--wp--preset--color--contrast);
	--wc-accent: var(--wp--preset--color--accent-1);
	--wc-highlight: var(--wp--preset--color--accent-1);
	--wc-subtext: color-mix(in srgb, var(--wp--preset--color--base) 40%, var(--wp--preset--color--contrast));
	--wc-border: color-mix(in srgb, var(--wp--preset--color--base) 88%, var(--wp--preset--color--contrast));
}

/* -- Buttons & Actions -- */

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.5rem; /* 40px (h-10) */
	background-color: var(--wp--preset--color--contrast);
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 0.25rem; /* 4px */
	color: var(--wp--preset--color--base);
	cursor: pointer;
	font-family: var(--wp--preset--font-family--primary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: 1rem; /* 16px */
	padding: 0.75rem 1rem; /* 12px 16px */
	text-decoration: none;
	transition: all 0.2s ease-in-out;

	&:hover,
	&:focus {
		background-color: var(--wp--preset--color--base);
		color: var(--wp--preset--color--contrast);
	}

	&.alt {
		background-color: var(--wp--preset--color--accent-1);
		border-color: var(--wp--preset--color--accent-1);
		color: var(--wp--preset--color--base);

		&:hover,
		&:focus {
			background-color: var(--wp--preset--color--accent-2);
			border-color: var(--wp--preset--color--accent-2);
			color: var(--wp--preset--color--base);
		}
	}

	&.disabled,
	&:disabled {
		opacity: 0.5;
		cursor: not-allowed;
	}
}

/* -- Badges (Sale / New) -- */

.woocommerce span.onsale {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 1.5rem; /* 24px (4px*6) */
	padding: 0.25rem 0.625rem; /* 4px 10px */
	background-color: var(--wp--preset--color--accent-1);
	border-radius: 0.25rem; /* 4px */
	color: var(--wp--preset--color--base);
	font-family: var(--wp--preset--font-family--primary);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: var(--wp--custom--font-weight--semi-bold);
	line-height: 1rem; /* 16px */
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

/* -- Product Cards & Lists -- */

.woocommerce ul.products li.product {
	.woocommerce-loop-product__title {
		font-family: var(--wp--preset--font-family--primary);
		font-size: var(--wp--preset--font-size--medium);
		font-weight: var(--wp--custom--font-weight--regular);
		margin-block: 0.5em;
	}

	.price {
		color: var(--wp--preset--color--contrast);
		font-size: var(--wp--preset--font-size--small);
		font-weight: var(--wp--custom--font-weight--medium);

		del {
			opacity: 0.5;
		}

		ins {
			background: none;
			font-weight: inherit;
		}
	}
}

/* -- Notices & Alerts -- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	background-color: color-mix(in srgb, var(--wp--preset--color--base) 96%, var(--wp--preset--color--contrast));
	border-color: var(--wc-border);
	border-style: solid;
	border-width: 1px;
	border-radius: 0;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	padding: 1em 1.5em;

	a {
		color: inherit;
		font-weight: var(--wp--custom--font-weight--medium);
	}
}

.woocommerce-error {
	border-left: 3px solid var(--wp--preset--color--contrast);
}

.woocommerce-message {
	border-left: 3px solid var(--wp--preset--color--accent-1);
}

.woocommerce-info {
	border-left: 3px solid var(--wc-border);
}

/* -- Quantity Inputs -- */

.woocommerce .quantity .qty {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.5rem; /* 40px (h-10) */
	width: 4rem; /* 64px */
	border: 1px solid var(--wc-border);
	border-radius: 0.25rem; /* 4px */
	padding: 0.5rem;
	font-family: var(--wp--preset--font-family--primary);
	font-size: var(--wp--preset--font-size--small);
	font-weight: var(--wp--custom--font-weight--medium);
	line-height: 1.5rem;
	text-align: center;
	background-color: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);

	&:focus {
		outline: 2px solid var(--wp--preset--color--accent-1);
		outline-offset: 1px;
		border-color: var(--wp--preset--color--accent-1);
	}
}

/* -- Tables (Cart / Checkout / Order Review) -- */

.woocommerce table.shop_table {
	border-collapse: collapse;
	border: 1px solid var(--wc-border);
	border-radius: 0;
	width: 100%;

	th,
	td {
		border-color: var(--wc-border);
		padding: 12px;
		vertical-align: middle;
	}

	th {
		font-weight: var(--wp--custom--font-weight--medium);
	}

	tbody tr:last-child td {
		border-bottom-width: 0;
	}
}

/* -- Product Image Gallery (Single Product) -- */

.woocommerce .wp-block-woocommerce-product-image-gallery,
.wp-block-woocommerce-product-image-gallery {
	max-width: 100% !important;
	width: 100%;
}

.woocommerce-product-gallery {
	position: relative;
	width: 100%;
	margin-bottom: 2rem;
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger {
	position: absolute;
	top: 1rem;
	right: 1rem;
	z-index: 10;
	width: 2.25rem; /* 36px */
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--base, #ffffff);
	border: 1px solid var(--wc-border);
	border-radius: var(--wp--preset--border-radius--xs, 4px);
	text-decoration: none;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger:hover {
	border-color: var(--wp--preset--color--contrast);
	background-color: var(--wp--preset--color--base-alt, #f8fafc);
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger img,
.woocommerce-product-gallery .woocommerce-product-gallery__trigger span {
	display: none !important;
}

.woocommerce-product-gallery .woocommerce-product-gallery__trigger::before {
	content: "";
	width: 16px;
	height: 16px;
	background-color: var(--wp--preset--color--contrast);
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat center / contain;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat center / contain;
}

.woocommerce-product-gallery .flex-viewport {
	border: 1px solid var(--wc-border);
	border-radius: var(--wp--preset--border-radius--sm, 8px);
	background-color: var(--wp--preset--color--base, #ffffff);
	overflow: hidden;
}

/* Gallery Navigation Arrows (Next / Prev) */
.woocommerce-product-gallery .flex-direction-nav {
	margin: 0;
	padding: 0;
	list-style: none;
}

.woocommerce-product-gallery .flex-direction-nav li {
	list-style: none !important;
	margin: 0;
	padding: 0;
}

.woocommerce-product-gallery .flex-direction-nav a {
	position: absolute;
	top: clamp(160px, 25vw, 260px);
	transform: translateY(-50%);
	z-index: 10;
	width: 2.25rem; /* 36px */
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--wp--preset--color--base, #ffffff);
	border: 1px solid var(--wc-border);
	border-radius: var(--wp--preset--border-radius--xs, 4px);
	color: transparent;
	font-size: 0;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
	opacity: 0.85;
}

.woocommerce-product-gallery:hover .flex-direction-nav a {
	opacity: 1;
}

.woocommerce-product-gallery .flex-direction-nav a:hover {
	background-color: var(--wp--preset--color--base-alt, #f8fafc);
	border-color: var(--wp--preset--color--contrast);
}

.woocommerce-product-gallery .flex-direction-nav a.flex-disabled {
	opacity: 0.2 !important;
	cursor: not-allowed;
	pointer-events: none;
}

.woocommerce-product-gallery .flex-direction-nav a.flex-prev {
	left: 0.75rem;
}

.woocommerce-product-gallery .flex-direction-nav a.flex-next {
	right: 0.75rem;
}

.woocommerce-product-gallery .flex-direction-nav a::before {
	content: "";
	width: 16px;
	height: 16px;
	background-color: var(--wp--preset--color--contrast);
}

.woocommerce-product-gallery .flex-direction-nav a.flex-prev::before {
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 18 9 12 15 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
}

.woocommerce-product-gallery .flex-direction-nav a.flex-next::before {
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E") no-repeat center / contain;
}

/* Modern Gallery (woocommerce/product-gallery) Buttons */
.wc-block-next-previous-buttons .wc-block-next-previous-buttons__button {
	width: 2.25rem !important;
	height: 2.25rem !important;
	background-color: var(--wp--preset--color--base, #ffffff) !important;
	border: 1px solid var(--wc-border) !important;
	border-radius: var(--wp--preset--border-radius--xs, 4px) !important;
	box-shadow: none !important;
	color: var(--wp--preset--color--contrast) !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	transition: background-color 0.2s ease, border-color 0.2s ease !important;
}

.wc-block-next-previous-buttons .wc-block-next-previous-buttons__button:hover {
	background-color: var(--wp--preset--color--base-alt, #f8fafc) !important;
	border-color: var(--wp--preset--color--contrast) !important;
}

.wc-block-next-previous-buttons .wc-block-next-previous-buttons__button[aria-disabled="true"] {
	opacity: 0.25 !important;
	cursor: not-allowed !important;
}

/* Modern Product Gallery 1:1 Aspect Ratio & Zero Whitespace */
.wc-block-product-gallery-large-image,
.wc-block-product-gallery-large-image__wrapper,
.wc-block-product-gallery-large-image__container {
	aspect-ratio: 1 / 1 !important;
	width: 100% !important;
	max-width: 100% !important;
}

.wc-block-product-gallery-large-image img {
	aspect-ratio: 1 / 1 !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block !important;
}

.woocommerce-product-gallery .woocommerce-product-gallery__wrapper {
	margin: 0;
	padding: 0;
}

.woocommerce-product-gallery .woocommerce-product-gallery__image {
	width: 100%;
	display: block;
}

.woocommerce-product-gallery .woocommerce-product-gallery__image img {
	width: 100%;
	height: auto;
	max-height: 520px;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

.woocommerce-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0.75rem;
	margin: 0.75rem 0 0 0;
	padding: 0;
	list-style: none;
}

.woocommerce-product-gallery .flex-control-thumbs li {
	list-style: none !important;
	margin: 0;
	padding: 0;
	border: 1px solid var(--wc-border);
	border-radius: var(--wp--preset--border-radius--xs, 4px);
	overflow: hidden;
	background-color: var(--wp--preset--color--base, #ffffff);
	cursor: pointer;
	transition: border-color 0.2s ease;
}

.woocommerce-product-gallery .flex-control-thumbs li img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	opacity: 0.65;
	transition: opacity 0.2s ease;
}

.woocommerce-product-gallery .flex-control-thumbs li:hover img {
	opacity: 1;
}

.woocommerce-product-gallery .flex-control-thumbs li:hover {
	border-color: var(--wp--preset--color--contrast);
}

.woocommerce-product-gallery .flex-control-thumbs li:has(img.flex-active),
.woocommerce-product-gallery .flex-control-thumbs li.flex-active {
	border-color: var(--wp--preset--color--contrast);
}

.woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
	opacity: 1;
}

/* -- Breadcrumbs -- */

.woocommerce .woocommerce-breadcrumb,
.woocommerce-breadcrumb {
	color: var(--wc-subtext);
	font-size: var(--wp--preset--font-size--small);
	margin-bottom: 1.5em;

	a {
		color: var(--wp--preset--color--contrast);
		text-decoration: none;

		&:hover {
			text-decoration: underline;
		}
	}
}

/* -- Product Card Component & Hover System -- */
.product-card {
	position: relative;
	box-sizing: border-box;
	height: 100%;
	display: flex;
	flex-direction: column;
	background-color: var(--wp--preset--color--base, #ffffff);
	border-radius: var(--wp--preset--border-radius--sm, 8px);
	border: 1px solid var(--wp--preset--color--contrast-low, #e2e8f0);
}

/* Product Card Title: use default contrast text color instead of link color */
.product-card .wp-block-post-title,
.product-card .wp-block-post-title a {
	color: var(--wp--preset--color--contrast, #0f172a) !important;
	text-decoration: none !important;
	transition: color 0.15s ease !important;
}

.product-card .wp-block-post-title a:hover {
	color: var(--wp--preset--color--accent-1, #3858e9) !important;
}

/* Align action button to bottom when card contents differ in height */
.product-card .wp-block-woocommerce-product-button {
	margin-top: auto !important;
}

/* -- Card Styles -- */

/* Style: Bordered (Light, subtle border, no hover lift) */
.product-card.is-style-card-bordered {
	border-color: var(--wp--preset--color--contrast-low, #e2e8f0);
	box-shadow: none;
}

/* Style: Elevated (Soft Shadow) */
.product-card.is-style-card-elevated {
	border-color: transparent;
	box-shadow: var(--wp--preset--shadow--sm, 0 2px 4px rgba(0, 0, 0, 0.05));
}

/* Style: Minimal (Flat / Borderless) */
.product-card.is-style-card-minimal {
	border-color: transparent;
	background-color: transparent;
	box-shadow: none;
}

/* -- Corner Radius Variations -- */
.product-card.has-card-radius-none {
	border-radius: var(--wp--preset--border-radius--none, 0px);
}
.product-card.has-card-radius-sm {
	border-radius: var(--wp--preset--border-radius--xs, 4px);
}
.product-card.has-card-radius-md {
	border-radius: var(--wp--preset--border-radius--sm, 8px);
}
.product-card.has-card-radius-lg {
	border-radius: var(--wp--preset--border-radius--md, 12px);
}
.product-card.has-card-radius-xl {
	border-radius: var(--wp--preset--border-radius--lg, 16px);
}

/* -- Image Frame & Clipping -- */
.product-card .wp-block-woocommerce-product-image,
.product-card .wc-block-components-product-image,
.product-card .woocommerce-loop-product__link {
	overflow: hidden;
	border-radius: calc(var(--wp--preset--border-radius--sm, 8px) - 2px);
	display: block;
	position: relative;
}

.product-card.has-card-radius-none .wp-block-woocommerce-product-image,
.product-card.has-card-radius-none .wc-block-components-product-image {
	border-radius: 0;
}

.product-card.has-card-radius-lg .wp-block-woocommerce-product-image,
.product-card.has-card-radius-lg .wc-block-components-product-image {
	border-radius: calc(var(--wp--preset--border-radius--md, 12px) - 2px);
}

.product-card.has-card-radius-xl .wp-block-woocommerce-product-image,
.product-card.has-card-radius-xl .wc-block-components-product-image {
	border-radius: calc(var(--wp--preset--border-radius--lg, 16px) - 2px);
}

/* Ensure images fill and transition smoothly */
.product-card img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform;
}

/* -- Interactive Hover Animations (Desktop & Mouse Only) -- */
	/* Hover effects disabled per design requirements */
	.product-card:hover {
		transform: none !important;
		box-shadow: none !important;
		border-color: var(--wp--preset--color--contrast-low, #e2e8f0) !important;
	}

	.product-card:hover img {
		transform: none !important;
	}

	/* Border Highlight */
	.product-card.has-hover-border-highlight:hover {
		border-color: var(--wp--preset--color--primary, #16a34a);
	}

	/* Zero shadow per design rules */
	.product-card.has-hover-shadow-bloom:hover {
		box-shadow: none !important;
		border-color: #16a34a;
	}
}

/* -- Accessibility: Reduced Motion -- */
@media (prefers-reduced-motion: reduce) {
	.product-card,
	.product-card img {
		transition: none !important;
		transform: none !important;
	}
}

/* -- Product Tabs Section -- */
.product-tabs-nav {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 12px;
	margin-bottom: 36px;
	flex-wrap: wrap;
}

.product-tab-btn {
	cursor: pointer;
	padding: 12px 28px;
	font-size: 15px;
	font-weight: 600;
	border-radius: 6px;
	border: 1px solid #cbd5e1;
	background-color: #ffffff;
	color: #475569;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	outline: none;
}

.product-tab-btn:hover {
	border-color: #94a3b8;
	color: #0f172a;
}

.product-tab-btn.active {
	background-color: #16a34a !important;
	border-color: #16a34a !important;
	color: #ffffff !important;
	font-weight: 700;
}

.product-tab-btn .tab-count {
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 12px;
	background: #f1f5f9;
	color: #64748b;
	transition: all 0.2s ease;
}

.product-tab-btn.active .tab-count {
	background: rgba(255, 255, 255, 0.25) !important;
	color: #ffffff !important;
}

