/*
 * What the calculator adds to the design system's PriceCalculator, which comes from
 * design-system.css. Everything is scoped to .sb-reiknivel and uses the design system's tokens.
 */

.sb-reiknivel {
	--sb-thumb: var(--space-4);
	width: 100%;
	text-align: left;
}

.sb-reiknivel [hidden] {
	display: none !important;
}

/* The live theme's bare labels are grey, with a bottom margin. */
.sb-reiknivel label {
	margin: 0;
	color: var(--ink);
}

/* Text for screen readers only. */
.sb-reiknivel__hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Phones and small tablets show the sizes first, as the calculator always has. */
@media (max-width: 720px) {
	.sb-reiknivel__sizes {
		order: -1;
	}
}

/*
 * The scale's labels are unevenly spaced (10, 30, 50, 70, 100, 130…), so each sits at its value,
 * measured over the distance the slider's thumb travels.
 */
.sb-reiknivel .sb-calc__scale {
	position: relative;
	display: block;
	height: var(--space-4);
}

.sb-reiknivel .sb-calc__scale span {
	position: absolute;
	left: calc(var(--sb-thumb) / 2 + (100% - var(--sb-thumb)) * var(--sb-tick));
	transform: translateX(-50%);
}

/* Explanations of the cutting options. */
.sb-reiknivel__explanations {
	margin-top: calc(-1 * var(--space-2));
}

.sb-reiknivel details {
	padding: var(--space-1) 0;
}

.sb-reiknivel summary.sb-calc__label {
	display: list-item;
	margin: 0;
	cursor: pointer;
}

.sb-reiknivel summary:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-radius: var(--radius-sm);
}

.sb-reiknivel .sb-reiknivel__explanation {
	margin: var(--space-2) 0;
	color: var(--ink);
}

.sb-reiknivel__explanation strong {
	display: block;
	font-weight: 600;
}

/* The result, with the discount when one is running. */
.sb-reiknivel__caption {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2);
}

.sb-reiknivel__amounts {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	margin-left: auto;
}

.sb-reiknivel__was {
	color: var(--ink-muted);
}

/* The live theme's .small is grey, and its stylesheet loads after this one. */
.sb-reiknivel .sb-reiknivel__offer {
	color: var(--ink);
}

.sb-reiknivel__until {
	white-space: nowrap;
}

.sb-reiknivel__badge {
	display: inline-block;
	margin-right: var(--space-1);
	padding: 0 var(--space-2);
	background: var(--green);
	color: var(--on-green);
	border-radius: var(--radius-sm);
	font-weight: 700;
}
