/* =========================================================================
 * Single product page — phone layout (max-width:767px)
 *
 * Why this file exists
 * --------------------
 * main.css:563 states the intent in its own comment: "single product on
 * phones: same two-column layout as desktop, just smaller". That decision is
 * the root of every mobile problem on this page — at 390px the gallery and the
 * summary each get ~179px, the title is set at 14px, the gallery arrows are
 * 24px and the quantity buttons are 26px wide.
 *
 * This file is the phone layer for that one template. It changes layout,
 * reading size and touch targets only; it adds no markup and no behaviour.
 *
 * SCOPE GUARANTEES
 *   - every rule sits inside one `@media (max-width:767px)` block;
 *   - every selector is rooted at `.single-product`;
 *   - the file is only enqueued when is_product() is true (inc/assets.php),
 *     so no other template downloads it.
 * Tablet (768-1023) and desktop (>=1024) are untouched by construction.
 *
 * The parent's mobile block uses !important on the grid declarations, so the
 * layout rules below must match it in weight and load later — which they do,
 * because this file depends on bsc-mobile and sits after it in the queue.
 * ========================================================================= */

@media (max-width: 767px) {

	/* ---------------------------------------------------------------------
	 * 1. One column, in the order the reader needs
	 *
	 * DOM order on a WooCommerce product page is gallery, then summary, so a
	 * single-column grid puts the image first with no `order` juggling.
	 *
	 * The column assignments MUST be restated: main.css:567-568 pins the
	 * gallery to column 1 and the summary to column 2 with !important. Left
	 * alone inside a one-column grid, the summary would be pushed into an
	 * implicit second column and land off-screen.
	 * ------------------------------------------------------------------ */
	.single-product div.product {
		grid-template-columns: minmax(0, 1fr) !important;
		gap: 20px !important;
	}

	.single-product div.product > .woocommerce-product-gallery {
		grid-column: 1 !important;
		margin-inline: 0 !important;
	}

	.single-product div.product > .summary {
		grid-column: 1 !important;
		width: 100% !important;
		float: none !important;
	}

	/* ---------------------------------------------------------------------
	 * 2. Reading sizes
	 *
	 * The parent drops the title to 14px (main.css:574) on a 390px screen,
	 * which is below the floor this project uses everywhere else. The price
	 * is restored to the same weight as the title so the pair reads as one
	 * block rather than a caption above a number.
	 * ------------------------------------------------------------------ */
	.single-product .summary .product_title,
	.single-product div.product .product_title {
		font-size: 20px;
		line-height: 1.6;
		margin-bottom: 6px;
	}

	.single-product .summary .price {
		font-size: 20px;
		margin: 6px 0 16px;
	}

	.single-product .summary table.variations label {
		font-size: 13px;
		margin-bottom: 6px;
	}

	/* ---------------------------------------------------------------------
	 * 3. Size picker touch target
	 *
	 * The animated picker (assets/css/variation-picker.css) is active on this
	 * page and is NOT replaced here — only its footprint changes. Its own
	 * phone block sets 13px text and 10px padding, which lands around 38px
	 * tall; 15px text and 12/14 padding clears the 48px target this page
	 * uses for every other control.
	 * ------------------------------------------------------------------ */
	.single-product .summary .mg-size__trigger {
		min-height: 48px;
		padding: 12px 14px;
		font-size: 15px;
	}

	.single-product .summary .mg-size__opt {
		min-height: 48px;
		font-size: 14px;
	}

	/* ---------------------------------------------------------------------
	 * 4. Purchase actions
	 *
	 * main.css:580 shrinks both buttons to 12px type with 9px padding so they
	 * can sit side by side with the stepper.
	 *
	 * The stepper and the add-to-cart button now share one row. They are one
	 * decision — how many, then add — and stacked they cost a full extra row on
	 * the busiest part of the page. The buy-now button keeps its own full-width
	 * row: it is a different commitment, not a second quantity control.
	 *
	 * The wrapper is already `display:flex; flex-wrap:wrap; gap:8px` (measured),
	 * so only the flex bases change: the add button drops from `1 1 100%` to
	 * `1 1 auto` and the stepper already refuses to shrink. Buy-now stays 100%
	 * so it wraps onto its own line by itself.
	 * ------------------------------------------------------------------ */
	.single-product .summary .single_add_to_cart_button,
	.single-product .summary .button.buy-now {
		min-width: 0;
		min-height: 48px;
		padding: 12px 10px;
		font-size: 15px;
		white-space: nowrap;
	}

	/* One row, two controls, one height. The stepper's own box came out at 50px
	 * and the button at 48px, which read as a 2px step in a row that is meant to
	 * look like a single line; both are pinned to the stepper's height. */
	.single-product .summary .woocommerce-variation-add-to-cart {
		align-items: stretch;
	}

	.single-product .summary .woocommerce-variation-add-to-cart .single_add_to_cart_button {
		flex: 1 1 auto;
		min-height: 50px;
	}

	.single-product .summary .woocommerce-variation-add-to-cart .button.buy-now {
		flex: 1 1 100%;
	}

	/* ---------------------------------------------------------------------
	 * 5. Quantity stepper
	 *
	 * main.css:581 sets the +/- buttons to 26px wide. The stepper is the most
	 * mis-tapped control on the page; 44px each side, 48px tall.
	 * ------------------------------------------------------------------ */
	.single-product .summary .brand-q .qb {
		width: 44px;
		min-height: 48px;
	}

	.single-product .summary .brand-q input.qty {
		min-height: 48px;
		width: 52px;
		font-size: 16px; /* 16px keeps iOS from zooming on focus */
	}

	/* ---------------------------------------------------------------------
	 * 6. Gallery controls
	 *
	 * The full-width gallery makes the arrows and dots the only way to move
	 * between shots. main.css:570-572 leaves them at 24px and 6px, which is
	 * neither tappable nor visible.
	 * ------------------------------------------------------------------ */
	.single-product .gal-arrow {
		width: 44px;
		height: 44px;
		font-size: 18px;
		margin-top: -22px;
	}

	.single-product .gal-dots {
		bottom: 10px;
		gap: 7px;
	}

	.single-product .gal-dots button {
		width: 10px;
		height: 10px;
	}

	.single-product .gal-thumbs {
		gap: 6px;
		margin-top: 8px;
	}

	/* ---------------------------------------------------------------------
	 * 7. Gallery dots — contrast
	 *
	 * main.css:342-344 draws 9px dots as a white fill with a 1px ink border.
	 * Over a photograph the white fill and the dark border each win on one kind
	 * of image and lose on the other, so the control disappears on exactly the
	 * product shots where it is needed. A dark pill behind the row gives every
	 * dot a guaranteed backdrop; the dots themselves become white rings so they
	 * read against it instead of against the photo.
	 * ------------------------------------------------------------------ */
	.single-product .gal-dots {
		/* Centred by symmetric insets and auto margins, not by
		 * `inset-inline-start: 50%` + translateX(-50%): in RTL the logical start
		 * resolves to `right`, so the translate pushed the pill 50px away from
		 * the centre of the image (measured: 145 against a 195 centre). */
		inset-inline: 0;
		width: max-content;
		margin-inline: auto;
		bottom: 10px;
		padding: 6px 11px;
		gap: 8px;
		background: rgba(10, 10, 10, 0.46);
		border-radius: 999px;
		backdrop-filter: blur(2px);
	}

	.single-product .gal-dots button {
		width: 10px;
		height: 10px;
		border: 1.5px solid #fff;
		background: transparent;
		box-shadow: none;
	}

	.single-product .gal-dots button.on {
		background: #fff;
		border-color: #fff;
	}

	/* Nothing here for the mobile buy bar: it is cart-only now, and its gate in
	 * inc/assets.php no longer loads it on a product page. */
}
