/* Option block on the single product page. Neutral enough to sit inside any
   theme, specific enough not to inherit a theme's radio styling. */

.kpo-block {
	margin: 0 0 1.25em;
}

.kpo-group {
	margin-bottom: 1em;
}

.kpo-group__title {
	font-weight: 700;
	margin-bottom: .55em;
	font-size: .95em;
}

.kpo-options {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
	gap: .5em;
}

.kpo-option {
	display: block;
	position: relative;
	margin: 0;
	padding: .7em .85em;
	border: 1px solid rgba( 0, 0, 0, .14 );
	border-radius: 10px;
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
	background: transparent;
}

.kpo-option:hover {
	border-color: rgba( 0, 0, 0, .3 );
}

.kpo-option__input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
	margin: 0;
}

.kpo-option__body {
	display: flex;
	flex-direction: column;
	gap: .15em;
	line-height: 1.5;
}

.kpo-option__label {
	font-weight: 600;
}

.kpo-option__desc {
	font-size: .8em;
	opacity: .65;
}

.kpo-option__fee {
	font-size: .85em;
	opacity: .8;
}

.kpo-option__fee .woocommerce-Price-amount {
	font-weight: 600;
}

/* :has() is not everywhere yet, so the checked state is also styled through the
   input's own sibling selector below. */
.kpo-option:has( .kpo-option__input:checked ),
.kpo-option__input:checked + .kpo-option__body {
	border-color: currentColor;
}

.kpo-option:has( .kpo-option__input:checked ) {
	border-color: rgba( 0, 0, 0, .55 );
	background: rgba( 0, 0, 0, .035 );
	box-shadow: inset 0 0 0 1px rgba( 0, 0, 0, .35 );
}

.kpo-option__input:focus-visible + .kpo-option__body {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.kpo-note {
	font-size: .85em;
	opacity: .7;
	margin: .4em 0 0;
}

.kpo-total {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: .75em;
	margin-top: .9em;
	padding-top: .75em;
	border-top: 1px dashed rgba( 0, 0, 0, .18 );
}

.kpo-total[hidden] {
	display: none;
}

.kpo-total__label {
	font-size: .9em;
	opacity: .75;
}

.kpo-total__value {
	font-size: 1.2em;
	font-weight: 700;
}

@media ( prefers-color-scheme: dark ) {
	.kpo-option {
		border-color: rgba( 255, 255, 255, .2 );
	}
	.kpo-option:has( .kpo-option__input:checked ) {
		border-color: rgba( 255, 255, 255, .6 );
		background: rgba( 255, 255, 255, .06 );
		box-shadow: inset 0 0 0 1px rgba( 255, 255, 255, .4 );
	}
	.kpo-total {
		border-top-color: rgba( 255, 255, 255, .22 );
	}
}

.kpo-option--unavailable {
	opacity: .45;
	cursor: not-allowed;
	pointer-events: none;
}

.kpo-option__fee[hidden] {
	display: none;
}
