/* Inherits the theme's fonts and primary colour (--color-primary from Solemar). */
.ssf-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	margin: 0.5rem 0 0;
	margin-inline-end: 1rem;
	padding: 0.25rem 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.875em;
	text-decoration: none;
	cursor: pointer;
}

/* Only the words are underlined, not the icon. */
.ssf-trigger-text {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ssf-icon {
	flex: none;
	width: 1.45em;
	height: 1.45em;
}

.ssf-trigger[hidden],
.ssf-dialog [hidden] {
	display: none;
}

.ssf-dialog {
	box-sizing: border-box;
	width: min(27rem, calc(100vw - 2rem));
	max-height: calc(100vh - 2rem);
	margin: auto;
	padding: 0;
	overflow: auto;
	border: 0;
	border-radius: 0.5rem;
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1f2937);
	text-align: start;
}

.ssf-dialog::backdrop {
	background: rgba(0, 0, 0, 0.55);
}

.ssf-body {
	position: relative;
	padding: 1.5rem;
}

.ssf-dialog p {
	margin: 0;
}

.ssf-close {
	position: absolute;
	top: 0.5rem;
	inset-inline-end: 0.5rem;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	background: none;
	color: inherit;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.ssf-title {
	margin: 0 0 1.25rem;
	padding-inline-end: 2.5rem;
	font-family: var(--font-heading, inherit);
	font-size: 1.25rem;
}

.ssf-form,
.ssf-result,
.ssf-fallback {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.ssf-result:not(:empty),
.ssf-fallback {
	margin-top: 1.25rem;
}

.ssf-measures {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
	align-items: start;
}

.ssf-field label,
.ssf-fit legend {
	display: block;
	margin-bottom: 0.35rem;
	padding: 0;
	font-size: 0.875rem;
}

.ssf-field input {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	padding: 0.6rem 0.75rem;
	border: 1px solid #d1d5db;
	border-radius: 0.375rem;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 1rem; /* Smaller text makes iOS zoom in. */
}

.ssf-field input[aria-invalid="true"] {
	border-color: #b91c1c;
}

.ssf-error {
	display: block;
	margin-top: 0.25rem;
	color: #b91c1c;
	font-size: 0.8125rem;
}

.ssf-fit {
	margin: 0;
	padding: 0;
	border: 0;
}

.ssf-fit-options {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.5rem;
}

.ssf-fit-options label {
	position: relative;
	cursor: pointer;
}

.ssf-fit-options input {
	position: absolute;
	opacity: 0;
}

.ssf-fit-options span {
	display: block;
	padding: 0.65rem 0.25rem;
	border: 1px solid #d1d5db;
	border-radius: 0.375rem;
	font-size: 0.875rem;
	text-align: center;
}

.ssf-fit-options input:checked + span {
	border-color: currentColor;
	box-shadow: inset 0 0 0 1px currentColor;
	font-weight: 600;
}

.ssf-fit-options input:focus-visible + span {
	outline: 2px solid var(--color-primary, currentColor);
	outline-offset: 2px;
}

.ssf-dialog .ssf-button {
	display: block;
	box-sizing: border-box;
	width: 100%;
	padding: 0.75rem 1rem;
	border: 2px solid var(--color-primary, #1f2937);
	border-radius: 0.375rem;
	font: inherit;
	font-weight: 500;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.ssf-dialog .ssf-primary {
	background: var(--color-primary, #1f2937);
	color: #fff;
}

.ssf-dialog .ssf-secondary {
	background: transparent;
	color: var(--color-primary, #1f2937);
}

.ssf-headline {
	font-family: var(--font-heading, inherit);
	font-size: 1.25rem;
	font-weight: 600;
}

.ssf-note,
.ssf-alternative {
	font-size: 0.9375rem;
}

.ssf-alternative {
	padding-top: 0.75rem;
	border-top: 1px solid #e5e7eb;
}

.ssf-table-wrap {
	overflow-x: auto;
}

.ssf-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.ssf-table caption {
	margin-bottom: 0.35rem;
	font-weight: 600;
	text-align: start;
}

.ssf-table th,
.ssf-table td {
	padding: 0.4rem 0.5rem;
	border: 1px solid #e5e7eb;
	text-align: start;
}

.ssf-dialog .ssf-privacy {
	margin-top: 1rem;
	font-size: 0.75rem;
	opacity: 0.7;
}
