/*
 * Monster Theme 0.1.0: shop, basket, checkout, My Account and Monster Bookings event pages.
 * Loaded only on pages that sell. Sits on top of WooCommerce's own styles, never replaces
 * its templates.
 */

/* 1. Buttons --------------------------------------------------------------- */

.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
.woocommerce #respond input#submit, .woocommerce a.button.alt, .woocommerce button.button.alt,
.woocommerce input.button.alt, .wc-block-components-button:not(.is-link) {
	padding: var(--mt-button-py) var(--mt-button-px);
	border: 0;
	border-radius: var(--mt-radius);
	background: var(--mt-accent);
	color: var(--mt-accent-text);
	font-family: var(--mt-font-button);
	font-weight: var(--mt-button-weight);
	line-height: 1.2;
	text-transform: var(--mt-button-transform);
	transition: background-color 0.15s;
}

.woocommerce a.button:hover, .woocommerce button.button:hover, .woocommerce input.button:hover,
.woocommerce #respond input#submit:hover, .woocommerce a.button.alt:hover, .woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover, .wc-block-components-button:not(.is-link):hover {
	background: var(--mt-accent-hover);
	color: var(--mt-accent-text);
}

.woocommerce button.button:disabled, .woocommerce button.button:disabled[disabled] { opacity: 0.5; }

/* 2. Messages: styled, never moved ---------------------------------------- */

.woocommerce-message, .woocommerce-info { border-top-color: var(--mt-accent); }
.woocommerce-message::before, .woocommerce-info::before { color: var(--mt-accent); }

/* 3. Shop grid ------------------------------------------------------------- */

.woocommerce ul.products {
	display: grid;
	grid-template-columns: repeat(var(--mt-cols, 4), minmax(0, 1fr));
	gap: var(--mt-shop-gap, 28px);
	margin: 0 0 2em;
	padding: 0;
}
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none; }
.woocommerce ul.products.columns-1 { --mt-cols: 1; }
.woocommerce ul.products.columns-2 { --mt-cols: 2; }
.woocommerce ul.products.columns-3 { --mt-cols: 3; }
.woocommerce ul.products.columns-4 { --mt-cols: 4; }
.woocommerce ul.products.columns-5 { --mt-cols: 5; }
.woocommerce ul.products.columns-6 { --mt-cols: 6; }

.woocommerce ul.products li.product {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	text-align: center;
}
.woocommerce ul.products li.product a img { margin-bottom: 12px; }
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	padding: 0.2em 0;
	color: var(--mt-heading);
	font-family: var(--mt-font-heading);
	font-size: 1rem;
	font-weight: var(--mt-heading-weight);
	text-transform: var(--mt-heading-transform);
}
.woocommerce ul.products li.product .price { color: var(--mt-heading); font-weight: 700; }
.woocommerce span.onsale { min-width: 0; min-height: 0; padding: 4px 10px; border-radius: var(--mt-radius); background: var(--mt-accent); color: var(--mt-accent-text); line-height: 1.4; }

@media (max-width: 900px) {
	.woocommerce ul.products[class*="columns-"] { --mt-cols: 3; }
}
@media (max-width: 767px) {
	body.mt-shop-phone-2 ul.products[class*="columns-"] { --mt-cols: 2; gap: min(var(--mt-shop-gap, 28px), 16px); }
	body.mt-shop-phone-1 ul.products[class*="columns-"] { --mt-cols: 1; }
}

.woocommerce .woocommerce-ordering select { width: auto; }
.woocommerce nav.woocommerce-pagination ul { border: 0; }
.woocommerce nav.woocommerce-pagination ul li { border: 0; }

/* 3a. Shop layout: the product grid (Shop: product grid) ----------------------
 * Every option here is a body class or a variable, set from the theme's settings and
 * swapped by the Customizer preview as a setting changes. Nothing in WooCommerce's
 * markup is moved, so "Add to basket", "Select options" and Monster Bookings' "Book
 * now" all stay where WooCommerce puts them.
 */

/* Picture shape. "auto" leaves each picture as it was uploaded. */
.woocommerce ul.products li.product a img {
	width: 100%;
	aspect-ratio: var(--mt-shop-ratio, auto);
	object-fit: var(--mt-shop-fit, cover);
}

/* Name and price on the left instead of centred. */
.woocommerce ul.products li.product .star-rating { margin: 0 auto 0.5em; }
.mt-shop-align-left ul.products li.product { text-align: left; }
.mt-shop-align-left ul.products li.product .star-rating { margin-left: 0; }

/* The category above the name. */
.mt-card__cat {
	display: block;
	margin-bottom: 2px;
	color: var(--mt-muted);
	font-size: 0.72em;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* Boxed and Lifted: each product in a card, the button at the foot of it. */
.mt-card-boxed ul.products li.product,
.mt-card-shadow ul.products li.product {
	display: flex;
	flex-direction: column;
	padding: 16px 16px 20px;
	border-radius: var(--mt-radius);
	background: var(--mt-page-bg);
}
.mt-card-boxed ul.products li.product { border: 1px solid var(--mt-border); }
.mt-card-shadow ul.products li.product {
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
	transition: transform 0.18s, box-shadow 0.18s;
}
.mt-card-shadow ul.products li.product:hover,
.mt-card-shadow ul.products li.product:focus-within {
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
	transform: translateY(-4px);
}
.mt-card-boxed ul.products li.product .button,
.mt-card-shadow ul.products li.product .button { align-self: center; margin-top: auto; }
.mt-card-boxed.mt-shop-align-left ul.products li.product .button,
.mt-card-shadow.mt-shop-align-left ul.products li.product .button { align-self: flex-start; }

@media (prefers-reduced-motion: reduce) {
	.mt-card-shadow ul.products li.product { transition: none; }
	.mt-card-shadow ul.products li.product:hover,
	.mt-card-shadow ul.products li.product:focus-within { transform: none; }
}

/* Overlay: the name and price over the foot of the picture. The link is named the way
 * WooCommerce's own rule names it (a.woocommerce-loop-product__link, which sets
 * display: block), so that these, coming later, are the ones that count. */
.mt-card-overlay ul.products li.product a.woocommerce-loop-product__link {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	box-sizing: border-box;
	min-height: 240px;
	aspect-ratio: var(--mt-shop-ratio, auto);
	padding: 16px;
	overflow: hidden;
	border-radius: var(--mt-radius);
	background: var(--mt-surface);
	text-decoration: none;
}
.mt-card-overlay ul.products li.product a.woocommerce-loop-product__link img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	aspect-ratio: auto;
}
.mt-card-overlay ul.products li.product a.woocommerce-loop-product__link::after {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0) 62%);
	content: "";
}
.mt-card-overlay ul.products li.product .woocommerce-loop-product__title,
.mt-card-overlay ul.products li.product .price,
.mt-card-overlay ul.products li.product .star-rating,
.mt-card-overlay ul.products li.product .mt-card__cat {
	position: relative;
	z-index: 1;
	color: #fff;
}
.mt-card-overlay ul.products li.product .onsale { z-index: 2; }

/* What shows on each product. */
.mt-shop-no-price ul.products li.product .price,
.mt-shop-no-rating ul.products li.product .star-rating,
.mt-shop-no-sale ul.products li.product .onsale,
.mt-shop-btn-never ul.products li.product .button,
.mt-shop-btn-never ul.products li.product .added_to_cart { display: none; }

/* The button only when pointed at. A phone has nothing to point with, so it stays. */
@media (hover: hover) {
	.mt-shop-btn-hover ul.products li.product .button { opacity: 0; transition: opacity 0.15s; }
	.mt-shop-btn-hover ul.products li.product:hover .button,
	.mt-shop-btn-hover ul.products li.product:focus-within .button,
	.mt-shop-btn-hover ul.products li.product .button.loading,
	.mt-shop-btn-hover ul.products li.product .button.added { opacity: 1; }
}

.mt-shop-no-toolbar .woocommerce-result-count,
.mt-shop-no-toolbar .woocommerce-ordering { display: none; }

/* 3b. Shop layout: an ordinary product's page (Shop: product page) ------------
 * These classes are only ever on the page of a product that is not a Monster Bookings
 * event, so an event's own layout (section 5) is never touched. The pictures, the
 * summary and the add-to-basket form stay where they are in the page and are only laid
 * out differently: an add-on's questions, which Monster Bookings prints inside that
 * form, come along with it.
 */

@media (min-width: 768px) {
	/* Side by side is WooCommerce's own layout (two floats, 48% each, 4% between), kept
	 * as it is: only the widths follow the setting, and at the default of 48% they are
	 * exactly WooCommerce's. !important because WooCommerce's rules for these carry an
	 * ID (#content), which nothing here can outrank otherwise. */
	.mt-pl-left div.product > .woocommerce-product-gallery,
	.mt-pl-right div.product > .woocommerce-product-gallery { width: var(--mt-gallery-w, 48%) !important; }
	.mt-pl-left div.product > .summary,
	.mt-pl-right div.product > .summary { width: calc(96% - var(--mt-gallery-w, 48%)) !important; }

	/* Details on the left: the same two floats, the other way round. */
	.mt-pl-right div.product > .woocommerce-product-gallery { float: right !important; }
	.mt-pl-right div.product > .summary { float: left !important; }

	/* The details stay in view while tall pictures scroll past. A float that sticks would
	 * slide down over the tabs underneath, so here, and only here, the two become a grid:
	 * the details then stop at the foot of the pictures. Everything else on the page
	 * (tabs, related products) runs full width underneath, as before. */
	.mt-product-sticky.mt-pl-left div.product,
	.mt-product-sticky.mt-pl-right div.product {
		display: grid;
		grid-template-columns: var(--mt-gallery-w, 48%) minmax(0, 1fr);
		column-gap: 4%;
		align-items: start;
	}
	.mt-product-sticky.mt-pl-right div.product { grid-template-columns: minmax(0, 1fr) var(--mt-gallery-w, 48%); }

	.mt-product-sticky.mt-pl-left div.product > *,
	.mt-product-sticky.mt-pl-right div.product > * { grid-column: 1 / -1; }

	.mt-product-sticky.mt-pl-left div.product > .woocommerce-product-gallery,
	.mt-product-sticky.mt-pl-right div.product > .woocommerce-product-gallery,
	.mt-product-sticky.mt-pl-left div.product > .summary,
	.mt-product-sticky.mt-pl-right div.product > .summary {
		grid-row: 1;
		float: none !important;
		width: auto !important;
	}
	.mt-product-sticky.mt-pl-left div.product > .woocommerce-product-gallery { grid-column: 1; }
	.mt-product-sticky.mt-pl-left div.product > .summary { grid-column: 2; }
	.mt-product-sticky.mt-pl-right div.product > .woocommerce-product-gallery { grid-column: 2; }
	.mt-product-sticky.mt-pl-right div.product > .summary { grid-column: 1; }

	.mt-product-sticky.mt-pl-left div.product > .summary,
	.mt-product-sticky.mt-pl-right div.product > .summary {
		position: sticky;
		top: calc(var(--mt-offset, 0px) + 24px);
	}
}

/* Pictures on top: one centred column, so a picture is not blown up to the full width
 * of the page and the details under it stay a comfortable width to read. */
.mt-pl-stacked div.product > .woocommerce-product-gallery,
.mt-pl-stacked div.product > .summary {
	float: none !important;
	width: 100% !important;
	max-width: 760px;
	margin-right: auto !important;
	margin-left: auto !important;
}

.mt-product-no-meta div.product .product_meta { display: none; }

/* Description, details and reviews one after another instead of in tabs. */
.mt-product-sections { clear: both; }
.mt-product-section {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 1px solid var(--mt-border);
}
.mt-product-section > h2 { font-size: var(--mt-h3); }

/* 4. Product page ---------------------------------------------------------- */

.woocommerce div.product .product_title { font-size: var(--mt-h2); }
.woocommerce div.product p.price, .woocommerce div.product span.price { color: var(--mt-accent); font-weight: 700; }
.woocommerce div.product form.cart .button { margin-left: 8px; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { border-bottom-color: var(--mt-page-bg); }
.woocommerce div.product .woocommerce-tabs ul.tabs li a { color: var(--mt-heading); }

/* 5. Event pages (Monster Bookings) ---------------------------------------
 * Banner image, then the booking panel at full content width (Monster Bookings'
 * form switches to two columns from 760px), then the event details. WooCommerce's
 * own elements and hooks stay in place.
 */

.mt-event div.product { display: flex; flex-direction: column; }
.mt-event div.product .woocommerce-product-gallery { float: none !important; width: 100% !important; margin: 0 0 32px !important; }
.mt-event div.product .woocommerce-product-gallery__image img { width: 100%; max-height: 480px; object-fit: cover; }
.mt-event div.product .flex-control-thumbs { display: none; }
.mt-event div.product .summary { float: none !important; width: 100% !important; margin: 0 !important; }
.mt-event div.product .product_title { margin-bottom: 0.3em; }
.mt-event .mt-event__details { max-width: 860px; margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--mt-border); }
.mt-book-anchor { display: block; height: 0; }

@media (max-width: 767px) {
	.mt-event--no-phone-image div.product .woocommerce-product-gallery { display: none !important; }
	body.mt-event { padding-bottom: 80px; }
}

/* The phone "Book now" bar (in the shared bottom area) */
.mt-book-bar { display: none; }

@media (max-width: 767px) {
	.mt-book-bar {
		display: inline-flex;
		align-self: stretch;
		justify-content: center;
		padding: 14px 24px;
		border-radius: 999px;
		box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
		font-size: 16px;
	}
	.mt-book-bar.is-hidden { display: none; }
}

/* 6. Steps: Basket → Checkout → Complete ---------------------------------- */

.mt-steps {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 0 0 40px;
	padding: 0;
	list-style: none;
	color: var(--mt-muted);
	font-weight: 600;
}
.mt-steps__step, .mt-steps a { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.mt-steps__step:not(:last-child)::after { width: 48px; height: 2px; margin-left: 4px; background: var(--mt-border); content: ""; }
.mt-steps__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: 2px solid var(--mt-border);
	border-radius: 50%;
	font-size: 14px;
}
.mt-steps__num .mt-icon { width: 16px; height: 16px; }
.mt-steps__step.is-current { color: var(--mt-heading); }
.mt-steps__step.is-current .mt-steps__num { border-color: var(--mt-accent); background: var(--mt-accent); color: var(--mt-accent-text); }
.mt-steps__step.is-done .mt-steps__num { border-color: var(--mt-accent); color: var(--mt-accent); }
.mt-steps__step.is-done::after { background: var(--mt-accent); }

@media (max-width: 600px) {
	.mt-steps__step:not(:last-child)::after { width: 14px; }
	.mt-steps__label { font-size: 13px; }
}

/* 7. Basket and checkout (classic) ---------------------------------------- */

.woocommerce table.shop_table { border-color: var(--mt-border); border-radius: 0; }
.woocommerce table.shop_table th { color: var(--mt-heading); }
.woocommerce-cart table.cart img { width: 64px; }
.woocommerce .quantity .qty { width: 4.5em; text-align: center; }
.woocommerce form .form-row label { color: var(--mt-heading); font-weight: 600; }
.woocommerce-checkout #payment { border-radius: var(--mt-input-radius); background: var(--mt-surface); }
.woocommerce-checkout #payment div.payment_box { background: var(--mt-page-bg); }
.woocommerce-checkout #payment div.payment_box::before { border-bottom-color: var(--mt-page-bg); }
#order_review_heading, .woocommerce-billing-fields h3, .woocommerce-additional-fields h3 { font-size: var(--mt-h4); }

/* 8. Basket and checkout (blocks) ----------------------------------------- */

.wc-block-cart, .wc-block-checkout { font-family: var(--mt-font-body); }
.wc-block-components-title, .wc-block-components-checkout-step__title,
.wc-block-cart__totals-title { color: var(--mt-heading); font-family: var(--mt-font-heading); }
.wc-block-components-text-input input, .wc-blocks-components-select .wc-blocks-components-select__select,
.wc-block-components-textarea { border-radius: var(--mt-input-radius) !important; }
.wc-block-components-product-name { color: var(--mt-heading); }

/* 9. Order received -------------------------------------------------------- */

.woocommerce ul.order_details {
	display: flex;
	flex-wrap: wrap;
	gap: 12px 32px;
	padding: 20px;
	background: var(--mt-surface);
}
.woocommerce ul.order_details::before, .woocommerce ul.order_details::after { display: none; }
.woocommerce ul.order_details li { margin: 0; padding: 0; border: 0; }

/* 10. My Account ----------------------------------------------------------- */

.woocommerce-account .mt-entry__content > .woocommerce:has(.woocommerce-MyAccount-navigation) {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 40px;
	align-items: start;
}
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content { float: none; width: auto; }
.woocommerce-MyAccount-navigation ul { margin: 0; padding: 0; border: 1px solid var(--mt-border); list-style: none; }
.woocommerce-MyAccount-navigation li a {
	display: block;
	padding: 12px 16px;
	border-bottom: 1px solid var(--mt-border);
	color: var(--mt-text);
	text-decoration: none;
}
.woocommerce-MyAccount-navigation li:last-child a { border-bottom: 0; }
.woocommerce-MyAccount-navigation li.is-active a { background: var(--mt-accent); color: var(--mt-accent-text); }
.woocommerce-MyAccount-navigation-link--mb-tickets a { font-weight: 700; }

@media (max-width: 767px) {
	.woocommerce-account .mt-entry__content > .woocommerce:has(.woocommerce-MyAccount-navigation) { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
