/*
Theme Name: SwissDelight Child
Theme URI: https://swissdelight.qodeinteractive.com
Description: A child theme of SwissDelight
Author: Elated Themes
Author URI: https://qodeinteractive.com
Version: 1.0.0
Text Domain: swissdelight
Template: swissdelight
*/

/* Pagina prodotto: la regola del tema parent
     #qodef-woo-page.qodef--single .woocommerce-product-gallery.woocommerce-product-gallery--columns-4 .woocommerce-product-gallery__image { width: 25%; }
   applica 25% anche alla foto principale (e tutti i prodotti del catalogo ne
   hanno una sola), facendola apparire come una thumb 200x200. Riportiamo il
   comportamento standard WooCommerce: 100% sulla prima foto, 25% sulle
   eventuali successive. Specificita' alzata per superare la regola parent. */
#qodef-woo-page.qodef--single .woocommerce-product-gallery.woocommerce-product-gallery--columns-4 .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child {
	width: 100% !important;
	float: none !important;
	clear: both !important;
}
#qodef-woo-page.qodef--single .woocommerce-product-gallery.woocommerce-product-gallery--columns-4 .woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image:first-child img {
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
}

/* Header: bandiera WPML attaccata al testo lingua + bottone Shop con margin
   negativo che lo sovrapponeva al successivo "Accedi". Fix di spaziatura.
   Selettori coprono sia l'header non-sticky (header / .qodef-page-header) sia
   l'header sticky (.qodef-header-sticky) che è un DOM separato renderizzato
   dal template inc/header/scroll-appearance/sticky/templates/sticky.php */
header .wpml-ls-flag,
.qodef-page-header .wpml-ls-flag,
.qodef-header-sticky .wpml-ls-flag {
	margin-right: 8px !important;
	vertical-align: middle;
}
header .widget_swissdelight_core_button .qodef-button,
.qodef-page-header .widget_swissdelight_core_button .qodef-button,
.qodef-header-sticky .widget_swissdelight_core_button .qodef-button {
	margin-right: 14px !important;
}
/* Spaziatura tra i singoli elementi della widget area destra dell'header
   (Shop / Accedi / Carrello / hamburger): il tema parent li attacca, lasciamo
   un gap leggibile. */
header .qodef-header-widget-areas > .widget,
header .qodef-header-widget-area-one > .widget,
header .qodef-header-widget-area-two > .widget,
.qodef-page-header .qodef-header-widget-areas > .widget,
.qodef-header-sticky .qodef-header-widget-areas > .widget,
.qodef-header-sticky [id^="qodef-sticky-header-widget-area"] > .widget {
	margin-right: 16px;
}
header .qodef-header-widget-areas > .widget:last-child,
.qodef-page-header .qodef-header-widget-areas > .widget:last-child,
.qodef-header-sticky .qodef-header-widget-areas > .widget:last-child,
.qodef-header-sticky [id^="qodef-sticky-header-widget-area"] > .widget:last-child {
	margin-right: 0;
}
/* Aggiungo aria al pulsante Accedi che era senza padding laterale */
header .qodef-login-opener,
.qodef-page-header .qodef-login-opener,
.qodef-header-sticky .qodef-login-opener {
	padding: 0 4px;
}
/* Nascondi l'avatar cerchio dell'opener login (è uno SVG decorativo, non porta info utili
   perché non c'è un'avatar utente reale per ora). Il tema parent crea il cerchio
   anche via pseudo-elemento ::after; nascondiamo entrambi. */
header .qodef-login-opener .qodef-m-svg-icon,
.qodef-page-header .qodef-login-opener .qodef-m-svg-icon,
.qodef-header-sticky .qodef-login-opener .qodef-m-svg-icon {
	display: none !important;
}
header .qodef-login-opener::before,
header .qodef-login-opener::after,
.qodef-page-header .qodef-login-opener::before,
.qodef-page-header .qodef-login-opener::after,
.qodef-header-sticky .qodef-login-opener::before,
.qodef-header-sticky .qodef-login-opener::after {
	display: none !important;
	content: none !important;
}

/* CARRELLO: sostituiamo la scritta "Carrello" con un'icona shopping-bag.
   Manteniamo il badge contatore (numero + cerchio). */
header .qodef-woo-dropdown-cart-inner .qodef-m-opener .qodef-m-opener-label,
.qodef-page-header .qodef-woo-dropdown-cart-inner .qodef-m-opener .qodef-m-opener-label,
.qodef-header-sticky .qodef-woo-dropdown-cart-inner .qodef-m-opener .qodef-m-opener-label {
	display: none !important;
}
header .qodef-woo-dropdown-cart-inner .qodef-m-opener,
.qodef-page-header .qodef-woo-dropdown-cart-inner .qodef-m-opener,
.qodef-header-sticky .qodef-woo-dropdown-cart-inner .qodef-m-opener {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0;
}
header .qodef-woo-dropdown-cart-inner .qodef-m-opener::before,
.qodef-page-header .qodef-woo-dropdown-cart-inner .qodef-m-opener::before,
.qodef-header-sticky .qodef-woo-dropdown-cart-inner .qodef-m-opener::before {
	content: '';
	display: inline-block;
	width: 22px;
	height: 22px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6L18 2z'/%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") no-repeat center / contain;
	        mask: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6L18 2z'/%3E%3Cline x1='3' y1='6' x2='21' y2='6'/%3E%3Cpath d='M16 10a4 4 0 0 1-8 0'/%3E%3C/svg%3E") no-repeat center / contain;
	flex: 0 0 auto;
}

/* Sezione "Ricette" sulla home: l'immagine di sfondo (ricetta_artigiana.jpg)
   compete con i testi e li rende poco leggibili. Inseriamo un gradient seppia
   semitrasparente tra il background e il contenuto via pseudo-elemento ::before.
   La classe `art-recipe-section` è applicata via Elementor data sulle 5 home
   tradotte (vedi tools/tag-recipe-section.php). */
.art-recipe-section {
	position: relative;
}
.art-recipe-section > .elementor-container,
.art-recipe-section > .elementor-background-overlay {
	position: relative;
	z-index: 2;
}

/* Lista articoli custom ([artigiana_post_list]) + override per le pagine
   archivio categoria del blog: layout immagine-sinistra + testo-destra su
   desktop, immagine-sopra + testo-sotto su mobile. */
.art-post-list {
	display: flex;
	flex-direction: column;
	gap: 36px;
	margin: 0 0 40px;
}
.art-post-list__item {
	display: grid;
	grid-template-columns: 1fr;
	gap: 18px;
	padding-bottom: 30px;
	border-bottom: 1px solid rgba(28, 18, 12, 0.08);
}
.art-post-list__item:last-child {
	border-bottom: 0;
}
.art-post-list__media {
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow: hidden;
	border-radius: 4px;
	background: #fff;
	aspect-ratio: 1 / 1;
}
.art-post-list__media img,
.art-post-list__img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: center top;
	display: block;
	transition: transform 600ms ease;
}
.art-post-list__media:hover img,
.art-post-list__media:hover .art-post-list__img {
	transform: scale(1.04);
}
.art-post-list__body {
	display: flex;
	flex-direction: column;
}
.art-post-list__meta {
	margin: 0 0 8px;
	font-size: 12px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba(28, 18, 12, 0.6);
}
.art-post-list__meta a {
	color: inherit;
	text-decoration: none;
}
.art-post-list__meta a:hover {
	color: #1c120c;
}
.art-post-list__sep {
	margin: 0 6px;
	color: rgba(28, 18, 12, 0.3);
}
.art-post-list__title {
	margin: 0 0 12px;
	font-size: clamp(20px, 2vw, 28px);
	line-height: 1.25;
	font-weight: 600;
}
.art-post-list__title a {
	color: #1c120c;
	text-decoration: none;
}
.art-post-list__title a:hover {
	text-decoration: underline;
}
.art-post-list__excerpt {
	color: rgba(28, 18, 12, 0.78);
	font-size: 15px;
	line-height: 1.6;
	margin: 0 0 14px;
}
.art-post-list__excerpt p { margin: 0; }
.art-post-list__readmore {
	margin: auto 0 0;
}
.art-post-list__readmore a {
	display: inline-block;
	font-size: 13px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	color: #1c120c;
	border-bottom: 1px solid #1c120c;
	padding-bottom: 2px;
	transition: opacity 150ms;
}
.art-post-list__readmore a:hover {
	opacity: 0.7;
}

/* Desktop (≥769px): immagine a sinistra (220px), testo a destra */
@media (min-width: 769px) {
	.art-post-list__item {
		grid-template-columns: 280px 1fr;
		gap: 28px;
		align-items: start;
	}
	.art-post-list__media {
		aspect-ratio: 1 / 1;
	}
}

/* Override del blog list del tema Qode (archivio categoria news / ricette /
   blog index). Solo desktop ≥769px: cambia layout da "immagine sopra + testo
   sotto" a "immagine sx 280px + testo dx". Mobile resta invariato. */
@media (min-width: 769px) {
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-inner {
		display: grid !important;
		grid-template-columns: 280px 1fr;
		gap: 28px;
		align-items: start;
	}
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media,
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media-image {
		width: 100% !important;
		height: 100% !important;
		margin: 0 !important;
		aspect-ratio: 1 / 1;
		overflow: hidden;
		background: #fff !important;
		display: flex !important;
		align-items: flex-start !important;
		justify-content: center !important;
	}
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media img,
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media-image img {
		width: auto !important;
		height: auto !important;
		max-width: 100% !important;
		max-height: 100% !important;
		object-fit: contain !important;
		object-position: center top !important;
	}
	/* Cattura anche eventuali <a> wrapper della thumbnail */
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media a,
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-media-image a {
		display: flex !important;
		align-items: flex-start !important;
		justify-content: center !important;
		width: 100% !important;
		height: 100% !important;
	}
	.qodef-blog.qodef--list .qodef-blog-item .qodef-e-content {
		margin: 0 !important;
		padding: 0 !important;
	}
	/* Articoli senza thumbnail: il template Qode omette `.qodef-e-media`
	   in quel caso. Diamo al .qodef-e-content tutta la larghezza. */
	.qodef-blog.qodef--list .qodef-blog-item:not(.has-post-thumbnail) .qodef-e-inner {
		grid-template-columns: 1fr;
	}
}

/* Breadcrumb compatto al posto del banner "Shop" sulle pagine prodotto/shop/categoria.
   Il banner originale era 168px con un piccolo "Shop" 15px allineato a sinistra. */
.qodef-page-title:has(.art-breadcrumb) {
	min-height: 0 !important;
	height: auto !important;
	padding: 14px 0 !important;
	background: #fafaf6 !important;
	border-bottom: 1px solid rgba(28, 18, 12, 0.08);
}
.qodef-page-title:has(.art-breadcrumb) .qodef-m-inner {
	padding: 0 !important;
}
.art-breadcrumb-bar {
	display: flex;
	align-items: center;
	min-height: 32px;
}
.art-breadcrumb {
	font-size: 14px;
	line-height: 1.6;
	color: #1c120c;
}
.art-breadcrumb a {
	color: rgba(28, 18, 12, 0.65);
	text-decoration: none;
	transition: color 150ms;
}
.art-breadcrumb a:hover,
.art-breadcrumb a:focus-visible {
	color: #1c120c;
	text-decoration: underline;
}
.art-breadcrumb [aria-current="page"] {
	color: #1c120c;
	font-weight: 600;
}
.art-breadcrumb .art-bc-sep {
	display: inline-block;
	margin: 0 8px;
	color: rgba(28, 18, 12, 0.35);
	font-size: 12px;
}
@media (max-width: 640px) {
	.art-breadcrumb { font-size: 12px; }
	.art-breadcrumb .art-bc-sep { margin: 0 5px; }
	.qodef-page-title:has(.art-breadcrumb) { padding: 10px 0 !important; }
}

.art-recipe-section::before {
	content: '';
	position: absolute;
	inset: 0;
	/* Gradient chiaro orizzontale: crema avorio quasi pieno a sinistra (dove i
	   testi devono essere leggibili) che fade a trasparente verso destra
	   (dove l'immagine del prodotto resta visibile). */
	background: linear-gradient(
		90deg,
		rgba(245, 233, 208, 0.92) 0%,
		rgba(245, 233, 208, 0.80) 25%,
		rgba(245, 233, 208, 0.45) 55%,
		rgba(245, 233, 208, 0) 90%
	);
	z-index: 1;
	pointer-events: none;
}

/* Mobile (≤768px): la section è più stretta, l'immagine del prodotto è a
   destra e schiaccia i testi. Aumentiamo l'altezza, centriamo i testi e
   cambiamo il gradient in verticale (alto opaco → basso trasparente) per
   coprire l'area dei testi indipendentemente da dove sta il prodotto. */
@media (max-width: 768px) {
	.art-recipe-section {
		min-height: 600px;
		padding-top: 80px !important;
		padding-bottom: 80px !important;
		background-position: center bottom !important;
	}
	.art-recipe-section::before {
		background: linear-gradient(
			180deg,
			rgba(245, 233, 208, 0.95) 0%,
			rgba(245, 233, 208, 0.85) 40%,
			rgba(245, 233, 208, 0.45) 75%,
			rgba(245, 233, 208, 0) 100%
		);
	}
	.art-recipe-section .elementor-container,
	.art-recipe-section .elementor-widget-heading,
	.art-recipe-section .elementor-widget-button,
	.art-recipe-section .elementor-heading-title,
	.art-recipe-section p {
		text-align: center !important;
	}
	.art-recipe-section .elementor-widget-button .elementor-button-wrapper {
		text-align: center !important;
	}
	/* Il widget custom Qode "qodef-section-title" è inline-block + left-aligned
	   internamente: lo forziamo a block centrato. */
	.art-recipe-section .qodef-shortcode.qodef-section-title,
	.art-recipe-section .qodef-shortcode.qodef-section-title.qodef-alignment--left {
		display: block !important;
		text-align: center !important;
		width: 100% !important;
	}
	.art-recipe-section .qodef-m-tagline,
	.art-recipe-section .qodef-m-title,
	.art-recipe-section .qodef-m-subtitle {
		text-align: center !important;
		display: block !important;
	}
}

/* Card categoria home: testo bianco con ombra per leggibilità. */
.qodef-banner.qodef-layout--link-overlay .qodef-m-title,
.qodef-banner.qodef-layout--link-overlay .qodef-m-title a {
	font-weight: 600 !important;
	letter-spacing: 0.06em;
	color: #ffffff !important;
	text-shadow:
		0 2px 4px rgba(0, 0, 0, 0.75),
		0 1px 2px rgba(0, 0, 0, 0.85),
		0 0 12px rgba(0, 0, 0, 0.45);
	text-rendering: optimizeLegibility;
}
.qodef-banner.qodef-layout--link-overlay:hover .qodef-m-title {
	text-shadow:
		0 2px 6px rgba(0, 0, 0, 0.85),
		0 1px 2px rgba(0, 0, 0, 0.95),
		0 0 16px rgba(0, 0, 0, 0.55);
}

/* Page title /contatti/: titolo centrato (override qodef-alignment--left). */
body.page-id-5042 .qodef-page-title,
body.page-id-5042 .qodef-page-title .qodef-m-inner,
body.page-id-5042 .qodef-page-title .qodef-m-content,
body.page-id-5042 .qodef-page-title .qodef-m-title {
	text-align: center !important;
}
body.page-id-5042 .qodef-page-title .qodef-m-content {
	justify-content: center !important;
	align-items: center !important;
	margin-left: auto !important;
	margin-right: auto !important;
}

/* Page title /per-le-aziende/: hero con bg fixed + overlay scuro + testo centrato.
   L'overlay è ::after sul wrapper parallax (stesso stacking context dell'img,
   altri target non funzionavano per will-change/transform del wrapper). */
body.page-id-6054 .qodef-page-title {
	position: relative;
}
body.page-id-6054 .qodef-page-title .qodef-parallax-img-wrapper::after {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.60);
	pointer-events: none;
	z-index: 99;
}

/* L'img viene sostituita da background-image fixed (vedi JS in functions.php
   che imposta backgroundImage al runtime). transform/will-change spenti per
   evitare conflitto col background-attachment: fixed. */
body.page-id-6054 .qodef-page-title .qodef-parallax-img-wrapper {
	background-size: cover;
	background-position: center center;
	background-attachment: fixed;
	background-repeat: no-repeat;
	transform: none !important;
	will-change: auto !important;
	z-index: 0 !important;
}
body.page-id-6054 .qodef-page-title .qodef-parallax-img-wrapper img {
	display: none !important;
	filter: saturate(0.8) contrast(1.05);
}
body.page-id-6054 .qodef-page-title > * {
	position: relative;
	z-index: 2;
}

body.page-id-6054 .qodef-page-title,
body.page-id-6054 .qodef-page-title .qodef-m-inner,
body.page-id-6054 .qodef-page-title .qodef-m-content,
body.page-id-6054 .qodef-page-title .qodef-m-title {
	text-align: center !important;
}
body.page-id-6054 .qodef-page-title .qodef-m-content {
	justify-content: center !important;
	align-items: center !important;
	margin-left: auto !important;
	margin-right: auto !important;
}
body.page-id-6054 .qodef-page-title .qodef-m-title {
	color: #ffffff !important;
	text-shadow:
		0 2px 8px rgba(0, 0, 0, 0.85),
		0 1px 2px rgba(0, 0, 0, 0.95),
		0 0 18px rgba(0, 0, 0, 0.55) !important;
}
body.page-id-6054 .qodef-page-title .qodef-m-subtitle,
body.page-id-6054 .qodef-page-title .qodef-m-info,
body.page-id-6054 .qodef-page-title .qodef-m-content a,
body.page-id-6054 .qodef-page-title .qodef-breadcrumbs-wrap,
body.page-id-6054 .qodef-page-title .qodef-breadcrumbs-wrap * {
	color: #ffffff !important;
	text-shadow:
		0 1px 4px rgba(0, 0, 0, 0.85),
		0 0 10px rgba(0, 0, 0, 0.50) !important;
}

/* Navbar: padding laterale ridotto a 32px su desktop (default theme: 70px,
   troppo per la nostra densità di voci menu + widget destra). Limitato a
   ≥1025px per non toccare il mobile header che usa il proprio layout. */
@media (min-width: 1025px) {
	#qodef-page-header-inner,
	.qodef-header-sticky-inner {
		padding-left: 32px !important;
		padding-right: 32px !important;
	}
}

