/*
 * Mobiliário Urbano Musical (the instruments)
 *   mc-instruments, __item, __link, __image,
 *   __label, __name, __plus,
 *   __filter, __filter-name, __filter-all      grid of the page: shortcode [mc-instruments] (grid.php)
 *   mc-instrument, __categories, __category,
 *   __icons, __buttons                         details of the product page of an instrument (product.php)
 */

/* ------------------------------------------------------------------ grid of the page */

/* The squares get their height from their width. On phones Elementor wraps its column containers, and in a
   wrapping column the width of a widget is not known yet when its height is worked out: without a width of its
   own, the widget of the grid would count as empty and the section after it would cover the squares. */
.mc-embed:has(.mc-instruments) {
	width: 100%;
}

/* one category only (?categoria-musical=): its name above the grid, and the way back to all the instruments */
.mc-instruments__filter {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 24px;
	margin: 0 0 clamp(16px, 1.25vw, 24px);
	color: var(--mc-black);
	font: 500 clamp(16px, 1.198vw, 23px)/1.22 var(--mc-font);
}

.mc-instruments__filter-name {
	font-weight: 600;
}

.mc-instruments__filter-all {
	color: inherit;
	font-size: clamp(14px, .938vw, 18px);
	text-decoration: underline;
	text-underline-offset: .2em;
}

.mc-instruments__filter-all:hover {
	color: inherit;
	opacity: .7;
}

/* Figma: three columns of 409px squares, 16px apart. ul.: the theme's ul:not(.wp-block) margin.
   scroll-margin: the links to one category land on the grid, under the header and with the category in view */
ul.mc-instruments {
	scroll-margin-top: calc(var(--mc-header-h, 98px) + 80px);
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(8px, .833vw, 16px);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mc-instruments__item {
	margin: 0;
	padding: 0;
}

/* grey while the instrument has no image */
.mc-instruments__link {
	position: relative;
	display: block;
	overflow: hidden;
	aspect-ratio: 1;
	background: #d9d9d9;
	color: var(--mc-black);
	text-decoration: none;
}

.mc-instruments__link:hover {
	color: var(--mc-black);
}

.mc-instruments__image {
	position: absolute;
	inset: 0;
}

.mc-instruments__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* on hover: a white square 42px inside the 409px one, the name in the middle, a "+" in the corner */
.mc-instruments__label {
	position: absolute;
	inset: 10.27%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 12%;
	background: var(--mc-white);
	opacity: 0;
	transition: opacity .3s;
}

.mc-instruments__link:hover .mc-instruments__label,
.mc-instruments__link:focus-visible .mc-instruments__label {
	opacity: 1;
}

.mc-instruments__link:focus-visible {
	outline: 1px solid var(--mc-black);
	outline-offset: 3px;
}

.mc-instruments__name {
	font: 500 clamp(13px, .938vw, 18px)/1.22 var(--mc-font);
	text-align: center;
	text-transform: uppercase;
}

.mc-instruments__plus {
	position: absolute;
	top: 8%;
	right: 10.8%;
	width: clamp(14px, 1.146vw, 22px);
	height: auto;
	fill: currentColor;
}

/* no hover (touch): the name stays visible, on a white band at the bottom of the square */
@media (hover: none) {
	.mc-instruments__label {
		inset: auto 0 0;
		padding: 8px 10px;
		opacity: 1;
	}

	.mc-instruments__name {
		font-size: 12px;
	}

	.mc-instruments__plus {
		display: none;
	}
}

@media (max-width: 767px) {
	ul.mc-instruments {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* phones: one instrument per row, in the 3:2 of the photos (a square would crop them and make the page longer) */
@media (max-width: 480px) {
	ul.mc-instruments {
		grid-template-columns: 1fr;
	}

	.mc-instruments__link {
		aspect-ratio: 3 / 2;
	}

	.mc-instruments__name {
		font-size: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mc-instruments__label {
		transition: none;
	}
}

/* ------------------------------------------------------------------ product page of an instrument */

/* The Figma page is the current product page at 90%: its 24px title is 26px here, and its 83x95 hexagons
   (pointing up) are the client's 105x91 ones (flat on top). */
.mc-instrument__categories {
	margin-top: 46px;
	padding-bottom: 12px;
}

.mc-instrument__category {
	margin: 0 0 22px;
	color: var(--mc-black);
	font: 600 26px/1.22 var(--mc-font);
}

/* #microcubo-single-product-content ul styles every list of the details: this one is not a text list */
#microcubo-single-product-content ul.mc-instrument__icons {
	display: flex;
	flex-wrap: wrap;
	gap: 16px 28px;
	margin: 0;
	padding: 0 0 0 24px; /* in line with the text of the materials list */
	list-style: none;
}

.mc-instrument__icons li {
	margin: 0;
	padding: 0;
}

.mc-instrument__icons img {
	display: block;
	width: 105px;
	height: auto;
}

/* the buttons come after the note here (before it on the other products): "Ver Fixação", then one per category */
.mc-instrument__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 53px;
}

/* the kit's 20px under every widget: the gap already spaces the buttons */
.mc-instrument__buttons .elementor-widget {
	margin-bottom: 0;
}

@media (max-width: 767px) {
	.mc-instrument__category {
		font-size: 22px;
	}

	.mc-instrument__icons img {
		width: 88px;
	}
}
