/**
 * Fabric by the Meter.
 *
 * Everything inherits the theme's font and colours. Override the custom
 * properties below in your child theme to restyle without touching this file.
 */

.fbm-field {
	--fbm-border: currentColor;
	--fbm-radius: 6px;
	--fbm-gap: 8px;
	margin-block: 1.25em;
	/* Some themes lay the add-to-cart form out as a flex row. */
	width: 100%;
	flex-basis: 100%;
	order: -1;
}

.fbm-field__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
	margin-block-end: 0.5em;
}

.fbm-field__label {
	font-weight: 600;
}

.fbm-calc-open {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	font-size: 0.9em;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.fbm-lengths {
	display: flex;
	flex-wrap: wrap;
	gap: var(--fbm-gap);
}

.fbm-length {
	font: inherit;
	line-height: 1.2;
	padding: 0.7em 1.1em;
	min-width: 4.5em;
	background: transparent;
	color: inherit;
	border: 1px solid var(--fbm-border);
	border-radius: var(--fbm-radius);
	opacity: 0.55;
	cursor: pointer;
}

.fbm-length:hover {
	opacity: 0.85;
}

.fbm-length.is-selected {
	opacity: 1;
	border-width: 2px;
	padding: calc(0.7em - 1px) calc(1.1em - 1px);
	font-weight: 600;
}

.fbm-length:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.fbm-length.is-unavailable,
.fbm-length[disabled] {
	opacity: 0.3;
	cursor: not-allowed;
	text-decoration: line-through;
}

.fbm-custom {
	margin-block-start: 0.9em;
}

.fbm-custom__label {
	display: block;
	font-size: 0.9em;
	margin-block-end: 0.35em;
}

.fbm-custom__row {
	display: flex;
	align-items: center;
	gap: 0.5em;
	max-width: 12em;
}

.fbm-custom__input {
	width: 100%;
	max-width: 8em;
}

.fbm-custom__unit {
	font-size: 0.9em;
	opacity: 0.7;
}

.fbm-summary {
	margin-block: 0.75em 0;
	font-size: 0.95em;
}

.fbm-summary:empty {
	display: none;
}

.fbm-error {
	margin-block: 0.4em 0;
	font-size: 0.9em;
	display: none;
}

.fbm-error.is-visible {
	display: block;
	color: #b32d2e;
}

.fbm-btn-total {
	margin-inline-start: 0.6em;
	font-weight: 600;
	opacity: 0.85;
}

.fbm-unit {
	font-size: 0.8em;
	opacity: 0.7;
}

.fbm-sample-button {
	margin-inline-start: 0.5em;
}

.fbm-tag {
	display: inline-block;
	font-size: 0.75em;
	padding: 0.15em 0.5em;
	border: 1px solid currentColor;
	border-radius: 3px;
	opacity: 0.7;
	vertical-align: middle;
}

/* Cart */

.fbm-cart-qty {
	display: flex;
	align-items: center;
	gap: 0.5em;
	flex-wrap: wrap;
}

.fbm-cart-pieces {
	width: 4.5em;
}

.fbm-cart-qty__hint {
	font-size: 0.85em;
	white-space: nowrap;
	opacity: 0.8;
}

/* Calculator dialog */

.fbm-modal[hidden] {
	display: none;
}

.fbm-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.fbm-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.fbm-modal__panel {
	position: relative;
	background: #fff;
	color: #1a1a1a;
	width: min(32rem, 100%);
	max-height: 85vh;
	overflow-y: auto;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.fbm-modal__head,
.fbm-modal__foot {
	display: flex;
	align-items: center;
	gap: 0.75em;
	padding: 1rem 1.25rem;
}

.fbm-modal__head {
	justify-content: space-between;
	border-block-end: 1px solid rgba(0, 0, 0, 0.1);
}

.fbm-modal__head h2 {
	margin: 0;
	font-size: 1.1rem;
}

.fbm-modal__close {
	background: none;
	border: 0;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	padding: 0 0.25rem;
}

.fbm-modal__body {
	padding: 1.25rem;
	display: grid;
	gap: 0.85rem;
}

.fbm-modal__foot {
	border-block-start: 1px solid rgba(0, 0, 0, 0.1);
}

.fbm-calc-modes {
	display: flex;
	gap: 0.4em;
	flex-wrap: wrap;
}

.fbm-calc-mode {
	font: inherit;
	font-size: 0.9em;
	padding: 0.45em 0.9em;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 999px;
	background: transparent;
	cursor: pointer;
}

.fbm-calc-mode.is-active {
	background: #1a1a1a;
	color: #fff;
	border-color: #1a1a1a;
}

.fbm-calc-pane {
	display: grid;
	gap: 0.7rem;
}

.fbm-modal__body label {
	display: grid;
	gap: 0.3em;
	font-size: 0.9rem;
}

.fbm-modal__body input,
.fbm-modal__body select {
	width: 100%;
	padding: 0.5em;
	font: inherit;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 4px;
	background: #fff;
	color: inherit;
}

.fbm-calc-width {
	border-block-start: 1px solid rgba(0, 0, 0, 0.1);
	padding-block-start: 0.85rem;
}

.fbm-calc-result {
	background: rgba(0, 0, 0, 0.04);
	border-radius: 6px;
	padding: 0.85rem 1rem;
}

.fbm-calc-result__value {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
}

.fbm-calc-result__working {
	margin: 0.25rem 0 0;
	font-size: 0.85rem;
	opacity: 0.7;
}

body.fbm-modal-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.fbm-length,
	.fbm-calc-mode {
		transition: none;
	}
}
