/* Quick view (assets/js/quick-view.js): the product page's section in a sheet (sheet.css). A bottom sheet on phones;
   a centred window from 56rem, photos beside the details. */
.quick-view__heading {
	flex: 1;
	min-inline-size: 0;
}

.quick-view__title {
	margin: 0;
	overflow: hidden;
	font-weight: var(--weight-semibold);
	line-height: var(--leading-tight);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.quick-view__price {
	margin: var(--space-1) 0 0;
	font-size: var(--step--1);
	color: var(--color-ink-soft);
}

.quick-view__price:empty {
	display: none;
}

/* The page's layout, sized for the sheet: no sticky gallery, a photo that leaves room for the details. */
.quick-view .product-layout {
	gap: var(--space-5);
}

.quick-view .product-gallery {
	position: static;
	inline-size: 100%;
	max-inline-size: calc((100dvh - 12rem) * 3 / 4);
	margin-inline: auto;
}

.quick-view .product-summary__title {
	font-size: var(--step-2);
}

.quick-view .product-description {
	margin-block-start: var(--space-6);
}

/* Below the product's name (--step-2) in the sheet's order of sizes; the page's own heading is larger. */
.quick-view .product-description .storecore-heading {
	font-size: var(--step-1);
}

.quick-view__full {
	display: inline-block;
	margin-block-start: var(--space-5);
	padding-block: var(--space-2);
	font-weight: var(--weight-semibold);
	color: var(--color-accent-text);
}

.quick-view__foot .storecore-purchase__status {
	margin: 0;
}

/* While it loads: the shape of what comes. */
.quick-view__loading {
	display: grid;
	gap: var(--space-3);
}

.quick-view__bone {
	display: block;
	block-size: 1.25rem;
	border-radius: var(--radius-sm);
	background: var(--color-sand);
	animation: quick-view-pulse 1.2s ease-in-out infinite alternate;
}

.quick-view__bone--photo {
	inline-size: 100%;
	max-inline-size: calc((100dvh - 12rem) * 3 / 4);
	block-size: auto;
	aspect-ratio: 3 / 4;
	margin-inline: auto;
	border-radius: var(--radius);
}

.quick-view__bone--short {
	inline-size: 40%;
}

.quick-view__bone--box {
	block-size: 8rem;
	border-radius: calc(var(--radius) * 1.4);
}

@keyframes quick-view-pulse {
	to {
		opacity: 0.55;
	}
}

/* The enlarged photo (quick-view.js): a dialog of its own over the sheet, the whole screen, the photo whole. */
.quick-view-zoom {
	inline-size: 100%;
	block-size: 100%;
	max-inline-size: none;
	max-block-size: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: #0e0c0b;
	-webkit-tap-highlight-color: transparent;
}

.quick-view-zoom__image {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: contain;
}

.quick-view-zoom__close {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-end: 12px;
	inline-size: 44px;
	block-size: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgb(255 255 255 / 0.92);
	color: #111;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.quick-view-zoom__close:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.product-gallery__zoom {
	display: none;
}

/* Phones (owner's S21+ screenshots, 2026-12-04): the photo filled the sheet and the colours needed a scroll. The sheet
   rises to a thin strip that still closes it on a tap, the name and price
   stay in the header only (the h2 stays for screen readers), and the two buttons share one row, wrapping only when a
   label cannot fit. */
@media (max-width: 47.99rem) {
	.quick-view {
		block-size: calc(100vh - 0.75rem);
		block-size: calc(100dvh - 0.75rem);
	}

	/* One line: the name takes what is left and ends in an ellipsis, the price never wraps. */
	.quick-view__heading {
		display: flex;
		align-items: baseline;
		gap: var(--space-3);
	}

	.quick-view__title,
	.quick-view__price {
		font-size: var(--sheet-fs-title);
	}

	/* The name in the brand's heading face, like the card it was opened from; the price stays in the body face. */
	.quick-view__title {
		flex: 1;
		min-inline-size: 0;
		font-family: var(--font-heading);
	}

	:lang(ar) .quick-view__title {
		font-family: var(--font-heading-ar);
	}

	.quick-view__price {
		flex: none;
		margin: 0;
		font-weight: 800;
		font-variant-numeric: tabular-nums;
		color: var(--color-ink);
		white-space: nowrap;
	}

	/* A promotion copied from the card: the old price stays, smaller; the percentage would push the name out. */
	.quick-view__price .storecore-price__was {
		font-size: var(--sheet-fs-small);
		font-weight: var(--weight-regular);
		color: var(--color-ink-soft);
	}

	.quick-view__price .storecore-price__off {
		display: none;
	}

	.quick-view__body {
		padding-block-start: var(--space-3);
		font-size: var(--sheet-fs-body);
	}

	.quick-view .product-layout {
		gap: var(--space-4);
	}

	/* The sheet is the surface now (sheet.css): a box of the same colour inside it only pushed the choices inward. */
	.quick-view .storecore-purchase {
		padding: 0;
		border-radius: 0;
		background: none;
	}

	/* Photo first (owner, 2026-12-04): the photo runs edge to edge over the body's padding, 4:5, with no height cap;
	   the sheet scrolls to the colours. The placeholder has the same shape, so nothing jumps when loading ends. */
	/* On a short screen (360x640) a full-width 4:5 photo would fill the sheet: it gets narrower, never cut to a
	   wider shape, at most 62% of the screen's height. The margins centre it, and are negative (edge to edge) while it
	   runs full width; a percentage margin resolves against the body's width, as the width does. */
	.quick-view .product-gallery,
	.quick-view__bone--photo {
		--quick-view-photo: min(100% + 2 * var(--space-4), 62vh * 0.8);
		inline-size: var(--quick-view-photo);
		max-inline-size: none;
		margin-inline: calc((100% - var(--quick-view-photo)) / 2);
	}

	/* A custom property is not checked when declared, so the dvh value needs its own test, not a second line. */
	@supports (block-size: 1dvh) {
		.quick-view .product-gallery,
		.quick-view__bone--photo {
			--quick-view-photo: min(100% + 2 * var(--space-4), 62dvh * 0.8);
		}
	}

	.quick-view .product-gallery__main,
	.quick-view__bone--photo {
		aspect-ratio: 4 / 5;
		border-radius: 0;
	}

	.quick-view .product-gallery__thumbs {
		padding-inline: var(--space-4);
	}

	/* "Enlarge" at the photo's bottom right, physically, in Arabic too (the dots stay centred, clear of it). */
	.quick-view .product-gallery__zoom:not([hidden]) {
		position: absolute;
		inset-block-end: 12px;
		right: 12px;
		left: auto;
		display: inline-flex;
		gap: 6px;
		align-items: center;
		min-block-size: 40px;
		padding: 0 var(--space-3);
		border: 0;
		border-radius: 999px;
		background: rgb(255 255 255 / 0.9);
		color: #222;
		font-size: 0.8125rem;
		font-weight: var(--weight-semibold);
		cursor: pointer;
	}

	.quick-view .product-gallery__zoom:focus-visible {
		outline: none;
		box-shadow: var(--focus-ring);
	}

	.quick-view .product-summary__title {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.quick-view .product-summary__price {
		display: none;
	}

	.quick-view .storecore-option__body {
		min-inline-size: 3.5rem;
		min-block-size: 40px;
		padding-block: 0;
	}

	.quick-view .storecore-swatch__body {
		min-block-size: 40px;
		padding-block: 0.125rem;
	}

	.quick-view .storecore-swatch__image {
		inline-size: 32px;
		block-size: 32px;
	}

	.quick-view__foot {
		padding-block: var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
	}

	.quick-view__foot .storecore-purchase__actions {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-2);
	}

	/* "Buy now" under the right thumb in Arabic too (owner decision 2026-12-04), not mirrored to the left. */
	[dir="rtl"] .quick-view__foot .storecore-purchase__actions {
		flex-direction: row-reverse;
	}

	.quick-view__foot .storecore-purchase__actions .storecore-button {
		flex: 1 1 auto;
		min-block-size: 2.875rem;
		padding-block: 0;
		padding-inline: var(--space-3);
		font-size: var(--sheet-fs-body);
		white-space: nowrap;
	}
}

@media (min-width: 56rem) {
	.quick-view {
		inset: 0;
		inline-size: min(100% - 4rem, 64rem);
		block-size: auto;
		max-block-size: calc(100dvh - 4rem);
		margin: auto;
		border-radius: var(--radius);
		animation-name: quick-view-appear;
	}

	/* The section beside the photos already shows the name and price: no header row, only the × over the window's
	   corner, on the details side. The title stays in the markup, as the window's accessible name. */
	.quick-view__head {
		position: absolute;
		inset-block-start: var(--space-3);
		inset-inline-end: var(--space-4);
		z-index: 1;
		padding: 0;
		border-block-end: 0;
		background: none;
	}

	.quick-view__heading {
		display: none;
	}

	/* The product's name ends before the ×; so does the delivery note, the full-width line that scrolls under it. */
	.quick-view .product-summary__title,
	.quick-view .delivery-note {
		padding-inline-end: var(--tap);
	}

	/* The grey reassurance sentence too, which Tamazight's longer wording stretches into the ×'s column; it is
	   centred, so both sides give way and it stays under the buttons' middle. */
	.quick-view .storecore-quick-order__reassure {
		padding-inline: var(--tap);
	}

	.quick-view__body {
		padding: var(--space-5);
	}

	.quick-view .product-layout {
		gap: var(--space-6);
	}

	.quick-view .product-gallery {
		max-inline-size: none;
	}

	.quick-view .product-gallery__main {
		max-block-size: calc(100dvh - 16rem);
	}

	.quick-view__bone--photo {
		inline-size: 50%;
		margin-inline: 0;
	}

	.quick-view__foot {
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		padding-inline: var(--space-5);
	}

	.quick-view__foot .storecore-purchase__actions {
		grid-column: 2;
		grid-row: 1;
		grid-template-columns: repeat(2, minmax(12rem, auto));
	}

	.quick-view__foot .storecore-purchase__status {
		grid-column: 1;
		grid-row: 1;
	}
}

@keyframes quick-view-appear {
	from {
		opacity: 0;
		transform: translateY(1rem);
	}
}

@media (prefers-reduced-motion: reduce) {
	.quick-view {
		animation: none;
	}

	.quick-view__bone {
		animation: none;
	}
}
