/* Mortgage Calculator.
 *
 * Written for the markup as the SERVER prints it — a worked example with every
 * disclosure in place — because that is what a visitor gets if the script never
 * runs. Nothing here hides content that the script is needed to reveal. The
 * only things that wait for it are controls that cannot work without it, and
 * they are hidden until the script marks the block ready with `.zd-mc-js`, which
 * is the safe direction: a failed script leaves a readable example, never a
 * blank panel.
 *
 * Every colour, radius, height, shadow and transition is a theme token, so a
 * style variation reshapes this block the way it reshapes every other one.
 *
 * TWO HALVES, TWO SHAPE RULES. The light form half is for entering figures,
 * and every control in it — option cards, the Repayment / Interest only
 * toggle, the deposit pills, the tinted rate field — takes ONE shape,
 * --zd-mc-field-radius, whatever the variation does with its chips and
 * inputs. A form where some choices are lozenges and others are boxes reads as
 * two kinds of control when there is one, and a variation with pill inputs
 * turned a two-line option into a lozenge. The dark results half is the site
 * talking — the call to action — so it follows the theme exactly:
 * --zd-btn-radius, the site's button shape.
 *
 * The only values of its own are the control boundary (the theme's
 * --zd-border is decorative, well under the 3:1 a control needs) and the panel
 * shades mixed from the palette.
 *
 * The results panel is the INVERSE of the page —
 * foreground as its ground, background as its text — which keeps it readable
 * in all five style variations and under any client palette without a second
 * set of colours to maintain. Secondary shades are mixed from those two, so they
 * move with them.
 *
 * Stacks on the BLOCK's width, not the viewport's: a calculator in a narrow
 * column on a wide screen needs the stacked layout just as much as one on a
 * phone. */

.zerodigital-mortgage-calculator {
	--zd-mc-accent: var(--wp--preset--color--primary, #a8125f);
	--zd-mc-on-accent: var(--wp--preset--color--background, #fff);
	--zd-mc-fg: var(--wp--preset--color--foreground, #1c1418);
	--zd-mc-bg: var(--wp--preset--color--background, #fff);
	--zd-mc-muted: var(--wp--preset--color--muted, #5e4b54);
	--zd-mc-card: var(--zd-card-bg, var(--zd-mc-bg));

	/* A boundary a control can be seen by: at least 3:1 against the card, the
	 * WCAG 1.4.11 floor. The design board's 1.62:1 outline was below it. */
	--zd-mc-boundary: color-mix(in srgb, var(--zd-mc-fg) 55%, var(--zd-mc-bg));
	--zd-mc-track: color-mix(in srgb, var(--zd-mc-accent) 16%, var(--zd-mc-bg));
	--zd-mc-tint: color-mix(in srgb, var(--zd-mc-accent) 7%, var(--zd-mc-bg));

	/* Muted text that sits on the tint. The palette's muted colour is chosen to
	 * clear 4.5:1 on the page background with little to spare, and the tint
	 * takes that away: measured live at 4.48:1. Pulled a quarter of the way to
	 * the foreground, which only ever raises contrast on a light surface. */
	--zd-mc-muted-strong: color-mix(in srgb, var(--zd-mc-muted) 75%, var(--zd-mc-fg));

	--zd-mc-panel: var(--zd-mc-fg);
	--zd-mc-panel-text: var(--zd-mc-bg);
	--zd-mc-panel-soft: color-mix(in srgb, var(--zd-mc-bg) 80%, var(--zd-mc-fg));
	--zd-mc-panel-rule: color-mix(in srgb, var(--zd-mc-bg) 18%, transparent);
	--zd-mc-panel-raise: color-mix(in srgb, var(--zd-mc-bg) 9%, var(--zd-mc-fg));

	/* The capital / interest split, on the dark panel. NOT derived from the
	 * primary: the panel IS the foreground colour, and a site whose primary is
	 * that same dark (Broker Studio's Ink, for one) turned both segments into
	 * greys 1.17:1 apart — no split at all. Even Aurora's green primary only
	 * managed 1.75:1.
	 *
	 * Capital takes the theme's ACCENT, its emphasis colour, lightened toward
	 * the panel text because every variation tunes its accent for light
	 * grounds; interest is a dark step off the panel. Solved across all five
	 * variations and the Broker Studio palette for the most accent that still
	 * holds: capital vs interest at least 3.25:1 (the WCAG 1.4.11 line for
	 * adjacent parts of a graphic), interest vs panel at least 1.7:1 so its
	 * key stays visible. tests/test-mortgage-split.php recomputes both from
	 * these two lines and every variation's palette, so a nudge that breaks
	 * one fails there. */
	--zd-mc-capital: color-mix(in srgb, var(--wp--preset--color--accent, #c4263c) 55%, var(--zd-mc-panel-text));
	--zd-mc-interest: color-mix(in srgb, var(--zd-mc-panel-text) 18%, var(--zd-mc-panel));

	/* Every control in the form half: the card radius stepped down so the
	 * corners nest inside the card rather than match it. Derived from the card,
	 * not from --zd-input-radius or --zd-chip-radius, which a variation may set
	 * to a pill; a variation with square cards still gets square fields. */
	--zd-mc-field-radius: calc(var(--zd-card-radius, 0.75rem) * 0.6);
	--zd-mc-control-h: var(--zd-btn-min-h, 2.875rem);

	container-type: inline-size;
	padding: clamp(var(--wp--preset--spacing--xl, 3rem), 5vw, var(--wp--preset--spacing--2-xl, 4rem)) var(--zd-section-gutter, var(--wp--preset--spacing--md, 1.5rem));
}

.zerodigital-mortgage-calculator__container {
	max-width: var(--zd-content-max, calc(var(--wp--style--global--wide-size, 1600px) - 2 * var(--wp--preset--spacing--md, 1.5rem)));
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--lg, 2rem);
}

.zerodigital-mortgage-calculator__heading {
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: var(--zd-step-h2, clamp(1.9rem, 1.35rem + 2.2vw, 2.9rem));
	line-height: 1.1;
	letter-spacing: -0.015em;
	text-wrap: balance;
	margin: 0 0 var(--wp--preset--spacing--xs, 0.75rem);
}

.zerodigital-mortgage-calculator__intro {
	max-width: 62ch;
	margin: 0;
	font-size: var(--zd-step-lede, clamp(1.0625rem, 1rem + 0.45vw, 1.25rem));
	line-height: 1.6;
	color: var(--zd-mc-muted);
}

/* --------------------------------------------------------------------------
 * The card: controls beside results, stacking when the block is narrow.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
	border-radius: var(--zd-card-radius, var(--wp--custom--radius--lg, 1.25rem));
	overflow: clip;
	border: var(--zd-border, 1px solid color-mix(in srgb, var(--zd-mc-fg) 12%, transparent));
}

@container (max-width: 52rem) {
	.zerodigital-mortgage-calculator__card {
		grid-template-columns: minmax(0, 1fr);
	}
}

.zerodigital-mortgage-calculator__controls {
	background: var(--zd-mc-card);
	padding: clamp(var(--wp--preset--spacing--md, 1.5rem), 3.5cqi, var(--wp--preset--spacing--xl, 2.5rem));
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--md, 1.5rem);
	min-width: 0;
}

.zerodigital-mortgage-calculator__results {
	background: var(--zd-mc-panel);
	color: var(--zd-mc-panel-text);
	padding: clamp(var(--wp--preset--spacing--md, 1.5rem), 3.5cqi, var(--wp--preset--spacing--xl, 2.5rem));
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--sm, 1rem);
	min-width: 0;
}

/* A class that sets `display` beats the browser's own [hidden] rule, so the
 * non-resident option, the note and the split bar would stay on screen when
 * the script hides them. This puts `hidden` back in charge. */
.zerodigital-mortgage-calculator [hidden] {
	display: none;
}

/* Controls that cannot work without the script: hidden until it says it ran. */
.zerodigital-mortgage-calculator__js-only {
	display: none;
}

.zd-mc-js .zerodigital-mortgage-calculator__js-only {
	display: flex;
}

.zd-mc-js .zerodigital-mortgage-calculator__reset.zerodigital-mortgage-calculator__js-only {
	display: inline-block;
}

/* --------------------------------------------------------------------------
 * Fields.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__field {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--2-xs, 0.5rem);
}

.zerodigital-mortgage-calculator__field-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--wp--preset--spacing--sm, 1rem);
}

.zerodigital-mortgage-calculator__field-label {
	font-weight: 600;
	font-size: 1rem;
	padding: 0;
}

.zerodigital-mortgage-calculator__num {
	width: 9.5ch;
	min-width: 0;
	flex-shrink: 0;
	padding: 0.2rem 0;
	border: 0;
	border-bottom: 1px dashed var(--zd-mc-boundary);
	background: transparent;
	color: var(--zd-mc-accent);
	font: inherit;
	font-size: 1.125rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
	-moz-appearance: textfield;
	appearance: textfield;
}

.zerodigital-mortgage-calculator__num::-webkit-outer-spin-button,
.zerodigital-mortgage-calculator__num::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.zerodigital-mortgage-calculator__num::placeholder {
	color: var(--zd-mc-muted);
	opacity: 1;
}

.zerodigital-mortgage-calculator__num:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, #c9922a);
	outline-offset: 2px;
	border-bottom-color: transparent;
}

.zd-mc-js .zerodigital-mortgage-calculator__slider-slot + .zerodigital-mortgage-calculator__bounds {
	margin-top: -1.125rem;
}

.zerodigital-mortgage-calculator__bounds {
	display: flex;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--xs, 0.75rem);
	font-size: 0.875rem;
	color: var(--zd-mc-muted);
}

.zerodigital-mortgage-calculator__bound-mid {
	color: var(--zd-mc-accent);
	font-weight: 700;
}

.zerodigital-mortgage-calculator__bound-hint {
	color: var(--zd-mc-muted-strong);
	text-align: center;
}

.zerodigital-mortgage-calculator__field--rate {
	padding: var(--wp--preset--spacing--sm, 1rem);
	margin-inline: calc(-1 * var(--wp--preset--spacing--sm, 1rem));
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-tint);
}

.zerodigital-mortgage-calculator__help {
	margin: var(--wp--preset--spacing--2-xs, 0.25rem) 0 0;
	font-size: 0.875rem;
	line-height: 1.55;
	color: var(--zd-mc-muted-strong);
}

/* The slider view.js creates. The visible track is 6px; the hit area is not.
 * WCAG 2.2's 2.5.8 wants a 24px minimum target, and a finger wants more, so the
 * input itself is 44px tall and the thumb is sized to match — the design
 * board's 30px thumb on the phone was under both. */
.zerodigital-mortgage-calculator__range {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 44px;
	margin: -12px 0;
	background: transparent;
	cursor: pointer;
	--zd-mc-fill: 0%;
}

.zerodigital-mortgage-calculator__range::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 3px;
	background: linear-gradient(to right, var(--zd-mc-accent) 0 var(--zd-mc-fill), var(--zd-mc-track) var(--zd-mc-fill) 100%);
}

.zerodigital-mortgage-calculator__range::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 28px;
	height: 28px;
	margin-top: -11px;
	border-radius: 50%;
	background: var(--zd-mc-bg);
	border: 4px solid var(--zd-mc-accent);
	box-shadow: var(--zd-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.25));
}

.zerodigital-mortgage-calculator__range::-moz-range-track {
	height: 6px;
	border-radius: 3px;
	background: var(--zd-mc-track);
}

.zerodigital-mortgage-calculator__range::-moz-range-progress {
	height: 6px;
	border-radius: 3px;
	background: var(--zd-mc-accent);
}

.zerodigital-mortgage-calculator__range::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--zd-mc-bg);
	border: 4px solid var(--zd-mc-accent);
}

/* --------------------------------------------------------------------------
 * Toggles, pills and choices. State is read from aria-pressed / :checked and
 * nothing inline can outrank it — see the note in parts/repayment.php.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__seg {
	align-self: flex-start;
	gap: 4px;
	padding: 4px;
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-tint);
	border: 1px solid var(--zd-mc-boundary);
	max-width: 100%;
}

.zerodigital-mortgage-calculator__seg-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: var(--zd-mc-control-h);
	padding: 0 1.25rem;
	border: 0;
	border-radius: max(0px, calc(var(--zd-mc-field-radius) - 4px));
	background: transparent;
	color: var(--zd-mc-fg);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 700;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color var(--zd-ease, 180ms ease), color var(--zd-ease, 180ms ease), box-shadow var(--zd-ease, 180ms ease);
}

/* A phone-width card: "Interest only" wrapped to two lines at 384px. The pill
 * takes the full width and the two options share it equally, which also keeps
 * them the same size, so neither reads as the default by being bigger. */
@container (max-width: 26rem) {
	.zerodigital-mortgage-calculator__seg {
		align-self: stretch;
	}

	.zerodigital-mortgage-calculator__seg-btn {
		flex: 1 1 0;
		padding: 0 0.75rem;
	}
}

.zerodigital-mortgage-calculator__seg-btn[aria-pressed="false"]:hover {
	background: var(--zd-mc-card);
}

.zerodigital-mortgage-calculator__seg-btn[aria-pressed="true"] {
	background: var(--zd-mc-accent);
	color: var(--zd-mc-on-accent);
	box-shadow: var(--zd-shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.25));
}

.zerodigital-mortgage-calculator__tick {
	display: none;
	flex-shrink: 0;
}

[aria-pressed="true"] > .zerodigital-mortgage-calculator__tick {
	display: block;
}

.zerodigital-mortgage-calculator__pills {
	gap: var(--wp--preset--spacing--2-xs, 0.5rem);
	margin-top: var(--wp--preset--spacing--2-xs, 0.25rem);
}

/* One row of equal cells, like the toggle above, rather than a ragged 3 + 2
 * wrap at phone width. 2.5rem wide by the full control height keeps five in a
 * row down to a ~360px phone, and is still well over WCAG 2.2's 24px minimum;
 * narrower than that, auto-fit drops a cell to a second row rather than
 * shrinking further. Scoped as the js-only rule is, which would otherwise set
 * it back to flex. */
.zd-mc-js .zerodigital-mortgage-calculator__pills.zerodigital-mortgage-calculator__js-only {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(2.5rem, 1fr));
}

.zerodigital-mortgage-calculator__pill {
	min-height: var(--zd-mc-control-h);
	min-width: 0;
	padding: 0 0.25rem;
	border: 1px solid var(--zd-mc-boundary);
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-card);
	color: var(--zd-mc-fg);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	cursor: pointer;
}

.zerodigital-mortgage-calculator__pill[aria-pressed="false"]:hover {
	border-color: var(--zd-mc-accent);
	background: var(--zd-mc-tint);
}

.zerodigital-mortgage-calculator__pill[aria-pressed="true"] {
	background: var(--zd-mc-accent);
	border-color: var(--zd-mc-accent);
	color: var(--zd-mc-on-accent);
}

.zerodigital-mortgage-calculator__choice-group {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.zerodigital-mortgage-calculator__choice-group > legend {
	margin-bottom: var(--wp--preset--spacing--2-xs, 0.5rem);
}

.zerodigital-mortgage-calculator__choices {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--2-xs, 0.5rem);
}

.zerodigital-mortgage-calculator__choices--row {
	flex-direction: row;
	flex-wrap: wrap;
}

.zerodigital-mortgage-calculator__choices--row > .zerodigital-mortgage-calculator__choice {
	flex: 1 1 11rem;
}

.zerodigital-mortgage-calculator__choice {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	min-height: 44px;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--zd-mc-boundary);
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-card);
	cursor: pointer;
	transition: border-color var(--zd-ease, 180ms ease), background-color var(--zd-ease, 180ms ease);
}

.zerodigital-mortgage-calculator__choice:hover {
	border-color: var(--zd-mc-accent);
}

.zerodigital-mortgage-calculator__choice:has(input:checked) {
	border-color: var(--zd-mc-accent);
	background: var(--zd-mc-tint);
	box-shadow: inset 0 0 0 1px var(--zd-mc-accent);
}

.zerodigital-mortgage-calculator__choice:has(input:focus-visible) {
	outline: 2px solid var(--wp--preset--color--accent, #c9922a);
	outline-offset: 2px;
}

/* The ring is on the card, so the native one on the 18px radio is a second
 * ring inside the first. */
.zerodigital-mortgage-calculator__choice input:focus-visible {
	outline: none;
}

.zerodigital-mortgage-calculator__choice input {
	width: 1.125rem;
	height: 1.125rem;
	margin: 0.15rem 0 0;
	flex-shrink: 0;
	accent-color: var(--zd-mc-accent);
}

.zerodigital-mortgage-calculator__choice-text {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

.zerodigital-mortgage-calculator__choice-name {
	font-weight: 600;
}

.zerodigital-mortgage-calculator__choice-note {
	font-size: 0.875rem;
	color: var(--zd-mc-muted-strong);
}

.zerodigital-mortgage-calculator__region-fixed {
	margin: 0;
	font-weight: 600;
}

/* A fixed buyer reads like a fixed region; its relief note, like a choice's. */
.zerodigital-mortgage-calculator__buyer-fixed [data-zd-mc-out="ftb_note"] {
	font-weight: 400;
}

.zerodigital-mortgage-calculator__reset {
	align-self: flex-start;
	padding: 0.5rem 0;
	border: 0;
	background: none;
	color: var(--zd-mc-muted);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.zerodigital-mortgage-calculator__reset:hover {
	color: var(--zd-mc-fg);
	text-decoration-thickness: 2px;
}

.zerodigital-mortgage-calculator__results button:focus-visible,
.zerodigital-mortgage-calculator__results a:focus-visible {
	outline-color: var(--zd-mc-panel-text);
}

/* --------------------------------------------------------------------------
 * Results.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__label {
	margin: 0;
	font-size: var(--zd-spec-size, 0.72rem);
	font-weight: 700;
	letter-spacing: var(--zd-spec-tracking, 0.14em);
	text-transform: var(--zd-spec-transform, uppercase);
	color: var(--zd-mc-panel-soft);
}

/* Restated here rather than using .zd-data: theme CSS loads after block CSS,
 * and that utility's tracking would beat this rule's. */
.zerodigital-mortgage-calculator__figure {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: clamp(2.5rem, 1.6rem + 3.5cqi, 3.875rem);
	font-weight: 600;
	line-height: 1.02;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

/* A prompt is words, not a figure, so it does not shout like one. Nor does an
 * answer that is a phrase — "About the same", "1 year and 11 months". */
.zerodigital-mortgage-calculator__figure[data-zd-mc-state="prompt"],
.zerodigital-mortgage-calculator__figure[data-zd-mc-state="words"] {
	font-size: clamp(1.5rem, 1.2rem + 1.2cqi, 1.875rem);
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.zerodigital-mortgage-calculator__sub {
	margin: 0;
	line-height: 1.55;
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__split[hidden] {
	display: none;
}

.zerodigital-mortgage-calculator__split-bar {
	display: flex;
	height: 11px;
	border-radius: 999px;
	overflow: clip;
	background: var(--zd-mc-interest);
}

/* A 2px gap in the panel colour where the two meet, so the boundary is drawn
 * rather than left to the colours alone. A shadow, not a border, so it adds
 * nothing to the capital segment's width and the split stays exact. */
.zerodigital-mortgage-calculator__split-bar > span {
	display: block;
	background: var(--zd-mc-capital);
	box-shadow: 2px 0 0 var(--zd-mc-panel);
}

.zerodigital-mortgage-calculator__split-key {
	display: flex;
	gap: var(--wp--preset--spacing--sm, 1rem);
	margin: var(--wp--preset--spacing--2-xs, 0.5rem) 0 0;
	font-size: 0.875rem;
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__key {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.zerodigital-mortgage-calculator__key::before {
	content: "";
	width: 0.7rem;
	height: 0.7rem;
	border-radius: 3px;
}

.zerodigital-mortgage-calculator__key--capital::before {
	background: var(--zd-mc-capital);
}

.zerodigital-mortgage-calculator__key--interest::before {
	background: var(--zd-mc-interest);
}

.zerodigital-mortgage-calculator__stats {
	margin: 0;
	display: flex;
	flex-direction: column;
}

.zerodigital-mortgage-calculator__stat {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--wp--preset--spacing--sm, 1rem);
	padding: 0.8rem 0;
	border-top: 1px solid var(--zd-mc-panel-rule);
}

.zerodigital-mortgage-calculator__stat dt {
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__stat dd {
	margin: 0;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.zerodigital-mortgage-calculator__note {
	margin: 0;
	padding: 0.9rem 1rem;
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-panel-raise);
	line-height: 1.6;
}

.zerodigital-mortgage-calculator__note[hidden] {
	display: none;
}

.zerodigital-mortgage-calculator__ctas {
	margin-top: auto;
	padding-top: var(--wp--preset--spacing--xs, 0.75rem);
}

/* The CTA sits on the dark results panel, so it is the theme's dark-surface
 * button — Home Hero and Subpage Hero on .zd-bg-dark: a light fill with a
 * primary label, darkening a touch on hover, lifting 1px. The primary-filled
 * version it replaced took the theme's global a:hover on hover, which turned
 * its label accent-orange on green: measured 1.3:1. The label is pinned in
 * every state so no link colour can reach it. */
.zerodigital-mortgage-calculator__cta {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--zd-mc-control-h);
	padding: 0.9rem 1.6rem;
	border-radius: var(--zd-btn-radius, var(--wp--custom--radius--md, 0.5rem));
	background: var(--zd-mc-panel-text);
	color: var(--wp--preset--color--primary, #1b3a5c);
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	box-shadow: var(--zd-shadow-sm, 0 1px 3px rgba(16, 24, 40, 0.1));
	transition: background-color var(--zd-ease, 180ms ease), box-shadow var(--zd-ease, 180ms ease), transform var(--zd-ease, 180ms ease);
}

.zerodigital-mortgage-calculator__cta:hover,
.zerodigital-mortgage-calculator__cta:focus-visible,
.zerodigital-mortgage-calculator__cta:active {
	background: color-mix(in srgb, var(--zd-mc-panel-text) 90%, var(--zd-mc-fg));
	/* The label darkens with the fill, to the theme's hover shade of primary:
	 * primary alone on the darker fill measured 4.0:1, under AA. */
	color: var(--wp--preset--color--secondary, #0a3339);
	box-shadow: var(--zd-shadow-md, 0 4px 8px -2px rgba(16, 24, 40, 0.1));
}

.zerodigital-mortgage-calculator__cta:hover {
	transform: translateY(-1px);
}

.zerodigital-mortgage-calculator__noscript,
.zerodigital-mortgage-calculator__preview-note {
	margin: 0;
	font-size: 0.875rem;
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* A range is two figures and a dash: smaller than a single figure, and broken
 * only at the spaces around the dash, never inside a number. */
.zerodigital-mortgage-calculator__figure--range {
	font-size: clamp(1.75rem, 1.2rem + 2.2cqi, 2.625rem);
	overflow-wrap: normal;
	text-wrap: balance;
}

/* --------------------------------------------------------------------------
 * The light half's extras: a titled group of fields, and a quiet aside.
 * Both are form-half surfaces, so both take the field radius.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__group {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--xs, 0.75rem);
	padding: var(--wp--preset--spacing--sm, 1rem);
	border: 1px solid var(--zd-mc-boundary);
	border-radius: var(--zd-mc-field-radius);
}

.zerodigital-mortgage-calculator__group-name {
	margin: 0;
	font-size: var(--zd-spec-size, 0.72rem);
	font-weight: 700;
	letter-spacing: var(--zd-spec-tracking, 0.14em);
	text-transform: var(--zd-spec-transform, uppercase);
	color: var(--zd-mc-accent);
}

.zerodigital-mortgage-calculator__aside {
	margin: 0;
	padding: var(--wp--preset--spacing--xs, 0.75rem) var(--wp--preset--spacing--sm, 1rem);
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-tint);
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--zd-mc-muted-strong);
}

/* --------------------------------------------------------------------------
 * Interest only compared. Two monthly figures and the capital owed, all three
 * the SAME size — the one rule this panel exists to keep (Section 7.4).
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__compare {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: var(--wp--preset--spacing--xs, 0.75rem);
}

@container (max-width: 26rem) {
	.zerodigital-mortgage-calculator__compare {
		grid-template-columns: minmax(0, 1fr);
	}
}

.zerodigital-mortgage-calculator__compare-card,
.zerodigital-mortgage-calculator__owed {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	padding: var(--wp--preset--spacing--sm, 1rem);
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-panel-raise);
}

/* Set apart by an outline rather than a warning colour: a palette-agnostic
 * boundary every variation can see, where a red box would be one brand's red
 * on another brand's page. */
.zerodigital-mortgage-calculator__owed {
	border: 1px solid color-mix(in srgb, var(--zd-mc-panel-text) 45%, var(--zd-mc-panel));
}

.zerodigital-mortgage-calculator__compare-name {
	margin: 0;
	font-size: var(--zd-spec-size, 0.72rem);
	font-weight: 700;
	letter-spacing: var(--zd-spec-tracking, 0.14em);
	text-transform: var(--zd-spec-transform, uppercase);
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__compare-figure {
	margin: 0;
	font-family: var(--wp--preset--font-family--heading, inherit);
	font-size: clamp(1.75rem, 1.3rem + 1.8cqi, 2.5rem);
	font-weight: 600;
	line-height: 1.05;
	letter-spacing: -0.02em;
	font-variant-numeric: tabular-nums;
}

.zerodigital-mortgage-calculator__compare-unit {
	font-family: var(--wp--preset--font-family--body, inherit);
	font-size: 0.875rem;
	font-weight: 400;
	letter-spacing: 0;
	color: var(--zd-mc-panel-soft);
}

.zerodigital-mortgage-calculator__owed-note {
	margin: 0.2rem 0 0;
	font-size: 0.875rem;
	line-height: 1.6;
	color: var(--zd-mc-panel-soft);
}

/* --------------------------------------------------------------------------
 * The dark half's extras: the affordability explanation and its caution, and
 * the line under the rate change button.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__lenders {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.65;
	color: var(--zd-mc-panel-soft);
}

/* Full panel-text contrast and bold: this sentence is the answer's other half,
 * so it is not allowed to read as small print. */
.zerodigital-mortgage-calculator__caution {
	margin: 0;
	padding: 0.9rem 1rem;
	border-radius: var(--zd-mc-field-radius);
	background: var(--zd-mc-panel-raise);
	font-weight: 700;
	line-height: 1.6;
}

.zerodigital-mortgage-calculator__cta-note {
	margin: 0;
	font-size: 0.875rem;
	text-align: center;
	color: var(--zd-mc-panel-soft);
}

/* --------------------------------------------------------------------------
 * The stamp duty breakdown.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__breakdown {
	padding: clamp(var(--wp--preset--spacing--md, 1.5rem), 3cqi, var(--wp--preset--spacing--lg, 2rem));
	border-radius: var(--zd-card-radius, var(--wp--custom--radius--lg, 1.25rem));
	background: var(--zd-mc-card);
	border: var(--zd-border, 1px solid color-mix(in srgb, var(--zd-mc-fg) 12%, transparent));
}

.zerodigital-mortgage-calculator__breakdown-heading {
	margin: 0 0 0.25rem;
	font-size: 1.125rem;
}

.zerodigital-mortgage-calculator__breakdown-intro {
	margin: 0 0 var(--wp--preset--spacing--sm, 1rem);
	color: var(--zd-mc-muted);
}

.zerodigital-mortgage-calculator__table-scroll {
	overflow-x: auto;
	overscroll-behavior-inline: contain;
}

.zerodigital-mortgage-calculator__table-scroll:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent, #c9922a);
	outline-offset: 2px;
}

.zerodigital-mortgage-calculator__table {
	width: 100%;
	min-width: 34rem;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.zerodigital-mortgage-calculator__table th,
.zerodigital-mortgage-calculator__table td {
	padding: 0.8rem 1rem;
	text-align: left;
}

.zerodigital-mortgage-calculator__table thead th {
	padding-bottom: 0.5rem;
	font-size: var(--zd-spec-size, 0.72rem);
	font-weight: 700;
	letter-spacing: var(--zd-spec-tracking, 0.14em);
	text-transform: var(--zd-spec-transform, uppercase);
	color: var(--zd-mc-muted-strong);
}

.zerodigital-mortgage-calculator__table tbody tr {
	border-top: 1px solid color-mix(in srgb, var(--zd-mc-fg) 10%, transparent);
}

.zerodigital-mortgage-calculator__table tfoot tr {
	border-top: 2px solid var(--zd-mc-fg);
}

.zerodigital-mortgage-calculator__table tfoot th,
.zerodigital-mortgage-calculator__table tfoot td {
	font-weight: 700;
}

.zerodigital-mortgage-calculator__row--nil td {
	color: var(--zd-mc-muted);
}

.zerodigital-mortgage-calculator__row--flat td:first-child {
	font-weight: 600;
}

.zerodigital-mortgage-calculator__table .zerodigital-mortgage-calculator__col-num {
	text-align: right;
}

/* --------------------------------------------------------------------------
 * Small print. Body size, full contrast: Section 6.3 is explicit that a
 * required disclosure is never a 12px afterthought.
 * -------------------------------------------------------------------------- */

.zerodigital-mortgage-calculator__small-print {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: var(--wp--preset--spacing--lg, 2rem);
	align-items: start;
}

@container (max-width: 52rem) {
	.zerodigital-mortgage-calculator__small-print {
		grid-template-columns: minmax(0, 1fr);
	}
}

.zerodigital-mortgage-calculator__small-heading {
	margin: 0 0 0.5rem;
	font-size: 1rem;
}

.zerodigital-mortgage-calculator__assumptions ul {
	margin: 0;
	padding-left: 1.25rem;
	line-height: 1.7;
}

.zerodigital-mortgage-calculator__disclaimer,
.zerodigital-mortgage-calculator__risk,
.zerodigital-mortgage-calculator__as-at {
	margin: 0 0 0.75rem;
	font-size: inherit;
	line-height: 1.65;
}

.zerodigital-mortgage-calculator__disclaimer--addendum {
	margin-top: -0.25rem;
}

.zerodigital-mortgage-calculator__risk {
	color: var(--zd-mc-fg);
}

.zerodigital-mortgage-calculator__as-at {
	color: var(--zd-mc-muted);
}

@media (prefers-reduced-motion: reduce) {
	.zerodigital-mortgage-calculator__seg-btn,
	.zerodigital-mortgage-calculator__choice,
	.zerodigital-mortgage-calculator__cta {
		transition: none;
	}

	.zerodigital-mortgage-calculator__cta:hover {
		transform: none;
	}
}

/* --------------------------------------------------------------------------
 * Print. A printed estimate is what a customer carries to a lender, so the
 * printed page keeps everything that makes the figure honest — the disclosures
 * at body size, the assumptions, the breakdown — and drops only the controls,
 * whose current values are already stated in the figures beside them.
 * -------------------------------------------------------------------------- */

@media print {
	/* As specific as the rules that show these, and later, so they win without
	 * !important — which the standards keep for beating a preset class. */
	.zerodigital-mortgage-calculator .zerodigital-mortgage-calculator__range,
	.zd-mc-js .zerodigital-mortgage-calculator__js-only,
	.zd-mc-js .zerodigital-mortgage-calculator__reset.zerodigital-mortgage-calculator__js-only,
	.zd-mc-js .zerodigital-mortgage-calculator__pills.zerodigital-mortgage-calculator__js-only,
	.zerodigital-mortgage-calculator .zerodigital-mortgage-calculator__ctas,
	.zerodigital-mortgage-calculator .zerodigital-mortgage-calculator__noscript {
		display: none;
	}

	.zerodigital-mortgage-calculator__card {
		grid-template-columns: minmax(0, 1fr);
		border: 1px solid #000;
	}

	.zerodigital-mortgage-calculator__results {
		background: none;
		color: #000;
	}

	.zerodigital-mortgage-calculator__label,
	.zerodigital-mortgage-calculator__sub,
	.zerodigital-mortgage-calculator__stat dt,
	.zerodigital-mortgage-calculator__compare-name,
	.zerodigital-mortgage-calculator__compare-unit,
	.zerodigital-mortgage-calculator__owed-note,
	.zerodigital-mortgage-calculator__lenders,
	.zerodigital-mortgage-calculator__cta-note {
		color: #000;
	}

	.zerodigital-mortgage-calculator__compare-card,
	.zerodigital-mortgage-calculator__owed,
	.zerodigital-mortgage-calculator__caution,
	.zerodigital-mortgage-calculator__note {
		background: none;
		border: 1px solid #000;
	}

	.zerodigital-mortgage-calculator__num {
		color: #000;
		border-bottom: 0;
	}

	.zerodigital-mortgage-calculator__card,
	.zerodigital-mortgage-calculator__breakdown,
	.zerodigital-mortgage-calculator__small-print {
		break-inside: avoid;
	}

	.zerodigital-mortgage-calculator__disclaimer,
	.zerodigital-mortgage-calculator__risk {
		font-size: 11pt;
		color: #000;
	}
}
