/*!
 * Custom Elementor Widgets - Product CPT Styles
 * Only enqueued on the Product archive and single Product screens
 * (see class-cpt-product.php::enqueue_assets()).
 * Class prefix: cew-product (Custom Elementor Widgets).
 */

/* =========================================================
   Archive
   ========================================================= */
.cew-product-archive__title {
	margin-bottom: 1.5em;
}

.cew-product-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 24px;
	margin: 0 0 2em;
	padding: 0;
	list-style: none;
}

.cew-product-card {
	display: flex;
	flex-direction: column;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 6px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cew-product-card:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.cew-product-card__link {
	display: flex;
	flex-direction: column;
	color: inherit;
	text-decoration: none;
}

.cew-product-card__thumbnail {
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f2f2f2;
}

.cew-product-card__thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cew-product-card__no-image {
	display: block;
	width: 100%;
	height: 100%;
}

.cew-product-card__title {
	margin: 0.75em 1em 0.25em;
	font-size: 1.05em;
}

.cew-product-card__categories {
	margin: 0 1em 1em;
	font-size: 0.85em;
	opacity: 0.75;
}

.cew-product-card__categories a {
	color: inherit;
}

.cew-product-archive__pagination {
	margin-top: 1em;
}

/* =========================================================
   Single Product - two column detail layout
   Left: featured image. Right: title, category, description.
   ========================================================= */
.cew-product-detail-wrap {
	--cew-product-accent: #1c7430;
	--cew-product-border: rgba(0, 0, 0, 0.08);
	--cew-product-radius: 10px;

	max-width: 1280px;
	margin: 40px auto;
	padding: 0 20px;
}

.cew-product-detail {
	display: grid;
	grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
	gap: 48px;
	align-items: start;
	padding: 40px;
	background: #fff;
	border: 1px solid var(--cew-product-border);
	border-radius: var(--cew-product-radius);
}

/* No featured image: let the text span the full width. */
.cew-product-detail--no-image {
	grid-template-columns: minmax(0, 1fr);
}

/* ---------- Left column: image ---------- */
.cew-product-detail__media {
	position: sticky;
	top: 24px;
}

.cew-product-detail__image,
.cew-product-detail__media img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--cew-product-border);
	border-radius: var(--cew-product-radius);
}

/* ---------- Right column: content ---------- */
.cew-product-detail__title {
	margin: 0 0 18px;
	color: var(--cew-product-accent);
	font-size: clamp(1.75rem, 3vw, 2.5rem);
	font-weight: 800;
	line-height: 1.2;
}

.cew-product-detail__meta {
	margin: 0 0 22px;
	font-size: 1rem;
}

.cew-product-detail__meta-label {
	font-weight: 700;
}

.cew-product-detail__meta-value a {
	color: inherit;
	text-decoration: none;
}

.cew-product-detail__meta-value a:hover {
	text-decoration: underline;
}

.cew-product-detail__description-heading {
	margin: 0 0 10px;
	font-size: 1.15rem;
	font-weight: 700;
}

.cew-product-detail__description {
	line-height: 1.7;
}

.cew-product-detail__description > *:first-child {
	margin-top: 0;
}

.cew-product-detail__description > *:last-child {
	margin-bottom: 0;
}

.cew-product-detail__description img {
	max-width: 100%;
	height: auto;
}

.cew-product-detail__description table {
	width: 100%;
	border-collapse: collapse;
}

.cew-product-detail__description table th,
.cew-product-detail__description table td {
	padding: 8px 12px;
	border: 1px solid var(--cew-product-border);
	text-align: left;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	.cew-product-detail {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
		padding: 24px;
	}

	.cew-product-detail__media {
		position: static;
		max-width: 420px;
	}
}

@media (max-width: 600px) {
	.cew-product-detail-wrap {
		margin: 24px auto;
		padding: 0 14px;
	}

	.cew-product-detail {
		padding: 18px;
	}
}
