/**
 * The accessories list on the block product page.
 *
 * Its own markup and its own stylesheet, sharing no selectors with the classic theme's, which is
 * why the classic shop is unaffected by anything in here.
 *
 * Everything is in the theme's own tokens, with fallbacks, so changing the palette, the type scale
 * or the radius scale in theme.json moves this with it instead of leaving it behind.
 *
 * The layout is driven by a container query, not the viewport: this sits in the product summary
 * column, whose width has nothing to do with the width of the screen.
 */

.qv-accessories {
	container-type: inline-size;
	margin-block: 0.5em;
}

/* The page's own field-label style, the one "Tamanho (L x A)" uses, because that is what this is:
   a label over a field. Both were bumped together in the theme, so if that one moves again this
   follows it. It was accent teal and bold, which competed with the product title. */
.qv-accessories__label {
	margin: 0 0 0.6em;
	color: var( --wp--preset--color--theme-4, #3a3a38 );
	font-size: var( --wp--preset--font-size--medium, 1.09rem );
	font-weight: 600;
}

.qv-accessories__group + .qv-accessories__group {
	margin-top: 1.1em;
}

.qv-accessories__group-title {
	margin: 0 0 0.4em;
	font-size: var( --wp--preset--font-size--small, 0.96rem );
	font-weight: 500;
}

.qv-accessories__items {
	display: grid;
	grid-template-columns: minmax( 0, 1fr );
	gap: 0.5em 1em;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Two columns once the column itself is wide enough, whatever the viewport is doing. */
@container ( min-width: 520px ) {
	.qv-accessories__items {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

.qv-accessories__item {
	display: grid;
	grid-template-columns: auto auto minmax( 0, 1fr );
	align-items: start;
	gap: 0.55em;
	padding-block: 0.3em;
}

.qv-accessories__check {
	margin: 0;
	/* Onto the first line of the name rather than the top of the box. */
	margin-top: 0.15em;
}

/* Name over price, tight against each other: they are one thing being read, not two. */
.qv-accessories__body {
	display: grid;
	min-width: 0;
	row-gap: 0;
}

/* The thumbnail and the name are both <label>s, which puts them in reach of WooCommerce's own
   .woocommerce-page label { margin-bottom: 0.7em }. That carries a class and an element, so it
   outranks a single class of ours and has to be undone explicitly rather than merely restated:
   without this the name sits 0.7em off its price instead of the 0.25em set below. */
.qv-accessories .qv-accessories__item label {
	margin-bottom: 0;
}

.qv-accessories__name {
	font-size: var( --wp--preset--font-size--small, 0.96rem );
	line-height: 1.25;
	cursor: pointer;
}

.qv-accessories .qv-accessories__item .qv-accessories__name {
	margin-bottom: 0.25em;
}

/* The product's own price block, directly above this on the page, puts the amount without VAT on
   one line and the amount with VAT quieter underneath. Same thing here, so the page reads
   consistently instead of inventing a second way of saying it. Smaller and lighter than the name,
   because the name is what is being chosen. */
.qv-accessories__price {
	color: var( --wp--preset--color--theme-4, #3a3a38 );
	font-size: 0.78em;
	line-height: 1.35;
	opacity: 0.9;
}

/* The whole VAT line smaller again, and one size throughout. Modules/Price marks it up as
   <small class="has-small-font-size">14,39 € <small>com IVA</small></small>, so without this the
   amount and its suffix are set at two different sizes and neither is smaller than the line above.
   !important because WordPress emits .has-small-font-size carrying !important of its own. */
.qv-accessories__price .qv_price_with_vat {
	display: block;
	font-size: 0.88em !important;
	opacity: 0.85;
}

.qv-accessories__price .qv_price_with_vat small {
	font-size: inherit;
}

.qv-accessories__thumb {
	display: block;
	position: relative;
	width: 40px;
	height: 40px;
	cursor: pointer;
}

.qv-accessories__thumb img {
	display: block;
	width: 40px;
	height: 40px;
	max-width: none;
	object-fit: contain;
	background: #fff;
	border: 1px solid var( --wp--preset--color--theme-6, rgba( 17, 17, 17, 0.15 ) );
	border-radius: var( --wp--custom--radius--small, 4px );
}

/* Hovering the image, and only the image, lifts it out of the flow and grows it. The 40px slot is
   left behind, so nothing below it moves. With no link out to the product any more, this is what
   answers "what is it" without leaving the page. Not :focus-within: that fired on the checkbox and
   the label, which makes no sense, and the 40px thumbnail is always visible anyway. */
@media ( hover: hover ) {
	.qv-accessories__thumb:hover img {
		position: absolute;
		z-index: 100;
		top: 50%;
		left: 0;
		width: 180px;
		height: 180px;
		max-height: none;
		margin-top: -90px;
		padding: 8px;
		border: 0;
		border-radius: var( --wp--custom--radius--medium, 6px );
		box-shadow: 0 2px 14px rgba( 0, 0, 0, 0.22 );
	}
}
