/**
 * 123D — Single-product redesign
 * Scope: every rule is prefixed with body.tzd-single-product so nothing leaks
 * to other pages or themes. RTL-first, brand color #C7522A.
 *
 * Approach: we restyle WooCommerce's standard markup (.product, .summary,
 * .price, .variations_form, .single_add_to_cart_button, .woocommerce-tabs)
 * rather than overriding templates — update-safe and theme-agnostic.
 */

/* ----------------------------------------------------------------------- */
/* Design tokens                                                           */
/* ----------------------------------------------------------------------- */
body.tzd-single-product {
	--tzd-brand: #c7522a;
	--tzd-brand-700: #a8401f;
	--tzd-brand-300: #e88b6a;
	--tzd-ink: #1c1410;
	--tzd-ink-soft: #6b5d54;
	--tzd-line: #ece4de;
	--tzd-surface: #ffffff;
	--tzd-surface-2: #faf6f3;
	--tzd-surface-3: #f4ebe5;
	--tzd-shadow: 0 1px 2px rgba(28, 20, 16, .04), 0 8px 28px rgba(28, 20, 16, .06);
	--tzd-shadow-lg: 0 4px 12px rgba(199, 82, 42, .10), 0 24px 60px rgba(28, 20, 16, .12);
	--tzd-radius: 18px;
	--tzd-radius-sm: 12px;
	--tzd-font: "Assistant", "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
	--tzd-display: "Heebo", "Assistant", system-ui, sans-serif;
}

/* ----------------------------------------------------------------------- */
/* Page canvas                                                             */
/* ----------------------------------------------------------------------- */
body.tzd-single-product {
	background:
		radial-gradient(1200px 600px at 100% -10%, rgba(199, 82, 42, .06), transparent 60%),
		radial-gradient(900px 500px at -10% 10%, rgba(199, 82, 42, .04), transparent 55%),
		var(--tzd-surface-2);
	font-family: var(--tzd-font);
	color: var(--tzd-ink);
}

/* -----------------------------------------------------------------------
 * Layout
 * The theme's own product wrapper is unpredictable, and WooCommerce floats
 * the gallery/summary by default. Rather than guess the wrapper class, our
 * JS wraps the gallery + summary in .tzd-product-layout (a node we fully
 * control) and we lay THAT out as a grid. We also hard-reset Woo's floats
 * and widths so nothing collapses into a narrow column.
 * --------------------------------------------------------------------- */

/* Neutralize WooCommerce/theme floats + fixed widths on the key blocks. */
body.tzd-single-product div.product .woocommerce-product-gallery,
body.tzd-single-product div.product .summary.entry-summary,
body.tzd-single-product div.product div.images,
body.tzd-single-product div.product div.summary {
	float: none !important;
	width: auto !important;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	clear: none !important;
}

/* Make sure the theme container doesn't clamp us to a skinny column. */
body.tzd-single-product div.product {
	max-width: 1180px;
	margin-inline: auto;
	padding: clamp(18px, 4vw, 40px) clamp(14px, 4vw, 28px) 0;
	display: block;      /* container itself is normal flow; layout lives in .tzd-product-layout */
	width: auto;
	float: none;
	overflow: visible;
}
body.tzd-single-product div.product::before,
body.tzd-single-product div.product::after { content: none; display: none; } /* kill clearfix */

/* Override central theme width clamp on the product page. */
body.tzd-single-product .central-page,
body.tzd-single-product .central-error {
	max-width: 100%;
}

/* The JS-built two-column layout wrapper (flex). */
body.tzd-single-product .tzd-product-layout {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: clamp(20px, 4vw, 48px);
}
/* Gallery first (right side in RTL) — kept narrower so the product image
   doesn't dominate; summary takes the remaining space. */
body.tzd-single-product .tzd-product-layout > .woocommerce-product-gallery {
	flex: 0 1 320px;
	min-width: 0;
}
body.tzd-single-product .tzd-product-layout > .summary.entry-summary {
	flex: 1 1 420px;
	min-width: 0;
}

/* Tabs / meta / upsells always span full width below the fold. */
body.tzd-single-product div.product .woocommerce-tabs,
body.tzd-single-product div.product .up-sells,
body.tzd-single-product div.product .related,
body.tzd-single-product div.product .product_meta { width: auto !important; float: none !important; clear: both; }

/* Single-column on tablet/mobile. */
@media (max-width: 880px) {
	body.tzd-single-product .tzd-product-layout {
		gap: 18px;
	}
	body.tzd-single-product .tzd-product-layout > .woocommerce-product-gallery,
	body.tzd-single-product .tzd-product-layout > .summary.entry-summary {
		flex: 1 1 100%;
		max-width: 100%;
	}
}

/* Requested: ensure the Woo gallery is sticky (theme override). */
.woocommerce div.product div.images.woocommerce-product-gallery {
	position: sticky;
}

/* -----------------------------------------------------------------------
 * Gallery
 * --------------------------------------------------------------------- */
body.tzd-single-product .woocommerce-product-gallery {
	position: sticky;
	top: 24px;
	background: var(--tzd-surface);
	border: 1px solid var(--tzd-line);
	border-radius: var(--tzd-radius);
	padding: clamp(16px, 3vw, 32px);
	box-shadow: var(--tzd-shadow);
	overflow: hidden;
}
body.tzd-single-product .woocommerce-product-gallery::before {
	content: "";
	position: absolute;
	inset: 0;
	background: radial-gradient(120% 80% at 50% 0%, rgba(199, 82, 42, .05), transparent 60%);
	pointer-events: none;
}
body.tzd-single-product .woocommerce-product-gallery__wrapper { margin: 0; }
body.tzd-single-product .woocommerce-product-gallery__image,
body.tzd-single-product .woocommerce-product-gallery__image a { display: block; }
body.tzd-single-product .woocommerce-product-gallery__image img {
	border-radius: var(--tzd-radius-sm);
	width: 100%;
	max-width: 260px;   /* keep the subscription logo image compact */
	height: auto;
	margin: 0 auto;     /* center within the card */
	display: block;
}
body.tzd-single-product .woocommerce-product-gallery__trigger { display: none; }

@media (max-width: 880px) {
	body.tzd-single-product .woocommerce-product-gallery { position: static; }
}

/* ----------------------------------------------------------------------- */
/* Summary column                                                          */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .summary.entry-summary {
	background: var(--tzd-surface);
	border: 1px solid var(--tzd-line);
	border-radius: var(--tzd-radius);
	padding: clamp(22px, 3vw, 38px);
	box-shadow: var(--tzd-shadow);
}

/* Eyebrow tag before the title (uses ::before so no markup change needed) */
body.tzd-single-product .summary .product_title::before {
	content: "מנוי חודשי · SaaS";
	display: inline-block;
	font-family: var(--tzd-font);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--tzd-brand-700);
	background: linear-gradient(180deg, rgba(199, 82, 42, .12), rgba(199, 82, 42, .06));
	border: 1px solid rgba(199, 82, 42, .2);
	padding: 5px 12px;
	border-radius: 999px;
	margin-bottom: 14px;
}

body.tzd-single-product .summary .product_title.entry-title {
	font-family: var(--tzd-display);
	font-weight: 800;
	font-size: clamp(26px, 3.4vw, 38px);
	line-height: 1.15;
	letter-spacing: -0.01em;
	margin: 0 0 14px;
	color: var(--tzd-ink);
}

/* Price */
body.tzd-single-product .summary .price,
body.tzd-single-product .summary .price ins {
	color: var(--tzd-brand-700);
	font-family: var(--tzd-display);
	font-weight: 800;
	text-decoration: none;
}
body.tzd-single-product .summary .price {
	font-size: clamp(22px, 2.6vw, 30px);
	margin: 0 0 6px;
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}
body.tzd-single-product .summary .price .woocommerce-Price-currencySymbol { font-weight: 700; }
/* WooCommerce Subscriptions period string ("/ חודש") softened */
body.tzd-single-product .summary .price .subscription-details,
body.tzd-single-product .summary .price small {
	font-size: 15px;
	font-weight: 600;
	color: var(--tzd-ink-soft);
}

/* Short description */
body.tzd-single-product .summary .woocommerce-product-details__short-description {
	color: var(--tzd-ink-soft);
	font-size: 16px;
	line-height: 1.7;
	margin: 14px 0 20px;
}
body.tzd-single-product .summary .woocommerce-product-details__short-description strong { color: var(--tzd-ink); }

/* Full description, surfaced in the summary above the variations. */
body.tzd-single-product .summary .tzd-description {
	text-align: right;
	font-size: 15.5px;
	line-height: 1.75;
	color: var(--tzd-ink);
	margin: 6px 0 22px;
	padding: 0 0 20px;
	border-bottom: 1px solid var(--tzd-line);
}
body.tzd-single-product .summary .tzd-description p { margin: 0 0 12px; }
body.tzd-single-product .summary .tzd-description p:last-child { margin-bottom: 0; }
body.tzd-single-product .summary .tzd-description strong { color: var(--tzd-ink); font-weight: 700; }
body.tzd-single-product .summary .tzd-description ul {
	list-style: none;
	padding: 0;
	margin: 12px 0;
}
body.tzd-single-product .summary .tzd-description ul li {
	position: relative;
	padding-inline-start: 26px;
	margin: 9px 0;
	color: var(--tzd-ink-soft);
}
body.tzd-single-product .summary .tzd-description ul li::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	top: 8px;
	width: 14px;
	height: 14px;
	background: var(--tzd-brand);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center / contain;
}
body.tzd-single-product .summary .tzd-description a[href^="tel"] { color: var(--tzd-brand-700); font-weight: 700; }


/* ----------------------------------------------------------------------- */
/* Variation form → plan selector                                          */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .variations_form .variations {
	margin: 8px 0 18px;
	border: 0;
}
body.tzd-single-product .variations_form .variations,
body.tzd-single-product .variations_form .variations tbody,
body.tzd-single-product .variations_form .variations tr {
	display: block;
	width: 100%;
}
body.tzd-single-product .variations_form .variations td,
body.tzd-single-product .variations_form .variations th {
	display: block;
	width: 100%;
	padding: 0;
	border: 0;
}
body.tzd-single-product .variations_form .variations .label label {
	font-family: var(--tzd-display);
	font-weight: 700;
	font-size: 15px;
	color: var(--tzd-ink);
	margin-bottom: 10px;
	display: block;
}

/* The native <select> — styled as a confident, tappable control.
   (The JS enhancement layers clickable plan cards above it; the select stays
    as the source of truth + graceful fallback if JS is disabled.) */
body.tzd-single-product .variations_form .variations select {
	width: 100%;
	font-family: var(--tzd-font);
	font-size: 16px;
	font-weight: 600;
	color: var(--tzd-ink);
	background: var(--tzd-surface-2);
	border: 1.5px solid var(--tzd-line);
	border-radius: var(--tzd-radius-sm);
	padding: 14px 16px;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23a8401f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 16px center; /* RTL: chevron on the left */
	cursor: pointer;
	transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
body.tzd-single-product .variations_form .variations select:hover {
	border-color: var(--tzd-brand-300);
	background-color: #fff;
}
body.tzd-single-product .variations_form .variations select:focus {
	outline: none;
	border-color: var(--tzd-brand);
	box-shadow: 0 0 0 4px rgba(199, 82, 42, .14);
}

/* "Clear" / reset variation link */
body.tzd-single-product .variations_form .reset_variations {
	font-size: 13px;
	color: var(--tzd-ink-soft);
	text-decoration: underline;
	margin-top: 8px;
	display: inline-block;
}

/* Plan-card selector injected by product.js */
body.tzd-single-product .tzd-plans {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
	gap: 10px;
	margin: 4px 0 16px;
}
@media (max-width: 420px) {
	body.tzd-single-product .tzd-plans {
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;
	}
	body.tzd-single-product .tzd-plan { padding: 11px 8px; }
	body.tzd-single-product .tzd-plan__count { font-size: 19px; }
}
body.tzd-single-product .tzd-plan {
	position: relative;
	border: 1.5px solid var(--tzd-line);
	background: var(--tzd-surface-2);
	border-radius: var(--tzd-radius-sm);
	padding: 14px 12px;
	text-align: center;
	cursor: pointer;
	transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
	user-select: none;
}
body.tzd-single-product .tzd-plan:hover {
	border-color: var(--tzd-brand-300);
	background: #fff;
	transform: translateY(-2px);
	box-shadow: var(--tzd-shadow);
}
body.tzd-single-product .tzd-plan__count {
	font-family: var(--tzd-display);
	font-weight: 800;
	font-size: 22px;
	line-height: 1;
	color: var(--tzd-ink);
}
body.tzd-single-product .tzd-plan__unit {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--tzd-ink-soft);
	margin-top: 5px;
}
body.tzd-single-product .tzd-plan[aria-pressed="true"] {
	border-color: var(--tzd-brand);
	background: linear-gradient(180deg, rgba(199, 82, 42, .10), rgba(199, 82, 42, .03));
	box-shadow: 0 0 0 3px rgba(199, 82, 42, .14);
}
body.tzd-single-product .tzd-plan[aria-pressed="true"] .tzd-plan__count { color: var(--tzd-brand-700); }
body.tzd-single-product .tzd-plan[aria-pressed="true"]::after {
	content: "✓";
	position: absolute;
	top: 8px;
	inset-inline-start: 10px;
	width: 18px;
	height: 18px;
	font-size: 12px;
	font-weight: 800;
	color: #fff;
	background: var(--tzd-brand);
	border-radius: 50%;
	display: grid;
	place-items: center;
	line-height: 1;
}

/* When JS enhancement is active we visually hide the native select but keep
   it accessible/operational as the form value source. */
body.tzd-single-product.tzd-plans-active .variations_form .variations select {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
body.tzd-single-product.tzd-plans-active .variations_form .variations .label label { margin-bottom: 4px; }

/* Variation price row that WooCommerce reveals after selection */
body.tzd-single-product .single_variation .price {
	margin: 4px 0 14px;
}
body.tzd-single-product .woocommerce-variation-availability { color: var(--tzd-ink-soft); font-size: 14px; }

/* ----------------------------------------------------------------------- */
/* Quantity + Add to cart                                                  */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .summary form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 12px;
	margin: 6px 0 4px;
}
body.tzd-single-product .summary form.variations_form { display: block; }
body.tzd-single-product .summary form.cart .quantity { flex: 0 0 auto; }

body.tzd-single-product .summary .quantity input.qty {
	width: 72px;
	height: 54px;
	text-align: center;
	font-size: 16px;
	font-weight: 700;
	color: var(--tzd-ink);
	background: var(--tzd-surface-2);
	border: 1.5px solid var(--tzd-line);
	border-radius: var(--tzd-radius-sm);
}
body.tzd-single-product .summary .quantity input.qty:focus {
	outline: none;
	border-color: var(--tzd-brand);
	box-shadow: 0 0 0 4px rgba(199, 82, 42, .14);
}

body.tzd-single-product .summary .single_add_to_cart_button,
body.tzd-single-product .summary button.single_add_to_cart_button {
	flex: 1 1 220px;
	min-height: 54px;
	font-family: var(--tzd-display);
	font-weight: 800;
	font-size: 17px;
	letter-spacing: .01em;
	color: #fff;
	background: linear-gradient(180deg, var(--tzd-brand) 0%, var(--tzd-brand-700) 100%);
	border: 0;
	border-radius: var(--tzd-radius-sm);
	padding: 0 26px;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(199, 82, 42, .28);
	transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
body.tzd-single-product .summary .single_add_to_cart_button:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(199, 82, 42, .34);
	filter: saturate(1.05);
}
body.tzd-single-product .summary .single_add_to_cart_button:active { transform: translateY(0); }
body.tzd-single-product .summary .single_add_to_cart_button.disabled,
body.tzd-single-product .summary .single_add_to_cart_button:disabled {
	opacity: .5;
	cursor: not-allowed;
	box-shadow: none;
	transform: none;
}

/* ----------------------------------------------------------------------- */
/* Trust strip                                                             */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .tzd-trust {
	list-style: none;
	margin: 22px 0 0;
	padding: 18px 0 0;
	border-top: 1px solid var(--tzd-line);
	display: grid;
	gap: 14px;
}
body.tzd-single-product .tzd-trust__item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}
body.tzd-single-product .tzd-trust__icon {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	color: var(--tzd-brand-700);
	background: linear-gradient(180deg, rgba(199, 82, 42, .12), rgba(199, 82, 42, .05));
	border: 1px solid rgba(199, 82, 42, .18);
	border-radius: 11px;
}
body.tzd-single-product .tzd-trust__icon svg { width: 21px; height: 21px; }
body.tzd-single-product .tzd-trust__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex-wrap: wrap;
	align-content: flex-start;
	align-items: flex-start;
}
body.tzd-single-product .tzd-trust__title { font-family: var(--tzd-display); font-weight: 700; font-size: 15px; color: var(--tzd-ink); }
body.tzd-single-product .tzd-trust__desc { font-size: 13.5px; line-height: 1.55; color: var(--tzd-ink-soft); }

/* ----------------------------------------------------------------------- */
/* Tabs — removed completely (description is surfaced in the summary instead) */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .woocommerce-tabs,
body.tzd-single-product .woocommerce-tabs.wc-tabs-wrapper {
	display: none !important;
}

/* additional information table (only shown if surfaced elsewhere) */
body.tzd-single-product .woocommerce-product-attributes {
	border-collapse: separate;
	border-spacing: 0;
	width: 100%;
	border: 1px solid var(--tzd-line);
	border-radius: var(--tzd-radius-sm);
	overflow: hidden;
}
body.tzd-single-product .woocommerce-product-attributes th,
body.tzd-single-product .woocommerce-product-attributes td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--tzd-line);
	font-size: 15px;
}
body.tzd-single-product .woocommerce-product-attributes tr:last-child th,
body.tzd-single-product .woocommerce-product-attributes tr:last-child td { border-bottom: 0; }
body.tzd-single-product .woocommerce-product-attributes th {
	background: var(--tzd-surface-2);
	font-weight: 700;
	color: var(--tzd-ink);
	width: 32%;
}

/* ----------------------------------------------------------------------- */
/* Product meta (SKU / category) — de-emphasize                            */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .product_meta {
	margin-top: 18px;
	padding-top: 16px;
	border-top: 1px solid var(--tzd-line);
	font-size: 13px;
	color: var(--tzd-ink-soft);
}
body.tzd-single-product .product_meta a { color: var(--tzd-brand-700); }

/* Hide the empty SKU ("אין מידע") noise */
body.tzd-single-product .product_meta .sku_wrapper { display: none; }

/* ----------------------------------------------------------------------- */
/* WooCommerce notices on the page                                         */
/* ----------------------------------------------------------------------- */
body.tzd-single-product .woocommerce-message,
body.tzd-single-product .woocommerce-info {
	border-top-color: var(--tzd-brand);
	border-radius: var(--tzd-radius-sm);
}
body.tzd-single-product .woocommerce-message::before,
body.tzd-single-product .woocommerce-info::before { color: var(--tzd-brand); }

/* ----------------------------------------------------------------------- */
/* Entrance animation (page load)                                          */
/* ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
	body.tzd-single-product .woocommerce-product-gallery,
	body.tzd-single-product .summary.entry-summary {
		animation: tzd-rise .55s cubic-bezier(.2, .7, .2, 1) both;
	}
	body.tzd-single-product .summary.entry-summary { animation-delay: .07s; }
	@keyframes tzd-rise {
		from { opacity: 0; transform: translateY(14px); }
		to   { opacity: 1; transform: translateY(0); }
	}
}
