/* =========================================================================
 * Tablet coverage — 768px to 1023px
 *
 * Why this file exists
 * --------------------
 * The site had two tiers: mobile (max-width:767px, handled by mobile.css) and
 * desktop. Nothing owned the tablet range, so an iPad in portrait — 768px
 * exactly, one pixel above the mobile ceiling — received desktop rules and
 * inherited their side effects:
 *
 *   - main.css:197 drops the product grid to TWO columns on max-width:900px,
 *     so 768px showed oversized cards while 901px jumped to four. Neither
 *     reads well on a 768px screen.
 *   - main.css:512 forces .latest to FOUR columns from 768px up, which at
 *     768px leaves ~165px cards.
 *   - main.css:312-314 collapses the single product to one column up to
 *     800px (image fills the whole first screen), then main.css:268 restores
 *     two columns with a 56px gap from 801px — a gap that is too wide below
 *     ~1024px.
 *
 * Every rule below is inside one closed media range, so it can never reach
 * mobile (<=767px) or desktop (>=1024px). Nothing here uses `!important`
 * except where the parent theme already does (`.latest`), because a later
 * rule of equal specificity wins on cascade order.
 *
 * Loading: registered in inc/assets.php as `bsc-tablet`, after `bsc-mobile`.
 * ========================================================================= */

@media (min-width: 768px) and (max-width: 1023px) {

	/* ---------------------------------------------------------------------
	 * 1. Product grid density
	 *
	 * Three columns is the right call for this range: two columns produce
	 * 350px+ cards that push the grid below the fold, and four columns drop
	 * under 170px. The parent's `.columns-N` classes are matched as well,
	 * because those carry one extra class of specificity and would otherwise
	 * keep their own column count.
	 * ------------------------------------------------------------------ */
	.woocommerce ul.products,
	.woocommerce-page ul.products,
	.woocommerce ul.products[class*=columns-],
	.woocommerce-page ul.products[class*=columns-] {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	/* Homepage "latest products": the parent forces four columns here with
	 * !important (main.css:512), so matching that is the only way to correct
	 * it. Same selector shape, one class heavier where possible. */
	.latest .woocommerce ul.products,
	.latest .woocommerce ul.products[class*=columns-] {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: clamp(16px, 3vw, 32px) !important;
	}

	/* ---------------------------------------------------------------------
	 * 2. Single product layout
	 *
	 * One consistent two-column layout across the whole tablet range. The
	 * gallery/summary column assignments are restated because the parent sets
	 * BOTH to column 1 up to 800px (main.css:314), which would otherwise
	 * stack them inside a two-column grid.
	 * ------------------------------------------------------------------ */
	.single-product .shop-wrap {
		max-width: 960px;
	}

	.single-product div.product {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		gap: 32px;
		align-items: start;
	}

	.single-product div.product > .woocommerce-product-gallery {
		grid-column: 1;
	}

	.single-product div.product > .summary {
		grid-column: 2;
	}

	/* ---------------------------------------------------------------------
	 * 3. Touch targets
	 *
	 * A tablet is a touch device, but the parent's >=768px block shrinks the
	 * variation select to 13px with 10px padding and the buttons to 13px
	 * (main.css:450-459) — comfortable with a mouse, small under a fingertip.
	 * These restore a 44px minimum without changing any desktop size.
	 * ------------------------------------------------------------------ */
	.single-product .summary table.variations select {
		min-height: 44px;
		padding: 10px 12px;
		font-size: 15px;
	}

	.single-product .summary table.variations label {
		font-size: 14px;
	}

	.single-product .summary .single_add_to_cart_button,
	.single-product .summary .button.buy-now {
		min-height: 44px;
		font-size: 14px;
	}

	/* The action row is a wrapping flex container (main.css:282). In the
	 * narrower tablet column the two buttons and the stepper all fit on one
	 * line only by shrinking, and the buy-now label «همین حالا خرید کنید» is
	 * clipped by its own box. Forcing each action onto its own full-width row
	 * removes the clipping and gives every control a real 44px target. */
	.single-product .summary .woocommerce-variation-add-to-cart .single_add_to_cart_button,
	.single-product .summary .woocommerce-variation-add-to-cart .button.buy-now {
		flex: 1 1 100%;
		white-space: nowrap;
	}

	.single-product .summary .brand-q .qb {
		width: 40px;
		min-height: 44px;
	}

	.single-product .summary .brand-q input.qty {
		min-height: 44px;
		font-size: 15px;
	}

	.woocommerce form .form-row input.input-text,
	.woocommerce form .form-row textarea,
	.woocommerce form .form-row select {
		min-height: 44px;
		font-size: 15px;
	}

	/* ---------------------------------------------------------------------
	 * 4. Breadcrumb
	 *
	 * 12px on a 768px screen is below the readable floor this project uses
	 * everywhere else.
	 * ------------------------------------------------------------------ */
	.woocommerce .woocommerce-breadcrumb {
		font-size: 13px;
	}
}
