/*
Theme Name: Maestro Riverso Child
Theme URI: https://orologio.okthemes.com/
Author: Maestro Riverso
Author URI: https://www.okthemes.com/
Description: Child theme for Orologio with Maestro Riverso customizations.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: maestro-riverso-child
Template: orologio
Tags: e-commerce, custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
Requires at least: 5.0
Tested up to: 6.5
Requires PHP: 7.4
*/

/* =Theme customization starts here
-------------------------------------------------------------- */

/* Woo filters: parent row arrow + subcategory indentation */
.filter-section-categories .category-level {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.filter-section-categories .category-level .category-level {
	margin-left: 18px;
	padding-left: 10px;
	border-left: 1px solid var(--orologio-primary-color);
}

.filter-section-categories .category-item {
	width: 100%;
}

.filter-section-categories .category-group-summary {
	display: flex;
	align-items: center;
	cursor: pointer;
	list-style: none;
}

.filter-section-categories .category-group-summary::-webkit-details-marker {
	display: none;
}

.filter-section-categories .category-group-summary::marker {
	content: "";
}

.filter-section-categories .category-group-summary .category-item {
	flex: 1 1 auto;
}

.filter-section-categories .category-group-summary::after {
	content: "";
	width: 8px;
	height: 8px;
	margin-left: 10px;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.filter-section-categories .category-group[open] > .category-group-summary::after {
	transform: rotate(135deg);
}

.filter-section-categories .category-parent-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}

.filter-section-categories .category-parent-row .category-item {
	flex: none;
	width: auto;
}

.filter-section-categories .category-parent-row .category-parent-link,
.filter-section-categories .category-parent-row .category-item-label {
	display: inline-flex;
	align-items: center;
}

/* Nested scroll wrappers for long filter lists */
.filter-section-scroll {
	min-height: 0;
	max-height: none;
	height: auto;
	overflow: visible;
	padding-right: 0;
}

.filter-section-scroll.is-scrollable {
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
	touch-action: pan-y;
	padding-right: 6px;
}

.filter-section-categories-scroll > .category-level {
	min-width: 0;
}

/* Subcategory navigational links (orthogonal facets: subs are links, not checkboxes) */
.filter-section-categories .category-sublink-item {
	width: 100%;
}

.filter-section-categories .category-sublink {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}

.filter-section-categories .category-sublink:hover,
.filter-section-categories .category-item.is-current > .category-sublink {
	text-decoration: underline;
}

.filter-actions #toggle-filters {
	gap: 8px;
}

.filter-actions #toggle-filters::after {
	content: "";
	width: 8px;
	height: 8px;
	margin-left: 2px;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(var(--maestro-filter-toggle-rotation, 45deg));
	transform-origin: 50% 50%;
	transition: transform 0.2s ease;
	flex: 0 0 auto;
}

.site-subheader .page-meta .page-meta-wrapper--category {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 20px;
	width: 100%;
	max-width: none;
	text-align: left;
}

.site-subheader .page-meta .page-meta-wrapper--category .page-meta-copy,
.site-subheader .page-meta .page-meta-wrapper--category .page-meta-media {
	width: 100%;
	max-width: none;
	min-width: 0;
	text-align: left;
}

.site-subheader .page-meta .page-meta-wrapper--category .page-meta-copy {
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

.site-subheader .page-meta .page-meta-wrapper--category h1,
.site-subheader .page-meta .page-meta-wrapper--category .page-header-toptitle,
.site-subheader .page-meta .page-meta-wrapper--category .header-page-description,
.site-subheader .page-meta .page-meta-wrapper--category .header-page-description p {
	width: 100%;
	max-width: none;
	margin-left: 0;
	margin-right: 0;
	text-align: left;
}

.site-subheader .page-meta .page-meta-wrapper--category h1 {
	word-break: normal;
	overflow-wrap: anywhere;
	text-align: center;
}

.site-subheader .page-meta .page-meta-wrapper--category .page-header-toptitle {
	text-align: center;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-accordion {
	width: 100%;
	text-align: center;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 4px;
	margin-left: auto;
	margin-right: auto;
	cursor: pointer;
	list-style: none;
	font-weight: 500;
	text-align: center;
	background: transparent;
	padding: 0;
	border: 0;
	color: var(--orologio-primary-color);
	text-transform: uppercase;
	letter-spacing: 2px;
	font-family: var(--orologio-primary-font);
	font-size: 0.857rem;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-toggle::-webkit-details-marker {
	display: none;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-toggle::marker {
	content: "";
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-toggle::after {
	content: "";
	width: 8px;
	height: 8px;
	margin-left: 2px;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	flex: 0 0 auto;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-accordion[open] .header-page-description-toggle::after {
	transform: rotate(225deg);
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-toggle-label--less,
.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-accordion[open] .header-page-description-toggle-label--more {
	display: none;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description-accordion[open] .header-page-description-toggle-label--less {
	display: inline;
}

.site-subheader .page-meta .page-meta-wrapper--category .header-page-description--accordion {
	padding-top: 12px;
}

.site-subheader .page-meta .page-meta-wrapper--category .page-header-category-image {
	margin-top: 0;
	width: 100%;
	text-align: left;
}

.site-subheader .page-meta .page-meta-wrapper--category .page-header-category-image img {
	display: block;
	width: 100%;
	max-width: 100%;
	max-height: 350px;
	height: auto;
	object-fit: contain;
	margin: 0;
}

/* WhatsApp shortcut mirrored from the go-top control */
.whatsapp_icon {
	position: fixed;
	left: 0;
	bottom: 0;
	z-index: 100;
	-webkit-transform: translate(calc(var(--orologio-layout-padding) * -1), 0);
	transform: translate(calc(var(--orologio-layout-padding) * -1), 0);
	-webkit-transition: .3s ease all;
	transition: .3s ease all;
	display: block;
}

.whatsapp_icon a {
	height: 60px;
	width: calc(var(--orologio-layout-padding) - 1px);
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	-ms-flex-align: center;
	align-items: center;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	justify-content: center;
	background: #25d366;
	text-decoration: none;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.whatsapp_icon i {
	color: #ffffff;
	font-size: 30px;
	line-height: 1;
}

@media (min-width: 2400px) {
	.whatsapp_icon a {
		height: 100px;
	}
}

.is-scrolled .whatsapp_icon {
	-webkit-transform: translate(0, 0);
	transform: translate(0, 0);
}

/* =Shop layout: filters sidebar + 2-column products (desktop), accordion (mobile)
-------------------------------------------------------------- */

/* Mobile / tablet (< 992px): single column, sidebar stacks on top, accordion stays. */
.shop-layout {
	display: block;
}

/* Griglia shop (categorie, sottocategorie, prodotti): 2 colonne mobile/tablet, 3 desktop.
   !important perché il CSS WooCommerce/tema carica dopo il child e sovrascrive. */
body.woocommerce .site-content ul.products {
	display: grid !important;
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	grid-column-gap: 1em !important;
	column-gap: 1em !important;
}

body.woocommerce .site-content ul.products::before,
body.woocommerce .site-content ul.products::after {
	display: none !important;
}

body.woocommerce .site-content ul.products > li.product {
	width: 100% !important;
	max-width: none !important;
	float: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	clear: none !important;
}

/* Titolo card: 1.1rem mobile/tablet, 1.8rem desktop */
body.woocommerce .site-content ul.products li.product .woocommerce-loop-product__title,
body.woocommerce .site-content ul.products li.product-category .product-category-wrap h2,
body.woocommerce .site-content ul.products li.product .woocommerce-loop-category__title {
	font-size: 1.1rem !important;
}

@media (min-width: 768px) {
	body.woocommerce .site-content ul.products {
		grid-column-gap: 1.5em !important;
		column-gap: 1.5em !important;
	}
}

@media (min-width: 992px) {
	body.woocommerce .site-content ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		grid-column-gap: 3em !important;
		column-gap: 3em !important;
	}

	body.woocommerce .site-content ul.products li.product .woocommerce-loop-product__title,
	body.woocommerce .site-content ul.products li.product-category .product-category-wrap h2,
	body.woocommerce .site-content ul.products li.product .woocommerce-loop-category__title {
		font-size: 1.8rem !important;
	}
}

@media (min-width: 992px) {
	/* Two-column grid: fixed sidebar + fluid products area. */
	.site-content .shop-layout {
		display: grid;
		grid-template-columns: 260px minmax(0, 1fr);
		grid-column-gap: 40px;
		align-items: start;
	}

	.site-content .shop-sidebar {
		position: -webkit-sticky;
		position: sticky;
		top: 120px; /* sotto l'header sticky; regola se serve */
		align-self: start;
		/* Area di scroll propria: la rotella sui filtri scrolla i filtri, non i prodotti. */
		max-height: calc(100vh - 140px);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* La sidebar scrolla come un blocco unico: annulla lo scroll interno per-sezione
	   (usato solo nell'accordion mobile). Vince sugli inline-style del guard JS del tema. */
	.site-content .shop-sidebar .filter-section-scroll {
		max-height: none !important;
		height: auto !important;
		overflow: visible !important;
	}

	.site-content .shop-main {
		min-width: 0; /* evita overflow della griglia prodotti */
	}

	/* Filtri sempre visibili nella sidebar: annulla l'accordion del parent. */
	.site-content .shop-sidebar .filters-container {
		max-height: none;
		overflow: visible;
		flex-direction: column;
		gap: 24px;
		margin-bottom: 0;
	}

	.site-content .shop-sidebar .filters-container.open {
		max-height: none;
		margin-bottom: 0;
	}

	.site-content .shop-sidebar .filters-container .filter-section {
		width: auto;
		padding: 20px;
	}

	/* Niente pulsante accordion da desktop; pill attive + reset restano in colonna. */
	.site-content .shop-sidebar #toggle-filters {
		display: none;
	}

	.site-content .shop-sidebar .filter-actions {
		flex-direction: column;
		align-items: stretch;
		margin-bottom: 20px;
	}
}

/* =Category tiles: thumbnail sempre quadrate nello shop
-------------------------------------------------------------- */
.site-content ul.products li.product-category a img,
.site-content ul.products li.product-category .product-category-wrap img,
.site-content ul.products li.product-category img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	object-position: center;
}
