/*
 * talha/product-page — Product (390) and D-Product (1440) boards. INTERACTIONS §2 (buy, WhatsApp,
 * stepper), §3 (links), §5 (size option), §6 (Add to cart), §9 (sticky buy box; the phone buy bar
 * replaces the bottom nav).
 *
 * One DOM: on phones the side column, buy box and form are display:contents, so their parts flow in
 * the board's order (photo, title and price, options, quantity, facts, sections).
 */

/* ---------- Phone (Product board) ---------- */
.pp .pp-top { width: 100%; margin: 0; }
.pp-grid { display: flex; flex-direction: column; gap: 24px; padding: 0 16px; }
.pp-side, .pp-buybox, .pp-form { display: contents; }

.pp-gal {
	margin: 0 -16px -8px; padding: 16px 0; background: #fff; display: flex; justify-content: center;
}
.pp-img { display: block; width: 310px; height: 310px; max-width: 100%; object-fit: contain; }
/* 600–1023 (no board): the photo grows with the width instead of staying phone-sized. */
@media (min-width: 600px) and (max-width: 1023.98px) {
	.pp-img { width: min(480px, 62vw); height: min(480px, 62vw); }
	/* A readable measure (about 65 characters) for What it does and Details. */
	.pp-desc :is(p, li), .pp-det :is(p, li, dd) { max-width: 65ch; }
}
/*
 * G-28 gallery thumbs (real Daraz photos; new UI, the boards draw none). Built from the card and chip
 * rules: white, 1px Line ring, radius 8 (--btn); hover (fine pointers only) a 1px Petrol ring on Tint;
 * press .97 on Line; the thumb showing its photo a 2px Ink ring; keyboard focus the 3px Ink outline,
 * offset 2. 52px on phones, 64px on desktop (both over 44). Phones: one row that scrolls sideways; its
 * 6px padding-block holds the 2px ring and the 5px focus outline, and scroll-padding keeps a focused
 * thumb 16px in from the edge, so nothing is clipped. Left/Right/Home/End move between thumbs
 * (view.js thumbKey). The photo box has a fixed size, so swapping the photo moves nothing.
 */
.pp-gal--thumbs { flex-direction: column; align-items: center; gap: 12px; padding-bottom: 8px; }
.pp-thumbs {
	display: flex; gap: 8px; margin: 0; padding: 6px 16px; list-style: none; max-width: 100%; box-sizing: border-box;
	overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 16px; scrollbar-width: none;
}
.pp-thumbs::-webkit-scrollbar { display: none; }
.pp-thumbs li { flex-shrink: 0; scroll-snap-align: start; }
.pp-thumb {
	display: block; width: 52px; height: 52px; box-sizing: border-box; padding: 4px; border-radius: var(--wp--custom--radius--btn, 8px); background: #fff;
	box-shadow: 0 0 0 1px #D5DCD6; cursor: pointer; -webkit-tap-highlight-color: transparent;
	transition: transform var(--wp--custom--motion, 120ms) ease-out, box-shadow var(--wp--custom--motion, 120ms) ease-out, background-color var(--wp--custom--motion, 120ms) ease-out;
}
.pp-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 4px; }
.pp-thumb[aria-current="true"] { box-shadow: 0 0 0 2px #101A1A; }
.pp-thumb:focus-visible { outline: 3px solid var(--ts-ring, #101A1A); outline-offset: 2px; }
.pp-thumb:active { transform: scale(.97); background: #D5DCD6; }
.pp-ph { display: flex; align-items: center; justify-content: center; background: #0F3D3E; border-radius: 12px; }
.pp-ph .ico { width: 64px; height: 64px; }

.pp-head { display: flex; flex-direction: column; gap: 8px; }
.pp-h1 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; font-stretch: 125%; letter-spacing: -.01em; color: #101A1A; overflow-wrap: anywhere; text-wrap: pretty; }
/* Long marketplace titles step down the scale (phone 18, desktop 22) so the price stays in view. */
.pp-h1--long { font-size: 18px; }
.pp-fit {
	margin: 0; align-self: flex-start; font-size: 12px; line-height: 16px; font-weight: 700; color: #0B2E2F;
	background: #E3EBE6; border-radius: 4px; padding: 2px 8px;
}
.pp-pr { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pp-price { font-size: 30px; line-height: 36px; font-weight: 900; font-stretch: 125%; color: #101A1A; }
.pp-stock { font-size: 14px; line-height: 20px; font-weight: 700; color: #0E7A3F; display: flex; align-items: center; gap: 6px; }
.pp-stock::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: currentColor; flex-shrink: 0; }
.pp-stock[data-oos="true"] { color: #3D4A49; }

/* Options (§5 size option: a radio). Native radios: one tab stop, arrow keys, and a no-JS form value. */
.pp-opts { margin: 0; padding: 0; border: 0; min-width: 0; }
.pp-legend { padding: 0; margin: 0 0 8px; font-weight: 700; float: left; width: 100%; }
.pp-legend + * { clear: both; }
.pp-opts-in { display: flex; flex-direction: column; gap: 8px; }
.sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.size {
	position: relative; min-height: 64px; box-sizing: border-box; border-radius: 12px; border: 2px solid #7B8483; background: #fff; color: #101A1A;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; text-align: center; cursor: pointer;
	transition: transform var(--wp--custom--motion, 120ms) ease-out, background-color var(--wp--custom--motion, 120ms) ease-out, border-color var(--wp--custom--motion, 120ms) ease-out, color var(--wp--custom--motion, 120ms) ease-out;
}
.size strong { font-size: 16px; line-height: 20px; font-weight: 800; font-stretch: 125%; overflow-wrap: anywhere; }
.size span { font-size: 14px; line-height: 20px; }
.size-in { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.size:has(.size-in:checked) { border-color: #0F3D3E; background: #0F3D3E; color: #fff; }
.size:has(.size-in:focus-visible) { outline: 3px solid var(--ts-ring, #101A1A); outline-offset: 2px; }
.size-in:focus-visible { outline: none; }
.size:active { transform: scale(.97); }
/* Press tint on an unpicked size, like the other chips, so a held finger shows (a scale alone is too faint). */
.size:not(:has(.size-in:checked)):active { background: #E3EBE6; }
.pp-help { margin: 0; color: #3D4A49; }

/* WhatsApp text link (§3 .ask). */
.ask {
	min-height: 44px; display: flex; align-items: center; gap: 8px; align-self: flex-start; font-weight: 700; color: #0E7A3F;
	text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.ask .ico { width: 24px; height: 24px; }
/* G-57 "Send to your technician": pairs with what sits above it (the WhatsApp ask link on phones, the
   dark purchase panel on desktop), so 12px instead of the 24px section gap. */
.pp-tech { margin-top: -12px; }

/* Purchase: the dark box on desktop. On phones only the quantity row shows here (Add and WhatsApp are in the
   buy bar), on the light page, so the ring is Ink again. */
.pp .pp-purchase { display: flex; flex-direction: column; gap: 12px; --ts-ring: #101A1A; }
.pp-qrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pp-qrow[hidden] { display: none; }
.qlabel { font-weight: 700; }
.stepper {
	display: flex; align-items: stretch; flex-shrink: 0; width: 128px; box-sizing: border-box; border-radius: 12px;
	background: #fff; border: 2px solid #7B8483;
}
.step {
	flex: 0 0 48px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #101A1A;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.step[hidden] { display: none; }
.step[aria-disabled="true"] { color: #C9D1CF; cursor: not-allowed; }
.step:not([aria-disabled="true"]):active { background: #E3EBE6; transform: scale(.97); }
/* Keyboard ring inside the button (its corners follow the stepper's), so it never lies over the number. */
.step:focus-visible { outline-offset: -3px; }
.qty {
	flex: 1 1 auto; min-width: 0; width: 100%; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent;
	color: inherit; text-align: center; font: inherit; font-size: 18px; font-weight: 800; font-stretch: 125%;
}
/* With JS the buttons show and the number sits between them, without the browser's own spinner. */
.step:not([hidden]) + .qty { flex: 0 0 28px; -moz-appearance: textfield; appearance: textfield; }
.step:not([hidden]) + .qty::-webkit-inner-spin-button, .step:not([hidden]) + .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* One ring for the field: on the whole stepper, never a second box inside it. */
.qty:focus, .qty:focus-visible { outline: none; }
.stepper:has(.qty:focus-visible) { outline: 3px solid var(--ts-ring, #101A1A); outline-offset: 2px; }

/* Main action (§2 .buy): Sunflower, only on the dark box and the dark bar. */
.buy {
	position: relative; height: 56px; margin: 0; padding: 0 12px; border: 0; border-radius: 12px; background: #FFC23C; color: #101A1A;
	font: inherit; font-stretch: 112%; font-weight: 900; font-size: 17px; line-height: 1.2;
	display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-align: center;
}
/* A long total wraps as one unit on very narrow phones instead of running out of the button. */
.buy-t, .buy-sum { white-space: nowrap; }
.buy[hidden] { display: none; }
.buy .buy-i { width: 22px; height: 22px; }
.buy .buy-i--tick, .buy .buy-l--busy, .buy .buy-l--done { display: none; }
.buy[aria-busy="true"] { cursor: progress; }
.buy[aria-busy="true"] .buy-l--idle { display: none; }
.buy[aria-busy="true"] .buy-l--busy { display: inline; }
/* INTERACTIONS §6: "turns WhatsApp green with a tick" (the spec wins over both boards' white button). */
.buy[data-added="true"] { background: #0E7A3F; color: #fff; }
.buy[data-added="true"] .buy-l--idle, .buy[data-added="true"] .buy-i--cart { display: none; }
.buy[data-added="true"] .buy-l--done { display: inline; }
.buy[data-added="true"] .buy-i--tick { display: block; }
.buy-sum[hidden] { display: none; }

/* WhatsApp button (§2 .wa): official glyph, green. */
.pp-purchase .wa, .pp-bar .wa {
	display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 12px; background: #0E7A3F; color: #fff;
	font-weight: 800; text-decoration: none; box-sizing: border-box;
}
.pp-err { margin: 0; font-size: 14px; line-height: 20px; font-weight: 700; color: #fff; }
.pp-err[hidden] { display: none; }

/* Delivery, payment, returns, safety (D-Product .info). */
.info { background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px #D5DCD6; }
.info-row { display: flex; gap: 12px; padding: 16px; align-items: flex-start; }
.info-row + .info-row { border-top: 1px solid #E3EBE6; }
.info-row > span { text-wrap: pretty; min-width: 0; }
.rlink { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rlink:active { color: #0F3D3E; }

/* The product's sections. Phones: plain sections (Product board); desktop: cards (D-Product). */
.pp-det { display: flex; flex-direction: column; gap: 24px; }
.dcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dcard .h2 { margin: 0; font-size: 18px; line-height: 1.15; font-weight: 800; font-stretch: 125%; letter-spacing: normal; color: #101A1A; }
.dots { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.dots li { display: flex; gap: 12px; overflow-wrap: anywhere; }
.dots li::before { content: ""; flex-shrink: 0; margin-top: 6px; width: 8px; height: 8px; border-radius: 2px; background: #0F3D3E; }
.pp-desc { overflow-wrap: anywhere; }
.pp-desc > :first-child { margin-top: 0; }
.pp-desc > :last-child { margin-bottom: 0; }
.pp-desc p { margin: 0 0 8px; }
.pp-desc :where(h2, h3, h4) { margin: 16px 0 8px; font-size: 16px; line-height: 1.2; font-weight: 800; }
.pp-desc :where(ul, ol) { margin: 0 0 8px; padding-left: 20px; }

/* You may also need: the Home row (talha/product-row's .prow). */
.pp-more { margin-top: 32px; padding-bottom: 32px; }

/* The dark buy bar, fixed at the bottom on phones (it replaces the bottom nav). */
.pp-bar {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #101A1A; color: #fff;
	padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px;
}
.pp-bar-row { display: flex; gap: 8px; }
.pp-bar .wa { flex: 0 0 56px; height: 56px; font-size: 16px; }
.pp-bar-wa-l { display: none; }
.pp-bar[data-oos="true"] .wa { flex: 1 1 auto; }
.pp-bar[data-oos="true"] .pp-bar-wa-l { display: inline; }
.pp-bar .buy { flex: 1 1 auto; min-width: 0; }
@media (max-width: 1023.98px) {
	body:has(.pp-bar) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
	body:has(.pp-bar .pp-err:not([hidden])) { padding-bottom: calc(128px + env(safe-area-inset-bottom)); }
	html:has(.pp-bar) { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom) + 8px); }
	.pp-purchase:not(:has(.pp-qrow:not([hidden]))) { display: none; }
}

/* ---------- Hover (pointer devices only) ---------- */
@media (hover: hover) and (pointer: fine) {
	.size:not(:has(.size-in:checked)):hover { border-color: #0F3D3E; }
	.pp-thumb:not([aria-current="true"]):hover { box-shadow: 0 0 0 1px #0F3D3E; background: #E3EBE6; }
	.ask:hover { color: #0B6634; text-decoration-thickness: 2px; }
	.step:not([aria-disabled="true"]):hover { background: #E3EBE6; }
	.buy:hover { background: #FFD066; }
	.buy[data-added="true"]:hover { background: #0B6634; }
	.pp-purchase .wa:hover, .pp-bar .wa:hover { background: #0B6634; }
	.rlink:hover { text-decoration-thickness: 2px; }
}

/* ---------- Press (after hover, so a held press shows its own colour, not the hover's) ---------- */
.buy:active { background: #E6A800; transform: scale(.97); }
.buy[data-added="true"]:active { background: #095A2E; }
.pp-purchase .wa:active, .pp-bar .wa:active { background: #095A2E; transform: scale(.97); }
.ask:active { color: #095A2E; }
.pp-thumb:not([aria-current="true"]):active { background: #D5DCD6; }

/* ---------- Desktop (D-Product) ---------- */
@media (min-width: 1024px) {
	.pp { padding: 40px 0 80px; }
	.pp .pp-top { width: min(1200px, 100% - 48px); margin-inline: auto; display: flex; flex-direction: column; gap: 16px; }
	.pp-crumbs .crumbs { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 14px; line-height: 22px; color: #101A1A; }
	.pp-crumbs li { display: flex; align-items: center; gap: 8px; }
	.pp-crumbs li + li::before { content: "/"; opacity: .8; }
	.pp-crumbs .crumb {
		min-height: 44px; min-width: 44px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: #101A1A;
		text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
	}
	.pp-crumbs .crumb:active { color: #0F3D3E; text-decoration-thickness: 2px; }

	.pp-grid {
		display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-rows: auto 1fr;
		grid-template-areas: "gal side" "det side"; column-gap: 48px; row-gap: 24px; padding: 0; align-items: start;
	}
	.pp-gal { grid-area: gal; margin: 0; padding: 0; height: 600px; border-radius: 16px; box-shadow: 0 0 0 1px #D5DCD6; align-items: center; }
	.pp-img { width: 540px; height: 540px; }
	.pp-gal--thumbs { height: auto; min-height: 600px; padding: 24px 0 16px; justify-content: center; gap: 16px; }
	.pp-thumbs { padding: 6px 24px; flex-wrap: wrap; justify-content: center; overflow: visible; }
	.pp-thumb { width: 64px; height: 64px; } /* 8 photos (the most any product has) fit on one row */
	.pp-ph { width: 100%; height: 100%; border-radius: 16px; }
	.pp-ph .ico { width: 96px; height: 96px; }

	/* §9: the buy box is sticky in the right column, 24px from the top. */
	/* A column taller than the window sticks by its bottom edge instead (view.js sets --pp-side-h), so the
	   facts box under the buy box is never held out of view while the left side scrolls. */
	.pp-side { grid-area: side; display: flex; flex-direction: column; gap: 16px; position: sticky; top: min(24px, calc(100vh - var(--pp-side-h, 0px) - 24px)); }
	.pp-buybox { display: flex; flex-direction: column; gap: 24px; padding: 32px; background: #fff; border-radius: 16px; box-shadow: 0 0 0 1px #D5DCD6; }
	.pp-form { display: flex; flex-direction: column; gap: 24px; }

	.pp-head { gap: 12px; }
	.pp-h1 { font-size: 30px; line-height: 1.12; letter-spacing: -.015em; }
	.pp-h1--long { font-size: 22px; line-height: 1.15; letter-spacing: -.01em; }
	.pp-fit { font-size: 14px; line-height: 20px; }
	.pp-pr { gap: 16px; }
	.pp-price { font-size: 40px; line-height: 48px; letter-spacing: -.01em; }
	.pp-stock { font-size: var(--wp--preset--font-size--sm-plus, 15px); line-height: 22px; }

	.pp-legend { margin-bottom: 10px; font-size: 16px; }
	.pp-opts-in { gap: 10px; }
	.size { min-height: 72px; }
	.size strong { font-size: 18px; line-height: 22px; }
	.size span { font-size: 15px; line-height: 20px; }

	.pp .pp-purchase { background: #101A1A; color: #fff; border-radius: 12px; padding: 20px; --ts-ring: #FFC23C; }
	.qlabel { font-size: var(--wp--preset--font-size--sm-plus, 15px); }
	.stepper { width: auto; background: transparent; border: 1.5px solid #7FA8A6; }
	.step { height: 53px; color: #fff; }
	.qty { height: 53px; }
	.stepper:has(.step[hidden]) { width: 127px; }
	.step:not([aria-disabled="true"]):active { background: #134A4B; }
	/* On the dark panel the enabled icon is white, so #C9D1CF read as enabled: a dimmer tone (G-review p3). */
	.pp .pp-purchase .step[aria-disabled="true"] { color: #5E6B69; }
	.buy { font-size: 18px; }
	.pp-purchase .wa { height: 52px; padding: 0 24px; font-size: 16px; }

	.info-row { padding: 16px 20px; font-size: var(--wp--preset--font-size--sm-plus, 15px); line-height: 22px; }
	.info-row--link { align-items: center; padding-top: 6px; padding-bottom: 6px; }
	.info-row--link .rlink { min-height: 44px; display: inline-flex; align-items: center; }
	.rlink { font-weight: 700; color: #0F3D3E; }
	.rlink:active { color: #101A1A; }

	.pp-det { grid-area: det; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: stretch; }
	.pp-det--two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
	.pp-det--two .dcard--wide { grid-column: 1 / -1; }
	.dcard { gap: 12px; padding: 28px; background: #fff; border-radius: 16px; box-shadow: 0 0 0 1px #D5DCD6; }
	.dcard .h2 { font-size: 22px; letter-spacing: -.01em; }
	.dots { gap: 10px; font-size: 16px; line-height: 24px; }
	.dots li::before { margin-top: 8px; }
	.pp-desc { font-size: 16px; line-height: 24px; }

	.pp-more { margin-top: 64px; padding-bottom: 0; }
}
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
	.step:not([aria-disabled="true"]):hover { background: #134A4B; }
	.pp-crumbs .crumb:hover { text-decoration-thickness: 2px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.size:active, .buy:active, .step:active, .pp-purchase .wa:active, .pp-bar .wa:active, .pp-thumb:active { transform: none; }
}
