/* ==========================================================================
   Teräsmyynti Length: length choice on the product page
   ========================================================================== */

/* --- Fieldset --- */
.tsl {
	display: grid;
	gap: 0.5rem;
	margin: 0 0 1.25rem;
	padding: 0;
	border: 0;
}

.tsl__legend {
	margin-bottom: 0.25rem;
	padding: 0;
	font-weight: 600;
}

/* --- Mode options: radios styled as toggle buttons --- */
.tsl__options {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.tsl__option {
	position: relative;
	cursor: pointer;
}

/* The radio stays in the DOM for keyboard and screen readers; the span is the visible button */
.tsl__option input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.tsl__option span {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	height: 2.75rem;
	padding: 0 1.125rem;
	border: 1px solid #949494;
	color: #fff;
	white-space: nowrap;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tsl__option:hover span {
	border-color: #fff;
}

.tsl__option input:checked + span {
	border-color: #ee003c;
	background-color: #262626;
	box-shadow: inset 0 0 0 1px #ee003c;
	font-weight: 600;
}

.tsl__option input:focus-visible + span {
	outline: 2px solid #ee003c;
	outline-offset: 2px;
}

/* Mobile: buttons fill the row, so a wrapped button doesn't end up a different width */
@media screen and (max-width: 600px) {
	.tsl__option {
		flex: 1 1 9rem;
	}

	.tsl__option span {
		justify-content: center;
		width: 100%;
	}
}

/* --- Sawn length --- */
.tsl__cut {
	display: grid;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.tsl__cut[hidden] {
	display: none;
}

.tsl__cut label {
	font-weight: 600;
}

/* Matches the site's checkout fields: transparent, 1px grey border, square corners */
.tsl__cut input {
	box-sizing: border-box;
	width: 12rem;
	max-width: 100%;
	height: 2.75rem;
	padding: 0 0.875rem;
	border: 1px solid #949494;
	border-radius: 0;
	background-color: transparent;
	color: #fff;
	font: inherit;
	-moz-appearance: textfield;
	appearance: textfield;
}

.tsl__cut input::-webkit-outer-spin-button,
.tsl__cut input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

.tsl__cut input[aria-invalid="true"] {
	border-color: #ee003c;
}

.tsl__cut input::placeholder {
	color: #949494;
	opacity: 1;
}

.tsl__hint {
	margin: 0;
	line-height: 1.4;
}

/* --- Sawing price table (collapsed by default) --- */
.tsl__prices summary {
	color: #9a9a9a;
	cursor: pointer;
}

.tsl__prices summary:hover {
	color: #fff;
}

.tsl__prices table {
	margin: 0.5rem 0;
	border-collapse: collapse;
	font-size: 0.875em;
}

.tsl__prices th,
.tsl__prices td {
	padding: 0.25rem 1.25rem 0.25rem 0;
	border-bottom: 1px solid #3a3a3a;
	text-align: left;
	white-space: nowrap;
}

.tsl__prices th {
	font-weight: 600;
}

.tsl__prices td:last-child {
	text-align: right;
}

.tsl__prices p {
	margin: 0;
	color: #9a9a9a;
	font-size: 0.875em;
	line-height: 1.4;
}

/* --- Whole bar only / no web sawing --- */
.tsl__only-bar {
	margin: 0;
	font-weight: 600;
}

.tsl__notice {
	margin: 0;
	color: #9a9a9a;
	line-height: 1.4;
}

/* --- Summary --- */
.tsl__summary {
	display: grid;
	gap: 0.15rem;
	margin: 0.25rem 0 0;
	line-height: 1.4;
}

.tsl__summary-length {
	color: #9a9a9a;
}

.tsl__summary-price {
	font-weight: 600;
}

.tsl__summary-note {
	font-weight: 400;
	color: #9a9a9a;
}

.tsl__summary:empty {
	display: none;
}

.tsl__summary.is-error {
	color: #ee003c;
}
