/* ==========================================================================
   N14 theme styles
   Everything visual (colors, fonts, sizes, spacing) is set in theme.json and
   can be changed from Aspetto > Editor > Stili or per block in the sidebar.
   Rules below are wrapped in :where() (zero specificity) so any choice made
   in the editor always wins. Only layout mechanics stay at normal strength.
   Breakpoints: smartphone < 768px · tablet 768-1023px · desktop >= 1024px
   ========================================================================== */

/* ---------- Base ---------- */
html.n14-no-scroll {
	overflow: hidden;
}
:where(body) {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 2px solid var(--wp--preset--color--rose);
	outline-offset: 2px;
}
.n14-sr-only,
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* ---------- Per-device controls (set in the block sidebar) ---------- */
@media (max-width: 767.98px) {
	.n14-hide-mobile { display: none !important; }
	.n14-order-first-mobile { order: -1; }
	.n14-order-last-mobile { order: 99; }
	.n14-align-left-mobile { text-align: left; justify-content: flex-start; }
	.n14-align-center-mobile { text-align: center; justify-content: center; }
	.n14-align-right-mobile { text-align: right; justify-content: flex-end; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
	.n14-hide-tablet { display: none !important; }
	.n14-order-first-tablet { order: -1; }
	.n14-order-last-tablet { order: 99; }
	.n14-align-left-tablet { text-align: left; justify-content: flex-start; }
	.n14-align-center-tablet { text-align: center; justify-content: center; }
	.n14-align-right-tablet { text-align: right; justify-content: flex-end; }
}
@media (min-width: 1024px) {
	.n14-hide-desktop { display: none !important; }
}
.n14-editor-has-visibility {
	outline: 1px dashed var(--wp--preset--color--rose);
	outline-offset: 3px;
}

/* ---------- Header ---------- */
.n14-site-header {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 100;
}
:where(.n14-site-header) {
	background: var(--wp--preset--color--surface);
}
.n14-topbar,
.n14-header__main {
	margin-block: 0;
}
/* The main row is a normal "Riga" block: reorder, align and space its blocks from the editor. */
.n14-header__main {
	position: relative;
}
:where(.n14-header__main) {
	border-bottom: 1px solid var(--wp--preset--color--line);
}
@media (min-width: 1024px) {
	.n14-header__main > .wp-block-n14-megamenu {
		flex: 1 1 auto;
	}
}
@media (max-width: 1023.98px) {
	/* Logo stays centered: the blocks on its sides share the free space. */
	.n14-header__main > .wp-block-n14-megamenu,
	.n14-header__main > .wp-block-n14-header-actions {
		flex: 1 1 0;
	}
}

/* Wordmark shown until a logo is uploaded */
.wp-block-site-logo .n14-wordmark,
.n14-wordmark {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	line-height: 1;
	text-decoration: none;
}
:where(.n14-wordmark) {
	color: inherit;
}
:where(.n14-wordmark__small, .n14-wordmark__tag) {
	font-size: 0.5625rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
}
:where(.n14-wordmark__big) {
	font-family: var(--wp--preset--font-family--display);
	font-size: 2.75rem;
	font-weight: 500;
	letter-spacing: -0.02em;
	margin: 0.1rem 0;
}
@media (max-width: 1023.98px) {
	:where(.n14-wordmark__big) { font-size: 2rem; }
	:where(.n14-wordmark__small, .n14-wordmark__tag) { font-size: 0.5rem; }
}

/* Header icons */
.n14-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.125rem;
}
.n14-actions__btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}
:where(.n14-actions__btn:hover) {
	color: var(--wp--preset--color--rose);
}
.n14-cart-count {
	position: absolute;
	top: 5px;
	right: 3px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	font-size: 0.625rem;
	font-weight: 600;
	line-height: 1;
}
:where(.n14-cart-count) {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
}
@media (max-width: 767.98px) {
	.n14-actions__account,
	.n14-actions__wishlist {
		display: none;
	}
}
.n14-search {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 60;
	padding: 1.5rem clamp(1rem, 4vw, 3rem);
}
:where(.n14-search) {
	background: var(--wp--preset--color--surface);
	border-top: 1px solid var(--wp--preset--color--line);
	box-shadow: 0 30px 40px -30px rgba(28, 24, 24, 0.28);
}
.n14-search[hidden] {
	display: none;
}
.n14-search form {
	display: flex;
	gap: 0.5rem;
	max-width: 720px;
	margin: 0 auto;
}
:where(.n14-search input[type="search"]) {
	flex: 1;
	min-width: 0;
	height: 48px;
	padding: 0 1rem;
	border: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--base);
	font: inherit;
	color: var(--wp--preset--color--ink);
}
:where(.n14-search button[type="submit"]) {
	height: 48px;
	padding: 0 1.5rem;
	border: 0;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
}

/* ---------- Category hero (all visual settings live in the block sidebar) ---------- */
.n14-cat-hero {
	position: relative;
	display: flex;
	overflow: hidden;
	margin-block: 0;
	box-sizing: border-box;
}
.n14-cat-hero__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}
.n14-cat-hero__overlay {
	position: absolute;
	inset: 0;
	pointer-events: none;
}
.n14-cat-hero--top-left .n14-cat-hero__overlay.is-gradient,
.n14-cat-hero--center-left .n14-cat-hero__overlay.is-gradient,
.n14-cat-hero--bottom-left .n14-cat-hero__overlay.is-gradient {
	-webkit-mask-image: linear-gradient(90deg, #000 0%, #000 25%, transparent 80%);
	mask-image: linear-gradient(90deg, #000 0%, #000 25%, transparent 80%);
}
.n14-cat-hero--top-right .n14-cat-hero__overlay.is-gradient,
.n14-cat-hero--center-right .n14-cat-hero__overlay.is-gradient,
.n14-cat-hero--bottom-right .n14-cat-hero__overlay.is-gradient {
	-webkit-mask-image: linear-gradient(270deg, #000 0%, #000 25%, transparent 80%);
	mask-image: linear-gradient(270deg, #000 0%, #000 25%, transparent 80%);
}
.n14-cat-hero.has-image:not(.has-text-color) {
	color: #fff;
}
.n14-cat-hero__content {
	position: relative;
	z-index: 1;
	width: 100%;
}
.n14-cat-hero__content > * {
	color: inherit;
}
.n14-cat-hero__content > :first-child {
	margin-top: 0;
}
.n14-cat-hero__content > :last-child {
	margin-bottom: 0;
}
.n14-cat-hero--top-center .wp-block-buttons,
.n14-cat-hero--center-center .wp-block-buttons,
.n14-cat-hero--bottom-center .wp-block-buttons {
	justify-content: center;
}
.n14-cat-hero--top-right .wp-block-buttons,
.n14-cat-hero--center-right .wp-block-buttons,
.n14-cat-hero--bottom-right .wp-block-buttons {
	justify-content: flex-end;
}
@media (max-width: 767.98px) {
	.n14-cat-hero__overlay.is-gradient {
		-webkit-mask-image: none !important;
		mask-image: none !important;
	}
}

/* ---------- Shop grid ---------- */
:where(.n14-shop) {
	padding-bottom: var(--wp--preset--spacing--60);
}
:where(.n14-shop__toolbar) {
	margin-block: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}
.n14-shop__heading > * {
	margin: 0;
}
:where(.n14-shop__heading .woocommerce-result-count) {
	margin: 0.25rem 0 0;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted);
}
:where(.woocommerce-ordering select) {
	height: 44px;
	padding: 0 2.25rem 0 0.875rem;
	border: 1px solid var(--wp--preset--color--line);
	background-color: var(--wp--preset--color--surface);
	font: inherit;
	font-size: 0.875rem;
	color: var(--wp--preset--color--ink);
}
:where(.wc-block-product .wc-block-components-product-image) {
	margin-bottom: 0.875rem;
	background: var(--wp--preset--color--blush);
}
.wc-block-product .wc-block-components-product-image img {
	aspect-ratio: 1 / 1;
	object-fit: cover;
}
:where(.wc-block-product .wp-block-post-title a) {
	color: inherit;
}
.wc-block-product .wp-block-post-title a,
.n14-blog-grid .wp-block-post-title a {
	text-decoration: none;
}
:where(.wc-block-product .wc-block-components-product-price del) {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
	margin-right: 0.375rem;
}
/* Card button: outline by default (change it on the block to override). */
.wc-block-product .wp-block-button__link:not(.has-background):not(.has-text-color) {
	margin-top: 0.75rem;
	padding: 0.75rem 1.25rem;
	border: 1px solid var(--wp--preset--color--ink);
	background: transparent;
	color: var(--wp--preset--color--ink);
}
.wc-block-product .wp-block-button__link:not(.has-background):not(.has-text-color):hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
}
@media (max-width: 767.98px) {
	.wc-block-product-template.is-flex-container {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 1.5rem 0.875rem !important;
	}
	.wc-block-product-template.is-flex-container > li {
		width: auto !important;
		margin: 0 !important;
	}
	.wc-block-product .wp-block-button__link:not(.has-background):not(.has-text-color) {
		padding: 0.625rem 0.75rem;
		letter-spacing: 0.1em;
	}
}

/* ---------- Single product ---------- */
:where(.n14-product) {
	padding-block: var(--wp--preset--spacing--30) var(--wp--preset--spacing--60);
}
:where(.n14-product .woocommerce-breadcrumb) {
	font-size: 0.75rem;
	color: var(--wp--preset--color--muted);
}
:where(.n14-product .woocommerce-breadcrumb a) {
	color: inherit;
	text-decoration: none;
}
.n14-product form.cart {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.75rem;
}
:where(.n14-product form.cart .quantity input.qty) {
	width: 76px;
	height: 54px;
	border: 1px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--surface);
	font: inherit;
	text-align: center;
}
.n14-product form.cart .single_add_to_cart_button {
	flex: 1;
	min-height: 54px;
}
.n14-product form.variations_form .variations {
	width: 100%;
	margin-bottom: 1rem;
}
:where(.n14-ship-note) {
	margin: 0;
	padding: 0.75rem 1rem;
	text-align: center;
	font-size: 0.875rem;
}

/* Gallery: vertical thumbnails on desktop, horizontal row below on tablet/smartphone */
.woocommerce-product-gallery {
	position: relative;
}
.woocommerce-product-gallery .flex-control-thumbs {
	display: flex;
	gap: 0.5rem;
	margin: 0.75rem 0 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
}
.woocommerce-product-gallery .flex-control-thumbs li {
	flex: 0 0 72px;
}
.woocommerce-product-gallery .flex-control-thumbs img {
	display: block;
	width: 72px;
	height: 72px;
	object-fit: cover;
	opacity: 0.6;
	cursor: pointer;
	transition: opacity 0.2s ease;
}
.woocommerce-product-gallery .flex-control-thumbs img.flex-active,
.woocommerce-product-gallery .flex-control-thumbs img:hover {
	opacity: 1;
}
@media (min-width: 1024px) {
	.woocommerce-product-gallery:has(.flex-control-thumbs) {
		display: grid;
		grid-template-columns: 88px minmax(0, 1fr);
		gap: 1rem;
	}
	.woocommerce-product-gallery .flex-viewport,
	.woocommerce-product-gallery > .woocommerce-product-gallery__wrapper {
		grid-column: 2;
		grid-row: 1;
	}
	.woocommerce-product-gallery .flex-control-thumbs {
		grid-column: 1;
		grid-row: 1;
		flex-direction: column;
		margin: 0;
		overflow: visible;
	}
	.woocommerce-product-gallery .flex-control-thumbs li {
		flex: 0 0 auto;
	}
	.woocommerce-product-gallery .flex-control-thumbs img {
		width: 88px;
		height: 88px;
	}
	.woocommerce-product-gallery__trigger {
		z-index: 2;
	}
}

/* Tabs */
:where(.n14-product .woocommerce-tabs) {
	margin-top: var(--wp--preset--spacing--60);
}
.n14-product .woocommerce-tabs ul.tabs {
	display: flex;
	gap: 2rem;
	margin: 0 0 2rem;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	white-space: nowrap;
}
:where(.n14-product .woocommerce-tabs ul.tabs) {
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.n14-product .woocommerce-tabs ul.tabs::before,
.n14-product .woocommerce-tabs ul.tabs li::before,
.n14-product .woocommerce-tabs ul.tabs li::after {
	display: none !important;
}
.n14-product .woocommerce-tabs ul.tabs li {
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
}
:where(.n14-product .woocommerce-tabs ul.tabs li a) {
	display: block;
	padding: 0.875rem 0;
	border-bottom: 2px solid transparent;
	color: var(--wp--preset--color--muted);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
}
:where(.n14-product .woocommerce-tabs ul.tabs li.active a) {
	color: var(--wp--preset--color--ink);
	border-bottom-color: currentColor;
}

/* ---------- Trust bar ---------- */
.n14-trust.wp-block-columns {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1.25rem 1rem;
}
@media (min-width: 1024px) {
	.n14-trust.wp-block-columns {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
	.n14-trust--compact.wp-block-columns {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
.n14-trust .wp-block-column {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
}
.n14-trust .wp-block-column > * {
	margin: 0;
}
.n14-trust svg {
	flex: 0 0 auto;
	display: block;
}
:where(.n14-trust p) {
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--wp--preset--color--muted);
}
:where(.n14-trust p strong) {
	display: block;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
}

/* ---------- Blog ---------- */
.n14-blog-grid .wp-block-post-featured-image img {
	aspect-ratio: 4 / 3;
	object-fit: cover;
}
:where(.n14-blog-grid .wp-block-post-title a) {
	text-decoration: none;
}

/* ---------- Footer ---------- */
:where(.n14-footer ul.wp-block-list) {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.5rem;
}
:where(.n14-footer a) {
	color: inherit;
}
.n14-footer a {
	text-decoration: none;
}
:where(.n14-footer a:hover) {
	color: var(--wp--preset--color--rose);
}
:where(.n14-footer__claim) {
	max-width: 32ch;
	color: var(--wp--preset--color--muted);
}
:where(.n14-footer__bottom) {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--30);
	border-top: 1px solid var(--wp--preset--color--line);
	font-size: 0.75rem;
	color: var(--wp--preset--color--muted);
}
@media (max-width: 781.98px) {
	.n14-footer__cols.wp-block-columns {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 2rem 1rem;
	}
	.n14-footer__cols > .wp-block-column:first-child {
		grid-column: 1 / -1;
	}
}

/* Trust bar icons are normal Image blocks */
.n14-trust .wp-block-image {
	flex: 0 0 auto;
	margin: 0;
}
.n14-trust .wp-block-image img {
	display: block;
}

/* ---------- Single product: photos scroll on the left, details scroll on the right ---------- */
@media (min-width: 1024px) {
	.n14-product__top {
		align-items: flex-start !important;
	}
	.n14-product__summary {
		position: sticky;
		top: calc(var(--n14-header-h, 0px) + 24px);
		max-height: calc(100vh - var(--n14-header-h, 0px) - 48px);
		overflow-y: auto;
		overscroll-behavior: contain;
		scrollbar-width: thin;
		scrollbar-color: var(--wp--preset--color--line) transparent;
		padding-right: 0.5rem;
	}
	.admin-bar .n14-product__summary {
		max-height: calc(100vh - var(--n14-header-h, 0px) - 48px - var(--wp-admin--admin-bar--height, 0px));
	}
}
.n14-product__summary > * + * {
	margin-block-start: 1.25rem;
}
:where(.n14-product__summary .wc-block-components-product-price del) {
	color: var(--wp--preset--color--muted);
	font-weight: 400;
	margin-right: 0.5rem;
}
:where(.n14-product__summary .wc-block-components-product-price ins) {
	text-decoration: none;
	color: var(--wp--preset--color--rose);
}
.n14-product__summary .onsale,
.n14-product .wc-block-components-product-sale-badge {
	display: none;
}
:where(.n14-product__related, .n14-product__reviews) {
	border-top: 1px solid var(--wp--preset--color--line);
	margin-top: var(--wp--preset--spacing--60);
}
