/* ==========================================================================
   N14 Shop bar, sheets, cart popup, assistance
   Bar: smartphone + tablet (< 1024px). Popup and assistance: everywhere.
   ========================================================================== */
.n14-shop {
	--n14-bar-h: 64px;
	--n14-safe: env(safe-area-inset-bottom, 0px);
}

/* ---------- Bottom bar ---------- */
.n14-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 970;
	display: none;
	align-items: center;
	gap: 2px;
	padding: 6px 10px calc(6px + var(--n14-safe));
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	border-top: 1px solid var(--wp--preset--color--line);
	box-shadow: 0 -10px 24px -18px rgba(28, 24, 24, 0.4);
	transition: transform 0.25s ease;
}
.n14-bar__item {
	position: relative;
	flex: 1 1 0;
	min-width: 0;
	height: 52px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: inherit;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	font: inherit;
	font-size: 0.6875rem;
	font-weight: 500;
	letter-spacing: 0.02em;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.n14-bar__item.is-active,
.n14-bar__item[aria-expanded="true"] {
	color: var(--wp--preset--color--rose);
}
.n14-bar__count {
	position: absolute;
	top: 4px;
	left: calc(50% + 4px);
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	box-sizing: border-box;
	border-radius: 8px;
	background: var(--wp--preset--color--rose);
	color: #fff;
	font-size: 0.625rem;
	font-weight: 600;
	line-height: 16px;
	text-align: center;
}
.n14-bar__count[hidden] {
	display: none;
}
.n14-bar__total {
	white-space: nowrap;
}
.n14-bar__cta {
	flex: 0 0 auto;
	max-width: 52%;
	min-width: 0;
	height: 48px;
	margin-left: 4px;
	padding: 0 1.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface) !important;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	border-radius: 2px;
}
.n14-bar__cta.is-busy {
	opacity: 0.7;
}
@media (max-width: 1023.98px) {
	.n14-bar {
		display: flex;
	}
	html.has-n14-bar body {
		padding-bottom: calc(var(--n14-bar-h) + env(safe-area-inset-bottom, 0px));
	}
	html.n14-typing .n14-bar {
		transform: translateY(110%);
	}
	.n14-assist-fab {
		display: none !important;
	}
}

/* ---------- Assistance button (desktop) ---------- */
.n14-assist-fab {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 960;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	height: 42px;
	padding: 0 1.125rem 0 0.875rem;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
	box-shadow: 0 12px 24px -12px rgba(28, 24, 24, 0.55);
	font: inherit;
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}
.n14-assist-fab[aria-expanded="true"] {
	background: var(--wp--preset--color--rose);
}

/* ---------- Scrim + sheets ---------- */
.n14-scrim {
	position: fixed;
	inset: 0;
	z-index: 950;
	background: rgba(28, 24, 24, 0.42);
	opacity: 0;
	transition: opacity 0.3s ease;
}
.n14-scrim.is-open {
	opacity: 1;
}
.n14-scrim[hidden],
.n14-sheet[hidden] {
	display: none;
}
.n14-sheet {
	position: fixed;
	left: 0;
	right: 0;
	will-change: transform;
	bottom: calc(var(--n14-bar-h) + var(--n14-safe));
	z-index: 960;
	max-height: calc(100dvh - var(--n14-bar-h) - var(--n14-safe) - 64px);
	display: flex;
	flex-direction: column;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -20px 40px -20px rgba(28, 24, 24, 0.5);
	transform: translateY(24px);
	opacity: 0;
	transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.25s ease;
}
.n14-sheet.is-open {
	transform: none;
	opacity: 1;
}
.n14-sheet__grip {
	position: relative;
	flex: 0 0 auto;
	height: 22px;
	cursor: grab;
	touch-action: none;
}
.n14-sheet__grip::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 9px;
	width: 44px;
	height: 5px;
	margin-left: -22px;
	border-radius: 3px;
	background: var(--wp--preset--color--line);
	transition: background-color 0.2s ease, width 0.2s ease;
}
.n14-sheet.is-dragging .n14-sheet__grip::before {
	background: var(--wp--preset--color--muted);
}
.n14-sheet__head {
	touch-action: none;
}
.n14-sheet.is-dragging,
.n14-scrim.is-dragging {
	transition: none !important;
}
.n14-sheet.is-dragging {
	cursor: grabbing;
	user-select: none;
}
.n14-sheet__head {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.25rem 0.5rem 0.5rem 1.25rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
	flex: 0 0 auto;
}
.n14-sheet__back + .n14-sheet__title {
	padding-left: 0;
}
.n14-sheet__back {
	margin-left: -0.75rem;
}
.n14-sheet__title {
	flex: 1;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.5rem;
	text-transform: uppercase;
}
.n14-sheet__close,
.n14-sheet__back {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}
.n14-sheet__back[hidden] {
	display: none;
}
.n14-sheet__body {
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}
@media (min-width: 1024px) {
	.n14-sheet {
		left: 50%;
		right: auto;
		top: 50%;
		bottom: auto;
		width: min(560px, 92vw);
		max-height: 86vh;
		border-radius: 0;
		transform: translate(-50%, -46%);
	}
	.n14-sheet.is-open {
		transform: translate(-50%, -50%);
	}
	.n14-sheet__grip {
		display: none;
	}
	.n14-sheet__head {
		padding: 0.75rem 0.75rem 0.75rem 1.75rem;
	}
	.n14-sheet--assist {
		top: auto;
		left: 24px;
		bottom: 84px;
		width: 360px;
		transform: translateY(12px);
		box-shadow: 0 24px 48px -24px rgba(28, 24, 24, 0.5);
	}
	.n14-sheet--assist.is-open {
		transform: none;
	}
}

/* Categories */
.n14-sheet__list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.n14-sheet__row {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	width: 100%;
	min-height: 64px;
	padding: 0 1rem 0 1.25rem;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}
.n14-sheet__thumb {
	flex: 0 0 44px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
}
.n14-sheet__thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--blush);
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.25rem;
}
.n14-sheet__name {
	flex: 1;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.1875rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.n14-sheet__all {
	display: block;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--rose);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
}
.n14-sheet__level[hidden] {
	display: none;
}
.n14-sheet__level.is-active {
	animation: n14-sheet-in 0.25s ease;
}
@keyframes n14-sheet-in {
	from { opacity: 0; transform: translateX(16px); }
	to { opacity: 1; transform: none; }
}

/* Assistance */
.n14-assist {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1rem;
}
.n14-assist__item {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	min-height: 60px;
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--wp--preset--color--line);
	color: inherit;
	text-decoration: none;
}
.n14-assist__item.is-primary {
	background: var(--wp--preset--color--blush);
	border-color: var(--wp--preset--color--blush-strong);
}
.n14-assist__item.is-primary .n14-assist__icon {
	color: #25d366;
}
.n14-assist__item:hover {
	border-color: var(--wp--preset--color--ink);
}
.n14-assist__icon {
	display: flex;
	width: 36px;
	justify-content: center;
}
.n14-assist__text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.n14-assist__title {
	font-size: 0.875rem;
	font-weight: 500;
}
.n14-assist__sub {
	font-size: 0.75rem;
	opacity: 0.75;
}

/* ---------- Cart popup ---------- */
.n14-cart {
	padding: 1rem 1.25rem 1.25rem;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}
@media (min-width: 1024px) {
	.n14-cart {
		padding: 1.25rem 1.75rem 1.75rem;
	}
}
.n14-cart__title {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.14em;
}
.n14-cart__check {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--wp--preset--color--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat;
	flex: 0 0 auto;
}
.n14-cart__list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.n14-cart__row {
	display: flex;
	gap: 0.875rem;
	align-items: center;
	padding: 0 0 1rem;
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.n14-cart__list .n14-cart__row + .n14-cart__row {
	padding-top: 1rem;
}
.n14-cart__img {
	flex: 0 0 64px;
	width: 64px;
	height: 80px;
	object-fit: cover;
	background: var(--wp--preset--color--blush);
}
.n14-cart__img--empty {
	display: block;
	background: var(--wp--preset--color--blush);
}
.n14-cart__info {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 3px;
	min-width: 0;
}
.n14-cart__name {
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.n14-cart__meta {
	font-size: 0.75rem;
	color: var(--wp--preset--color--muted);
}
.n14-cart__price {
	font-weight: 500;
	white-space: nowrap;
}
.n14-cart__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}
.n14-cart__remove {
	padding: 0;
	border: 0;
	background: none;
	color: var(--wp--preset--color--muted);
	font: inherit;
	font-size: 0.6875rem;
	text-decoration: underline;
	cursor: pointer;
}
.n14-cart__qty {
	display: inline-flex;
	align-items: center;
	margin-top: 4px;
	border: 1px solid var(--wp--preset--color--line);
	align-self: flex-start;
}
.n14-cart__qty button {
	width: 32px;
	height: 32px;
	border: 0;
	background: none;
	color: inherit;
	font-size: 1rem;
	cursor: pointer;
}
.n14-cart__qty span {
	min-width: 24px;
	text-align: center;
	font-size: 0.8125rem;
}
.n14-cart__ship p {
	margin: 0 0 0.5rem;
	font-size: 0.8125rem;
}
.n14-cart__ship-track {
	display: block;
	height: 6px;
	background: var(--wp--preset--color--blush);
}
.n14-cart__ship-track span {
	display: block;
	height: 100%;
	background: var(--wp--preset--color--rose);
	transition: width 0.4s ease;
}
.n14-cart__summary,
.n14-cart__empty,
.n14-cart__error {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted);
}
.n14-cart__error {
	color: var(--wp--preset--color--rose);
}
.n14-cart__subtotal {
	display: flex;
	justify-content: space-between;
	margin: 0;
	font-size: 0.875rem;
}
.n14-cart__suggest-title {
	margin: 0 0 0.75rem;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.25rem;
}
.n14-cart__suggest ul {
	display: flex;
	gap: 0.75rem;
	margin: 0 -1.25rem;
	padding: 0 1.25rem 0.5rem;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding-inline: 1.25rem;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}
@media (min-width: 1024px) {
	.n14-cart__suggest ul {
		margin: 0 -1.75rem;
		padding: 0 1.75rem 0.5rem;
		scroll-padding-inline: 1.75rem;
	}
}
.n14-cart__suggest li {
	flex: 0 0 38%;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}
@media (min-width: 1024px) {
	.n14-cart__suggest li {
		flex-basis: 29%;
	}
}
a.n14-cart__suggest-add {
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}
.n14-cart__suggest-link {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: inherit;
	text-decoration: none;
}
.n14-cart__suggest-link img,
.n14-cart__suggest-link .n14-cart__img--empty {
	width: 100%;
	aspect-ratio: 4 / 5;
	object-fit: cover;
	background: var(--wp--preset--color--blush);
}
.n14-cart__suggest-name {
	font-size: 0.625rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-transform: uppercase;
}
.n14-cart__suggest-price {
	font-size: 0.75rem;
}
.n14-cart__suggest-add {
	height: 32px;
	margin-top: auto;
	border: 1px solid var(--wp--preset--color--ink);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-size: 0.5625rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
}
.n14-cart__suggest-add:hover {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface);
}
.n14-cart__actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem;
}
.n14-cart__continue,
.n14-cart__checkout {
	height: 42px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 1px solid var(--wp--preset--color--ink);
	font: inherit;
	font-size: 0.625rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
}
.n14-cart__continue {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
}
.n14-cart__checkout {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--surface) !important;
}

/* Editor */
.n14-bar-editor {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px;
	border: 1px dashed var(--wp--preset--color--line);
	font-size: 13px;
}
@media (prefers-reduced-motion: reduce) {
	.n14-sheet,
	.n14-scrim,
	.n14-bar {
		transition: none;
	}
}

.n14-cart__row.is-added {
	padding: 0.75rem;
	background: var(--wp--preset--color--blush);
	border-bottom: 0;
}
.n14-cart__list .n14-cart__row.is-added + .n14-cart__row {
	padding-top: 1rem;
}
.n14-cart__list {
	max-height: 40vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* The cart is always one tap away: hide WooCommerce's "Visualizza carrello" links */
a.added_to_cart,
.wc-block-components-product-button a.added_to_cart,
.wc-block-components-product-button__button + a,
.woocommerce-message .button.wc-forward {
	display: none !important;
}

/* ==========================================================================
   Desktop: the cart is a full-height panel sliding in from the right
   ========================================================================== */
@media (min-width: 1024px) {
	.n14-sheet.n14-sheet--cart {
		top: 0;
		right: 0;
		bottom: 0;
		left: auto;
		width: min(460px, 92vw);
		height: 100vh;
		height: 100dvh;
		max-height: none;
		border-radius: 0;
		box-shadow: -24px 0 60px -30px rgba(28, 24, 24, 0.45);
		transform: translate3d(32px, 0, 0);
		transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease;
	}
	.n14-sheet.n14-sheet--cart.is-open {
		transform: none;
	}
	.admin-bar .n14-sheet.n14-sheet--cart {
		top: var(--wp-admin--admin-bar--height, 32px);
		height: calc(100vh - var(--wp-admin--admin-bar--height, 32px));
	}
	.n14-sheet--cart .n14-sheet__head {
		padding: 1rem 1rem 1rem 1.75rem;
	}
	.n14-sheet--cart .n14-sheet__body {
		flex: 1;
		scrollbar-width: thin;
		scrollbar-color: var(--wp--preset--color--line) transparent;
	}
	.n14-sheet--cart .n14-cart {
		gap: 1.25rem;
		padding: 1.5rem 1.75rem 2rem;
	}
	/* No scroll inside the scroll: the whole panel scrolls */
	.n14-sheet--cart .n14-cart__list {
		max-height: none;
		overflow: visible;
	}
	.n14-sheet--cart .n14-cart__img {
		flex-basis: 76px;
		width: 76px;
		height: 76px;
	}
	.n14-sheet--cart .n14-cart__actions {
		grid-template-columns: 1fr;
		gap: 0.625rem;
	}
	.n14-sheet--cart .n14-cart__checkout {
		order: -1;
		height: 50px;
		font-size: 0.75rem;
	}
	.n14-sheet--cart .n14-cart__continue {
		height: 44px;
	}
	/* Suggestions: a tidy vertical list, one product per row */
	.n14-sheet--cart .n14-cart__suggest {
		padding-top: 1.25rem;
		border-top: 1px solid var(--wp--preset--color--line);
	}
	.n14-sheet--cart .n14-cart__suggest ul {
		display: flex;
		flex-direction: column;
		gap: 0;
		margin: 0;
		padding: 0;
		overflow: visible;
		scroll-snap-type: none;
	}
	.n14-sheet--cart .n14-cart__suggest li {
		flex: none;
		flex-direction: row;
		align-items: center;
		gap: 0.875rem;
		padding: 0.75rem 0;
		border-bottom: 1px solid var(--wp--preset--color--line);
	}
	.n14-sheet--cart .n14-cart__suggest li:last-child {
		border-bottom: 0;
	}
	.n14-sheet--cart .n14-cart__suggest-link {
		flex: 1;
		min-width: 0;
		display: grid;
		grid-template-columns: 64px minmax(0, 1fr);
		grid-template-rows: auto auto;
		column-gap: 0.875rem;
		align-items: center;
	}
	.n14-sheet--cart .n14-cart__suggest-link img,
	.n14-sheet--cart .n14-cart__suggest-link .n14-cart__img--empty {
		grid-row: 1 / span 2;
		width: 64px;
		height: 80px;
		aspect-ratio: auto;
	}
	.n14-sheet--cart .n14-cart__suggest-name {
		align-self: end;
		font-size: 0.6875rem;
	}
	.n14-sheet--cart .n14-cart__suggest-price {
		align-self: start;
		font-size: 0.8125rem;
		font-weight: 500;
	}
	.n14-sheet--cart .n14-cart__suggest-add {
		flex: 0 0 auto;
		height: 36px;
		margin: 0;
		padding: 0 1rem;
	}
}

/* Bottom bar switched off in N14 > Impostazioni > Funzioni */
.n14-shop.no-bar .n14-bar {
	display: none !important;
}
.n14-shop.no-bar .n14-sheet {
	bottom: var(--n14-safe);
}

.n14-cart__meta {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* "Crea la tua box" at the top of the Shop sheet */
.n14-sheet__boxrow {
	padding: 0.25rem 0 0.75rem;
}
.n14-sheet__box {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 48px;
	border-radius: 999px;
	background: var(--wp--preset--color--rose);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-decoration: none;
	text-transform: uppercase;
}
