/**
 * simplydwell/mortgage-calculator — card styles (Figma "Calculator").
 *
 * Translucent card (rgba(255,255,255,0.05)) with a gold top hairline, a custom
 * price slider (sand track + brand-orange fill + square white/orange thumb), two
 * centred numeric fields, a left-aligned loan-term toggle and a highlighted result
 * panel with a gold edge bar and a gradient amount.
 *
 * Figma reference (desktop card 588px): Lexend throughout; title 20/28 #FFF; sub
 * 14/20 500 #C8C8C8; labels 14/20 500 #C8C8C8; price 24/32 700 #FFF; term/field
 * text 14/20 700 #C8C8C8; result amount 24/32 700 gradient; note 10/15 700 #C8C8C8.
 *
 * Accent + gradient + card bg come in as CSS custom properties from render.php, so
 * each instance recolours from the sidebar; the slider fill % is set by view.js.
 */

.sd-calc {
	--sd-calc-accent: #ea6e24;
	--sd-calc-grad-from: #ea6e24;
	--sd-calc-grad-to: #e2bb61;
	--sd-calc-bg: rgba( 255, 255, 255, 0.05 );
	--sd-calc-track: #faf8f5;
	--sd-calc-fill: 20%;
	width: 100%;
	max-width: 588px;
	background: var( --sd-calc-bg );
	border-top: 1px solid #e2bb61;
	padding: clamp( 24px, 4vw, 48px ) clamp( 20px, 3vw, 24px );
	font-family: 'Lexend', system-ui, sans-serif;
	box-sizing: border-box;
}

.sd-calc * {
	box-sizing: border-box;
}

.sd-calc__title {
	margin: 0;
	color: #fff;
	font-size: 20px;
	font-weight: 700;
	line-height: 28px;
}

.sd-calc__sub {
	margin: 4px 0 32px;
	color: #c8c8c8;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
}

.sd-calc__label {
	display: block;
	margin: 0 0 8px;
	color: #c8c8c8;
	font-size: 14px;
	font-weight: 500;
	line-height: 20px;
}

.sd-calc__price {
	display: block;
	margin: 0 0 20px;
	color: #fff;
	font-size: 24px;
	font-weight: 700;
	line-height: 32px;
}

/* ── Price slider: sand track, orange fill, square thumb ─────────────────────── */
.sd-calc__slider {
	display: block;
	width: 100%;
	height: 7px;
	margin: 0 0 32px;
	-webkit-appearance: none;
	appearance: none;
	background: linear-gradient(
		to right,
		var( --sd-calc-accent ) 0%,
		var( --sd-calc-accent ) var( --sd-calc-fill, 20% ),
		var( --sd-calc-track ) var( --sd-calc-fill, 20% ),
		var( --sd-calc-track ) 100%
	);
	cursor: pointer;
	border-radius: 10px;
}

.sd-calc__slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 17px;
	height: 17px;
	background: #faf8f5;
	border: 1.5px solid var( --sd-calc-accent );
	cursor: pointer;
	border-radius: 100%;
}

.sd-calc__slider::-moz-range-thumb {
	width: 17px;
	height: 17px;
	background: #faf8f5;
	border: 1.5px solid var( --sd-calc-accent );
	border-radius: 100%;
	cursor: pointer;
}

.sd-calc__slider::-moz-range-track {
	height: 7px;
	background: var( --sd-calc-track );
}

.sd-calc__slider::-moz-range-progress {
	height: 7px;
	background: var( --sd-calc-accent );
}

.sd-calc__slider:focus-visible {
	outline: 2px solid var( --sd-calc-accent );
	outline-offset: 6px;
}

/* ── Down payment / interest rate fields ─────────────────────────────────────── */
.sd-calc__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
	margin-bottom: 32px;
	align-items: start;
}

/* Down-payment label + unit (%/$) toggle share one row so the toggle sits inline with
   the label; the label keeps its 8px gap above the input via the row's own margin. */
.sd-calc__field-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 8px;
}

.sd-calc__field-head .sd-calc__label {
	margin: 0;
}

.sd-calc__unit {
	display: inline-flex;
	flex: none;
	border: 0.5px solid #c8c8c8;
}

.sd-calc__unit-btn {
	min-width: 30px;
	padding: 2px 8px;
	background: transparent;
	border: 0;
	color: #c8c8c8;
	font-family: inherit;
	font-size: 13px;
	font-weight: 700;
	line-height: 20px;
	cursor: pointer;
	transition: background 120ms, color 120ms;
}

.sd-calc__unit-btn + .sd-calc__unit-btn {
	border-left: 0.5px solid #c8c8c8;
}

.sd-calc__unit-btn:hover,
.sd-calc__unit-btn.is-active {
	background: var( --sd-calc-accent );
	color: #fff;
}

/* The synced "= $X" / "= Y%" equivalent under the down-payment input. */
.sd-calc__hint {
	display: block;
	margin: 6px 0 0;
	color: #c8c8c8;
	font-size: 12px;
	font-weight: 500;
	line-height: 16px;
}

.sd-calc__input {
	display: block;
	width: 100%;
	height: 36px;
	padding: 8px 16px;
	background: rgba( 255, 255, 255, 0.05 );
	border: 0.5px solid #c8c8c8;
	border-radius: 0;
	color: #c8c8c8;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	text-align: left;
}

.sd-calc__input:focus {
	outline: none;
	border-color: var( --sd-calc-accent );
	color: #fff;
}

/* ── Loan-term toggle ────────────────────────────────────────────────────────── */
.sd-calc__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 24px;
	margin-bottom: 32px;
}

.sd-calc__term {
	padding: 8px 16px;
	min-height: 36px;
	background: transparent;
	border: 0.5px solid #c8c8c8;
	border-radius: 0;
	color: #c8c8c8;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	cursor: pointer;
	transition: background 120ms, color 120ms, border-color 120ms;
}

.sd-calc__term:hover,
.sd-calc__term.is-active {
	background: var( --sd-calc-accent );
	border-color: var( --sd-calc-accent );
	color: #fff;
}

/* ── Result panel ────────────────────────────────────────────────────────────── */
.sd-calc__result {
	padding: 24px;
	background: rgba( 255, 255, 255, 0.05 );
	border-left: 3px solid #dca23b;
	border-radius: 0;
}

.sd-calc__result .sd-calc__label {
	margin: 0 0 4px;
}

.sd-calc__amount {
	display: inline-flex;
	margin: 0 0 7px;
	font-size: 24px;
	font-weight: 700;
	line-height: 32px;
	background: linear-gradient( 90deg, var( --sd-calc-grad-from ) 0%, var( --sd-calc-grad-to ) 100% );
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
}

.sd-calc__note {
	margin: 0;
	color: #c8c8c8;
	font-size: 10px;
	font-weight: 700;
	line-height: 15px;
}

/* ── Budget CTA (below the result) ───────────────────────────────────────────── */
.sd-calc__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	margin-top: 16px;
	padding: 15px 20px;
	background: var( --sd-calc-accent );
	color: #fff;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	text-decoration: none;
	transition: background 150ms ease, transform 150ms ease;
}

.sd-calc__cta:hover,
.sd-calc__cta:focus-visible {
	background: #d75b14;
	color: #fff;
	transform: translateY( -1px );
	outline: none;
}

.sd-calc__cta-arrow {
	flex: none;
	transition: transform 150ms ease;
}

.sd-calc__cta:hover .sd-calc__cta-arrow,
.sd-calc__cta:focus-visible .sd-calc__cta-arrow {
	transform: translateX( 3px );
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
	.sd-calc__grid {
		grid-template-columns: 1fr;
		gap: 20px;
	}
	.sd-calc__terms {
		gap: 12px;
	}
	.sd-calc__term {
		flex: 1 1 auto;
		text-align: center;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.sd-calc__term {
		transition: none;
	}
}
