/**
 * single-product.css
 *
 * Ported directly from the approved review mockup. Covers gallery,
 * color swatches, pricing matrix, CTA row, modals (Show All Colors,
 * Size Chart), and the description/spec section.
 */

.product-layout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 40px;
	padding: 22px 0 50px;
	align-items: start;
}

/* ---------------- Gallery ---------------- */
.gallery {
	display: grid;
	grid-template-columns: 76px 1fr;
	gap: 12px;
}
.thumb-strip {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.thumb-strip button {
	border: 1px solid #ddd;
	background: #f2f2f2;
	aspect-ratio: 1 / 1;
	padding: 0;
	overflow: hidden;
}
.thumb-strip button.active {
	border-color: #111;
	border-width: 2px;
}
.thumb-strip img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.main-image-wrap {
	position: relative;
	border: 1px solid #ddd;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}
.main-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.gallery-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.9);
	border: 1px solid #111;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	font-size: 15px;
	z-index: 5;
	cursor: pointer;
}
.gallery-arrow.prev {
	left: 12px;
}
.gallery-arrow.next {
	right: 12px;
}
.color-disclaimer {
	font-size: 11px;
	color: #999;
	margin-top: 10px;
}

/* ---------------- Product summary ---------------- */
.brand-link {
	text-transform: uppercase;
	font-size: 12px;
	letter-spacing: 0.05em;
	color: #666;
}
.product-title {
	font-size: 24px;
	margin: 0.2em 0 0.3em;
}
.sku-line {
	font-size: 12.5px;
	color: #888;
	margin-bottom: 14px;
}
.price-lead {
	font-size: 20px;
	font-weight: 800;
	margin-bottom: 18px;
}
.price-lead .from {
	display: block;
	font-size: 11px;
	text-transform: uppercase;
	color: #888;
	font-weight: 400;
	letter-spacing: 0.03em;
	margin-bottom: 2px;
}

.option-group {
	margin-bottom: 20px;
}
.option-label-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	margin-bottom: 10px;
}
.option-label-row.tight {
	justify-content: flex-start;
	gap: 12px;
}
.option-label-row .label {
	font-weight: 700;
	text-transform: uppercase;
	font-size: 12.5px;
	letter-spacing: 0.04em;
}
.option-label-row .selected-value {
	font-size: 12.5px;
	color: #666;
}
.size-chart-link {
	font-size: 11.5px;
	text-decoration: underline;
	color: #666;
	background: none;
	border: 0;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}
.size-chart-link svg {
	width: 14px;
	height: 14px;
}

/* ---------------- Color swatches ---------------- */
.swatch-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.color-swatch {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 1px solid #ccc;
	cursor: pointer;
	position: relative;
}
.color-swatch.active {
	outline: 2px solid #111;
	outline-offset: 2px;
}
.show-all-colors {
	font-size: 12px;
	text-decoration: underline;
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	background: none;
	border: 0;
	cursor: pointer;
}
.show-all-colors svg {
	width: 15px;
	height: 15px;
}

/* ---------------- Pricing matrix ---------------- */
.pricing-matrix {
	width: 100%;
	border-collapse: collapse;
	margin-top: 4px;
}
.pricing-matrix th,
.pricing-matrix td {
	border: 1px solid #ddd;
	padding: 8px 6px;
	text-align: center;
	font-size: 12.5px;
}
.pricing-matrix thead th {
	background: #111;
	color: #fff;
	text-transform: uppercase;
	font-size: 10.5px;
	letter-spacing: 0.03em;
}
.pricing-matrix .size-cell {
	font-weight: 700;
	background: #f7f7f7;
	text-align: left;
	padding-left: 10px;
	/*
	 * Guarantees consistent display regardless of how an admin actually
	 * typed the pa_size term's Name (e.g. "One Size" vs "one size") —
	 * the underlying value is now the real term name (see
	 * pricing-matrix.php), not the raw slug, but this is a safety net
	 * so casing never depends on admin discipline.
	 */
	text-transform: uppercase;
}
.pricing-matrix .qty-cell {
	padding: 5px 6px;
}
/*
 * Qty stepper (mobile-audit "Pricing Matrix" pass, 2026-09-15) — replaces
 * the bare number input's native spin arrows, which iOS Safari doesn't
 * render at all and every browser renders too small to tap reliably.
 * One shared component used at every screen size, not just mobile (see
 * pricing-matrix.php's docblock for why); assets/js/pricing-matrix.js
 * wires the −/+ clicks and keeps both buttons' disabled state in sync
 * with the input (out-of-stock, and − specifically at qty 0).
 */
.qty-stepper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid #ccc;
}
.qty-stepper button {
	background: #f7f7f7;
	border: 0;
	width: 26px;
	font-size: 14px;
	line-height: 1;
	color: #111;
	cursor: pointer;
}
.qty-stepper .qty-dec {
	border-right: 1px solid #ccc;
}
.qty-stepper .qty-inc {
	border-left: 1px solid #ccc;
}
.qty-stepper button:hover:not(:disabled) {
	background: #e8e8e8;
}
.qty-stepper button:disabled {
	color: #ccc;
	cursor: default;
}
.qty-stepper input {
	width: 40px;
	border: 0;
	padding: 5px 2px;
	text-align: center;
	font-size: 12.5px;
	/* Native spin arrows are redundant now that the stepper buttons do
	 * the same job — WebKit/Blink and Firefox each need their own
	 * property to actually remove them. */
	-moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.pricing-matrix .oos td {
	color: #bbb;
}
.pricing-matrix .oos .qty-stepper,
.pricing-matrix .oos .qty-stepper input {
	background: #f2f2f2;
}
.size-discount-badge {
	display: block;
	font-size: 10.5px;
	font-weight: 700;
	margin-bottom: 2px;
	background: #111;
	color: #fff;
	padding: 1px 5px;
	width: fit-content;
}
/*
 * v87.5 (2026-09-04, user request): previously used a red (#b00020)
 * text color — a 3rd instance of the same "no color for UI styling,
 * grayscale only" violation found in v87.4 (same round the user
 * screenshotted this tag showing red on the pricing matrix). Now
 * bold/dark (#111, this theme's standard ink tone) instead of colored
 * — still reads as prominent against the row's own grayed-out `#bbb`
 * text (.pricing-matrix .oos td, above) purely through weight and
 * contrast, no hue needed.
 */
.oos-tag {
	font-size: 9.5px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #111;
	font-weight: 700;
	display: block;
	margin-top: 2px;
}
/*
 * 2026-09-25 (user request): Preorder and Discontinued previously both
 * rendered identically to a plain in-stock or out-of-stock
 * row/product — Preorder showed no label at all (is_in_stock() is true for
 * WooCommerce's 'onbackorder' status, same as 'instock'), and Discontinued
 * showed the same generic "Out of Stock" tag above. Same grayscale-only
 * treatment as .oos-tag (this theme's "no color for UI styling" rule) —
 * differentiated by text only, not color, consistent with that rule.
 */
.preorder-tag,
.discontinued-tag {
	font-size: 9.5px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #111;
	font-weight: 700;
	display: block;
	margin-top: 2px;
}
.b2b-matrix-note {
	font-size: 11px;
	color: #999;
	margin-top: 8px;
}
/*
 * Phase 5b item 5 (revised 2026-09-25): sale price display for a tier
 * cell — wholesaletheme_tier_price_html() (includes/helpers.php) renders
 * WooCommerce's own wc_format_sale_price() markup (<del>regular</del>
 * <ins>sale</ins>) here, same as the theme's existing product-level sale
 * price. Grayscale only, matching this theme's "no color for UI styling"
 * rule (see the .size-discount-badge note above) — same treatment as
 * product-card.css's `.was` strikethrough price, just applied to <del>
 * instead since this reuses WooCommerce's own markup rather than a custom
 * span.
 */
.b2b-tier-price-cell del {
	color: #999;
	font-weight: 400;
	text-decoration: line-through;
	margin-right: 4px;
}
.b2b-tier-price-cell ins {
	font-weight: 700;
	text-decoration: none;
}

/*
 * Simple-product buy box (2026-09-22) — template-parts/single-product/
 * simple-buybox.php, the Simple-product counterpart to the matrix above.
 * Reuses .qty-stepper as-is (it was already a standalone component, not
 * scoped to .pricing-matrix — see that block's own comment), so only the
 * tier-price list needs new rules here.
 */
.b2b-simple-tier-prices {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
	border: 1px solid #e5e5e5;
}
.b2b-simple-tier-prices li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 7px 10px;
	font-size: 13px;
}
.b2b-simple-tier-prices li + li {
	border-top: 1px solid #e5e5e5;
}
.b2b-simple-tier-prices .tier-label {
	color: #555;
}
.b2b-simple-tier-prices .tier-price {
	font-weight: 700;
	color: #111;
}
/* Sale price within a tier row — see the .b2b-tier-price-cell del/ins rule above (same markup, same grayscale treatment). */
.b2b-simple-tier-prices .tier-price del {
	color: #999;
	font-weight: 400;
	text-decoration: line-through;
	margin-right: 4px;
}
.b2b-simple-tier-prices .tier-price ins {
	text-decoration: none;
}

.selection-summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-top: 2px solid #111;
	margin-top: 16px;
	padding-top: 14px;
	font-size: 13.5px;
}
.selection-summary strong {
	font-size: 16px;
}

.cta-row {
	display: flex;
	gap: 10px;
	margin-top: 16px;
}
/*
 * Both buttons split the row evenly (matches the approved mockup's
 * inline .btn { flex: 1 } — scoped here rather than added to base.css's
 * shared .btn so every OTHER .btn on the site keeps its normal
 * content-width sizing; this row is the one place two buttons sit
 * side-by-side and are meant to look like equal, parallel actions).
 * Round 2 (2026-09-04): "Get Custom Quote" moved into this row as a
 * real .btn.btn-outline button, next to Add to Cart — previously it
 * was a plain text link below the row (see the now-removed .quote-link
 * rule this replaced).
 */
.cta-row .btn {
	flex: 1;
}
.b2b-add-to-cart-message {
	font-size: 13px;
	margin: 10px 0 0;
	padding: 8px 12px;
	border: 1px solid #ddd;
}
/*
 * v87.4 (2026-09-04, user request): .is-error previously used a red
 * (#c0392b) border/text color — a direct violation of the sitewide
 * "no color for UI styling, grayscale only" standard (color is
 * reserved for product variant swatches). Now matches .is-success
 * exactly, same as every other notice pairing in this theme (see
 * base.css's .woocommerce-error/.woocommerce-message, which have
 * never used color to distinguish notice types either) — the message
 * text itself communicates error vs. success, not the color.
 */
.b2b-add-to-cart-message.is-error,
.b2b-add-to-cart-message.is-success {
	border-color: #111;
	color: #111;
}
.payment-icons-row {
	display: flex;
	gap: 8px;
	margin-top: 16px;
	flex-wrap: wrap;
}
.payment-icons-row span {
	border: 1px solid #ddd;
	padding: 5px 9px;
	font-size: 10.5px;
	color: #777;
}

/*
 * .modal-overlay / .modal-box (common) / .modal-close / .modal-box h3
 * now live in base.css (shared with the cart page's Save/Share Cart
 * modals) — this page-specific override just sets the larger size this
 * context's content (a full size-chart table) actually needs.
 */
.modal-box {
	max-width: 640px;
	max-height: 80vh;
	overflow: auto;
}
.size-chart-table {
	width: 100%;
	border-collapse: collapse;
}
.size-chart-table th,
.size-chart-table td {
	border: 1px solid #ddd;
	padding: 8px;
	text-align: center;
	font-size: 12.5px;
}
.size-chart-table th {
	background: #f2f2f2;
	text-transform: uppercase;
	font-size: 10.5px;
	letter-spacing: 0.03em;
}
.all-colors-grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 14px;
}
.all-colors-grid .color-item {
	text-align: center;
	font-size: 11px;
	cursor: pointer;
}
.all-colors-grid .color-swatch {
	margin: 0 auto 6px;
	width: 34px;
	height: 34px;
}

/* ---------------- Description / spec section ---------------- */
.description-section {
	/* 3-value left/right restored explicitly (2026-09-07 fix) — same
	 * .wrap-clobbering bug found in header.css/footer.css/homepage.css:
	 * the old `padding: 10px 0 50px` zeroed the sides, overriding .wrap's
	 * 24px horizontal gutter on the single-product page's description
	 * area (this element is `class="wrap description-section"`). */
	padding: 10px 24px 50px;
	border-top: 1px solid var(--line);
	margin-top: 10px;
}
/* "You May Also Like" band (2026-09-07): the description section above and
 * this carousel were both plain white with nothing separating them —
 * matches the alternating #fafafa pattern already used on the homepage
 * (homepage.css's .section/.section-alt), but defined here instead since
 * homepage.css isn't loaded on the single-product page. Full-width
 * background band with the existing inner .wrap supplying the gutter,
 * same structure as the homepage's alternating sections.
 *
 * 2026-09-07 follow-up: the sitewide 60px gap above .site-footer
 * (footer.css) is zeroed out for this specific adjacency
 * (.related-products-section + .site-footer), same pattern as the
 * homepage's newsletter/footer fix — so the extra bottom padding here
 * (64px, up from the original 48px) is what now carries the #fafafa
 * band through what used to be a plain-white margin gap before the dark
 * footer starts. */
.related-products-section {
	background: #fafafa;
	padding: 48px 0 64px;
}
.desc-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 40px;
	margin-top: 24px;
}
.desc-main p {
	color: var(--ink-soft);
	font-size: 14px;
}
.badge-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 16px 0;
}
.spec-badge {
	border: 1px solid #111;
	padding: 6px 12px;
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-weight: 600;
}
.feature-list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.feature-list li {
	padding: 5px 0;
	font-size: 13.5px;
	border-bottom: 1px solid #eee;
}
.feature-list li::before {
	content: '✓ ';
	color: #111;
	font-weight: 700;
}
.spec-table {
	width: 100%;
	border-collapse: collapse;
}
.spec-table th,
.spec-table td {
	padding: 8px 0;
	font-size: 13px;
	border-bottom: 1px solid #eee;
	text-align: left;
}
.spec-table th {
	color: #888;
	font-weight: 600;
	width: 40%;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.03em;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
	.product-layout {
		grid-template-columns: 1fr;
	}
	.desc-grid {
		grid-template-columns: 1fr;
	}
}
@media (max-width: 600px) {
	.gallery {
		grid-template-columns: 1fr;
	}
	/*
	 * Mobile-audit "Single Product Page" pass (2026-09-15). Switching
	 * `.thumb-strip` from column to row was already here, but that alone
	 * was never actually tested at a real phone width: with no explicit
	 * button size, a flex row just divides the strip's own width evenly
	 * across however many thumbnails a product has. Confirmed via
	 * Playwright at 375px with 6 thumbnails (a realistic count once a
	 * product has a full per-color photo set): every button rendered at
	 * 24x24px — the 76px square size they get in the desktop/tablet
	 * column layout (from `.gallery`'s 76px first grid track) never
	 * carried over once that track collapsed to a single column. A
	 * 24x24px button is both illegibly small (you can't tell one product
	 * photo from another at that size) and well under any reasonable tap
	 * target. Fixed the same way the product/category carousels were —
	 * a fixed thumbnail size plus native horizontal scroll — rather than
	 * letting the row keep shrinking to fit: `flex-shrink: 0` +
	 * `min-width` stop the squeeze, `overflow-x: auto` lets a strip
	 * longer than the viewport scroll instead. No peek/scroll-hint
	 * styling needed here the way the homepage carousels got one — this
	 * strip is a secondary selection aid (the arrows + tapping a
	 * thumbnail are the primary way to browse), not the primary
	 * scrollable content on the page.
	 */
	.thumb-strip {
		flex-direction: row;
		overflow-x: auto;
		flex-wrap: nowrap;
		scrollbar-width: none;
	}
	.thumb-strip::-webkit-scrollbar {
		display: none;
	}
	.thumb-strip button {
		width: 56px;
		min-width: 56px;
		flex-shrink: 0;
	}
	.all-colors-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	/*
	 * ---- Pricing matrix: table -> one card per size (mobile-audit
	 * "Pricing Matrix" pass, 2026-09-15) ----
	 * This table had no mobile treatment at all before — a real <table>
	 * doesn't reflow on its own, and with a Size column, several tier
	 * columns, and a Qty column it has no way to fit a phone width
	 * without horizontal scrolling, which the goal for this whole
	 * sub-project rules out. Standard table -> block reflow technique:
	 * every table-display role is overridden to block (or flex, for a
	 * label/value row), <thead> is hidden since each cell now carries
	 * its own visible label via `data-label` (pricing-matrix.php) rendered
	 * through `::before { content: attr(data-label) }`, and each <tr>
	 * becomes its own bordered card. Desktop keeps the real table,
	 * completely untouched — nothing here loads below 600px.
	 *
	 * Known tradeoff, accepted rather than solved here: hiding <thead>
	 * removes the table's native row/column semantics for screen readers
	 * along with it (the sighted-only `::before` label is a visual
	 * stand-in, not a replacement for that). Flagging it rather than
	 * quietly leaving it undocumented — matches every other cell's
	 * layout/pricing/stock info still being fully present and correct
	 * either way, just not table-structured for assistive tech at this
	 * width.
	 */
	.pricing-matrix,
	.pricing-matrix tbody,
	.pricing-matrix tr,
	.pricing-matrix td {
		display: block;
		width: auto;
	}
	.pricing-matrix thead {
		display: none;
	}
	.pricing-matrix tr {
		border: 1px solid #111;
		margin-bottom: 12px;
	}
	.pricing-matrix tr:last-child {
		margin-bottom: 0;
	}
	.pricing-matrix td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		border: 0;
		border-bottom: 1px solid #eee;
		padding: 9px 12px;
		text-align: right;
	}
	.pricing-matrix td:last-child {
		border-bottom: 0;
	}
	.pricing-matrix td::before {
		content: attr( data-label );
		font-weight: 700;
		text-transform: uppercase;
		font-size: 10.5px;
		letter-spacing: 0.03em;
		color: #888;
		text-align: left;
	}
	/*
	 * Size is the card's own header/identity, not a label/value row — no
	 * ::before label needed. Deliberately kept on the SAME light
	 * `#f7f7f7`/dark-text treatment as desktop's size-cell (not inverted
	 * to a dark bar) rather than introduced as new styling: the discount
	 * badge and OOS tag inside it are both dark-on-light (built for
	 * exactly this background), so keeping it means zero new contrast
	 * cases to get right, instead of two more color overrides to invent
	 * and verify.
	 */
	.pricing-matrix .size-cell {
		display: block;
		justify-content: normal;
		text-align: left;
		padding: 10px 12px;
		border-bottom: 1px solid var(--line);
	}
	.pricing-matrix .size-cell::before {
		content: none;
	}
	.qty-stepper button {
		/* Slightly larger tap target than desktop's 26px, still tidy
		 * against the card's own padding. */
		width: 32px;
		padding: 6px 0;
	}
}
