/**
 * Wills Family Farm mobile fixes (v1.5.8, cart alignment in v1.5.9).
 * Loaded in the footer so it overrides styles pasted into page content
 * (including min-width:560px on .wff-table and max-width:640px on lab reports).
 */

/* ---- 1. How we compare and other .wff-table: stacked cards at 600px ---- */
@media (max-width: 600px) {
	.wff-table-wrap {
		overflow: visible !important;
		width: 100%;
		max-width: 100%;
	}
	.wff table.wff-table,
	table.wff-table {
		display: block;
		width: 100% !important;
		min-width: 0 !important;
		max-width: 100%;
		border-collapse: collapse;
	}
	.wff table.wff-table thead,
	table.wff-table thead {
		display: none;
	}
	.wff table.wff-table tbody,
	.wff table.wff-table tr,
	.wff table.wff-table td,
	.wff table.wff-table th,
	.wff table.wff-table caption,
	table.wff-table tbody,
	table.wff-table tr,
	table.wff-table td,
	table.wff-table th,
	table.wff-table caption {
		display: block;
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
	}
	.wff table.wff-table caption,
	table.wff-table caption {
		caption-side: bottom;
		text-align: left;
		padding: 10px 0 12px;
		white-space: normal;
	}
	.wff table.wff-table tr,
	table.wff-table tr {
		margin: 0 0 14px;
		padding: 12px 14px;
		border: 1px solid #e4dfd2;
		background: #fff;
	}
	.wff table.wff-table td,
	table.wff-table td {
		padding: 8px 0;
		border: 0;
		border-top: 1px solid #eee;
		text-align: left !important;
		white-space: normal !important;
	}
	.wff table.wff-table td:first-child,
	table.wff-table td:first-child {
		border-top: 0;
	}
	.wff table.wff-table td::before,
	table.wff-table td::before {
		content: attr(data-label);
		display: block;
		font-size: .72rem;
		letter-spacing: .08em;
		text-transform: uppercase;
		color: #8a6d1d;
		font-weight: 600;
		margin: 0 0 3px;
	}
	.wff table.wff-table td:empty::before,
	table.wff-table td:empty::before {
		margin: 0;
	}
}

/* ---- 2. Lab report images: fluid, tap-to-open when linked ---- */
.wff-report-pages,
.wff-report-pages a.wff-report-link,
.wff-reports-body figure {
	max-width: 100%;
}
.wff-report-pages {
	display: grid !important;
	grid-template-columns: 1fr !important;
	gap: 14px;
}
.wff-report-pages img,
.wff-report-pages a.wff-report-link img,
.wff-reports-body img[src*="lab-report"] {
	max-width: 100% !important;
	width: 100%;
	height: auto !important;
	display: block;
	margin: 0 auto;
}
.wff-report-pages a.wff-report-link {
	display: block;
}

/* ---- 3. Clipped selects (Share, package, Which beef, cut sheet) ---- */
.woocommerce div.product form.cart .variations select,
.woocommerce div.product form.cart select,
.wff-cut-sheet select,
.wff-field select,
.wff-qty-pick select,
.wff-opt--batch select,
.wff-waitlist-form select,
.wff-contact-form select,
select#share,
select#wff-quantity,
select[name="attribute_share"],
select[name="wff_product"],
select[name="quantity"][data-wff-qty],
select[id^="wff-"] {
	min-height: 48px !important;
	line-height: normal !important;
	font-size: 16px !important;
	padding: 10px 36px 10px 12px !important;
	box-sizing: border-box;
	max-width: 100%;
	background-color: #fff;
}

/* ---- 4. Astra scroll-to-top: hide on product/cart/checkout at phone width;
      elsewhere smaller, inset, and semi-transparent ---- */
@media (max-width: 600px) {
	body.single-product #ast-scroll-top,
	body.woocommerce-cart #ast-scroll-top,
	body.woocommerce-checkout #ast-scroll-top,
	body.woocommerce-page.single-product #ast-scroll-top {
		display: none !important;
	}
	#ast-scroll-top {
		width: 36px !important;
		height: 36px !important;
		right: 12px !important;
		bottom: 16px !important;
		opacity: 0.55;
		z-index: 20;
	}
	#ast-scroll-top:hover,
	#ast-scroll-top:focus {
		opacity: 1;
	}
}

/* ---- 5. Add to cart: 48px tall, full width inside the content margin ---- */
@media (max-width: 600px) {
	.woocommerce div.product form.cart,
	.woocommerce div.product form.variations_form,
	.woocommerce div.product .woocommerce-variation-add-to-cart {
		width: 100%;
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
		box-sizing: border-box;
		padding-left: 0;
		padding-right: 0;
	}
	.woocommerce div.product form.cart .single_add_to_cart_button,
	.single_add_to_cart_button,
	.woocommerce .button.single_add_to_cart_button {
		min-height: 48px !important;
		width: 100% !important;
		max-width: 100%;
		display: block !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		box-sizing: border-box;
		padding: 12px 20px !important;
	}
}

/* ---- 6. Cart remove target and coupon / Update cart row ---- */
.woocommerce a.remove,
.woocommerce-cart a.remove,
.wc-block-cart-item__remove-link {
	width: 44px !important;
	height: 44px !important;
	min-width: 44px;
	min-height: 44px;
	line-height: 44px !important;
	font-size: 1.35rem !important;
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	text-align: center;
}
@media (max-width: 600px) {
	.woocommerce-cart table.cart td.actions,
	.woocommerce-cart-form .actions,
	.woocommerce .cart .actions {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}
	.woocommerce-cart table.cart td.actions .coupon,
	.woocommerce-cart-form .coupon,
	.woocommerce .cart .coupon {
		display: flex;
		flex-direction: column;
		width: 100% !important;
		max-width: 100%;
		float: none !important;
		padding: 0 !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
		gap: 8px;
		box-sizing: border-box;
	}
	.woocommerce-cart table.cart td.actions .coupon .input-text,
	.woocommerce-cart table.cart td.actions .coupon #coupon_code,
	.woocommerce-cart table.cart td.actions .coupon button,
	.woocommerce-cart table.cart td.actions .coupon .button,
	.woocommerce-cart table.cart td.actions button[name="update_cart"],
	.woocommerce-cart-form .coupon input,
	.woocommerce-cart-form .coupon #coupon_code,
	.woocommerce-cart-form .coupon button,
	.woocommerce-cart-form button[name="update_cart"],
	.woocommerce .cart .coupon input,
	.woocommerce .cart .coupon #coupon_code,
	.woocommerce .cart .coupon .button,
	.woocommerce .cart button[name="update_cart"] {
		box-sizing: border-box !important;
		width: 100% !important;
		max-width: 100% !important;
		min-height: 48px;
		flex: 0 0 auto;
		float: none !important;
		margin-left: 0 !important;
		margin-right: 0 !important;
	}
	.wc-block-cart .wc-block-components-totals-coupon,
	.wc-block-components-totals-coupon {
		width: 100%;
		box-sizing: border-box;
		margin-left: 0;
		margin-right: 0;
	}
}

/* ---- 7. Tap targets about 44px, look unchanged otherwise ---- */
.wff details summary,
.wff-section details summary,
#common-questions details summary,
.wff-reports summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	padding-top: 10px;
	padding-bottom: 10px;
	box-sizing: border-box;
	cursor: pointer;
}
.wff-reports summary {
	display: inline-flex;
	padding-left: 4px;
	padding-right: 4px;
}
.wff-cut-sheet .wff-linkbtn,
.wff-cut-sheet button.wff-linkbtn[data-wff-expand],
.wff-cut-sheet button.wff-linkbtn[data-wff-collapse] {
	min-height: 44px !important;
	padding: 10px 8px !important;
	display: inline-flex !important;
	align-items: center !important;
	line-height: 1.2 !important;
}
.wff-cut-sheet .wff-section > summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	box-sizing: border-box;
}
.woocommerce-breadcrumb,
.woocommerce-breadcrumb a,
.ast-breadcrumbs-wrapper a,
.ast-breadcrumbs .trail-items a {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	padding: 8px 4px;
	box-sizing: border-box;
}
.woocommerce-form-coupon-toggle,
.woocommerce-form-coupon-toggle .woocommerce-info,
.woocommerce-form-coupon-toggle a.showcoupon,
a.showcoupon,
.wc-block-components-totals-coupon-link,
.wc-block-components-panel__button {
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	padding-top: 10px;
	padding-bottom: 10px;
	box-sizing: border-box;
}
button.menu-toggle,
button.main-header-menu-toggle,
.ast-mobile-menu-buttons button,
.ast-button-wrap button.menu-toggle {
	min-height: 44px;
	min-width: 44px;
	padding: 10px;
	box-sizing: border-box;
}
