/* ============================================================================
   Geeks4Learning — Consolidated responsive fixes
   Built from a 4-way device audit (shop, product, cart/checkout, account +
   wishlist) at 375 / 768 / desktop. Loaded site-wide on the store so it also
   catches the shared header chrome. Layout-only; brand colours unchanged.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   0. GLOBAL — kill horizontal scroll, and collapse the header nav to the
      hamburger at/below tablet. At <=768 the theme was rendering BOTH the
      hamburger AND the full inline menu, leaking ~300px of horizontal scroll
      on EVERY page. Hide the inline list unless it is the open overlay; keep
      the hamburger toggle visible (it opens a fixed full-screen overlay).
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	html, body { overflow-x: hidden; max-width: 100%; }

	.site-header .wp-block-navigation__responsive-container:not(.is-menu-open),
	.g4l-primary-nav .wp-block-navigation__responsive-container:not(.is-menu-open),
	header .wp-block-navigation__responsive-container:not(.is-menu-open) {
		display: none !important;
	}
	.site-header .wp-block-navigation__responsive-container-open,
	.g4l-primary-nav .wp-block-navigation__responsive-container-open,
	header .wp-block-navigation__responsive-container-open {
		display: flex !important;
	}
}

/* ---------------------------------------------------------------------------
   1. SHOP / CATALOG
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.g4l-shop-flex, .g4l-cat-col, .g4l-shop-col,
	.wc-block-product-template, .g4l-shop-ad, .g4l-shop-ad__img { max-width: 100%; }

	.g4l-shop-flex { display: block !important; }
	.g4l-cat-col, .g4l-shop-col { width: 100% !important; flex: 0 0 100% !important; float: none !important; }
	.g4l-cat-col { margin-bottom: 24px; }

	.wc-block-product-template.columns-3,
	.wc-block-product-template { grid-template-columns: repeat(2, 1fr) !important; gap: 16px !important; }

	.wc-block-components-product-button .wp-block-button__link {
		width: 100% !important; min-height: 44px;
		display: flex !important; align-items: center; justify-content: center; box-sizing: border-box;
	}
	.tinvwl_add_to_wishlist_button { min-height: 44px; display: inline-flex !important; align-items: center; padding: 8px 4px; }
	.g4l-cat-sidebar a, .g4l-cat-sidebar button { min-height: 44px; }
}
@media (max-width: 480px) {
	.wc-block-product-template.columns-3,
	.wc-block-product-template { grid-template-columns: 1fr !important; }
	body.g4l-shop .g4l-shop-ad__note { font-size: 12px !important; line-height: 1.4; }
}

/* ---------------------------------------------------------------------------
   2. SINGLE PRODUCT + ENQUIRY MODAL
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.single_add_to_cart_button,
	.g4l-enq-open,
	.g4l-enq-loop-btn,
	.wp-block-add-to-cart-form .wc-block-components-product-button__button {
		display: block !important; width: 100% !important; max-width: none !important;
		text-align: center; box-sizing: border-box;
	}
	.wp-block-add-to-cart-form form.cart { display: block !important; }

	.g4l-enq-overlay { padding: 16px !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; align-items: flex-start !important; }
	.g4l-enq-dialog { width: 100% !important; max-width: none !important; max-height: 90vh !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; padding: 20px 16px !important; }
	.g4l-enq-close { position: sticky !important; top: 0 !important; float: right !important; margin: -6px -4px 0 0 !important; z-index: 3; }
	.g4l-enq-grid { grid-template-columns: 1fr !important; }
	.g4l-enq-form input, .g4l-enq-form select, .g4l-enq-form textarea, .g4l-enq-datefield { width: 100% !important; box-sizing: border-box; }
	.g4l-enq-actions { flex-direction: column; align-items: stretch; gap: 12px; }
	.g4l-enq-submit { width: 100% !important; }
}
@media (max-width: 480px) {
	h1.wp-block-post-title { font-size: 22px; line-height: 1.25; word-break: break-word; }
	.wp-block-woocommerce-product-price { font-size: 24px; }
	.wc-tabs li a { padding-left: 12px !important; padding-right: 12px !important; font-size: 15px !important; }
	.g4l-enq-h { font-size: 20px !important; }
}

/* ---------------------------------------------------------------------------
   3. CART + CHECKOUT (blocks)
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.wp-block-woocommerce-cart .wc-block-cart, .wc-block-cart { display: flex; flex-direction: column; }
	.wc-block-cart__main, .wc-block-cart__sidebar, .wc-block-components-sidebar { width: 100% !important; max-width: 100% !important; }
	.wc-block-cart-items { width: 100%; }
	.wc-block-cart__submit-container, .wc-block-cart__submit-button,
	.wp-block-woocommerce-proceed-to-checkout .wc-block-components-button { width: 100% !important; }
	.wc-block-components-quantity-selector__button { min-width: 44px !important; min-height: 44px !important; }

	.wc-block-checkout.wc-block-components-sidebar-layout, .wc-block-checkout__form { display: flex !important; flex-direction: column !important; }
	.wc-block-checkout__main { order: 0 !important; width: 100% !important; max-width: 100% !important; }
	.wc-block-checkout__sidebar { order: 1 !important; width: 100% !important; max-width: 100% !important; }
	.wc-block-components-text-input, .wc-block-components-text-input input,
	.wc-block-components-address-form .wc-block-components-text-input { width: 100% !important; box-sizing: border-box; }
	.wc-block-components-checkout-place-order-button { width: 100% !important; }
	.wc-block-components-radio-control__option { box-sizing: border-box; }

	.wc-block-checkout__main, .wc-block-checkout__sidebar,
	.wc-block-cart__main, .wc-block-cart__sidebar { padding-left: 16px !important; padding-right: 16px !important; }
}
@media (max-width: 480px) {
	.wc-block-cart-items__row { padding-left: 0 !important; padding-right: 0 !important; }
	.wc-block-components-sidebar .wc-block-components-totals-item { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------------------
   4. ACCOUNT (logged-out) + LOST/RESET PASSWORD + WISHLIST
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	/* Guest login/register single card: gutters + full-width fields */
	.woocommerce-account:not(.logged-in) .u-columns.col2-set { max-width: 480px !important; margin: 20px 16px 48px !important; width: auto !important; }
	.woocommerce-account:not(.logged-in) .u-columns .u-column1,
	.woocommerce-account:not(.logged-in) .u-columns .u-column2 { box-sizing: border-box !important; padding: 24px 20px !important; border-radius: 14px !important; }
	.woocommerce-account .woocommerce-form-login,
	.woocommerce-account .woocommerce-form-register { max-width: none !important; }
	.woocommerce-account .woocommerce-form-login input.input-text,
	.woocommerce-account .woocommerce-form-register input.input-text,
	.woocommerce-account .woocommerce-form-login .form-row,
	.woocommerce-account .woocommerce-form-register .form-row { width: 100% !important; box-sizing: border-box !important; }

	/* Lost / reset password card */
	.woocommerce-lost-password .woocommerce,
	.woocommerce-reset-password .woocommerce { margin: 0 16px !important; max-width: none !important; box-sizing: border-box !important; }
	.woocommerce-account .woocommerce-ResetPassword,
	.woocommerce-lost-password .woocommerce-ResetPassword,
	.woocommerce-reset-password .woocommerce-ResetPassword { max-width: 480px !important; width: auto !important; margin: 20px auto 48px !important; padding: 24px 20px !important; box-sizing: border-box !important; }
	.woocommerce-ResetPassword .form-row { width: 100% !important; box-sizing: border-box !important; }
	.woocommerce-ResetPassword input.input-text { width: 100% !important; max-width: none !important; box-sizing: border-box !important; }
	.woocommerce-ResetPassword label { display: block !important; }
	.woocommerce-ResetPassword button[type="submit"] { width: 100% !important; }

	/* TI WooCommerce Wishlist: table -> stacked cards (kills horizontal scroll) */
	.tinv-wishlist { max-width: 100% !important; margin: 0 16px !important; overflow-x: hidden !important; box-sizing: border-box !important; }
	.tinv-wishlist table.tinvwl-table { display: block !important; width: 100% !important; min-width: 0 !important; border: 0 !important; }
	.tinv-wishlist table.tinvwl-table thead { display: none !important; }
	.tinv-wishlist table.tinvwl-table tbody { display: block !important; width: 100% !important; }
	.tinv-wishlist table.tinvwl-table tbody tr.wishlist_item {
		position: relative !important; display: grid !important; grid-template-columns: 64px 1fr !important;
		grid-gap: 6px 14px !important; align-items: center !important; width: 100% !important; box-sizing: border-box !important;
		margin: 0 0 16px !important; padding: 16px 40px 16px 16px !important; border: 1px solid #e3e8ee !important; border-radius: 12px !important; background: #fff !important;
	}
	.tinv-wishlist table.tinvwl-table tbody tr.wishlist_item td { display: block !important; width: auto !important; border: 0 !important; padding: 0 !important; margin: 0 !important; text-align: left !important; }
	.tinv-wishlist td.product-cb { display: none !important; }
	.tinv-wishlist td.product-thumbnail { grid-column: 1 !important; grid-row: 1 / span 2 !important; }
	.tinv-wishlist td.product-thumbnail img { width: 60px !important; height: 60px !important; object-fit: cover !important; border-radius: 8px !important; }
	.tinv-wishlist td.product-name { grid-column: 2 !important; grid-row: 1 !important; font-weight: 600 !important; line-height: 1.3 !important; }
	.tinv-wishlist td.product-name a { color: #1f2d3d !important; text-decoration: none !important; }
	.tinv-wishlist td.product-price { grid-column: 2 !important; grid-row: 2 !important; color: #257a9e !important; font-weight: 700 !important; }
	.tinv-wishlist td.product-stock,
	.tinv-wishlist td.product-date { grid-column: 1 / -1 !important; font-size: 13px !important; color: #5a6b7b !important; }
	.tinv-wishlist td.product-stock .stock { margin: 0 !important; display: inline !important; }
	.tinv-wishlist td.product-stock[data-title]:not([data-title=""])::before,
	.tinv-wishlist td.product-date[data-title]:not([data-title=""])::before { content: attr(data-title) ": "; font-weight: 600; color: #1f2d3d; }
	.tinv-wishlist td.product-action { grid-column: 1 / -1 !important; margin-top: 4px !important; }
	.tinv-wishlist td.product-action .button { display: block !important; width: 100% !important; text-align: center !important; box-sizing: border-box !important; }
	.tinv-wishlist td.product-remove { position: absolute !important; top: 10px !important; right: 10px !important; }
	.tinv-wishlist td.product-remove .button { background: transparent !important; color: #8a97a5 !important; padding: 2px 6px !important; }
}
@media (max-width: 480px) {
	.woocommerce-account:not(.logged-in) .u-columns .u-column1,
	.woocommerce-account:not(.logged-in) .u-columns .u-column2,
	.woocommerce-ResetPassword { padding: 20px 16px !important; }
	.tinv-wishlist table.tinvwl-table tbody tr.wishlist_item { grid-template-columns: 56px 1fr !important; }
}

/* Wishlist: hide the bulk-select checkbox column on mobile. Needs this higher
   specificity to beat the generic stacked-card `td { display:block }` rule. */
@media (max-width: 768px) {
	.tinv-wishlist table.tinvwl-table tbody tr.wishlist_item td.product-cb { display: none !important; }
}

/* ---------------------------------------------------------------------------
   5. TOAST / NOTICE messages (branded WooCommerce notices, rendered inline).
      Keep within viewport with 16px gutters, wrap text, give the close a 44px
      tap target, and stack the action button. Layout/sizing only — brand
      colours (success teal/green, error red, navy) unchanged.
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	body .woocommerce-notices-wrapper .woocommerce-message,
	body .woocommerce-notices-wrapper .woocommerce-info,
	body .woocommerce-notices-wrapper .woocommerce-error,
	body .woocommerce-MyAccount-content .woocommerce-message,
	body .woocommerce-MyAccount-content .woocommerce-info,
	body .woocommerce-MyAccount-content .woocommerce-error,
	body .wc-block-components-notice-banner {
		box-sizing: border-box !important;
		max-width: calc(100vw - 32px) !important;
		margin-left: auto !important; margin-right: auto !important;
		align-items: flex-start !important;
		overflow-wrap: anywhere !important; word-break: break-word !important;
	}
	body .woocommerce-notices-wrapper .woocommerce-message,
	body .woocommerce-notices-wrapper .woocommerce-info,
	body .woocommerce-notices-wrapper .woocommerce-error,
	body .woocommerce-MyAccount-content .woocommerce-message,
	body .woocommerce-MyAccount-content .woocommerce-info,
	body .woocommerce-MyAccount-content .woocommerce-error { padding: 14px 48px 14px 48px !important; }
	body .woocommerce-notices-wrapper .woocommerce-message::before,
	body .woocommerce-notices-wrapper .woocommerce-info::before,
	body .woocommerce-notices-wrapper .woocommerce-error::before,
	body .woocommerce-MyAccount-content .woocommerce-message::before,
	body .woocommerce-MyAccount-content .woocommerce-info::before,
	body .woocommerce-MyAccount-content .woocommerce-error::before { top: 16px !important; transform: none !important; }
	body .woocommerce-MyAccount-content .woocommerce-info,
	body .woocommerce-MyAccount-content .woocommerce-message { flex-wrap: wrap !important; }
	body .woocommerce-notices-wrapper .woocommerce-message .button.wc-forward,
	body .woocommerce-notices-wrapper .woocommerce-message a.button,
	body .woocommerce-MyAccount-content .woocommerce-info .button,
	body .woocommerce-MyAccount-content .woocommerce-info a.button,
	body .woocommerce-MyAccount-content .woocommerce-message .button,
	body .wc-block-components-notice-banner .wc-forward {
		display: block !important; width: 100% !important; text-align: center !important;
		margin: 10px 0 0 !important; order: 2 !important; box-sizing: border-box !important; float: none !important;
	}
	.g4l-toast-close {
		top: 4px !important; right: 4px !important; width: 44px !important; height: 44px !important;
		display: flex !important; align-items: center !important; justify-content: center !important; font-size: 22px !important;
	}
	body .wc-block-components-notice-banner { flex-wrap: wrap !important; }
	body .wc-block-components-notice-banner > .wc-block-components-button { min-width: 44px !important; min-height: 44px !important; flex: 0 0 44px !important; }
	body .wc-block-components-notice-banner > .wc-block-components-notice-banner__content { min-width: 0 !important; flex: 1 1 auto !important; }
}
@media (max-width: 480px) {
	body .woocommerce-notices-wrapper .woocommerce-message,
	body .woocommerce-notices-wrapper .woocommerce-info,
	body .woocommerce-notices-wrapper .woocommerce-error,
	body .woocommerce-MyAccount-content .woocommerce-message,
	body .woocommerce-MyAccount-content .woocommerce-info,
	body .woocommerce-MyAccount-content .woocommerce-error,
	body .wc-block-components-notice-banner { font-size: 14px !important; border-radius: 12px !important; }
	body .woocommerce-notices-wrapper .woocommerce-message,
	body .woocommerce-notices-wrapper .woocommerce-info,
	body .woocommerce-notices-wrapper .woocommerce-error { padding: 12px 44px 12px 44px !important; }
	body .woocommerce-notices-wrapper .woocommerce-message::before,
	body .woocommerce-notices-wrapper .woocommerce-info::before,
	body .woocommerce-notices-wrapper .woocommerce-error::before {
		width: 20px !important; height: 20px !important; line-height: 20px !important; left: 14px !important; font-size: 12px !important;
	}
}

/* ---------------------------------------------------------------------------
   6. MOBILE HEADER / BURGER MENU
   - The primary nav sits in a second bar on desktop (position:relative; top:77px).
     On mobile that pushed the hamburger ~77px DOWN into an empty band below the
     logo (the "inconsistent" header). Reset the offset so the hamburger sits on
     the logo row.
   - The footer store-policy links are position:absolute and were escaping to the
     TOP of the page on mobile (their footer wrapper wasn't a positioning
     context), overlaying the top of the product content. Give the wrapper a
     positioning context so they stay in the footer.
   - The open hamburger overlay inherited `items-justified-right`, which pushed
     the menu items off the right edge (clipped). Left-align the open overlay.
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.nav-wrap .g4l-primary-nav,
	header .g4l-primary-nav { top: 0 !important; align-self: center !important; }

	.g4l-policies-inner { position: relative !important; }

	/* --- Modern full-screen mobile menu overlay --- */
	.g4l-primary-nav .wp-block-navigation__responsive-container.is-menu-open {
		background: linear-gradient(165deg, #0a1733 0%, #122a52 55%, #164a66 100%) !important;
		color: #fff !important;
	}
	.is-menu-open .wp-block-navigation__responsive-container-content {
		padding: 34px 26px 44px !important;
		width: 100% !important;
		align-items: stretch !important;
	}
	.is-menu-open .wp-block-navigation__responsive-container-content::before {
		content: "";
		display: block;
		width: 100%;
		height: 40px;
		margin: 0 0 24px;
		background: url(g4l-logo.png) left center / auto 40px no-repeat;
	}
	.is-menu-open .wp-block-navigation__responsive-container-close {
		color: #fff !important; top: 26px !important; right: 22px !important; width: 44px !important; height: 44px !important;
	}
	.is-menu-open .wp-block-navigation__responsive-container-close svg { width: 26px; height: 26px; fill: #fff; }
	.is-menu-open .wp-block-navigation__container {
		flex-direction: column !important; align-items: flex-start !important; justify-content: flex-start !important; gap: 0 !important; width: 100% !important;
	}
	.is-menu-open .wp-block-navigation__container > li.wp-block-navigation-item { width: 100% !important; text-align: left !important; justify-content: flex-start !important; }
	.is-menu-open li.wp-block-navigation-link > .wp-block-navigation-item__content {
		display: block !important; width: 100% !important; box-sizing: border-box !important; color: #eaf2ff !important;
		font-size: 19px !important; font-weight: 600 !important; letter-spacing: .2px; text-align: left !important; margin: 0 !important;
		padding: 15px 4px !important; border-bottom: 1px solid rgba(255, 255, 255, .12) !important; transition: color .18s, transform .18s;
	}
	.is-menu-open li.wp-block-navigation-link > .wp-block-navigation-item__content:hover { color: #56d8e6 !important; transform: translateX(6px); }
	.is-menu-open .wp-block-navigation-item.btn { margin-top: 14px !important; }
	.is-menu-open .wp-block-navigation-item.btn.nav-login { margin-top: 28px !important; }
	.is-menu-open .wp-block-navigation-item.btn .wp-block-navigation-item__content {
		display: flex !important; align-items: center; justify-content: center; gap: 8px; width: 100% !important; box-sizing: border-box !important;
		padding: 14px 20px !important; border-radius: 12px !important; font-size: 16px !important; font-weight: 700 !important; border-bottom: 0 !important; text-align: center !important;
	}
	.is-menu-open .nav-login .wp-block-navigation-item__content { color: #fff !important; border: 2px solid rgba(255, 255, 255, .55) !important; background: transparent !important; }
	.is-menu-open .nav-login svg, .is-menu-open .nav-login path { fill: #fff !important; stroke: #fff !important; }
	.is-menu-open .nav-cta .wp-block-navigation-item__content { color: #06263a !important; background: linear-gradient(135deg, #55d7e6, #2bb6cf) !important; border: 0 !important; box-shadow: 0 8px 20px rgba(43, 182, 207, .35); }
}

/* ---------------------------------------------------------------------------
   7. SINGLE PRODUCT PAGE — edge gutters + Related Courses
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	/* Align the WHOLE product summary (title, price, description, buttons, SKU,
	   Category, Policies) to ONE left edge: pad the summary column once and zero
	   the per-element insets, instead of padding each element separately (which
	   left them at different left positions). */
	.single-product .wp-block-columns > .wp-block-column:has(.wp-block-post-title) {
		padding-left: 16px !important; padding-right: 16px !important; box-sizing: border-box !important;
	}
	.single-product .wp-block-column:has(.wp-block-post-title) .wp-block-post-title,
	.single-product .wp-block-column:has(.wp-block-post-title) .wp-block-woocommerce-product-price,
	.single-product .wp-block-column:has(.wp-block-post-title) .wp-block-post-excerpt,
	.single-product .wp-block-column:has(.wp-block-post-title) .wp-block-post-excerpt__excerpt,
	.single-product .wp-block-column:has(.wp-block-post-title) .woocommerce-product-details__short-description,
	.single-product .wp-block-column:has(.wp-block-post-title) form.cart,
	.single-product .wp-block-column:has(.wp-block-post-title) .wp-block-woocommerce-product-meta,
	.single-product .wp-block-column:has(.wp-block-post-title) .wc-block-components-product-sku,
	.single-product .wp-block-column:has(.wp-block-post-title) .product_meta,
	.single-product .wp-block-column:has(.wp-block-post-title) .g4l-policies-links {
		padding-left: 0 !important; padding-right: 0 !important; margin-left: 0 !important; margin-right: 0 !important; text-align: left !important;
	}
	/* Stack the add-to-cart form so its buttons sit on the same left edge (the
	   flex row's 14px gap was pushing the "Add to cart" pill in). */
	.single-product .wp-block-column:has(.wp-block-post-title) form.cart {
		flex-direction: column !important; align-items: flex-start !important; row-gap: 12px !important; column-gap: 0 !important; padding-left: 0 !important;
	}
	.single-product .wp-block-column:has(.wp-block-post-title) form.cart > * { margin-left: 0 !important; }
	.single-product .wp-block-column:has(.wp-block-post-title) form.cart .single_add_to_cart_button { margin: 0 !important; }
	.single-product .wp-block-column:has(.wp-block-post-title) form.cart .tinv-wraper { margin-left: 0 !important; }

	/* Related Courses: side gutters so cards don't touch the edges. */
	.wp-block-woocommerce-product-collection { padding-left: 16px !important; padding-right: 16px !important; box-sizing: border-box !important; }

	/* Equal-height cards with the button pinned to the bottom (so the
	   "Purchase course" buttons line up even when titles differ in length). */
	.wp-block-woocommerce-product-collection .wc-block-product-template { align-items: stretch !important; }
	.wp-block-woocommerce-product-collection li.wc-block-product { height: 100% !important; }
	.wp-block-woocommerce-product-collection li.wc-block-product .wp-block-button,
	.wp-block-woocommerce-product-collection li.wc-block-product .wc-block-components-product-button { margin-top: auto !important; width: 100% !important; }

	/* Discounted price (struck regular + sale + "incl. VAT") must WRAP inside the
	   narrow card instead of overflowing it. */
	.wp-block-woocommerce-product-collection .wc-block-components-product-price {
		display: block !important; white-space: normal !important; overflow-wrap: anywhere !important; max-width: 100% !important; font-size: 15px !important; line-height: 1.35 !important;
	}
	.wp-block-woocommerce-product-collection .wc-block-components-product-price del,
	.wp-block-woocommerce-product-collection .wc-block-components-product-price ins { display: inline !important; background: none !important; }
}

/* ---------------------------------------------------------------------------
   8. CART + CHECKOUT cards — equal width, inset from the screen edges, and the
      cart line items reflowed so nothing is clipped in the narrower card.
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	/* Cart: make the items card the same width as the totals card (both inset
	   16px, not touching the edges). */
	.wp-block-woocommerce-cart .wc-block-cart__main {
		width: calc(100% - 32px) !important; max-width: calc(100% - 32px) !important; margin: 0 auto !important; box-sizing: border-box !important;
	}
	.wp-block-woocommerce-cart .wc-block-cart__sidebar { width: 100% !important; max-width: 100% !important; margin: 0 !important; }

	/* The cart line-item table is wider than the (now inset) card, so reflow each
	   row to image-left + details/price stacked — otherwise the price is clipped. */
	.wp-block-woocommerce-cart .wc-block-cart-items,
	.wp-block-woocommerce-cart table.wc-block-cart-items,
	.wp-block-woocommerce-cart .wc-block-cart-items tbody { display: block !important; width: 100% !important; max-width: 100% !important; }
	.wp-block-woocommerce-cart .wc-block-cart-items__row {
		display: grid !important; grid-template-columns: 64px minmax(0, 1fr) !important; column-gap: 14px !important; row-gap: 4px !important;
		width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; padding: 16px !important; margin: 0 !important;
	}
	.wp-block-woocommerce-cart .wc-block-cart-item__image { grid-column: 1 !important; grid-row: 1 / span 4 !important; align-self: start !important; width: 64px !important; }
	.wp-block-woocommerce-cart .wc-block-cart-item__product { grid-column: 2 !important; grid-row: 1 !important; min-width: 0 !important; }
	.wp-block-woocommerce-cart .wc-block-cart-item__total { grid-column: 2 !important; grid-row: 2 !important; justify-self: start !important; text-align: left !important; margin: 4px 0 0 !important; }
	.wp-block-woocommerce-cart .wc-block-cart-item__total * { text-align: left !important; justify-content: flex-start !important; }

	/* Checkout: match the main form card to the order-summary card width (both
	   inset 16px) and give the order summary breathing room below the form. */
	.wc-block-checkout .wc-block-checkout__main {
		width: calc(100% - 32px) !important; max-width: calc(100% - 32px) !important; margin: 0 auto !important; box-sizing: border-box !important;
	}
	.wc-block-checkout .wc-block-checkout__sidebar { margin-top: 16px !important; }
	.wc-block-checkout .wc-block-checkout__sidebar .wp-block-woocommerce-checkout-order-summary-block {
		width: 100% !important; max-width: 100% !important; margin: 0 !important; box-sizing: border-box !important;
	}
}

/* ---------------------------------------------------------------------------
   9. SHOP / ARCHIVE on mobile — collapsible categories + aligned toolbar.
   The desktop layout shows a category sidebar BEFORE the product grid and pulls
   the pagination to the top (position:absolute; top:77px), so on a phone you
   scrolled past ~900px of categories before the first course. Instead of
   banishing the categories to the bottom (nobody scrolls there), collapse them
   behind a "Browse categories" toggle button that catalog.js injects just
   before the category column. The natural mobile flow becomes:
     result-count/sorting  ->  [Browse categories ▾]  ->  products  ->  pager
   Categories live right where people look (the top) but stay out of the way
   until tapped. `display:contents` on .g4l-shop-flex lets the sidebar + grid
   become orderable siblings inside the product-collection flex column.

   Alignment: the product-collection has 16px side padding (set in §1), so its
   flex children inset to 16px automatically. The results-count/sorting toolbar
   is an .alignwide .wp-block-group that escapes that padding via negative
   margins and lays the count + sorting dropdown side-by-side (cramped at 375px,
   the count wrapping to two lines). Stack it into a column with its own 16px
   gutters so every row — count, sorting, toggle, cards — lines up at 16px.
   --------------------------------------------------------------------------- */
@media (max-width: 768px) {
	/* Page title + breadcrumb: left-align on mobile (desktop centres them) so
	   they line up with the result-count, toggle and cards at the 16px gutter. */
	body.g4l-shop h1.wp-block-query-title,
	body.g4l-shop .wp-block-query-title {
		text-align: left !important; padding-left: 16px !important; padding-right: 16px !important;
		margin-left: 0 !important; margin-right: 0 !important;
	}
	/* The visible crumb is nav.woocommerce-breadcrumb. catalog.css centres it via
	   `.wc-block-breadcrumbs nav.woocommerce-breadcrumb` (specificity 0,3,2), which
	   out-ranks a plain `nav.woocommerce-breadcrumb` rule no matter the load order —
	   so match that same ancestor here to win the tie (later file wins). */
	body.g4l-shop .wc-block-breadcrumbs,
	body.g4l-shop .wc-block-breadcrumbs nav.woocommerce-breadcrumb,
	body.g4l-shop .wc-block-breadcrumbs .woocommerce-breadcrumb,
	body.g4l-shop nav.woocommerce-breadcrumb,
	body.g4l-shop .woocommerce-breadcrumb {
		text-align: left !important; justify-content: flex-start !important;
		padding-left: 16px !important; padding-right: 16px !important;
		margin-left: 0 !important; margin-right: 0 !important;
	}

	/* Toolbar: stack result-count above the sorting dropdown, both inset 16px. */
	.wp-block-group:has(> .wp-block-woocommerce-product-results-count) {
		flex-direction: column !important; align-items: flex-start !important;
		gap: 10px !important; padding-left: 16px !important; padding-right: 16px !important;
		box-sizing: border-box !important;
	}
	.wp-block-woocommerce-product-results-count { width: auto !important; margin: 0 !important; }
	.wc-block-catalog-sorting, .wp-block-woocommerce-catalog-sorting {
		width: auto !important; max-width: 100% !important; margin: 0 !important;
	}

	/* Product collection becomes a single ordered column. */
	.wp-block-woocommerce-product-collection { display: flex !important; flex-direction: column !important; }
	.g4l-shop-flex { display: contents !important; }
	.wp-block-woocommerce-product-collection > .wc-block-components-notices { order: 0 !important; }

	/* The injected toggle button (catalog.js) sits first, matching card width. */
	.g4l-cat-toggle {
		order: 1 !important; display: flex !important; align-items: center; gap: 10px;
		width: 100% !important; box-sizing: border-box; margin: 6px 0 0 !important; padding: 14px 16px;
		background: #fff; border: 1.5px solid #d7e0e8; border-radius: 12px;
		font: 700 15px/1.2 inherit; color: #1f2d3d; cursor: pointer; -webkit-tap-highlight-color: transparent;
	}
	.g4l-cat-toggle__l { flex: 1 1 auto; text-align: left; }
	.g4l-cat-toggle__c { flex: 0 0 auto; transition: transform .25s ease; color: #257a9e; }
	body.g4l-cats-open .g4l-cat-toggle { border-color: #257a9e; }
	body.g4l-cats-open .g4l-cat-toggle__c { transform: rotate(180deg); }

	/* Categories: collapsed by default, slide open when the toggle is active. */
	.wp-block-woocommerce-product-collection .g4l-cat-col {
		order: 2 !important; width: 100% !important; margin: 0 !important;
		max-height: 0 !important; overflow: hidden !important; opacity: 0 !important;
		transition: max-height .32s ease, opacity .2s ease, margin .2s ease;
	}
	body.g4l-cats-open .wp-block-woocommerce-product-collection .g4l-cat-col {
		max-height: 2600px !important; opacity: 1 !important; margin-top: 12px !important;
	}

	/* Products, then pagination (reset the desktop absolute-top trick). */
	.wp-block-woocommerce-product-collection .g4l-shop-col { order: 3 !important; width: 100% !important; }
	.wp-block-woocommerce-product-collection > .wp-block-query-pagination {
		order: 4 !important; position: static !important; top: auto !important; margin: 24px 16px 8px !important;
	}
}

/* The toggle button is mobile-only — hide it on desktop (catalog.js always
   injects it, CSS decides when it shows). */
.g4l-cat-toggle { display: none; }

/* ---------------------------------------------------------------------------
   10. Classic "Pay for order" page (/checkout/order-pay/).
   The block-checkout styles never reach this legacy WooCommerce form, so the
   theme rendered it with oversized 17–19px text and — because it styles every
   <input> as a full-width 48px field — a giant ~468px "checkbox" with its
   label stranded below it, and WooCommerce's grid `.form-row` pushed the terms
   row and its required asterisk out to the centre/right. Restore default-sized
   text, a real inline checkbox pinned beside its label, and phone gutters.
   --------------------------------------------------------------------------- */
.woocommerce-order-pay .shop_table,
.woocommerce-order-pay .shop_table th,
.woocommerce-order-pay .shop_table td,
.woocommerce-order-pay form#order_review,
.woocommerce-order-pay .woocommerce-terms-and-conditions-wrapper { font-size: 15px !important; }
.woocommerce-order-pay .payment_box,
.woocommerce-order-pay .payment_box p { font-size: 14px !important; }
.woocommerce-order-pay .woocommerce-privacy-policy-text,
.woocommerce-order-pay .woocommerce-privacy-policy-text p { font-size: 14px !important; line-height: 1.55 !important; }

/* Terms row: full width + left-aligned (override WooCommerce's grid form-row). */
.woocommerce-order-pay .woocommerce-terms-and-conditions-wrapper .form-row,
.woocommerce-order-pay .form-row.validate-required {
	display: block !important; width: 100% !important; max-width: 100% !important;
	margin: 14px 0 0 !important; padding: 0 !important; text-align: left !important;
}
/* Checkbox pinned to the left; the label text and required * flow inline beside it. */
.woocommerce-order-pay label.woocommerce-form__label-for-checkbox {
	display: block !important; position: relative !important; padding-left: 28px !important;
	font-size: 15px !important; line-height: 1.5 !important; margin: 0 !important;
	text-align: left !important; cursor: pointer;
}
.woocommerce-order-pay label.woocommerce-form__label-for-checkbox > input#terms,
.woocommerce-order-pay input#terms.input-checkbox {
	position: absolute !important; left: 0 !important; top: 2px !important;
	width: 18px !important; height: 18px !important; min-height: 0 !important;
	padding: 0 !important; margin: 0 !important;
	border: 1px solid #c3ced8 !important; border-radius: 4px !important;
	background: #fff !important; box-shadow: none !important;
	-webkit-appearance: auto !important; appearance: auto !important;
	accent-color: #257a9e !important; cursor: pointer;
}
.woocommerce-order-pay .woocommerce-terms-and-conditions-checkbox-text { font-size: 15px !important; }
.woocommerce-order-pay .required { color: #c0392b !important; }

/* Phone: inset the order-summary + payment cards 16px off the screen edges. */
@media (max-width: 768px) {
	.woocommerce-order-pay .shop_table,
	.woocommerce-order-pay #payment {
		width: calc(100% - 32px) !important; max-width: calc(100% - 32px) !important;
		margin-left: 16px !important; margin-right: 16px !important; box-sizing: border-box !important;
	}
	.woocommerce-order-pay #place_order { width: 100% !important; }
}

/* ---------------------------------------------------------------------------
   11. Account (login/register) error/success notice alignment.
   WooCommerce renders these as a block notice banner
   (.wc-block-components-notice-banner), which our toast styling (built for the
   classic .woocommerce-error markup) never touched. On the My Account login
   page it rendered ~540px wide — wider than, and detached above, the centred
   460px login card — so a login / "already registered" error floated out of
   place up near the header. Constrain the notices wrapper to the card's width,
   centre it above the card, and give it gutters on phones.
   --------------------------------------------------------------------------- */
.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper {
	max-width: 460px;
	width: 100%;
	margin: 16px auto 22px !important;
	box-sizing: border-box;
}
.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper .wc-block-components-notice-banner,
.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper .woocommerce-error,
.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper .woocommerce-message,
.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper .woocommerce-info {
	margin: 0 !important;
	width: 100% !important;
	box-sizing: border-box !important;
}
@media (max-width: 768px) {
	.woocommerce-account:not(.logged-in) .woocommerce-notices-wrapper {
		max-width: 480px;
		width: auto !important;
		margin: 16px 16px 20px !important;
	}
}
