/* Matjari product page (tpl-product): the gallery, the head, the buy panel,
   the options, the details, the lightbox, the reviews and the related rail.
   The contract is docs/DESIGN-SYSTEM.md: 2.7 (frames and fit: the gallery
   never crops by surprise), 2.11 (stacking), 3.3 (the page), 4.4 (three
   layouts on ONE markup), 5.5 (what this file owns), section 7 (the floor).

   woocommerce/single-product.php prints four blocks inside .m-product:
   __gallery, then __info holding __head, __buy and __details. The layout is
   the class pdp--classic, pdp--showcase or pdp--focus on <html>, and the only
   key used here. Three designs, not three paddings:

     classic   the photo, a counter and the page under it on a phone; from 900
               the gallery and the details in one column and a calm info
               column beside them whose buy panel stays in view
     showcase  the photo leads: tall on a phone with the page rising over its
               foot as a sheet; from 900 every photo at once, as a mosaic
     focus     the buy panel is the anchor: a framed panel that takes the
               head in from 900, beside a contained photo and its thumbs

   The buttons, the stepper, the badge, the price atoms, the stars, the
   accordion, the share control, the card and the rail are components.css's;
   the sticky buy bar (.m-sticky) is chrome.css's. Every value is a token or a
   printed role, read through the current layer. This file declares no custom
   property. Hover lives behind (hover: hover) and (pointer: fine). */

/* ==========================================================================
   The page: one grid. A phone is one column in source order.
   ========================================================================== */
.m-product {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	row-gap: var(--m-gap-group);
	margin-block-end: var(--m-section-y);
}
.m-product__info, .m-product__head, .m-product__buy, .m-buy {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-content: start;
	min-width: 0;
}
.m-product__info { row-gap: var(--m-gap-group); }
.m-product__head { row-gap: var(--m-sp-2); }
.m-product__buy { row-gap: var(--m-sp-4); }
.m-buy { row-gap: var(--m-sp-5); margin: 0; }

/* ==========================================================================
   The gallery (2.7, 3.3). A grid, so the track, the counter and the zoom
   control share one cell and nothing is positioned by hand. On a phone it
   runs edge to edge. Slides are 100% of a track with no gap and no padding:
   product.js scrolls by track widths.
   ========================================================================== */
.m-product__gallery {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	min-width: 0;
	margin-inline: calc(var(--m-gutter) * -1);
}
.m-product__track {
	display: flex;
	grid-area: 1 / 1;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.m-product__track::-webkit-scrollbar, .m-product__thumbs::-webkit-scrollbar, .m-lightbox__track::-webkit-scrollbar { display: none; }
.m-product__slide { flex: 0 0 100%; min-width: 0; margin: 0; scroll-snap-align: center; }
/* The frame is the one element that clips. Its ratio is --ratio, a number the
   template prints on the gallery (matjari_gallery_plan()): the Look's own
   ratio (its cards', or the gallery ratio its look.json states), or her
   photos' when they are far from it, so nothing floats in a frame of the
   wrong shape and every frame of one gallery is the same size. On a phone the
   frame stops short of the first screen's foot by exactly what the name and
   the price need above the buy bar, counted from the Look's own tokens: the
   gap, the eyebrow, two lines of name at --m-fs-product, the price, the head's
   gaps and the bar. So in every layout, in every Look, a two-line name and its
   price are read before she scrolls. The width is stated, or the stop would
   narrow the frame instead; how the photo sits in a frame it does not fit is
   the next rule's, and the lightbox always shows it whole. */
.m-product__frame {
	position: relative;
	display: block;
	overflow: hidden;
	width: 100%;
	max-height: calc(100vh - var(--m-header-first) - var(--m-gap-group) - 2 * var(--m-fs-product) * var(--m-lh-heading) - (var(--m-fs-small) + var(--m-fs-price)) * var(--m-lh-control) - 5 * var(--m-sp-2) - var(--m-sp-1) - var(--m-sticky-h) - var(--m-safe-b));
	background-color: var(--m-img-bg);
	aspect-ratio: var(--ratio);
}
.m-product__img {
	position: absolute;
	inset-block-start: 0;
	inset-inline-start: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	cursor: zoom-in;
	transition: opacity var(--m-dur-panel) var(--m-ease);
}
/* A variation's photo swaps in: a breath, not a blink. */
.m-product__img.is-swapping { opacity: .3; }
/* Under `cover` a photograph fills its frame while that cuts 12% of it or
   less (2.7), and is shown whole beyond: it is as wide as the frame, as tall
   as that makes it but never more than 1/.88 of the frame's height, and
   fitted inside that box, centred. So a photo near the frame's shape covers
   it; a phone stop or a split half far shorter than a portrait cuts it by 12%
   and shows the rest on the frame's own ground; a photo wider than its frame
   is shown whole. One rule for every frame at every width. */
.fit--cover .m-product__img { inset-block-start: 50%; height: auto; min-height: 100%; max-height: calc(100% / .88); object-fit: contain; transform: translateY(-50%); }
/* Where the frame can measure itself, the photo is drawn at its own ratio
   (--photo, printed on its slide), by the same 12% both ways: a photo wider
   than its frame covers it too while that cuts 12% of it or less, and beyond
   is shown whole. And no sliver (the lead's ruling on V2-P1): where the bars
   would come to less than --m-sp-6 a side, the photo covers instead. Older
   engines keep the rule above. */
@supports (width: 1cqw) {
	.fit--cover .m-product__frame { container-type: size; }
	.fit--cover .m-product__img { inset: -9999px; width: min(max(100cqw, 100cqh * var(--photo)), calc(min(100cqw, 100cqh * var(--photo) / .88) + clamp(0px, max(calc(100cqw - min(100cqw, 100cqh * var(--photo) / .88) - 2 * var(--m-sp-6)), calc(100cqh - 100cqw / var(--photo) - max(2 * var(--m-sp-6), 12cqh))) * -1000, 9999px))); height: calc(min(max(100cqw, 100cqh * var(--photo)), calc(min(100cqw, 100cqh * var(--photo) / .88) + clamp(0px, max(calc(100cqw - min(100cqw, 100cqh * var(--photo) / .88) - 2 * var(--m-sp-6)), calc(100cqh - 100cqw / var(--photo) - max(2 * var(--m-sp-6), 12cqh))) * -1000, 9999px))) / var(--photo)); min-height: 0; max-height: none; margin: auto; object-fit: cover; transform: none; }
}
/* Shown whole (audit I3). Under `cover`, a photo the plan found more than 12%
   off the frame is never cropped: it stands whole on the Look's mat. Under
   `contain` and `mat` every photo floats in the frame, and its corners follow
   the photograph, not an empty box. */
.m-product__slide--contain .m-product__frame, .fit--contain .m-product__frame { background-color: var(--m-mat); }
.m-product__slide--contain .m-product__img { width: 100%; height: 100%; object-fit: contain; }
.fit--mat .m-product__frame { background-color: var(--m-plate); }
/* A frame that paints a plate dims with its photograph in the dark form, so a
   white-background shot does not glare (8.9): 1 in the light form. */
.m-product__slide--contain .m-product__frame, .fit--contain .m-product__frame, .fit--mat .m-product__frame { opacity: var(--m-plate-dim); }
.fit--contain .m-product__img, .fit--mat .m-product__img {
	inset-block-end: 0;
	inset-inline-end: 0;
	width: auto;
	max-width: calc(100% - 2 * var(--m-img-pad-contain));
	height: auto;
	max-height: calc(100% - 2 * var(--m-img-pad-contain));
	margin: auto;
	border-radius: var(--m-r-thumb);
}
.fit--mat .m-product__img { max-width: calc(100% - 2 * var(--m-img-pad-mat)); max-height: calc(100% - 2 * var(--m-img-pad-mat)); }
.fit--mat.tone-light .m-product__img { mix-blend-mode: multiply; }

/* Where she is in the photos, on a phone: no height, no tap target. In the
   middle of the photo's foot: both corners belong to floating buttons. */
.m-product__count {
	grid-area: 1 / 1;
	align-self: end;
	justify-self: center;
	z-index: 1;
	margin: var(--m-sp-3);
	padding: var(--m-sp-1) var(--m-sp-3);
	border-radius: var(--m-r-pill);
	background-color: rgba(var(--m-scrim-rgb), .62);
	color: var(--m-on-photo);
	font-size: var(--m-fs-micro);
	font-weight: var(--m-fw-strong);
	line-height: var(--m-lh-control);
	font-variant-numeric: var(--m-fvn);
	pointer-events: none;
}
/* The way into the lightbox, for a keyboard too. The heart's twin, so it takes
   the heart's shape (--m-wish-r): square on a Look whose heart is square. */
.m-product__zoom {
	grid-area: 1 / 1;
	align-self: start;
	justify-self: start;
	z-index: 1;
	display: grid;
	place-items: center;
	width: var(--m-touch);
	height: var(--m-touch);
	margin: var(--m-sp-3);
	padding: 0;
	border: 0;
	border-radius: var(--m-wish-r);
	background-color: var(--m-surface-1);
	color: var(--m-ink);
	box-shadow: var(--m-elev-1);
	cursor: zoom-in;
	transition: transform var(--m-dur-press) var(--m-ease);
}
.m-product__zoom:active { transform: var(--m-btn-press); }

/* Thumbs: from 600, and on a `focus` phone. Real 64px targets. */
.m-product__thumbs { display: none; margin-block-start: var(--m-sp-3); overflow-x: auto; scrollbar-width: none; }
.m-product__thumb {
	position: relative;
	flex: none;
	overflow: hidden;
	width: var(--m-sp-11);
	height: var(--m-sp-11);
	margin: 0;
	margin-inline-end: var(--m-sp-2);
	padding: 0;
	border: 0;
	border-radius: var(--m-r-thumb);
	background-color: var(--m-img-bg);
	cursor: pointer;
}
.m-product__thumb img { width: 100%; height: 100%; object-fit: cover; }
.fit--contain .m-product__thumb img, .fit--mat .m-product__thumb img { object-fit: contain; }
/* The current one is ringed over its photo: nothing moves, nothing shrinks. */
.m-product__thumb::after {
	content: "";
	position: absolute;
	inset: 0;
	border: var(--m-bw-strong) solid var(--m-c-ink);
	border-radius: inherit;
	opacity: 0;
	transition: opacity var(--m-dur-press) var(--m-ease);
}
.m-product__thumb.is-active::after { opacity: 1; }
.m-product__thumb:active { opacity: .7; }

/* ==========================================================================
   The head: where it lives, its name, its rating, its price, the promises.
   ========================================================================== */
.m-product__eyebrow {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	margin: 0;
	color: var(--m-c-ink-2);
	font-size: var(--m-fs-small);
	font-weight: var(--m-fw-small);
	line-height: var(--m-lh-control);
}
.m-product__eyebrow a { position: relative; padding-block: var(--m-sp-2); color: inherit; text-decoration: none; }
/* The eyebrow's and the rating's links are words, not buttons: each keeps its
   line and is given a touch-sized hit area centred on it, so the head does not
   grow by a pixel. */
.m-product__eyebrow a::after, .m-product__rating a::after {
	content: "";
	position: absolute;
	inset-block-start: 50%;
	inset-inline-start: 50%;
	inline-size: max(100%, var(--m-touch));
	block-size: var(--m-touch);
	transform: translate(calc(var(--m-dir) * -50%), -50%);
}
.m-product__eyebrow span { margin-inline: var(--m-sp-2); color: var(--m-c-ink-3); }
.m-product__title {
	margin: 0;
	font-family: var(--m-font-product);
	font-weight: var(--m-fw-product);
	font-size: var(--m-fs-product);
	line-height: var(--m-lh-heading);
}
/* On a phone the price comes straight after the name, then the rating and
   the promises: what it is and what it costs are read first (they are what
   the stop above keeps on the first screen). From 600 the source order. */
.m-product__rating { display: flex; order: 1; margin: 0; font-size: var(--m-fs-small); line-height: var(--m-lh-control); }
.m-product__rating a { position: relative; display: inline-flex; align-items: center; padding-block: var(--m-sp-1); color: var(--m-c-ink-2); text-decoration: none; }
.m-product__rating-count { margin-inline-start: var(--m-sp-2); }
.m-product__rating--empty a { text-decoration: underline; text-underline-offset: .22em; }
/* The price is a large numeral (2.1) with its unit said small beside it. On
   a sale the price she pays leads, in the sale ink, then what it was, struck
   and readable, with its unit said once; the badge says the saving. */
.m-product__pricerow { display: flex; flex-wrap: wrap; align-items: center; margin-block-start: var(--m-sp-1); }
.m-product__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	margin: 0;
	margin-inline-end: var(--m-sp-3);
	font-family: var(--m-font-num);
	font-weight: var(--m-fw-num);
	font-size: var(--m-fs-price);
	line-height: var(--m-lh-control);
}
.m-product__price > * { margin-inline-end: var(--m-sp-2); }
.m-product__price ins { order: -1; }
.m-product__price del { font-family: var(--m-font-text); }
.m-product__price .woocommerce-Price-currencySymbol { font-size: .62em; }
.m-product__price del .woocommerce-Price-currencySymbol { display: none; }
/* One calm line, not pills that look like coupons. */
.m-product__assure {
	display: flex;
	order: 2;
	flex-wrap: wrap;
	margin: var(--m-sp-1) 0 0;
	padding: 0;
	list-style: none;
	color: var(--m-c-ink-2);
	font-size: var(--m-fs-small);
	font-weight: var(--m-fw-small);
	line-height: var(--m-lh-ui);
}
.m-product__assure li { display: flex; align-items: center; margin-inline-end: var(--m-sp-4); padding-block: var(--m-sp-1); }
.m-product__assure svg { flex: none; margin-inline-end: var(--m-sp-2); color: var(--m-c-link); }

/* ==========================================================================
   The buy panel. Margins and grid gaps only: this is the buy path (7).
   ========================================================================== */
.m-product__excerpt { max-width: var(--m-measure); color: var(--m-c-ink-2); }
.m-product__excerpt p { margin: 0; }

/* Options: colour chips and labelled pills. The radio is the control and
   covers its swatch, so the target is the swatch. */
.m-swatches { min-width: 0; margin: 0; padding: 0; border: 0; }
.m-swatches__label {
	display: block;
	margin-block-end: var(--m-sp-2);
	padding: 0;
	color: var(--m-c-ink);
	font-size: var(--m-fs-ui);
	font-weight: var(--m-fw-strong);
	line-height: var(--m-lh-control);
	transition: color var(--m-dur-press) var(--m-ease);
}
/* Both sides: the chosen value is its own isolated run, and a number alone
   (a size) is a left-to-right run whose start is the far side in Arabic. */
.m-swatches__chosen { margin-inline-start: var(--m-sp-2); margin-inline-end: var(--m-sp-2); color: var(--m-c-ink-2); font-weight: var(--m-fw-body); }
.m-swatches__row { display: flex; flex-wrap: wrap; margin: calc(var(--m-sp-1) * -1); }
.m-swatch { position: relative; display: block; margin: var(--m-sp-1); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.m-swatch input { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
/* A chip is a 44px box: its ring is the border, the colour is a disc inside
   it, and the ground shows between the two. */
.m-swatch__chip {
	position: relative;
	display: block;
	width: var(--m-touch);
	height: var(--m-touch);
	border: var(--m-bw-strong) solid transparent;
	border-radius: var(--m-r-chip);
	transition: border-color var(--m-dur-press) var(--m-ease), transform var(--m-dur-press) var(--m-ease);
}
.m-swatch__chip::after {
	content: "";
	position: absolute;
	inset: var(--m-sp-1);
	border-radius: inherit;
	background-color: var(--chip);
	/* The inner ring of the current ink, always (2.6, H34): it bounds a pale
	   shade on a light page and a dark one on a dark page. PHP cannot know the
	   form she is in, so nothing is decided from the shade. */
	box-shadow: inset 0 0 0 1px rgba(var(--m-c-ink-rgb), .34);
}
.m-swatch__pill {
	display: grid;
	place-items: center;
	min-width: var(--m-touch);
	min-height: var(--m-touch);
	padding-inline: var(--m-sp-4);
	border: var(--m-bw-control) solid var(--m-c-line-strong);
	border-radius: var(--m-r-chip);
	color: var(--m-c-ink);
	font-size: var(--m-fs-ui);
	font-weight: var(--m-fw-ui);
	line-height: var(--m-lh-control);
	transition: background-color var(--m-dur-press) var(--m-ease), border-color var(--m-dur-press) var(--m-ease), color var(--m-dur-press) var(--m-ease), transform var(--m-dur-press) var(--m-ease);
}
/* Chosen: the ink, never the primary. The primary is the button's. */
.m-swatch input:checked + .m-swatch__chip { border-color: var(--m-c-ink); }
.m-swatch input:checked + .m-swatch__pill { border-color: var(--m-inverse); background-color: var(--m-inverse); color: var(--m-on-inverse); }
.m-swatch input:focus-visible + .m-swatch__chip { outline: var(--m-bw-focus) solid var(--m-c-focus); outline-offset: var(--m-focus-offset); }
.m-swatch input:focus-visible + .m-swatch__pill { outline: var(--m-bw-focus) solid var(--m-c-focus); outline-offset: var(--m-focus-offset); }
.m-swatch:active .m-swatch__chip, .m-swatch:active .m-swatch__pill { transform: var(--m-btn-press); }
/* Sold out LOOKS sold out before it is tapped (audit U6): a struck chip, a
   struck and dashed pill. It can still be chosen: the page then says why. */
.m-swatch.is-out .m-swatch__chip::after { opacity: .4; }
.m-swatch.is-out .m-swatch__chip::before {
	content: "";
	position: absolute;
	inset-block-start: calc(50% - var(--m-bw-control) / 2);
	inset-inline: 0;
	z-index: 1;
	height: var(--m-bw-control);
	background-color: var(--m-c-ink);
	transform: rotate(-45deg);
}
.m-swatch.is-out .m-swatch__pill { border-style: dashed; color: var(--m-c-ink-3); text-decoration: line-through; }
.m-swatch.is-out input:checked + .m-swatch__pill { border-color: var(--m-c-ink); background-color: transparent; color: var(--m-c-ink-2); }
/* The prompt walks her to the group she skipped: its name takes the link
   colour, so it reads with motion reduced too, and every option of the group
   gives the Look's own emphasis once (12.4: the shared keyframe at half
   strength, the heart's; transform and opacity only). */
.m-swatches.is-pulse .m-swatches__label { color: var(--m-c-link); }
.m-swatches.is-pulse .m-swatch__chip, .m-swatches.is-pulse .m-swatch__pill { animation: m-emph-soft var(--m-dur-emph) var(--m-ease-emph); }

/* The stock line of the chosen option, or of a simple product. */
.m-buy__stock { margin: 0; color: var(--m-c-ink-2); font-size: var(--m-fs-small); font-weight: var(--m-fw-strong); line-height: var(--m-lh-ui); }
.m-buy__stock.is-low { color: var(--m-danger); }

/* Quantity, then the button. The button stands beside the stepper when its
   label fits there, and takes the next line whole when it does not: a long
   prompt can never push the page sideways (audit X2). */
.m-buy__row { display: flex; flex-wrap: wrap; align-items: stretch; margin: calc(var(--m-sp-3) / -2); }
.m-buy__row > * { margin: calc(var(--m-sp-3) / 2); }
.m-buy__submit { flex: 1 1 auto; }
/* What cannot be bought says why, readably: a quiet surface, not a faded primary. */
.m-buy__submit:disabled:not(.is-busy) { border-color: transparent; background-color: var(--m-surface-3); color: var(--m-c-ink-2); opacity: 1; }
/* The mirrored quantity (2.1): the number she reads is the <b>, laid over a
   field whose own digits show only while she types in it. */
.m-buy__row--mirror .m-qty input, .m-buy__row--mirror .m-qty b { grid-area: 1 / 2; }
.m-buy__row--mirror .m-qty b { pointer-events: none; }
.m-buy__row--mirror .m-qty input { color: transparent; caret-color: var(--m-input-ink); }
.m-buy__row--mirror .m-qty input:focus { color: inherit; }
.m-buy__row--mirror .m-qty input:focus + b { visibility: hidden; }

/* WhatsApp is the second path; share never competes with it for width. */
.m-product__actions { display: flex; flex-wrap: wrap; margin: calc(var(--m-sp-3) / -2); }
.m-product__actions > * { margin: calc(var(--m-sp-3) / 2); }
.m-product__actions .m-buy__wa { flex: 1 1 auto; }
.m-product__share { display: grid; }

/* ==========================================================================
   The details: the shared accordion, under one rule.
   ========================================================================== */
.m-product__details { border-block-start: var(--m-bw-hair) solid var(--m-c-line); }
.m-product__desc { color: var(--m-c-ink); }

/* ==========================================================================
   The lightbox (2.11): under the toasts, over everything else. It opens and
   closes with motion; a tap outside the photo closes it. product.js builds it.
   ========================================================================== */
.m-lightbox {
	position: fixed;
	inset: 0;
	z-index: var(--m-z-lightbox);
	background-color: var(--m-scrim);
	color: var(--m-on-photo);
	opacity: 0;
	transition: opacity var(--m-dur-panel) var(--m-ease-exit);
}
.m-lightbox.is-open { opacity: 1; transition-timing-function: var(--m-ease); }
.has-adminbar .m-lightbox { inset-block-start: var(--m-header-top); }
.m-lightbox__track { display: flex; height: 100%; overflow-x: auto; overscroll-behavior: contain; scroll-snap-type: x mandatory; scrollbar-width: none; }
/* One cell of a definite size, or the photo's own height would size the row
   and its max-height would have nothing to be a percentage of. */
.m-lightbox__cell {
	display: grid;
	flex: 0 0 100%;
	grid-template: minmax(0, 1fr) / minmax(0, 1fr);
	place-items: center;
	height: 100%;
	padding: var(--m-sp-10) var(--m-sp-2);
	overflow: hidden;
	scroll-snap-align: center;
}
.m-lightbox__cell img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	cursor: zoom-in;
	user-select: none;
	transform: scale(.96);
	transition: transform var(--m-dur-panel) var(--m-ease);
}
.m-lightbox.is-open .m-lightbox__cell img { transform: none; }
.m-lightbox__cell.is-zoomed { display: block; padding: 0; overflow: auto; }
.m-lightbox__cell.is-zoomed img { width: 230%; max-width: none; max-height: none; cursor: zoom-out; }
.m-lightbox__close, .m-lightbox__arrow {
	position: absolute;
	z-index: 1;
	place-items: center;
	width: var(--m-touch);
	height: var(--m-touch);
	padding: 0;
	border: 0;
	border-radius: var(--m-r-round);
	background-color: rgba(var(--m-on-photo-rgb), .16);
	color: inherit;
	cursor: pointer;
	transition: background-color var(--m-dur-press) var(--m-ease), transform var(--m-dur-press) var(--m-ease);
}
.m-lightbox__close { display: grid; inset-block-start: var(--m-sp-3); inset-inline-end: var(--m-sp-3); }
/* Arrows are for a pointer: a finger swipes. */
.m-lightbox__arrow { display: none; inset-block-start: calc(50% - var(--m-touch) / 2); }
.m-lightbox__arrow--prev { inset-inline-start: var(--m-sp-3); }
.m-lightbox__arrow--next { inset-inline-end: var(--m-sp-3); }
/* Both carry the same forward chevron; the direction turns it. */
.m-lightbox__arrow--next svg { transform: scaleX(var(--m-dir)); }
.m-lightbox__arrow--prev svg { transform: scaleX(calc(var(--m-dir) * -1)); }
.m-lightbox__close:active, .m-lightbox__arrow:active { transform: var(--m-btn-press); }
.m-lightbox__count {
	position: absolute;
	inset-block-end: var(--m-sp-4);
	inset-inline: 0;
	font-size: var(--m-fs-small);
	font-weight: var(--m-fw-small);
	line-height: var(--m-lh-control);
	font-variant-numeric: var(--m-fvn);
	text-align: center;
	pointer-events: none;
}

/* ==========================================================================
   Reviews: social proof first. The summary and the way to write one in an
   aside, the list beside it from 900.
   ========================================================================== */
.m-reviews, .m-related { margin-block: var(--m-section-y); }
.m-reviews__body, .m-reviews__aside, .m-revform { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; }
.m-reviews__body { row-gap: var(--m-gap-group); }
.m-reviews__aside { row-gap: var(--m-sp-4); justify-items: start; }
.m-reviews__summary { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: var(--m-sp-4); justify-self: stretch; }
/* The average is a large numeral (2.1). */
.m-reviews__avg { font-family: var(--m-font-num); font-weight: var(--m-fw-num); font-size: var(--m-fs-h1); line-height: var(--m-lh-control); font-variant-numeric: var(--m-fvn); }
.m-reviews__of { display: grid; row-gap: var(--m-sp-1); justify-items: start; }
.m-reviews__count, .m-reviews__invite, .m-rev__when, .m-revform__note, .m-revform__field small { color: var(--m-c-ink-2); font-size: var(--m-fs-small); font-weight: var(--m-fw-small); }
.m-reviews__invite, .m-revform__note, .m-revform__err, .m-revform__done { margin: 0; }
.m-reviews__bars {
	display: grid;
	grid-column: 1 / -1;
	row-gap: var(--m-sp-1);
	margin: var(--m-sp-4) 0 0;
	padding: 0;
	list-style: none;
	color: var(--m-c-ink-2);
	font-size: var(--m-fs-small);
	line-height: var(--m-lh-control);
	font-variant-numeric: var(--m-fvn);
}
.m-reviews__bars li { display: grid; grid-template-columns: var(--m-sp-4) minmax(0, 1fr) var(--m-sp-6); align-items: center; column-gap: var(--m-sp-2); }
.m-reviews__bars i { display: block; height: var(--m-sp-2); border-radius: var(--m-r-pill); background-color: var(--m-surface-3); }
.m-reviews__bars i i { background-color: var(--m-star); }
.m-reviews__list { display: grid; margin: 0; padding: 0; list-style: none; }
.m-rev { padding-block: var(--m-sp-5); border-block-end: var(--m-bw-hair) solid var(--m-c-line); }
.m-rev:first-child { padding-block-start: 0; }
.m-rev__head { display: flex; flex-wrap: wrap; align-items: center; }
.m-rev__head > * { margin-inline-end: var(--m-sp-2); }
.m-rev__who { font-size: var(--m-fs-ui); font-weight: var(--m-fw-strong); }
.m-rev__badge {
	padding: var(--m-sp-1) var(--m-sp-2);
	border-radius: var(--m-r-badge);
	background-color: var(--m-success-soft);
	color: var(--m-success);
	font-size: var(--m-fs-micro);
	font-weight: var(--m-fw-strong);
	line-height: var(--m-lh-control);
}
.m-rev .m-rev__when { margin-inline: auto 0; }
.m-rev__text { max-width: var(--m-measure); margin: var(--m-sp-2) 0 0; }
.m-rev__reply {
	max-width: var(--m-measure);
	margin-block-start: var(--m-sp-3);
	padding: var(--m-sp-3) var(--m-sp-4);
	border-inline-start: var(--m-bw-strong) solid var(--m-c-line-strong);
	background-color: var(--m-surface-2);
	font-size: var(--m-fs-ui);
}
.m-rev__reply b { font-weight: var(--m-fw-strong); }
.m-rev__reply p { margin: var(--m-sp-1) 0 0; }

/* The form waits behind the invitation (a native <details>, so it works with
   scripts dead) and replaces it when opened. */
.m-revdisc { justify-self: stretch; }
.m-revdisc summary::-webkit-details-marker { display: none; }
.m-revdisc__open { list-style: none; }
.m-revdisc[open] .m-revdisc__open { display: none; }
.m-revform { row-gap: var(--m-sp-4); max-width: var(--m-container-form); }
.m-revform__title { margin: 0; }
/* The rating field. The painted strip advances by its mask tile, so the tile
   IS the slot: the strip's tile and the five targets laid over it are both
   the touch token itself, and the fifth star is under the finger that taps
   it (scenario 62, I). */
.m-revform__rate { position: relative; min-block-size: var(--m-touch); margin: 0; padding: 0; border: 0; }
.m-revform__rate .m-stars {
	inline-size: calc(var(--m-touch) * 5);
	block-size: var(--m-touch);
	vertical-align: top;
	-webkit-mask-size: var(--m-touch) var(--m-touch);
	mask-size: var(--m-touch) var(--m-touch);
}
.m-revform__hits { position: absolute; inset-block-start: 0; inset-inline-start: 0; display: flex; }
.m-revform__star { display: grid; place-items: center; min-inline-size: var(--m-touch); min-block-size: var(--m-touch); cursor: pointer; }
.m-revform__star input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
/* The ring frames the star she tapped, with no :has() and no script. */
.m-revform__starbox { inline-size: var(--m-touch); block-size: var(--m-touch); border-radius: var(--m-r-thumb); }
.m-revform__star input:checked + .m-revform__starbox { box-shadow: inset 0 0 0 var(--m-bw-strong) var(--m-c-link); }
.m-revform__star input:focus-visible + .m-revform__starbox { outline: var(--m-bw-focus) solid var(--m-c-focus); outline-offset: var(--m-focus-offset); }
.m-revform__field { display: grid; row-gap: var(--m-label-gap); }
/* The field is base.css's; its text is stated here too, where it is typed. */
.m-revform__field input, .m-revform__field textarea { font-size: var(--m-fs-input); }
.m-revform__hp { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
.m-revform__err { color: var(--m-danger); font-size: var(--m-fs-small); font-weight: var(--m-fw-strong); }
.m-revform__done {
	padding: var(--m-sp-3) var(--m-sp-4);
	border: var(--m-bw-hair) solid var(--m-success-line);
	border-radius: var(--m-r-box);
	background-color: var(--m-success-soft);
	color: var(--m-success);
	font-size: var(--m-fs-ui);
}

/* A real phone's small viewport, where the engine knows it (section 7). */
@supports (height: 100svh) {
	.m-product__frame { max-height: calc(100svh - var(--m-header-first) - var(--m-gap-group) - 2 * var(--m-fs-product) * var(--m-lh-heading) - (var(--m-fs-small) + var(--m-fs-price)) * var(--m-lh-control) - 5 * var(--m-sp-2) - var(--m-sp-1) - var(--m-sticky-h) - var(--m-safe-b)); }
}

/* ==========================================================================
   From 600: two columns, so a tablet in portrait is not a stretched phone.
   The photo stays beside the page while it scrolls, and never outgrows the
   screen it is stuck to.
   ========================================================================== */
@media (min-width: 600px) {
	.m-product { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; column-gap: var(--m-sp-7); padding-block-start: var(--m-sp-6); }
	.m-product__gallery { position: sticky; top: var(--m-sp-4); max-inline-size: calc((100vh - var(--m-sp-13)) * var(--ratio)); margin-inline: 0; }
	.m-product__frame { max-height: none; border-radius: var(--m-r-image); }
	.m-product__rating, .m-product__assure { order: 0; }
	.m-product__count { display: none; }
	.m-product__thumbs { display: flex; }

	.m-reviews__bars { max-width: var(--m-summary-w); }
}

/* ==========================================================================
   From 900: nothing is fixed to the screen, so THE BUY PANEL is what stays
   in view (3.3), under the scrolled header, and scrolls inside itself if it
   must. The head, the panel and the details become cells of the page grid:
   the details go under the photo, never under the panel, so an open
   accordion cannot push the button out of reach or slide beneath it.
   ========================================================================== */
@media (min-width: 900px) {
	.m-product { grid-template-rows: auto auto 1fr; column-gap: var(--m-sp-9); padding-block-start: var(--m-sp-7); }
	.m-product__info { display: contents; }
	.m-product__gallery { grid-area: 1 / 1 / 3 / 2; position: relative; top: auto; max-inline-size: none; }
	.m-product__head { grid-area: 1 / 2; }
	.m-product__buy {
		grid-area: 2 / 2 / 4 / 3;
		position: sticky;
		top: var(--m-header-clear);
		max-height: calc(100vh - var(--m-header-clear) - var(--m-sp-4));
		/* Room inside the scroller for a focus ring and a Look's offset
		   shadow, taken back outside it, so nothing is clipped at its edge. */
		margin: calc(var(--m-sp-2) * -1);
		padding: var(--m-sp-2);
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
	}
	.m-product__details { grid-area: 3 / 1; }

	.m-reviews__body { grid-template-columns: var(--m-summary-w) minmax(0, 1fr); align-items: start; column-gap: var(--m-sp-11); }
	.m-reviews--empty .m-reviews__body { grid-template-columns: minmax(0, 1fr); }
	.m-reviews__aside { position: sticky; top: var(--m-header-clear); }
}

/* ==========================================================================
   From 1200: 7 to 5. Where the thumbs become a column beside the photo is a
   layout's own rule (classic and focus), never the core's (O1, 4.4).
   ========================================================================== */
@media (min-width: 1200px) {
	.m-product { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--m-sp-11); }
}

@media (min-width: 1600px) {
	.m-product { column-gap: var(--m-sp-12); }
}

@media (hover: hover) and (pointer: fine) {
	.m-product__eyebrow a:hover, .m-product__rating a:hover { color: var(--m-c-ink); text-decoration: underline; text-underline-offset: .22em; }
	.m-product__thumb:hover::after { opacity: .4; }
	.m-product__thumb.is-active:hover::after { opacity: 1; }
	.m-product__zoom:hover { background-color: var(--m-surface-3); }
	.m-swatch:hover .m-swatch__chip { border-color: var(--m-c-line-strong); }
	.m-swatch:hover .m-swatch__pill { border-color: var(--m-c-ink); }
	.m-lightbox__arrow { display: grid; }
	.m-lightbox__close:hover, .m-lightbox__arrow:hover { background-color: rgba(var(--m-on-photo-rgb), .3); }
}

/* Below the floor of aspect-ratio the frame is a padding box of the same
   ratio; the photo is already positioned inside it. */
@supports not (aspect-ratio: 1 / 1) {
	.m-product__frame { height: 0; max-height: none; padding-block-start: calc(100% / var(--ratio)); }
}
