/*
 * Pre-order catalogue — only the styles with no existing theme equivalent.
 * Cards reuse WooCommerce's .products/.product, .price and .wp-element-button styling;
 * the single page reuses .aha-feature-row + .woocommerce div.product.
 * Loaded only on the aha_pre_order_item archive + single templates.
 */

/* This site's other Woo pages render via block markup (product-collection), never
 * classic `ul.products li.product` — so WooCommerce's own legacy classic-catalog
 * float/width grid (woocommerce-layout.css) is otherwise dormant. Reusing that
 * classic markup here wakes it up; its selector is more specific than a single
 * class, so neutralize it with a selector of matching shape (ancestor + 2 classes
 * + 2 elements) rather than !important. */
.woocommerce ul.products.aha-po-grid li.product,
.woocommerce-page ul.products.aha-po-grid li.product {
	float: none;
	width: auto;
	margin: 0;
}

/* Same collision on the single item: WooCommerce's classic 2-column gallery
 * layout floats any div.images inside div.product — neutralize it here too. */
.woocommerce div.product div.images.aha-po-single__media,
.woocommerce-page div.product div.images.aha-po-single__media {
	float: none;
	width: auto;
}

/* ---------- Grid (layout glue only; cards inherit .products .product) ---------- */
/* Landing patterns wrap this in a constrained group that caps children at the
 * ~720px content-size; break out to the wide column so cards match the shop.
 * Mirror the shop grid's own breakpoint (WooCommerce's flex product-template
 * keeps cards full-width below 600px, only splitting into columns above it). */
.aha-po-grid {
	list-style: none;
	margin: var(--wp--preset--spacing--xl, 32px) auto 0;
	padding: 0;
	max-width: var(--wp--style--global--wide-size);
	width: 100%;
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--wp--preset--spacing--md, 16px);
}

/* Shop's product-collection uses displayLayout columns:4 — match that fixed
 * 4-up split (its single breakpoint above 600px never adds a further tablet
 * step) so cards are the same width as the shop grid at every desktop size. */
@media (min-width: 600px) {
	.aha-po-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: var(--wp--preset--spacing--lg, 24px);
	}
}

.aha-po-grid .product {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
}

.aha-po-card__media {
	position: relative;
	display: block;
}

.aha-po-card__noimg {
	display: block;
	aspect-ratio: 1 / 1;
	border-radius: var(--wp--custom--radius--lg, 12px);
	background: var(--wp--preset--color--surface-cream, #faf6f0);
}

/* ---------- Status badge (no existing equivalent) ---------- */
.aha-po-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: var(--wp--custom--radius--pill, 999px);
	font-size: var(--wp--preset--font-size--xs, 0.72rem);
	font-weight: 600;
	letter-spacing: 0.02em;
	background: var(--wp--preset--color--secondary, #4c6ef5);
	color: var(--wp--preset--color--white, #fff);
}

.aha-po-card__media .aha-po-badge {
	position: absolute;
	top: 8px;
	left: 8px;
}

.aha-po-badge--closed {
	background: var(--wp--preset--color--ink-muted, #5c6273);
}

.aha-po-badge--sold {
	background: var(--wp--preset--color--ink, #1b1f2a);
}

/* Disabled CTA (sold out) — the button styling itself is inherited. */
.button.disabled,
.button[aria-disabled="true"] {
	opacity: 0.55;
	pointer-events: none;
	cursor: not-allowed;
}

/* ---------- Single item (reuses .aha-feature-row + .woocommerce div.product) ---------- */
.aha-po-single {
	margin-top: var(--wp--preset--spacing--md, 16px);
	align-items: start;
}

.aha-po-single__info {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--sm, 12px);
	align-items: flex-start;
}

.aha-po-single__thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 10px;
}

.aha-po-single__thumb {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--md, 8px);
	border: 1px solid var(--wp--preset--color--line, #edeef2);
}

.aha-po-single__note {
	font-size: var(--wp--preset--font-size--sm, 0.85rem);
	color: var(--wp--preset--color--ink-muted, #5c6273);
	margin: 0;
}

/* ---------- Enquiry modal (novel UI, no existing equivalent) ---------- */
.aha-po-modal-open {
	overflow: hidden;
}

.aha-po-modal[hidden] {
	display: none;
}

.aha-po-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.aha-po-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(27, 31, 42, 0.55);
}

.aha-po-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 480px;
	max-height: 92vh;
	overflow-y: auto;
	background: var(--wp--preset--color--white, #fff);
	border-radius: 16px 16px 0 0;
	padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
	box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
}

@media (min-width: 601px) {
	.aha-po-modal {
		align-items: center;
	}

	.aha-po-modal__dialog {
		border-radius: 16px;
		padding: 28px;
	}
}

.aha-po-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	color: var(--wp--preset--color--ink-muted, #5c6273);
	cursor: pointer;
}

.aha-po-modal__title {
	font-size: 1.35rem;
	margin: 0 0 4px;
}

.aha-po-modal__item {
	color: var(--wp--preset--color--ink-muted, #5c6273);
	font-weight: 600;
	margin: 0 0 16px;
}

.aha-po-field {
	display: block;
	margin-bottom: 14px;
}

.aha-po-field > span {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin-bottom: 4px;
}

.aha-po-field em {
	color: var(--wp--preset--color--primary, #ff6b6b);
	font-style: normal;
}

.aha-po-field input {
	width: 100%;
	padding: 12px 14px;
	font-size: 16px; /* prevents iOS zoom-on-focus */
	border: 1px solid var(--wp--preset--color--line, #edeef2);
	border-radius: var(--wp--custom--radius--md, 8px);
	background: var(--wp--preset--color--white, #fff);
	color: var(--wp--preset--color--ink, #1b1f2a);
}

.aha-po-field input:focus {
	outline: 2px solid var(--wp--preset--color--secondary, #4c6ef5);
	outline-offset: 1px;
	border-color: transparent;
}

.aha-po-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 4px 0 16px;
	font-size: 0.9rem;
	line-height: 1.4;
}

.aha-po-check input {
	margin-top: 2px;
	flex: 0 0 auto;
}

.aha-po-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.aha-po-form__msg {
	min-height: 1.2em;
	margin: 0 0 10px;
	font-size: 0.9rem;
}

.aha-po-form__msg.is-error {
	color: #b32d2e;
}

.aha-po-form__msg.is-success {
	color: #1a7f37;
	font-weight: 600;
}

.aha-po-form__submit {
	width: 100%;
	padding: 14px 20px;
	border: 0;
	border-radius: var(--wp--custom--radius--lg, 12px);
	background: var(--wp--preset--color--primary, #ff6b6b);
	color: var(--wp--preset--color--white, #fff);
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
}

.aha-po-form__submit:disabled {
	opacity: 0.6;
	cursor: default;
}
