/**
 * Public calculator styling.
 *
 * Theme-native: colours, fonts and spacing come from the Kadence custom properties when
 * they exist, with plain fallbacks so the page still looks right under any theme. Only
 * structure and the few calculator-specific pieces are defined here, all scoped under
 * .nomo-calculator-public.
 */

.nomo-calculator-public {
	--nomo-accent: var( --global-palette1, #0b5cab );
	--nomo-text: var( --global-palette4, #23282d );
	--nomo-muted: var( --global-palette5, #6b7280 );
	--nomo-border: var( --global-palette7, #dcdfe3 );
	--nomo-surface: var( --global-palette8, #f6f7f8 );
	--nomo-radius: 6px;

	/* Some page templates hand the shortcode the full viewport width, so keep our own
	   measure and inset rather than relying on a theme container being present. */
	max-width: var( --global-content-width, 1200px );
	margin-inline: auto;
	padding-inline: clamp( 1rem, 4vw, 2rem );

	color: var( --nomo-text );
	container-type: inline-size;
}

.nomo-calculator-public *,
.nomo-calculator-public *::before,
.nomo-calculator-public *::after {
	box-sizing: border-box;
}

.nomo-intro {
	margin: 0 0 1.5em;
}

/* -- Form ------------------------------------------------------------------------- */

.nomo-form {
	display: grid;
	gap: 1.25em 1.5em;
	grid-template-columns: 1fr;
	margin: 0 0 1.5em;
}

@container ( min-width: 600px ) {
	.nomo-form {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}

	.nomo-field--produsent,
	.nomo-field--stein {
		grid-column: 1 / -1;
	}
}

.nomo-field {
	display: flex;
	flex-direction: column;
	gap: 0.4em;
	min-width: 0;
}

.nomo-field > label {
	font-weight: 600;
	line-height: 1.3;
}

.nomo-field select,
.nomo-field input[ type='text' ] {
	width: 100%;
	max-width: 100%;
	padding: 0.55em 0.7em;
	border: 1px solid var( --nomo-border );
	border-radius: var( --nomo-radius );
	background: #fff;
	color: inherit;
	font: inherit;
	line-height: 1.4;
}

.nomo-field select:focus-visible,
.nomo-field input:focus-visible {
	outline: 2px solid var( --nomo-accent );
	outline-offset: 1px;
}

.nomo-stein-preview,
.nomo-takform-preview {
	display: flex;
	align-items: center;
	gap: 1em;
	margin: 0.5em 0 0;
	padding: 0.75em;
	border: 1px solid var( --nomo-border );
	border-radius: var( --nomo-radius );
	background: var( --nomo-surface );
}

.nomo-stein-preview img,
.nomo-takform-preview img {
	flex: 0 0 auto;
	width: 120px;
	height: auto;
	max-width: 40%;
	border-radius: 4px;
}

.nomo-stein-preview figcaption {
	display: flex;
	flex-direction: column;
	gap: 0.25em;
	min-width: 0;
}

.nomo-stein-preview figcaption > span {
	font-weight: 600;
}

/* Collapsible help, replacing the legacy checkbox-driven tabs. */

.nomo-info {
	margin: 0;
	font-size: 0.9em;
}

.nomo-info > summary {
	cursor: pointer;
	color: var( --nomo-accent );
	list-style: none;
}

.nomo-info > summary::-webkit-details-marker {
	display: none;
}

.nomo-info > summary::before {
	content: 'ⓘ ';
}

.nomo-info-body {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	margin-top: 0.5em;
	padding: 0.75em;
	border-radius: var( --nomo-radius );
	background: var( --nomo-surface );
}

.nomo-info-body img {
	max-width: 271px;
	height: auto;
}

.nomo-info-body p {
	flex: 1 1 16em;
	margin: 0;
}

/* -- Status and results ------------------------------------------------------------ */

.nomo-status {
	margin: 0 0 1em;
	color: var( --nomo-muted );
}

.nomo-status.is-error {
	color: #a8071a;
	font-weight: 600;
}

.nomo-status.is-pending {
	opacity: 0.7;
}

.nomo-result-title {
	margin-top: 0;
}

.nomo-summary {
	display: grid;
	grid-template-columns: minmax( 0, 3fr ) minmax( 0, 1fr );
	gap: 0;
	margin: 0 0 2em;
}

.nomo-summary dt,
.nomo-summary dd {
	margin: 0;
	padding: 0.5em 0;

	/* Deliberately currentColor, not --nomo-border: on Kadence's palette that token is
	   #edf2f7 against an #eaf8ff page, so the rules were invisible. */
	border-bottom: 1px solid currentColor;
}

.nomo-summary dd {
	font-weight: 700;
	text-align: right;
}

.nomo-note {
	padding: 0.9em 1.1em;
	border-left: 4px solid var( --nomo-accent );
	border-radius: 0 var( --nomo-radius ) var( --nomo-radius ) 0;
	background: var( --nomo-surface );
}

.nomo-product {
	margin: 0 0 2.5em;
	padding-top: 1em;
	border-top: 2px solid var( --nomo-border );
}

.nomo-product h3 {
	margin-top: 0;
}

.nomo-unusable {
	color: #a8071a;
}

.nomo-metrics {
	display: grid;
	gap: 0.75em 1.5em;
	grid-template-columns: repeat( auto-fit, minmax( 12em, 1fr ) );
	margin: 0 0 1.5em;
	padding: 0;
	list-style: none;
}

.nomo-metrics li {
	display: flex;
	flex-direction: column;
	gap: 0.15em;
	padding: 0.75em;
	border-radius: var( --nomo-radius );
	background: var( --nomo-surface );
}

.nomo-metric-label {
	color: var( --nomo-muted );
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.nomo-metric-value {
	font-size: 1.15em;
	font-weight: 700;
}

.nomo-info--inline {
	margin-top: 0.35em;
	font-size: 0.8em;
}

.nomo-info--inline p {
	margin: 0.4em 0 0;
	color: var( --nomo-muted );
}

.nomo-info-figures {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin-top: 0.6em;
}

.nomo-info-figures img {
	max-width: 130px;
	height: auto;
}

.nomo-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em 1.5em;
	margin: 0 0 1em;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

.nomo-legend li {
	display: flex;
	align-items: center;
	gap: 0.5em;
}

.nomo-swatch {
	display: inline-block;
	width: 15px;
	height: 12px;
	border: 1px solid #660000;
	flex: 0 0 auto;
}

/* The diagram scrolls inside its own box rather than widening the page. */

.nomo-diagram {
	overflow-x: auto;
	margin: 0 0 1em;
	padding: 0.75em;
	border: 1px solid var( --nomo-border );
	border-radius: var( --nomo-radius );
	background: #fff;
}

.nomo-svg {
	display: block;
	max-width: 100%;
	height: auto;
}

.nomo-svg-label {
	font-family: Helvetica, Arial, sans-serif;
	font-size: 9px;
	fill: #000;
}

.nomo-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75em;
	margin: 0 0 1.5em;
}

.nomo-button {
	padding: 0.6em 1.1em;
	border: 1px solid var( --nomo-accent );
	border-radius: var( --nomo-radius );
	background: var( --nomo-accent );
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.nomo-button:hover,
.nomo-button:focus-visible {
	filter: brightness( 1.1 );
}

.nomo-button--ghost {
	background: transparent;
	color: var( --nomo-accent );
}

.nomo-video-liste {
	display: flex;
	flex-wrap: wrap;
	gap: 1em;
	margin-top: 1em;
}

.nomo-video {
	position: relative;
	flex: 1 1 18em;
	max-width: 560px;
	margin: 0 0 1em;
	aspect-ratio: 16 / 9;
}

.nomo-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.nomo-lekteavstand {
	margin: 0 0 1.5em;
}

.nomo-lekteavstand > summary {
	cursor: pointer;
	color: var( --nomo-accent );
	font-weight: 600;
}

.nomo-lekteavstand-body {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.5em;
	margin-top: 0.75em;
}

.nomo-lekteavstand-body img {
	max-width: min( 100%, 320px );
	height: auto;
}

.nomo-ansvar,
.nomo-copyright {
	color: var( --nomo-muted );
	font-size: 0.85em;
}

/* -- Print -------------------------------------------------------------------------- */

@media print {
	.nomo-calculator-public .nomo-actions,
	.nomo-calculator-public .nomo-video-liste,
	.nomo-calculator-public .nomo-video,
	.nomo-calculator-public .nomo-info,
	.nomo-calculator-public .nomo-intro,
	.nomo-calculator-public .nomo-status {
		display: none !important;
	}

	.nomo-calculator-public .nomo-diagram {
		overflow: visible;
		border: 0;
		padding: 0;
	}

	.nomo-calculator-public .nomo-lekteavstand > summary {
		display: none;
	}

	.nomo-calculator-public .nomo-lekteavstand[ open ] .nomo-lekteavstand-body,
	.nomo-calculator-public .nomo-lekteavstand .nomo-lekteavstand-body {
		display: flex;
	}

	.nomo-calculator-public .nomo-product {
		break-inside: avoid;
	}
}
