/*
 * Extrawise — product page, cart and checkout styles.
 *
 * Fields take the theme's font and text colour. The chosen state uses
 * --extrawise-accent: the theme's text colour unless a colour is set in
 * Extrawise → Settings. Layout uses logical properties, so right-to-left
 * languages need no extra file.
 *
 * Contents
 * 1. Tokens
 * 2. Groups and fields
 * 3. Labels, help and errors
 * 4. Inputs
 * 5. Choices: radio cards, checkboxes, colour and image swatches
 * 6. Numbers and sliders
 * 7. Calculated price
 * 8. File uploads
 * 9. Total box and button
 * 10. Cart and checkout
 * 11. Small screens
 */

/* 1. Tokens */
.extrawise,
.extrawise-edit-line {
	--extrawise-accent: currentcolor;
	--extrawise-line: rgba(128, 128, 128, 0.35);
	--extrawise-soft: rgba(128, 128, 128, 0.08);
	--extrawise-muted: rgba(128, 128, 128, 0.95);
	--extrawise-error: #cc1818;
	--extrawise-radius: 10px;
	--extrawise-gap: 16px;
}

/* 2. Groups and fields */
.extrawise {
	clear: both;
	margin: 0 0 var(--extrawise-gap);
	width: 100%;
}

.extrawise-group {
	border-block-start: 1px solid var(--extrawise-line);
	margin-block-end: var(--extrawise-gap);
	padding-block-start: var(--extrawise-gap);
}

.extrawise-group-title {
	font-size: 1.15em;
	margin: 0 0 12px;
}

.extrawise-fields {
	display: flex;
	flex-wrap: wrap;
	gap: var(--extrawise-gap);
}

.extrawise-field {
	flex: 1 1 100%;
	min-width: 0;
}

.extrawise-field.extrawise-half {
	flex: 1 1 calc(50% - var(--extrawise-gap));
}

.extrawise-field[hidden] {
	display: none;
}

.extrawise-fieldset {
	border: 0;
	margin: 0;
	min-width: 0;
	padding: 0;
}

.extrawise-heading {
	font-size: 1em;
	margin: 8px 0 0;
}

.extrawise-paragraph p {
	margin: 0 0 8px;
}

/* 3. Labels, help and errors */
.extrawise-label {
	display: block;
	font-weight: 600;
	margin: 0 0 8px;
	padding: 0;
}

.extrawise-required {
	border: 0;
	text-decoration: none;
}

.extrawise-hint,
.extrawise-chosen {
	color: var(--extrawise-muted);
	font-weight: 400;
}

.extrawise-help {
	color: var(--extrawise-muted);
	font-size: 0.875em;
	margin: 8px 0 0;
}

.extrawise-help:empty {
	display: none;
}

.extrawise-error {
	color: var(--extrawise-error);
	font-size: 0.875em;
	margin: 8px 0 0;
}

.extrawise-error[hidden] {
	display: none;
}

.extrawise-has-error .extrawise-input,
.extrawise-has-error .extrawise-choice,
.extrawise-has-error .extrawise-drop {
	border-color: var(--extrawise-error);
}

.extrawise-noscript {
	font-size: 0.875em;
}

/* 4. Inputs */
.extrawise-input {
	border: 1px solid var(--extrawise-line);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	box-sizing: border-box;
	font: inherit;
	max-width: 100%;
	min-height: 44px;
	padding: 8px 12px;
	width: 100%;
}

textarea.extrawise-input {
	min-height: 88px;
	resize: vertical;
}

.extrawise-input:focus {
	border-color: var(--extrawise-accent);
	outline: none;
}

/* 5. Choices: radio cards, checkboxes, colour and image swatches */
.extrawise-choices {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.extrawise-choice {
	align-items: center;
	border: 1px solid var(--extrawise-line);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	cursor: pointer;
	display: flex;
	flex: 1 1 160px;
	gap: 8px;
	margin: 0;
	min-height: 44px;
	padding: 8px 12px;
}

.extrawise-choice:hover {
	background: var(--extrawise-soft);
}

.extrawise-choice:has(input:checked) {
	border-color: var(--extrawise-accent);
	box-shadow: inset 0 0 0 1px var(--extrawise-accent);
}

.extrawise-choice:focus-within {
	border-color: var(--extrawise-accent);
}

.extrawise-choice input {
	margin: 0;
}

.extrawise-choice-price {
	color: var(--extrawise-muted);
	flex: 0 0 auto;
	font-size: 0.875em;
	white-space: nowrap;
}

.extrawise-choices--single .extrawise-choice,
.extrawise-choices--checkbox .extrawise-choice {
	border: 0;
	flex: 0 1 auto;
	min-height: 0;
	padding: 4px 0;
}

.extrawise-choices--single .extrawise-choice:hover,
.extrawise-choices--checkbox .extrawise-choice:hover {
	background: none;
}

.extrawise-choices--single .extrawise-choice:has(input:checked),
.extrawise-choices--checkbox .extrawise-choice:has(input:checked) {
	box-shadow: none;
}

.extrawise-choices--color .extrawise-choice {
	flex: 0 0 auto;
	height: 44px;
	justify-content: center;
	padding: 3px;
	position: relative;
	width: 44px;
}

.extrawise-choices--color input,
.extrawise-choices--image input {
	inset: 0;
	opacity: 0;
	position: absolute;
}

.extrawise-swatch {
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	corner-shape: squircle;
	display: block;
	height: 100%;
	width: 100%;
}

.extrawise-choices--image .extrawise-choice {
	flex: 1 1 120px;
	flex-direction: column;
	max-width: 200px;
	padding: 6px 6px 8px;
	position: relative;
	text-align: center;
}

.extrawise-image-box {
	align-items: center;
	aspect-ratio: 4 / 3;
	background: var(--extrawise-soft);
	border-radius: 8px;
	corner-shape: squircle;
	display: flex;
	justify-content: center;
	overflow: hidden;
	width: 100%;
}

.extrawise-image {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* 6. Numbers and sliders */
.extrawise-number {
	align-items: center;
	display: flex;
	gap: 12px;
}

.extrawise-slider {
	accent-color: var(--extrawise-accent);
	cursor: pointer;
	flex: 1 1 auto;
	min-width: 0;
}

.extrawise-slider[hidden] {
	display: none;
}

.extrawise-slider:not([hidden]) + .extrawise-input {
	flex: 0 0 96px;
	text-align: center;
}

.extrawise-unit {
	color: var(--extrawise-muted);
}

/* 7. Calculated price */
.extrawise-calc {
	align-items: center;
	border: 1px solid var(--extrawise-line);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	display: flex;
	gap: 16px;
	justify-content: space-between;
	padding: 12px 16px;
}

.extrawise-calc-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.extrawise-calc-label {
	font-weight: 600;
}

.extrawise-calc-help {
	color: var(--extrawise-muted);
	font-size: 0.875em;
}

.extrawise-calc-value {
	font-size: 1.15em;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

/* 8. File uploads */
.extrawise-files {
	display: flex;
	flex-direction: column;
	gap: 8px;
	list-style: none;
	margin: 0 0 8px;
	padding: 0;
}

.extrawise-files:empty {
	display: none;
}

.extrawise-file {
	align-items: center;
	border: 1px solid var(--extrawise-line);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	display: flex;
	gap: 8px;
	padding: 8px 12px;
}

.extrawise-file.is-uploading {
	color: var(--extrawise-muted);
}

.extrawise-file-name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.extrawise-file-size {
	color: var(--extrawise-muted);
	flex: 1 1 auto;
	font-size: 0.875em;
}

.extrawise-file-remove {
	background: none;
	border: 1px solid transparent;
	border-radius: 6px;
	corner-shape: squircle;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 0.875em;
	padding: 4px 8px;
}

.extrawise-file-remove:hover,
.extrawise-drop:hover {
	background: var(--extrawise-soft);
	border-color: var(--extrawise-accent);
	color: var(--extrawise-accent);
}

.extrawise-drop {
	align-items: center;
	background: var(--extrawise-soft);
	border: 1px dashed var(--extrawise-line);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	justify-content: center;
	min-height: 48px;
	padding: 12px;
	text-align: center;
}

.extrawise-drop[hidden] {
	display: none;
}

.extrawise-drop-text {
	font-weight: 600;
}

.extrawise-drop-limits {
	color: var(--extrawise-muted);
	font-size: 0.875em;
}

.extrawise-file-input:focus + .extrawise-drop,
.extrawise-drop:focus-within {
	border-color: var(--extrawise-accent);
}

/* 9. Total box and button */
.extrawise-totals {
	background: var(--extrawise-soft);
	border-radius: var(--extrawise-radius);
	corner-shape: squircle;
	display: flex;
	flex-direction: column;
	font-variant-numeric: tabular-nums;
	gap: 6px;
	margin-block-start: var(--extrawise-gap);
	padding: 16px;
}

.extrawise-totals[hidden] {
	display: none;
}

.extrawise-total-line,
.extrawise-total-sum {
	display: flex;
	gap: 16px;
	justify-content: space-between;
}

.extrawise-total-line {
	color: var(--extrawise-muted);
	font-size: 0.9em;
}

.extrawise-total-sum {
	border-block-start: 1px solid var(--extrawise-line);
	font-size: 1.1em;
	font-weight: 600;
	margin-block-start: 4px;
	padding-block-start: 10px;
}

.extrawise-button-total {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* 10. Cart and checkout */
.extrawise-edit-line {
	margin-block-start: 6px;
}

.wc-block-cart-items .extrawise-edit-line {
	font-size: 0.75em;
	margin-block-end: 8px;
}

.extrawise-edit-link {
	font-size: 0.875em;
	font-weight: 600;
}

.extrawise-price-label {
	white-space: nowrap;
}

/* 11. Small screens */
@media (max-width: 600px) {

	.extrawise-field.extrawise-half {
		flex-basis: 100%;
	}

	.extrawise-choice {
		flex-basis: 100%;
	}

	.extrawise-choices--color .extrawise-choice {
		flex-basis: auto;
	}

	.extrawise-choices--image .extrawise-choice {
		flex-basis: calc(50% - 8px);
		max-width: none;
	}
}
