/* Product attribute badges (includes/theme-nutrition-badges.php) */
.nutrition-badges-row {
	margin-bottom: 12px;
}

.nutrition-badges {
	gap: 8px;
}

.nutrition-badge {
	position: relative;
	display: inline-flex;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	cursor: help;
	outline: none;
	box-shadow: 0 0 0 0 transparent;
	transition: box-shadow .25s ease;
}

/* Smooth border on hover (mouse devices) or when opened by tap (touch devices) */
@media (hover: hover) {
	.nutrition-badge:hover {
		box-shadow: 0 0 0 2px #608026;
	}
}

.nutrition-badge.is-open {
	box-shadow: 0 0 0 2px #608026;
}

.nutrition-badge img {
	width: 100%;
	height: 100%;
	display: block;
}

.nutrition-badge:focus-visible {
	box-shadow: 0 0 0 2px #608026;
}

/* Tooltip */
.nutrition-badge::after,
.nutrition-badge::before {
	position: absolute;
	left: 50%;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity .2s ease, visibility .2s ease;
	z-index: 20;
}

.nutrition-badge::after {
	content: attr(data-tooltip);
	bottom: calc(100% + 8px);
	transform: translateX(-50%);
	width: max-content;
	max-width: 220px;
	padding: 6px 10px;
	border-radius: 4px;
	background-color: #223b0b;
	color: #fff;
	font-size: 13px;
	line-height: 1.3;
	text-align: center;
	white-space: normal;
}

.nutrition-badge::before {
	content: "";
	bottom: calc(100% + 2px);
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: #223b0b;
	border-bottom-width: 0;
}

@media (hover: hover) {
	.nutrition-badge:hover::after,
	.nutrition-badge:hover::before {
		opacity: 1;
		visibility: visible;
	}
}

/* Keyboard focus, or tap on touch devices (js/nutrition-badges.js) */
.nutrition-badge:focus-visible::after,
.nutrition-badge:focus-visible::before,
.nutrition-badge.is-open::after,
.nutrition-badge.is-open::before {
	opacity: 1;
	visibility: visible;
}

/* Touch devices: makes iOS Safari deliver taps on the badge as clicks */
@media (hover: none) {
	.nutrition-badge {
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
}

@media (max-width: 575.98px) {
	.nutrition-badge {
		width: 40px;
		height: 40px;
	}
}
