/*
 * Product page (assets/php/product-page.php).
 *
 * Same palette as the header and footer. Loads only on product pages, after the
 * child stylesheet. Storefront's add-to-cart rules come from the Customizer's
 * inline CSS (#…button.alt), hence the !important on the button colours.
 */

.single-product {
	--pdp-ink: #222;
	--pdp-muted: #6b6b6b;
	--pdp-line: #ececec;
	--pdp-soft: #f6f5f3;
	--pdp-good: #2f7d4f;
}

/* ---- Price and instalments ---- */

.single-product .summary p.price {
	margin-bottom: 4px;
}

.wecom-pdp-installments {
	margin: 0 0 18px;
	color: var(--pdp-muted);
	font-size: 14px;
}

.wecom-pdp-installments b {
	color: var(--pdp-ink);
	font-weight: 600;
}

/* ---- Size buttons with their price ---- */

.single-product .summary .button-variable-items-wrapper .variable-item {
	height: auto !important;
	min-height: 44px;
	padding: 6px 12px !important;
	border-radius: 8px !important;
}

.single-product .summary .button-variable-item .variable-item-contents {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1.2;
}

.single-product .summary .button-variable-item .variable-item-span-button {
	font-weight: 600;
}

.wecom-pdp-size-price {
	margin-top: 2px;
	color: var(--pdp-muted);
	font-size: 12px;
	font-weight: 400;
}

/* ---- Add to cart ---- */

.single-product .summary .single_add_to_cart_button,
.single-product .summary .single_add_to_cart_button.alt {
	border-radius: 999px !important;
	background-color: var(--pdp-ink) !important;
	border-color: var(--pdp-ink) !important;
	color: #fff !important;
	font-weight: 700;
	transition: background-color 0.15s;
}

.single-product .summary .single_add_to_cart_button:hover {
	background-color: #000 !important;
}

/* Waiting for a size: clearly a step to take, not a broken button. */
.single-product .summary .single_add_to_cart_button.disabled {
	opacity: 1 !important;
	background-color: #b9b9b9 !important;
	border-color: #b9b9b9 !important;
}

/* ---- Quantity stepper (− input +) ----
 * style.css floats .quantity at 140px with 35px side padding for the old
 * native spinner, with a selector that outranks this one unless div.product
 * is repeated. 128 + 12 margin keeps the 140px the button's width allows for. */

.single-product div.product .summary form.cart .quantity {
	display: flex;
	align-items: stretch;
	box-sizing: border-box;
	width: 128px;
	height: 56px;
	margin-right: 12px;
	padding: 0;
	border: 1px solid #d5d5d5;
	border-radius: 999px;
	background: #fff;
	overflow: hidden;
}

.single-product div.product .summary form.cart .quantity:has(input[type="hidden"]) {
	display: none;
}

.single-product .summary .quantity .qty {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	height: auto !important;
	margin: 0 !important;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--pdp-ink);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.single-product .summary .quantity .qty::-webkit-outer-spin-button,
.single-product .summary .quantity .qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* Storefront's Customizer CSS greys every button and its :hover. */
.single-product .summary .quantity .wecom-qty__btn,
.single-product .summary .quantity .wecom-qty__btn:hover {
	flex: 0 0 40px;
	padding: 0;
	border: 0;
	background: transparent !important;
	color: var(--pdp-ink) !important;
	font-size: 20px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
}

.single-product .summary .quantity .wecom-qty__btn:hover {
	background: var(--pdp-soft) !important;
}

.single-product .summary .quantity .wecom-qty__btn:focus-visible {
	outline: 2px solid var(--pdp-ink);
	outline-offset: -2px;
}

/* Phones: a narrower stepper so "Προσθήκη στο καλάθι" stays on one line. */
@media (max-width: 768px) {
	.single-product div.product .summary form.cart .quantity {
		width: 108px;
		margin-right: 10px;
	}

	.single-product div.product .summary .quantity .wecom-qty__btn {
		flex-basis: 34px;
	}

	.single-product div.product .summary .single_add_to_cart_button {
		width: calc(100% - 118px);
		padding-right: 12px;
		padding-left: 12px;
		white-space: nowrap;
	}
}

/* ---- Made-to-measure size (wecom-product-dimensions plugin) ----
 * The plugin prints, per made-to-measure variation: "( Τιμή m : 28€ )",
 * "Επιλέξτε", one or two inputs with its own - / + buttons, and
 * "Τελική Τιμή : …". Restyled as a card with the quantity's pill stepper.
 * Storefront's Customizer CSS greys every button, hence the !important. */

.single-product .summary .wecom-dimensions-front__inner:not(.wecom-dimensions-front__inner--hidden) {
	display: grid;
	gap: 4px;
	margin: 4px 0 20px;
	padding: 16px 18px;
	border-radius: 12px;
	background: var(--pdp-soft);
	color: var(--pdp-ink);
}

.single-product .summary .wecom-dimensions-front__inner > span:first-of-type {
	order: 2;
	color: var(--pdp-muted);
	font-size: 13px;
}

.single-product .summary .wecom-dimensions-front__inner > span:nth-of-type(2) {
	order: 1;
	font-size: 15px;
	font-weight: 600;
}

.single-product .summary .wecom-dimensions-front__inner .wecom_dimension_type {
	display: none;
}

.single-product .summary .wecom-dimension-inputs-outer {
	order: 3;
	flex-wrap: wrap;
	gap: 12px 16px;
	margin: 10px 0 6px;
}

.single-product .summary .wecom-dimension-input-wrapper {
	align-items: flex-start;
	gap: 6px;
	margin: 0;
}

.single-product .summary .wecom-dimension-input-wrapper label {
	width: auto;
	margin: 0;
	color: var(--pdp-muted);
	font-size: 13px;
	text-align: left;
}

.single-product .summary .wecom-dimension-input-wrapper > span {
	display: flex;
	align-items: stretch;
	box-sizing: border-box;
	width: 150px;
	height: 48px;
	border: 1px solid #d5d5d5;
	border-radius: 999px;
	background: #fff;
	overflow: hidden;
}

.single-product .summary .wecom-dimension-input-wrapper .wecom-dimension-input {
	flex: 1 1 auto;
	width: 100%;
	max-width: none;
	min-width: 0;
	height: auto;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	color: var(--pdp-ink);
	font-size: 16px;
	font-weight: 600;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.single-product .summary .wecom-dimension-input::-webkit-outer-spin-button,
.single-product .summary .wecom-dimension-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.single-product .summary .wecom-dimension-input-wrapper button,
.single-product .summary .wecom-dimension-input-wrapper button:hover {
	flex: 0 0 42px;
	width: auto;
	padding: 0;
	border: 0;
	background: transparent !important;
	color: var(--pdp-ink) !important;
	font-size: 20px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
}

.single-product .summary .wecom-dimension-input-wrapper button:hover {
	background: var(--pdp-soft) !important;
}

.single-product .summary .wecom-dimension-input-wrapper button:focus-visible {
	outline: 2px solid var(--pdp-ink);
	outline-offset: -2px;
}

.single-product .summary .wecom-dimensions-front__inner > span:last-of-type {
	order: 4;
	padding-top: 12px;
	border-top: 1px solid #e4e2de;
	font-size: 15px;
}

.single-product .summary .wecom-dimensions-front__calcPrice {
	font-size: 20px;
	font-weight: 700;
}

/* ---- Promise block ---- */

.wecom-pdp-promise {
	clear: both;
	display: grid;
	gap: 10px;
	margin: 4px 0 24px;
	padding: 16px 18px;
	border-radius: 12px;
	background: var(--pdp-soft);
	font-size: 14px;
	line-height: 1.4;
}

.wecom-pdp-promise p {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 0;
}

.wecom-pdp-promise p[hidden] {
	display: none;
}

.wecom-pdp-promise__delivery {
	color: var(--pdp-good);
}

.wecom-pdp-promise__delivery b {
	font-weight: 700;
}

.wecom-pdp-promise a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.wecom-pdp-icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-top: -1px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ---- Characteristics icons ---- */

.single-product .summary h4 + .characteristics {
	margin-bottom: 20px;
}

/* ---- Accordions ---- */

.wecom-pdp-details {
	margin: 8px 0 24px;
	border-top: 1px solid var(--pdp-line);
}

.wecom-pdp-details details {
	border-bottom: 1px solid var(--pdp-line);
}

.wecom-pdp-details summary {
	position: relative;
	padding: 14px 32px 14px 0;
	color: var(--pdp-ink);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.wecom-pdp-details summary::-webkit-details-marker {
	display: none;
}

.wecom-pdp-details summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 6px;
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--pdp-ink);
	border-bottom: 2px solid var(--pdp-ink);
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.2s;
}

.wecom-pdp-details details[open] summary::after {
	transform: translateY(-30%) rotate(-135deg);
}

.wecom-pdp-details summary:focus-visible {
	outline: 2px solid var(--pdp-ink);
	outline-offset: 2px;
}

.wecom-pdp-details__body {
	padding: 0 0 16px;
	color: #4a4a4a;
	font-size: 15px;
	line-height: 1.6;
}

.wecom-pdp-details__body p:last-child,
.wecom-pdp-details__body ul:last-child {
	margin-bottom: 0;
}

.wecom-pdp-details__body ul {
	margin: 0 0 12px 1.1em;
}

/* Imported spec lines ("Πέλος: 100% …") read as a list. */
.wecom-pdp-specs p {
	margin: 0;
}

/* ---- Sticky bar on phones ---- */

.wecom-pdp-bar {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 9990;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--pdp-line);
	background: #fff;
	box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.06);
}

.wecom-pdp-bar[hidden] {
	display: none;
}

.wecom-pdp-bar__info {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.25;
}

.wecom-pdp-bar__price {
	color: var(--pdp-ink);
	font-size: 16px;
	font-weight: 700;
}

.wecom-pdp-bar__price del {
	color: var(--pdp-muted);
	font-size: 13px;
	font-weight: 400;
}

.wecom-pdp-bar__price ins {
	text-decoration: none;
}

.wecom-pdp-bar__size {
	overflow: hidden;
	color: var(--pdp-muted);
	font-size: 12.5px;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.wecom-pdp-bar__button {
	padding: 12px 22px;
	border: 0;
	border-radius: 999px;
	background: var(--pdp-ink);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
}

/* Keep the Side Cart basket clear of the bar while it is open. */
.wecom-pdp-bar-open .xoo-wsc-basket {
	bottom: 84px !important;
}

@media (max-width: 768px) {
	.wecom-pdp-promise {
		padding: 14px 16px;
	}
}

/* The theme's inline script already writes the chosen size's price into the
   main price at the top; WooCommerce's own copy under the sizes repeated it. */
.single-product .summary .woocommerce-variation-price {
	display: none !important;
}

/* The accordions end on a rule; drop Storefront's second one above the meta. */
.single-product .summary .wecom-pdp-details ~ .product_meta {
	border-top: 0;
	padding-top: 0;
}

/* ---- Gallery: two images per row ----
 * The main image and the extra ones (.more-image, which the theme's templates
 * print as a separate block) become one grid; display:contents lifts the extra
 * images into it. Tiles share the main image's 416x577 shape. With an odd count
 * the first image spans the row at its own size, so every row is full.
 * These rules undo the theme's thumbnail column (style.css: .more-image floated
 * left at 150px, images floated at 75%).
 */

.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	align-items: start;
	margin: 0;
}

.single-product div.product div.images.wecom-gallery .more-image {
	display: contents;
}

.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__image {
	width: 100%;
	max-width: none;
	margin: 0;
	float: none;
	overflow: hidden;
	border-radius: 6px;
	/* Product shots are on white, so letterboxed landscape shots blend in. */
	background: #fff;
}

.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__image a {
	display: block;
}

/* Tiles share one shape, but a photo is never cropped to fit it: product shots
   are portrait (416x577) while angled and room shots are often landscape, and
   cropping those cut the rug off at both sides. */
.single-product div.product div.images.wecom-gallery img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	float: none;
	aspect-ratio: 416 / 577;
	object-fit: contain;
	transition: transform 0.3s;
}

.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__image a:hover img {
	transform: scale(1.03);
}

/* Room between the gallery and the buying column. */
@media (min-width: 769px) {
	.single-product div.product .woocommerce-product-gallery.wecom-gallery {
		padding-right: 32px;
	}
}

/* The sale badge was placed for the old narrow main image (right: 30%); pin it
   to the gallery's top-left corner instead of over the second tile. */
body.single-product .woocommerce-product-gallery.wecom-gallery .onsale {
	top: 12px;
	right: auto;
	left: 12px;
	z-index: 2;
}

/* Odd count: the first image takes the whole first row, at its own size. */
.single-product div.product div.images.wecom-gallery--odd .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
	grid-column: 1 / -1;
	background: transparent;
}

.single-product div.product div.images.wecom-gallery--odd .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img {
	width: auto;
	max-height: 720px;
	margin: 0 auto;
	aspect-ratio: auto;
	object-fit: contain;
}

/* Phones: the main image (the one a size choice swaps) always takes the full
   width; with an even count the last one does too, so rows stay full. */
@media (max-width: 768px) {
	.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper {
		gap: 8px;
	}

	.single-product div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
		grid-column: 1 / -1;
	}

	.single-product div.product div.images.wecom-gallery:not(.wecom-gallery--odd) .more-image > .woocommerce-product-gallery__image:last-child {
		grid-column: 1 / -1;
	}
}

/* ---- Phones: the gallery becomes a swipe slider ----
 * Edge to edge, each photo about 85% of the screen so the next one peeks in and
 * says "swipe". Snaps photo by photo. The grid's spanning rules (odd count,
 * last tile) do not apply here; every slide is the same width.
 * Storefront's mobile gutter is 1.41575em; the slider cancels it to run to the
 * screen edges and puts it back as inner padding, so the first photo still
 * lines up with the title below.
 */
@media (max-width: 768px) {
	/* div.product contains its floats with overflow:hidden, which would clip the
	   slider where it reaches past the gutter; flow-root contains them without
	   clipping. */
	.wecom-pdp-slider div.product {
		display: flow-root;
		overflow: visible;
	}

	/* The gallery is floated, and a float with width:auto shrinks to its content
	   instead of filling the cancelled gutters, so the width is set outright.
	   #content outranks style.css's `.woocommerce #content div.product div.images
	   { width: 100% !important }`, which has an id of its own. */
	.wecom-pdp-slider #content div.product div.images.wecom-gallery {
		position: relative;
		float: none;
		width: calc(100% + 2 * 1.41575em) !important;
		margin-right: -1.41575em;
		margin-left: -1.41575em;
	}

	.wecom-pdp-slider div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper {
		display: flex;
		gap: 8px;
		padding: 0 1.41575em;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding: 0 1.41575em;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.wecom-pdp-slider div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper::-webkit-scrollbar {
		display: none;
	}

	.wecom-pdp-slider div.product div.images.wecom-gallery .woocommerce-product-gallery__image,
	.wecom-pdp-slider div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child,
	.wecom-pdp-slider div.product div.images.wecom-gallery:not(.wecom-gallery--odd) .more-image > .woocommerce-product-gallery__image:last-child {
		flex: 0 0 85%;
		grid-column: auto;
		scroll-snap-align: start;
		border-radius: 4px;
	}

	/* A single photo needs no peek. */
	.wecom-pdp-slider div.product div.images.wecom-gallery .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:only-child {
		flex-basis: 100%;
	}

	.wecom-pdp-slider div.product div.images.wecom-gallery--odd .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img {
		width: 100%;
		max-height: none;
		aspect-ratio: 416 / 577;
		object-fit: contain;
	}

	.wecom-gallery-count {
		position: absolute;
		/* Top corner: the Side Cart basket floats at the bottom right. */
		top: 10px;
		right: calc(1.41575em + 8px);
		z-index: 2;
		padding: 3px 9px;
		border-radius: 999px;
		background: rgba(34, 34, 34, 0.72);
		color: #fff;
		font-size: 12px;
		font-weight: 600;
		letter-spacing: 0.04em;
		font-variant-numeric: tabular-nums;
		pointer-events: none;
	}
}

@media (min-width: 769px) {
	.wecom-gallery-count {
		display: none;
	}
}
