/*
 * ---------------------------------------------------------------------------
 * الملف:      assets/css/shop.css
 * الوظيفة:    تصميم المتجر فقط (يُحمَّل بعد core.css في صفحات المتجر):
 *             1. شبكة المنتجات: 2 في الصف على الجوال، 3 على اللوحي، 4 على الكمبيوتر
 *             2. بطاقة المنتج   3. صفحة المنتج: الصورة والمعلومات
 *             4. أزرار الشراء والإفصاح   5. أزرار الفيديو   6. التفاصيل والمنتجات المشابهة
 *             التصنيفات في القائمة الجانبية وصف الهيدر، مثل المدونة.
 *             اللون المميز في المتجر عنابي (من data-env في core.css).
 * ---------------------------------------------------------------------------
 */

/* A product shown in its other language (Arabic-only product on an English
   page) uses that language's font; the font file loads only when needed. */
[lang="ar"]:not(html) {
	font-family: var(--font-ar);
}

[lang="en"]:not(html) {
	font-family: var(--font-en);
}

/* 1. Product grid --------------------------------------------------------------- */

.product-grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

@media (min-width: 768px) {
	.product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--gap);
	}
}

@media (min-width: 1024px) {
	.product-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* 2. Product card ------------------------------------------------------------------ */

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.product-card__media {
	display: block;
	position: relative;
	background: #fff;
	border-bottom: 1px solid var(--c-line);
}

/* Product photos are often on white: show the whole product, never crop it. */
.product-card__media .thumb,
.product__media .thumb {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
}

.product-card__badge {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-start: 8px;
	padding: 2px 10px;
	background: var(--accent);
	border-radius: 999px;
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.6;
}

.product-card__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 10px 12px 14px;
}

.product-card__title {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.55;
}

/* The line clamp sits on the inner text, not on the link (see blog.css .card__text). */
.product-card__link {
	color: var(--c-text);
	text-decoration: none;
}

.product-card__text {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* The whole card opens the product. */
.product-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.product-card:hover .product-card__link,
.product-card__link:focus-visible {
	color: var(--accent);
}

.product-card__intro {
	margin: 0;
	color: var(--c-muted);
	font-size: 0.82rem;
	line-height: 1.6;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* «اكتشف السعر»: looks like an add-to-cart button, sits at the bottom so
   buttons line up across a row. The card link covers it. */
.product-card__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	margin-top: auto;
	padding: 6px 12px;
	background: var(--accent);
	border-radius: 10px;
	color: #fff;
	font-size: 0.88rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: center;
	/* Taps go through to the card link under it. */
	pointer-events: none;
	transition: box-shadow 0.2s;
}

/* Space above the button, whatever comes before it. */
.product-card__body > :nth-last-child(2) {
	margin-bottom: 8px;
}

/* No filter/opacity here: they lift the button above the card link and
   swallow the click. */
.product-card:hover .product-card__cta,
.product-card:focus-within .product-card__cta {
	box-shadow: inset 0 0 0 100px rgba(255, 255, 255, 0.12);
}

@media (min-width: 768px) {
	.product-card__body {
		padding: 12px 16px 16px;
	}

	.product-card__title {
		font-size: 1rem;
	}
}

/* 3. Product page ------------------------------------------------------------------- */

.product__main {
	display: grid;
	gap: 20px;
	margin-bottom: 32px;
}

@media (min-width: 768px) {
	.product__main {
		grid-template-columns: minmax(0, 45%) minmax(0, 1fr);
		gap: 32px;
		align-items: start;
	}
}

@media (min-width: 1024px) {
	.product__main {
		grid-template-columns: 520px minmax(0, 1fr);
		gap: 48px;
	}
}

.product__media {
	position: relative;
	background: #fff;
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
	overflow: hidden;
}

/* On wide screens the picture stays in view while the buttons scroll by. */
@media (min-width: 1024px) {
	.product__media {
		position: sticky;
		top: calc(var(--header-h) + 16px);
	}
}

.product__title {
	margin: 0 0 10px;
	font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2rem);
	line-height: 1.45;
}

html[lang="en"] .product__title {
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.product__intro {
	margin: 0 0 20px;
	color: var(--c-muted);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
}

.product__review {
	margin: 20px 0 0;
}

/* 4. Purchase buttons ------------------------------------------------------------------ */

.buy {
	padding: 16px;
	background: var(--c-ivory);
	border: 1px solid var(--c-line);
	border-radius: var(--radius);
}

.buy__title,
.videos__title {
	margin: 0 0 12px;
	font-size: 1.05rem;
}

/* Space between buttons so a tap never lands on the wrong one, even when an
   automatic ad pushes the page. */
.buy__list,
.videos__list {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.buy__button {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: 52px;
	padding: 8px 16px;
	background: #fff;
	border: 2px solid var(--accent);
	border-radius: 12px;
	color: var(--accent);
	font-weight: 700;
	text-decoration: none;
}

.buy__button:hover {
	background: var(--c-ivory);
}

.buy__button--main {
	background: var(--accent);
	color: #fff;
}

.buy__button--main:hover {
	background: var(--accent);
	filter: brightness(1.12);
}

.buy__logo {
	flex: none;
	width: 32px;
	height: 32px;
	object-fit: contain;
	background: #fff;
	border-radius: 8px;
}

.buy__letter {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	background: var(--c-ivory);
	border-radius: 8px;
	color: var(--accent);
	font-size: 1rem;
	font-weight: 700;
}

.buy__label {
	flex: 1;
	min-width: 0;
}

.buy__icon {
	flex: none;
	width: 18px;
	height: 18px;
	opacity: 0.8;
}

.buy__disclosure {
	margin: 12px 0 0;
	color: var(--c-muted);
	font-size: 0.8rem;
	line-height: 1.7;
}

.buy__disclosure a {
	color: var(--c-muted);
}

/* 5. Video buttons ------------------------------------------------------------------------ */

.videos {
	margin-top: 20px;
}

.videos__list {
	display: flex;
	flex-wrap: wrap;
}

.videos__list li {
	flex: 1 1 220px;
}

/* In-page players: one per row, the player loads only after a tap. */
.videos__list .videos__item--player {
	flex: 1 1 100%;
}

/* A video link alone on its line in the product description. */
.alz-embed-wrap {
	margin-block: 20px;
}

.alz-embed {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--c-dark);
	border-radius: var(--radius);
}

.alz-embed--tall {
	aspect-ratio: 9 / 16;
	max-width: 340px;
	margin-inline: auto;
}

.alz-embed__link,
.alz-embed__frame {
	display: block;
	width: 100%;
	height: 100%;
}

.alz-embed__link {
	color: #fff;
	text-decoration: none;
}

.alz-embed__frame {
	border: 0;
}

.alz-embed__thumb,
.alz-embed .thumb {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Product photos (white background) are shown whole and dimmed a little. */
.alz-embed .thumb {
	object-fit: contain;
	background: #fff;
	opacity: 0.85;
}

.alz-embed__play {
	position: absolute;
	inset: 50% auto auto 50%;
	width: 68px;
	height: 48px;
	transform: translate(-50%, -50%);
	background: rgba(14, 14, 18, 0.8);
	border-radius: 12px;
	transition: background 0.2s;
}

.alz-embed__play::after {
	content: "";
	position: absolute;
	inset: 50% auto auto 54%;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 10px 0 10px 17px;
	border-color: transparent transparent transparent #fff;
}

.alz-embed__link:hover .alz-embed__play,
.alz-embed__link:focus-visible .alz-embed__play {
	background: var(--accent);
}

.alz-embed__name {
	position: absolute;
	inset-block-end: 10px;
	inset-inline-start: 10px;
	padding: 2px 10px;
	background: rgba(14, 14, 18, 0.8);
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
}

.videos__button {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding-block: 6px;
	padding-inline: 8px 16px;
	background: var(--c-dark);
	border-radius: 999px;
	color: var(--c-on-dark);
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}

.videos__button:hover {
	background: #24242c;
}

.videos__play {
	display: inline-grid;
	place-items: center;
	width: 34px;
	height: 34px;
	background: var(--accent-on-dark);
	border-radius: 50%;
	color: #fff;
}

.videos__play .icon {
	width: 16px;
	height: 16px;
	margin-left: 2px; /* Optical centre; play icons are never mirrored. */
}

/* 6. Details and similar products ------------------------------------------------------------- */

.product__details {
	max-width: var(--reading);
	margin-bottom: 32px;
}

/* Under the details: the video list and the buy buttons again, same width. */
.product > .videos,
.product > .buy {
	max-width: var(--reading);
	margin-bottom: 32px;
}

.product__details .section-title,
.product__similar .section-title {
	display: inline-block;
	margin-bottom: 16px;
}

.product__similar {
	margin-top: 40px;
}
