/**
 * BuildFlex Besparelsesberegner
 *
 * Uses the site's own Breakdance design tokens (--bf-*) with hardcoded
 * fallbacks, so the calculator also looks right outside the theme.
 */

.bfc {
	--bfc-white: var( --bf-white, #fff );
	--bfc-light: var( --bf-light-green, #f7f9f1 );
	--bfc-stroke: var( --bf-stroke, #e6ecd8 );
	--bfc-stroke-strong: #cfe0b6;
	--bfc-grey: var( --bf-grey, #5f6c60 );
	--bfc-dark: var( --bf-dark-green, #0e3328 );
	--bfc-brand: var( --bf-brand, #aec74f );
	--bfc-green: var( --bf-green, #5e9a5a );
	--bfc-body-font: var( --bde-body-font-family, "Hanken Grotesk", sans-serif );
	--bfc-head-font: var( --bde-heading-font-family, "Bricolage Grotesque", sans-serif );
	--bfc-radius: 16px;
	--bfc-radius-sm: 6px;

	max-width: var( --bde-section-width, 1120px );
	margin-inline: auto;
	font-family: var( --bfc-body-font );
	font-size: 16px;
	line-height: 1.5;
	color: var( --bfc-grey );
	-webkit-text-size-adjust: 100%;
}

.bfc *,
.bfc *::before,
.bfc *::after {
	box-sizing: border-box;
}

/* ---------------------------------------------------------------- Head */

.bfc__head {
	margin-bottom: 24px;
	max-width: 46em;
}

.bfc__title {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	color: var( --bfc-dark );
	font-size: clamp( 1.75rem, 3.6vw, 2.5rem );
	line-height: 1.15;
	margin: 0 0 12px;
}

.bfc__intro {
	margin: 0;
	font-size: 1.0625rem;
}

/* ---------------------------------------------------------------- Card */

.bfc__card {
	background: var( --bfc-light );
	border: 2px solid var( --bfc-stroke-strong );
	border-radius: var( --bfc-radius );
	padding: 32px;
}

.bfc__legend {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: 0.8125rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --bfc-dark );
	margin: 0 0 20px;
}

.bfc__grid {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 220px, 1fr ) );
	gap: 20px 24px;
}

/* Step 1 sits in a fixed two-column rhythm: 2 fields, 2 fields, then the
   price field alone on the last row. */
.bfc__form .bfc__grid {
	grid-template-columns: repeat( 2, 1fr );
}

.bfc__grid--adv {
	grid-template-columns: repeat( auto-fit, minmax( 190px, 1fr ) );
	gap: 16px 20px;
}

.bfc__field--wide {
	grid-column: 1 / -1;
}

/* --------------------------------------------------------------- Field */

.bfc__label {
	display: block;
	font-weight: 500;
	color: var( --bfc-dark );
	font-size: 0.9375rem;
	margin-bottom: 8px;
}

.bfc__field--small .bfc__label {
	font-size: 0.875rem;
	font-weight: 400;
}

.bfc__control {
	position: relative;
	display: flex;
	align-items: center;
}

.bfc__input {
	width: 100%;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 500;
	color: var( --bfc-dark );
	background: var( --bfc-white );
	border: 1px solid var( --bfc-stroke-strong );
	border-radius: var( --bfc-radius-sm );
	padding: 12px 16px;
	margin: 0;
	appearance: none;
	-webkit-appearance: none;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Marks the fields the visitor is meant to fill in – the green cells of
   the original spreadsheet. */
.bfc__form .bfc__input {
	border-left: 3px solid var( --bfc-brand );
}

.bfc__input:focus {
	outline: none;
	border-color: var( --bfc-brand );
	box-shadow: 0 0 0 3px rgba( 174, 199, 79, 0.35 );
}

.bfc__control--select::after {
	content: "";
	position: absolute;
	right: 16px;
	width: 9px;
	height: 9px;
	border-right: 2px solid var( --bfc-dark );
	border-bottom: 2px solid var( --bfc-dark );
	transform: translateY( -2px ) rotate( 45deg );
	pointer-events: none;
}

select.bfc__input {
	padding-right: 40px;
	cursor: pointer;
}

.bfc__unit {
	position: absolute;
	right: 16px;
	font-size: 0.875rem;
	color: var( --bfc-grey );
	pointer-events: none;
}

/* Room for the unit suffix. The class is set by PHP; :has() covers markup
   that is built client-side. */
.bfc__control--unit .bfc__input,
.bfc__control:has( .bfc__unit ) .bfc__input {
	padding-right: 76px;
}

.bfc__hint {
	margin: 6px 0 0;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var( --bfc-grey );
}

/* ------------------------------------------------------------- Actions */

.bfc__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 28px;
}

.bfc__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	padding: 16px 32px;
	border-radius: 800px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}

.bfc__btn--primary {
	background: var( --bfc-brand );
	color: var( --bfc-dark );
}

.bfc__btn--primary:hover,
.bfc__btn--primary:focus-visible {
	background: var( --bfc-dark );
	color: var( --bfc-white );
}

.bfc__btn--ghost {
	background: transparent;
	color: var( --bfc-dark );
	border-color: var( --bfc-stroke-strong );
	padding: 12px 24px;
	font-size: 0.9375rem;
}

.bfc__btn--ghost:hover,
.bfc__btn--ghost:focus-visible {
	border-color: var( --bfc-dark );
}

.bfc__error {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 500;
	color: #b91c1c;
}

.bfc__error.is-soft {
	color: var( --bfc-grey );
	font-weight: 400;
}

/* -------------------------------------------------------------- Result */

.bfc__result {
	margin-top: 28px;
}

.bfc__switch {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 16px;
	margin-bottom: 20px;
}

.bfc__switch-label {
	font-size: 0.875rem;
	font-weight: 500;
	color: var( --bfc-grey );
}

.bfc__switch-btns {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.bfc__pill {
	font-family: inherit;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1;
	color: var( --bfc-dark );
	background: var( --bfc-white );
	border: 1px solid var( --bfc-stroke-strong );
	border-radius: 800px;
	padding: 11px 20px;
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease;
}

.bfc__pill:hover {
	border-color: var( --bfc-dark );
}

.bfc__pill.is-active {
	background: var( --bfc-dark );
	border-color: var( --bfc-dark );
	color: var( --bfc-white );
}

/* Hero – the number the visitor came for. */

.bfc__hero {
	background: var( --bfc-dark );
	border-radius: var( --bfc-radius );
	padding: 40px;
	text-align: center;
	color: var( --bfc-white );
}

.bfc__hero-label {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: rgba( 255, 255, 255, 0.75 );
}

.bfc__hero-value {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: clamp( 2.5rem, 8vw, 4.5rem );
	line-height: 1.05;
	color: var( --bfc-brand );
	margin: 8px 0 0;
}

.bfc__result.is-negative .bfc__hero-value {
	color: #f4b6ab;
}

.bfc__hero-sub {
	margin: 8px 0 0;
	font-size: 1.0625rem;
	color: rgba( 255, 255, 255, 0.85 );
}

.bfc__hero-per {
	display: inline-block;
	margin: 16px 0 0;
	padding: 8px 16px;
	border-radius: 800px;
	background: rgba( 255, 255, 255, 0.12 );
	font-size: 0.9375rem;
	font-weight: 500;
}

/* Tiles */

.bfc__tiles {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
	gap: 16px;
	margin-top: 16px;
}

.bfc__tile {
	background: var( --bfc-white );
	border: 1px solid var( --bfc-stroke );
	border-radius: var( --bfc-radius );
	padding: 24px;
}

.bfc__tile-label {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 500;
	color: var( --bfc-grey );
}

.bfc__tile-value {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: 1.75rem;
	line-height: 1.15;
	color: var( --bfc-dark );
	margin: 6px 0 4px;
}

.bfc__tile-sub {
	margin: 0;
	font-size: 0.8125rem;
	color: var( --bfc-grey );
}

/* ------------------------------------------------------------- Details */

.bfc__details {
	margin-top: 16px;
	background: var( --bfc-white );
	border: 1px solid var( --bfc-stroke );
	border-radius: var( --bfc-radius );
	padding: 8px 24px;
}

.bfc__summary {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: 1rem;
	color: var( --bfc-dark );
	cursor: pointer;
	list-style: none;
	padding: 16px 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.bfc__summary::-webkit-details-marker {
	display: none;
}

.bfc__summary::before {
	content: "";
	flex: 0 0 auto;
	width: 8px;
	height: 8px;
	border-right: 2px solid var( --bfc-brand );
	border-bottom: 2px solid var( --bfc-brand );
	transform: rotate( -45deg );
	transition: transform 200ms ease;
}

.bfc__details[ open ] > .bfc__summary::before {
	transform: rotate( 45deg );
}

.bfc__table-wrap {
	overflow-x: auto;
	padding-bottom: 16px;
}

.bfc__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
}

.bfc__table th,
.bfc__table td {
	text-align: right;
	padding: 10px 8px;
	border-bottom: 1px solid var( --bfc-stroke );
	white-space: nowrap;
}

.bfc__table thead th {
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var( --bfc-grey );
	font-weight: 500;
}

.bfc__table tbody th {
	text-align: left;
	font-weight: 400;
	color: var( --bfc-grey );
	white-space: normal;
	min-width: 220px;
}

.bfc__table td {
	color: var( --bfc-dark );
}

.bfc__table .is-sum th,
.bfc__table .is-sum td {
	font-weight: 600;
	color: var( --bfc-dark );
}

.bfc__table .is-total th,
.bfc__table .is-total td {
	font-weight: 700;
	color: var( --bfc-dark );
	background: var( --bfc-light );
	border-bottom-color: var( --bfc-stroke-strong );
}

.bfc__note {
	margin: 16px 0 0;
	padding: 16px 20px;
	background: var( --bfc-light );
	border-left: 3px solid var( --bfc-brand );
	border-radius: var( --bfc-radius-sm );
	font-size: 0.875rem;
	line-height: 1.5;
}

.bfc__cta {
	margin: 24px 0 0;
}

/* ------------------------------------------------------------ Advanced */

.bfc__advanced {
	margin-top: 28px;
	border-top: 1px solid var( --bfc-stroke );
	padding-top: 24px;
}

.bfc__adv-toggle {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: 1rem;
	color: var( --bfc-dark );
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
}

.bfc__adv-toggle[ disabled ] {
	cursor: not-allowed;
	color: var( --bfc-grey );
	opacity: 0.65;
}

.bfc__adv-icon {
	position: relative;
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var( --bfc-light );
	border: 1px solid var( --bfc-stroke-strong );
}

.bfc__adv-icon::before,
.bfc__adv-icon::after {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 12px;
	height: 2px;
	background: var( --bfc-dark );
	transform: translate( -50%, -50% );
	transition: opacity 200ms ease;
}

.bfc__adv-icon::after {
	transform: translate( -50%, -50% ) rotate( 90deg );
}

.bfc__adv-toggle[ aria-expanded="true" ] .bfc__adv-icon::after {
	opacity: 0;
}

.bfc__adv-locked {
	margin: 10px 0 0;
	font-size: 0.875rem;
	color: var( --bfc-grey );
}

.bfc__adv-body {
	margin-top: 24px;
}

.bfc__adv-intro {
	margin: 0 0 20px;
	font-size: 0.9375rem;
}

.bfc__group {
	border: 1px solid var( --bfc-stroke );
	border-radius: var( --bfc-radius );
	padding: 20px 24px 24px;
	margin: 0 0 16px;
	background: var( --bfc-white );
}

.bfc__group-title {
	font-family: var( --bfc-head-font );
	font-weight: 700;
	font-size: 0.8125rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --bfc-dark );
	padding: 0 8px;
	margin-left: -8px;
}

.bfc__adv-actions {
	margin-top: 8px;
}

.bfc__details--sources {
	margin-top: 16px;
	background: var( --bfc-light );
	border-color: var( --bfc-stroke-strong );
}

.bfc__sources {
	margin: 0 0 20px;
	font-size: 0.8125rem;
	line-height: 1.55;
}

.bfc__disclaimer {
	margin: 24px 0 0;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var( --bfc-grey );
}

/* ---------------------------------------------------------- Responsive */

@media ( max-width: 640px ) {
	.bfc__card {
		padding: 24px 20px;
	}

	.bfc__form .bfc__grid {
		grid-template-columns: 1fr;
	}

	.bfc__hero {
		padding: 28px 20px;
	}

	.bfc__details,
	.bfc__group {
		padding-inline: 20px;
	}

	.bfc__btn {
		width: 100%;
	}

	.bfc__table tbody th {
		min-width: 160px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.bfc * {
		transition: none !important;
	}
}
