/**
 * The quick-view dialog.
 *
 * The wrapper is not a layout box — it exists only to carry the endpoint and to
 * hold the dialog. Left with a default `display: block` it contributed a line
 * box to whatever grid or flex row the block was placed in.
 */

.hermizon-quick-view {
	display: contents;
}

/* `display` is stated per state, and that is not tidiness — it is E68.
 * `.hermizon-quick-view__dialog { display: flex }` is one class and the user
 * agent's `dialog:not([open]) { display: none }` is one type selector plus a
 * pseudo-class, so ours wins and the **closed** dialog is laid out at full size
 * over the whole page, swallowing every click on the site. Phase 11 shipped
 * exactly that once. Anything overriding a UA `display` rule has to restate the
 * hidden case. */
.hermizon-quick-view__dialog[open] {
	display: flex;
}

.hermizon-quick-view__dialog:not([open]) {
	display: none;
}

.hermizon-quick-view__dialog {
	box-sizing: border-box;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	height: 100%;
	max-height: 100%;
	padding: var(--wp--preset--spacing--50);
	margin: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

.hermizon-quick-view__dialog::backdrop {
	background-color: var(--wp--custom--state--overlay);
}

/* `showModal()` does not lock background scroll — that is CSS. `scrollbar-gutter`
 * has to go with it or the page jumps sideways by the scrollbar's width as it
 * disappears, which is the whole page shifting under a shopper mid-click. */
.hermizon-quick-view-open {
	overflow: hidden;
	scrollbar-gutter: stable;
}

.hermizon-quick-view__card {
	box-sizing: border-box;
	position: relative;
	width: 100%;
	max-width: 820px;
	max-height: 86vh;
	padding: var(--wp--preset--spacing--60);
	overflow-y: auto;
	background: var(--wp--preset--color--base);
	border-radius: var(--wp--custom--radius--md);
	box-shadow: 0 14px 24px rgb(0 0 0 / 8%);
}

/* The two columns belong to the **body**, not the card. The card also holds the
 * close button and the dialog's accessible name; the photograph and the detail
 * are siblings one level further in, because that is the subtree the fetched
 * fragment replaces. Putting the grid on the card laid out three children —
 * button, heading, body — and stacked the real content inside the third.
 * Nothing measured wrong; it simply looked wrong, and only a screenshot says so. */
.hermizon-quick-view__body {
	display: grid;
	grid-template-columns: 320px minmax(0, 1fr);
	gap: var(--wp--preset--spacing--60);
	align-items: start;
}

.hermizon-quick-view__close {
	box-sizing: border-box;
	position: absolute;
	top: var(--wp--preset--spacing--40);
	right: var(--wp--preset--spacing--40);
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
	border-radius: 50%;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.hermizon-quick-view__close:hover,
.hermizon-quick-view__close:focus-visible {
	border-color: var(--wp--preset--color--contrast);
}

.hermizon-quick-view__media {
	display: block;
}

.hermizon-quick-view__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface);
}

.hermizon-quick-view__image--empty {
	aspect-ratio: 1;
	width: 100%;
}

.hermizon-quick-view__detail {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--30);
	/* The close button sits in this column; without room for it a long product
	 * name runs under the glyph. */
	padding-right: var(--wp--preset--spacing--60);
}

.hermizon-quick-view__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 500;
	line-height: 1.2;
}

.hermizon-quick-view__price {
	font-size: var(--wp--preset--font-size--large);
}

.hermizon-quick-view__excerpt {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--public-sans);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.7;
}

.hermizon-quick-view__form {
	margin-block-start: var(--wp--preset--spacing--20);
}

.hermizon-quick-view__purchase {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--40);
}

.hermizon-quick-view__choice {
	padding: 0;
	margin: 0;
	border: 0;
}

.hermizon-quick-view__legend {
	padding: 0;
	margin-block-end: var(--wp--preset--spacing--20);
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--public-sans);
	font-size: var(--wp--preset--font-size--small);
}

.hermizon-quick-view__options {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
}

/* The radio is the control; the box around it is what a shopper sees and taps.
 * The input stays in the document and keeps its own focus ring — clipped to a
 * pixel rather than `display: none`, which would take it out of the tab order
 * and out of the accessibility tree with it. */
.hermizon-quick-view__option input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}

.hermizon-quick-view__option > span {
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	/* WCAG 2.2 target size. A size chip is small text and would otherwise be a
	 * 30px box on the one surface built for a quick decision. */
	min-width: 48px;
	min-height: 44px;
	padding: 0 var(--wp--preset--spacing--30);
	border: var(--wp--custom--border--width) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--sm);
	cursor: pointer;
	transition: border-color var(--wp--custom--transition--fast);
}

.hermizon-quick-view__option input:checked + span {
	border-color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

.hermizon-quick-view__option input:focus-visible + span {
	outline: var(--wp--custom--state--focus-width) solid var(--wp--custom--state--focus);
	outline-offset: var(--wp--custom--state--focus-offset);
}

.hermizon-quick-view__submit {
	align-self: flex-start;
	min-width: 12rem;
	cursor: pointer;
}

.hermizon-quick-view__link {
	align-self: flex-start;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

.hermizon-quick-view__status {
	grid-column: 1 / -1;
	margin: 0;
	padding: var(--wp--preset--spacing--80) 0;
	color: var(--wp--preset--color--muted);
	text-align: center;
}

/* Below the platform's own column-stacking breakpoint the two columns become
 * one, and the image stops being a 320px fixed track. */
@media (max-width: 781px) {
	.hermizon-quick-view__card {
		padding: var(--wp--preset--spacing--50);
	}

	.hermizon-quick-view__body {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--wp--preset--spacing--40);
	}

	.hermizon-quick-view__detail {
		padding-right: 0;
	}

	/* A 1:1 photograph plus a variation form does not fit a 844px viewport, and
	 * the thing that must stay reachable is the form. */
	.hermizon-quick-view__image {
		aspect-ratio: 16 / 10;
	}
}
