/*
 * Rewards bar, the same everywhere. --atop-cap is the caption width: the room between two gifts, with the last caption
 * centred under its icon and still inside the box. The steps share one grid cell, so the box grows with the longest name.
 */
.atop-gifts {
	--atop-icon: 40px;
	--atop-pull: 6px;
	--atop-reach: 11px;
	--atop-cap: min(100px, calc((200cqw + 2 * var(--atop-pull) + var(--atop-icon) + 2 * var(--atop-reach) - var(--atop-steps) * (var(--atop-icon) + 8px)) / (2 * var(--atop-steps) + 1)));
	container-type: inline-size;
	box-sizing: border-box;
	margin: 0;
	padding: 12px 12px 10px;
	font-size: 13px;
	line-height: 1.3;
	color: #222;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 12px;
}

.atop-gifts-message {
	margin: 0 0 10px;
	line-height: 1.3;
	text-align: center;
}

.atop-gifts-message-left,
.atop-gifts-message-name {
	font-weight: 700;
}

.atop-gifts-message-left {
	color: var(--atop-accent-text, #2f6b14);
}

.atop-gifts-track-wrap {
	position: relative;
	display: grid;
	margin: 0 max(0px, calc(var(--atop-cap) / 2 - var(--atop-icon) / 2 - var(--atop-reach))) 0 calc(var(--atop-pull) * -1);
}

.atop-gifts-track {
	position: absolute;
	left: 10px;
	right: calc(var(--atop-icon) / 2);
	top: calc(var(--atop-icon) / 2 - 2px);
	height: 5px;
	background: #e6e6e6;
	border-radius: 99px;
	overflow: hidden;
}

.atop-gifts-fill {
	height: 100%;
	background: var(--atop-accent, #6dab3c);
}

.atop-gifts-step {
	position: relative;
	grid-area: 1 / 1;
	width: var(--atop-icon);
	margin-left: calc(var(--atop-icon) / -2);
}

.atop-gifts-step.is-start {
	margin-left: calc(var(--atop-icon) / -2 + 10px);
}

.atop-gifts-step.is-end {
	margin-left: calc(var(--atop-icon) * -1);
}

.atop-gifts-zero {
	position: relative;
	display: block;
	width: var(--atop-icon);
	height: var(--atop-icon);
}

.atop-gifts-zero::before {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 9px;
	height: 9px;
	margin: -4px 0 0 -4px;
	border-radius: 50%;
	background: var(--atop-accent, #6dab3c);
}

.atop-gifts-step.is-zero .atop-gifts-caption {
	display: none;
}

.atop-gifts-icon {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--atop-icon);
	height: var(--atop-icon);
	background: #fff;
	border: 2px solid #e1e1e1;
	border-radius: 50%;
}

.atop-gifts-icon img {
	width: calc(var(--atop-icon) - 10px);
	height: calc(var(--atop-icon) - 10px);
	object-fit: contain;
}

.atop-gifts-step.is-unlocked .atop-gifts-icon {
	border-color: var(--atop-accent, #6dab3c);
}

.atop-gifts-step.is-unlocked .atop-gifts-icon::after {
	content: "\2713";
	position: absolute;
	right: -5px;
	bottom: -4px;
	width: 14px;
	height: 14px;
	background: var(--atop-accent, #6dab3c);
	border-radius: 50%;
	color: var(--atop-accent-contrast, #fff);
	font-size: 9px;
	font-weight: 700;
	line-height: 14px;
	text-align: center;
}

.atop-gifts-caption {
	display: block;
	width: var(--atop-cap);
	margin: 4px 0 0 calc((var(--atop-icon) - var(--atop-cap)) / 2);
	font-size: 11px;
	line-height: 1.25;
	text-align: center;
}

.atop-gifts-caption-amount {
	display: block;
	margin-bottom: 1px;
	font-size: 12px;
	font-weight: 700;
}

.atop-gifts-caption-name {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
	color: var(--atop-muted, #595959);
}

.atop-gifts-step.is-unlocked .atop-gifts-caption-name {
	color: var(--atop-accent-text, #2f6b14);
}

@media (max-width: 480px) {
	.atop-gifts {
		--atop-icon: 36px;
	}
}

.atop-gifts-lines {
	width: 100%;
	margin: 0;
	border: 0;
	border-bottom: 1px solid #e6e6e6;
	border-radius: 0;
	background: transparent;
	box-sizing: border-box;
}

.atop-gifts-lines summary {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	padding: 10px 0;
	cursor: pointer;
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	list-style: none;
	text-align: left;
}

.atop-gifts-lines-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 0;
	background: none;
	color: #545454;
	flex: 0 0 20px;
}

.atop-gifts-lines-icon svg {
	width: 18px;
	height: 18px;
}

.atop-gifts-lines-label {
	flex: 1;
	min-width: 0;
	text-align: left;
}

.atop-gifts-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 19px;
	height: 19px;
	margin-left: 6px;
	padding: 0 5px;
	border-radius: 99px;
	background: #6dab3c;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}

.atop-gifts-count > span {
	display: block;
	line-height: 1;
	text-box: trim-both cap alphabetic;
}

.atop-gifts-lines summary::-webkit-details-marker {
	display: none;
}

.atop-gifts-lines summary::after {
	content: "";
	display: inline-block;
	box-sizing: border-box;
	width: 9px;
	height: 9px;
	margin-left: 4px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.28s ease;
	flex: 0 0 9px;
}

.atop-gifts-lines[open] summary::after {
	transform: rotate(45deg);
}

.atop-gifts-lines::details-content {
	content-visibility: visible;
	height: auto;
}

.atop-gifts-lines-panel {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows 0.28s ease;
}

.atop-gifts-lines[open] .atop-gifts-lines-panel {
	grid-template-rows: 1fr;
}

.atop-gifts-lines-panel-inner {
	overflow: hidden;
}

.atop-gifts-line {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 0;
	border-top: 1px solid #e6e6e6;
}

.atop-gifts-lines:not([open]) .atop-gifts-line {
	border-top: 0;
}

.atop-gifts-line img {
	width: 48px;
	height: 48px;
	object-fit: contain;
	flex: 0 0 48px;
}

.atop-gifts-line-name {
	flex: 1;
	min-width: 0;
	text-align: left;
}

.atp-sliding-cart-off-canvas .atop-gifts-sidecart {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 136px;
	z-index: 3;
	margin: 0;
}

.atp-sliding-cart-off-canvas .atop-gifts-lines {
	width: auto;
	max-width: 100%;
	min-width: 0;
	margin: 0;
	padding-right: 8px;
	overflow: hidden;
	flex-shrink: 0;
}

/* No captions in the sidecart, so no room is kept for the last one. */
.atp-sliding-cart-off-canvas .atop-gifts {
	--atop-cap: var(--atop-icon);
}

.atp-sliding-cart-off-canvas .atop-gifts-caption {
	display: none;
}

.atp-sliding-cart-off-canvas:has(.atop-gifts-sidecart) .woocommerce-cart-form__contents {
	bottom: 228px !important;
	padding-bottom: 8px;
}

.atop-gift-price {
	margin-left: auto;
	white-space: nowrap;
}

.atp-sliding-cart-off-canvas .atop-gifts-line-name {
	font-size: 14px;
	line-height: 14px;
}

.atp-sliding-cart-off-canvas .atop-gift-price,
.atp-sliding-cart-off-canvas .atop-gift-price ins {
	font-size: 12.8px;
	font-weight: 300;
	line-height: 12.8px;
}

.atop-gift-price del {
	color: #bbb;
	margin-right: 4px;
}

.atop-gift-price ins {
	color: #d60057;
	font-weight: 700;
	text-decoration: none;
}
