/*
 * Product card (inc/product-card.php). Home / D-Home `.pcard`; INTERACTIONS §4 and §6.
 * The containers (row, grid) set the card width; the card fills it.
 */
.pcard {
	position: relative; min-width: 0; margin: 0; background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px #D5DCD6;
	display: flex; flex-direction: column; overflow: hidden;
	transition: transform var(--wp--custom--motion, 120ms) ease-out, box-shadow var(--wp--custom--motion, 120ms) ease-out;
}
.pc-img { display: block; width: 100%; height: 140px; object-fit: contain; background: #fff; box-sizing: border-box; flex-shrink: 0; }
/* No photo: Petrol panel with the category icon (Review focus 4), never a broken image. */
.pc-ph { display: flex; align-items: center; justify-content: center; background: #0F3D3E; }
.pc-ph .ico { width: 40px; height: 40px; }
.pcard-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex-grow: 1; min-width: 0; }
.fit {
	font-size: 12px; line-height: 16px; font-weight: 700; color: #0B2E2F; background: #E3EBE6; border-radius: 4px;
	padding: 2px 8px; align-self: flex-start; max-width: 100%; box-sizing: border-box;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* A row or grid where only some cards carry a tag: the others keep the tag's line (20px + the 8px
   gap) empty, so every title in the row starts on the same line. Rows without tags are unchanged,
   and so are one-column lists (the guide's "Shop the parts", phone search results), where there is
   no row to line up. */
:has(> .pcard .fit):not(.gp-parts-l, .srch-grid) > .pcard .pcard-body:not(:has(> .fit))::before,
.srch-grid:has(> .pcard .fit) > .pcard .pcard-body:not(:has(> .fit))::before { content: ""; display: block; height: 20px; flex-shrink: 0; }
/* Search results are a one-column list below 1024px (src/listing): no row there. */
@media (max-width: 1023.98px) {
	.srch-grid:has(> .pcard .fit) > .pcard .pcard-body:not(:has(> .fit))::before { content: none; }
}
.ptitle {
	font-size: 14px; line-height: 20px; min-height: 40px; color: #101A1A; text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
/* Stretched link: the title covers the whole card (one tap target, INTERACTIONS §4). */
.ptitle::after { content: ""; position: absolute; inset: 0; border-radius: 12px; z-index: 0; }
.price { display: flex; align-items: baseline; gap: 4px; min-height: 24px; margin-top: auto; }
.price small { font-size: 12px; color: #3D4A49; }
.price del { font-size: 12px; color: #3D4A49; }
.price strong { font-size: 18px; font-weight: 800; font-stretch: 125%; }
.pc-large { font-size: 12px; line-height: 16px; color: #3D4A49; }
.pc-add { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pcard .add {
	position: relative; z-index: 1; width: 100%; height: 44px; margin: 0; padding: 1px 6px; box-sizing: border-box; border: 0; border-radius: 8px;
	background: #101A1A; color: #FFC23C; font: inherit; font-weight: 800; font-size: 14px;
	display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.add .ico { width: 16px; height: 16px; }
.add .add-x { display: none; }
.add .add-l--busy, .add .add-l--done, .add .add-i--tick { display: none; }
.add[aria-busy="true"] { cursor: progress; }
.add[aria-busy="true"] .add-l--idle { display: none; }
.add[aria-busy="true"] .add-l--busy { display: inline; }
.pcard .add[data-added="true"] { background: #0E7A3F; color: #fff; }
.add[data-added="true"] .add-l--idle, .add[data-added="true"] .add-i--plus { display: none; }
.add[data-added="true"] .add-l--done { display: inline; }
.add[data-added="true"] .add-i--tick { display: block; }
/* Out of stock: Ask on WhatsApp (official glyph, white on green). */
/* Phone: icon 16, gap 4, padding 2 and Archivo's width axis at 90% keep "Ask on WhatsApp" inside the 136px button of a 160px card. */
.pcard .add--wa { background: #0E7A3F; color: #fff; gap: 4px; padding: 0 2px; font-stretch: 90%; }
.pcard .add--wa .ico { width: 16px; height: 16px; }
/* "Choose …": a label that still doesn't fit wraps inside the button instead of spilling out of it. */
.pcard .add--choose .ico { flex-shrink: 0; }
.pcard .add--choose span { min-width: 0; white-space: normal; text-align: center; line-height: 16px; }
.pc-err { margin: 0; position: relative; z-index: 1; font-size: 12px; line-height: 16px; font-weight: 700; color: #101A1A; white-space: normal; }

@media (min-width: 1024px) {
	.pc-img { height: 200px; padding: 12px; }
	.pcard-body { padding: 16px; }
	.ptitle { font-size: var(--wp--preset--font-size--sm-plus); }
	.price { min-height: 28px; }
	.price small { font-size: 13px; }
	.price strong { font-size: 20px; }
	.pcard .add { font-size: var(--wp--preset--font-size--sm-plus); }
	.add .add-x { display: inline; }
	.pcard .add--wa { gap: 6px; padding: 1px 6px; font-stretch: 100%; }
	.pcard .add--wa .ico { width: 18px; height: 18px; }
}

/* ---------- States ---------- */
@media (hover: hover) and (pointer: fine) {
	.pcard:hover { box-shadow: 0 0 0 2px #0F3D3E; }
	.pcard:hover .ptitle { text-decoration: underline; text-underline-offset: 3px; }
	.pcard .add:hover { background: #1E2B2B; }
	.pcard .add[data-added="true"]:hover, .pcard .add--wa:hover { background: #0B6634; }
}
/* Press: the card .99 when its title link is pressed; Add only scales itself (.97). */
.pcard:has(.ptitle:active) { transform: scale(.99); }
.pcard .add:active { background: #000; transform: scale(.97); }
.pcard .add[data-added="true"]:active, .pcard .add--wa:active { background: #095A2E; }
/* Keyboard: focus on the title outlines the whole card (3px, offset 2). */
.ptitle:focus-visible { outline: none; }
.pcard:has(.ptitle:focus-visible) { outline: 3px solid var(--ts-ring, #101A1A); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	.pcard:has(.ptitle:active), .pcard .add:active { transform: none; }
}
