/* Hynca Mortgage Calculator
   Deliberately quiet. It inherits the theme's font and everything else, and
   uses a single accent you can set in Display, then Accent colour.

   The accent must be a real colour, not currentColor. The filled buttons set
   their own colour to white, and currentColor inside an element resolves to
   that element's own colour, so a currentColor accent painted them white on
   white and made them invisible. */

.hynca-mc {
	--hynca-mc-accent: #2f3e46;
	--hynca-mc-line: rgba( 0, 0, 0, 0.12 );
	--hynca-mc-soft: rgba( 0, 0, 0, 0.035 );
	--hynca-mc-field-line: rgba( 0, 0, 0, 0.3 );
	--hynca-mc-field-bg: #fff;
	--hynca-mc-radius: 10px;
	font-family: inherit;
	color: inherit;
	line-height: 1.5;
	max-width: 100%;
}

/* No dark-mode variant. The site is light whatever the visitor's device is set
   to, so following prefers-color-scheme turned the lines white on a light page
   and the input boxes vanished on any phone or laptop in dark mode. Fields get
   a white fill and a firmer border so they read as boxes on grey and pale-green
   section backgrounds as well as on white. */

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

.hynca-mc__title {
	margin: 0 0 0.75em;
	font-size: 1.5em;
}

/* Tabs */

.hynca-mc__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: -1px;
}

.hynca-mc__tab {
	appearance: none;
	background: transparent;
	border: 1px solid var( --hynca-mc-line );
	border-bottom-color: transparent;
	border-radius: var( --hynca-mc-radius ) var( --hynca-mc-radius ) 0 0;
	color: inherit;
	cursor: pointer;
	font: inherit;
	font-size: 0.95em;
	opacity: 0.65;
	padding: 0.6em 1em;
}

.hynca-mc__tab:hover {
	opacity: 0.9;
}

.hynca-mc__tab.is-active {
	background: var( --hynca-mc-soft );
	box-shadow: inset 0 3px 0 var( --hynca-mc-accent );
	font-weight: 600;
	opacity: 1;
}

.hynca-mc__tab:focus-visible {
	outline: 2px solid var( --hynca-mc-accent );
	outline-offset: 2px;
}

/* Body */

.hynca-mc__body {
	border: 1px solid var( --hynca-mc-line );
	border-radius: 0 var( --hynca-mc-radius ) var( --hynca-mc-radius ) var( --hynca-mc-radius );
	padding: 1.25rem;
	position: relative;
	/* Keeps the wave cropped to the frame rather than spilling down the page. */
	overflow: hidden;
	/* A stacking context of its own, so the wave sitting at z-index -1 stays
	   above this box's own background instead of disappearing behind it. */
	isolation: isolate;
}

.hynca-mc__grid {
	display: grid;
	gap: 0.9rem;
	grid-template-columns: repeat( auto-fit, minmax( 200px, 1fr ) );
}

.hynca-mc__field {
	display: flex;
	flex-direction: column;
	gap: 0.3em;
	font-size: 0.9em;
}

.hynca-mc__field--wide {
	grid-column: 1 / -1;
}

.hynca-mc__field > span {
	font-weight: 600;
	opacity: 0.8;
}

.hynca-mc input[type="text"],
.hynca-mc input[type="number"],
.hynca-mc input[type="email"],
.hynca-mc input[type="tel"],
.hynca-mc input[type="url"],
.hynca-mc select,
.hynca-mc textarea {
	background: var( --hynca-mc-field-bg );
	border: 1px solid var( --hynca-mc-field-line );
	border-radius: 6px;
	color: inherit;
	font: inherit;
	font-size: 1em;
	padding: 0.55em 0.7em;
	width: 100%;
}

.hynca-mc input:focus,
.hynca-mc select:focus,
.hynca-mc textarea:focus {
	border-color: var( --hynca-mc-accent );
	outline: 2px solid var( --hynca-mc-accent );
	outline-offset: 1px;
}

.hynca-mc__prefixed,
.hynca-mc__suffixed {
	align-items: center;
	background: var( --hynca-mc-field-bg );
	border: 1px solid var( --hynca-mc-field-line );
	border-radius: 6px;
	display: flex;
	overflow: hidden;
}

.hynca-mc__prefixed:focus-within,
.hynca-mc__suffixed:focus-within {
	border-color: var( --hynca-mc-accent );
}

.hynca-mc__prefixed i,
.hynca-mc__suffixed i {
	font-style: normal;
	opacity: 0.6;
	padding: 0 0.6em;
}

/* Scoped under .hynca-mc so it outranks the general field rule above, which
   otherwise draws a second border inside the wrapper's. */

.hynca-mc .hynca-mc__prefixed input,
.hynca-mc .hynca-mc__suffixed input {
	border: 0;
	border-radius: 0;
}

.hynca-mc__prefixed input:focus,
.hynca-mc__suffixed input:focus {
	outline: none;
}

.hynca-mc__prefixed i {
	border-right: 1px solid var( --hynca-mc-line );
	align-self: stretch;
	display: flex;
	align-items: center;
}

.hynca-mc__check {
	align-items: flex-start;
	display: flex;
	font-size: 0.9em;
	gap: 0.55em;
	line-height: 1.4;
}

.hynca-mc__check input {
	margin-top: 0.2em;
	flex: 0 0 auto;
}

.hynca-mc__hp {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 0;
}

/* Results */

.hynca-mc__results {
	margin-top: 1.25rem;
	transition: opacity 0.15s ease;
}

.hynca-mc__results.is-busy {
	opacity: 0.45;
}

.hynca-mc__results:empty {
	margin-top: 0;
}

.hynca-mc__figures {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
}

.hynca-mc__figure {
	background: var( --hynca-mc-soft );
	border-radius: var( --hynca-mc-radius );
	border-left: 3px solid var( --hynca-mc-accent );
	display: flex;
	flex-direction: column;
	gap: 0.15em;
	padding: 0.85rem 1rem;
}

.hynca-mc__figure.is-good {
	border-left-color: #1a7f37;
}

.hynca-mc__figure.is-bad {
	border-left-color: #b32d2e;
}

/* Between the two: doable, but not on the usual terms. Amber rather than red,
   because it is a narrower choice of lender, not a refusal. */
.hynca-mc__figure.is-warn {
	border-left-color: #bf6516;
}

.hynca-mc__figure-label {
	font-size: 0.78em;
	letter-spacing: 0.02em;
	opacity: 0.7;
	text-transform: uppercase;
}

.hynca-mc__figure-value {
	font-size: 1.6em;
	font-weight: 700;
	line-height: 1.15;
}

.hynca-mc__figure-sub {
	font-size: 0.82em;
	opacity: 0.7;
}

.hynca-mc__aside,
.hynca-mc__panel-note {
	font-size: 0.92em;
	margin: 1rem 0 0;
}

.hynca-mc__panel-note {
	background: var( --hynca-mc-soft );
	border-radius: var( --hynca-mc-radius );
	padding: 0.9rem 1rem;
}

/* A note under a form, explaining something the form is doing on the
   visitor's behalf. Quieter than a result note, since it is not a result. */
.hynca-mc__hint {
	font-size: 0.88em;
	margin: 0.9rem 0 0;
	opacity: 0.75;
}

/* The same note under a single field, where it says where that field's
   starting figure came from. The field is already a flex column with its own
   gap, so this one brings no margin of its own, and it runs the full width of
   the field rather than sitting beside the input. */
.hynca-mc__field > .hynca-mc__hint {
	margin: 0;
	width: 100%;
}

.hynca-mc__table {
	border-collapse: collapse;
	font-size: 0.9em;
	margin-top: 1rem;
	width: 100%;
}

.hynca-mc__table th,
.hynca-mc__table td {
	border-bottom: 1px solid var( --hynca-mc-line );
	padding: 0.5em 0.6em;
	text-align: left;
}

.hynca-mc__table th {
	font-size: 0.85em;
	letter-spacing: 0.02em;
	opacity: 0.7;
	text-transform: uppercase;
}

.hynca-mc__notes {
	font-size: 0.85em;
	margin: 1rem 0 0;
	opacity: 0.8;
	padding-left: 1.1em;
}

.hynca-mc__notes li + li {
	margin-top: 0.4em;
}

.hynca-mc__error {
	color: #b32d2e;
	font-size: 0.95em;
}

/* Lead form */

.hynca-mc__lead {
	border-top: 1px solid var( --hynca-mc-line );
	margin-top: 1.5rem;
	padding-top: 1.25rem;
}

.hynca-mc__lead-title {
	font-size: 1.1em;
	margin: 0 0 0.35em;
}

.hynca-mc__lead-intro {
	font-size: 0.92em;
	margin: 0 0 1rem;
	opacity: 0.85;
}

.hynca-mc__lead-form .hynca-mc__check {
	margin-top: 0.9rem;
}

.hynca-mc__submit {
	appearance: none;
	background: var( --hynca-mc-accent );
	border: 1px solid var( --hynca-mc-accent );
	border-radius: 6px;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	margin-top: 0.9rem;
	padding: 0.7em 1.4em;
}

.hynca-mc__submit:disabled {
	cursor: wait;
	opacity: 0.6;
}

.hynca-mc__submit:focus-visible {
	outline: 2px solid var( --hynca-mc-accent );
	outline-offset: 2px;
}

.hynca-mc__lead-msg {
	font-size: 0.9em;
	margin: 0.75rem 0 0;
	min-height: 1.2em;
}

.hynca-mc__lead-msg.is-success {
	color: #1a7f37;
}

.hynca-mc__lead-msg.is-error {
	color: #b32d2e;
}

/* Footer */

.hynca-mc__contact {
	border-top: 1px solid var( --hynca-mc-line );
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em 1.2em;
	font-size: 0.9em;
	margin-top: 1.5rem;
	padding-top: 1rem;
}

/* The contact row's links, each led by its icon. inline-flex rather than a
   floated or absolutely placed icon, so a number that wraps onto a second
   line wraps under itself and not under the icon. */
.hynca-mc__contact a {
	align-items: center;
	display: inline-flex;
	gap: 0.45em;
}

.hynca-mc__icon {
	/* Sized in em so it tracks the text, whatever the theme sets that to. */
	width: 1.05em;
	height: 1.05em;
	/* Optical rather than baseline alignment: these read better sitting a
	   touch above the baseline, next to lowercase text. */
	margin-top: -0.05em;
	/* A flex item shrinks by default, which would squash the icon on a
	   narrow screen instead of wrapping the row. */
	flex: none;
	/* Decoration alongside a link, so it should not take pointer events or
	   be selectable as if it were part of the text. */
	pointer-events: none;
	user-select: none;
}

/* In a forced colours mode the stroke has to be a system colour or the icon
   vanishes. It follows the link text, which is what it belongs to. */
@media ( forced-colors: active ) {
	.hynca-mc__icon {
		stroke: LinkText;
	}
}

.hynca-mc__source {
	font-size: 0.82em;
	margin-top: 1rem;
	opacity: 0.65;
}

.hynca-mc__disclaimer {
	font-size: 0.78em;
	line-height: 1.45;
	margin-top: 0.6rem;
	opacity: 0.7;
}

.hynca-mc__disclaimer p {
	margin: 0 0 0.5em;
}

@media ( max-width: 480px ) {
	.hynca-mc__body {
		border-radius: var( --hynca-mc-radius );
		padding: 1rem;
	}

	.hynca-mc__figure-value {
		font-size: 1.35em;
	}

}

/* Calculate action
   The primary control on the whole block, so it is deliberately heavier than
   the enquiry form's submit button. */

.hynca-mc__actions {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	margin-top: 1.25rem;
}

.hynca-mc__calculate {
	appearance: none;
	background: var( --hynca-mc-accent );
	border: 1px solid var( --hynca-mc-accent );
	border-radius: 6px;
	color: #fff;
	cursor: pointer;
	font: inherit;
	font-size: 1.05em;
	font-weight: 700;
	min-height: 48px;
	padding: 0.75em 2em;
}

.hynca-mc__calculate:hover {
	opacity: 0.9;
}

.hynca-mc__calculate:disabled {
	cursor: wait;
	opacity: 0.6;
}

.hynca-mc__calculate:focus-visible {
	outline: 2px solid var( --hynca-mc-accent );
	outline-offset: 2px;
}

.hynca-mc__stale {
	font-size: 0.9em;
	margin: 0;
	opacity: 0.8;
}

.hynca-mc__stale[hidden] {
	display: none;
}

/* Stale results stay readable but stop looking like the current answer. */
.hynca-mc__results.is-stale {
	opacity: 0.45;
}

/* The results container is focusable so it can be moved to after a
   calculation. Only show a ring for keyboard users. */
.hynca-mc__results:focus:not( :focus-visible ) {
	outline: none;
}

.hynca-mc__results:focus-visible {
	outline: 2px solid var( --hynca-mc-accent );
	outline-offset: 4px;
}

/* Deposit, as a percentage or an amount.

   Two controls in one grid cell of 200px left the amount about four digits
   wide, and because the prefixed wrapper hides its overflow the rest was
   silently clipped rather than wrapping. So the field takes two columns. */

.hynca-mc__field--deposit {
	grid-column: span 2;
}

.hynca-mc__deposit {
	display: flex;
	gap: 6px;
}

.hynca-mc__deposit select {
	flex: 0 0 auto;
	/* Room for "Your own" and the arrow, and no more than its share. */
	max-width: 45%;
	width: auto;
}

.hynca-mc__deposit .hynca-mc__prefixed {
	flex: 1 1 0;
	min-width: 0;
}

/* Flex children will not shrink past their content without this, which is
   what pushed the amount under the clip. */
.hynca-mc__deposit .hynca-mc__prefixed input {
	min-width: 0;
}

/* Narrow layouts. This has to come after the rules above, not in the earlier
   media block, or it loses the cascade to them and never applies.

   grid-column: span 2 forces an auto-fit grid to create a second track even
   when there is not room for one, which overflowed the whole calculator, so
   below this width the percentage stacks above the amount instead. */

@media ( max-width: 560px ) {
	.hynca-mc__field--deposit {
		grid-column: auto;
	}

	.hynca-mc__deposit {
		flex-wrap: wrap;
	}

	.hynca-mc__deposit select,
	.hynca-mc__deposit .hynca-mc__prefixed {
		flex: 1 1 100%;
		max-width: none;
	}
}

/* Column counts

   auto-fit fills the row with as many tracks as will fit, which is fine until
   the field count does not divide into it: six fields in a seven track row
   leaves one stranded on a line of its own. So once container queries are
   available the grid switches to deliberate counts that the panels divide
   into, and the deposit goes back to a single cell because the tracks are then
   wide enough to hold both of its controls.

   Container queries rather than media queries, so this follows the width of
   the calculator itself. Dropped into a narrow sidebar on a wide screen, a
   media query would still be laying out four columns.

   Everything above stays as the fallback. A browser without container query
   support keeps auto-fit, which is untidy at some widths but never broken. */

.hynca-mc__body {
	container-type: inline-size;
	container-name: hyncamc;
}

@container hyncamc ( max-width: 519px ) {
	.hynca-mc__grid {
		grid-template-columns: minmax( 0, 1fr );
	}

	.hynca-mc__field--deposit {
		grid-column: auto;
	}
}

@container hyncamc ( min-width: 520px ) {
	.hynca-mc__grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}

	.hynca-mc__field--deposit {
		grid-column: auto;
	}

	.hynca-mc__field--wide {
		grid-column: 1 / -1;
	}
}

@container hyncamc ( min-width: 860px ) {
	.hynca-mc__grid {
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
	}
}

@container hyncamc ( min-width: 1160px ) {
	.hynca-mc__grid {
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	}
}

/* Once the deposit is back in a single cell it can sit on one line again,
   until the cell gets too narrow to hold both controls. */

@container hyncamc ( min-width: 340px ) {
	.hynca-mc__deposit {
		flex-wrap: nowrap;
	}

	.hynca-mc__deposit select {
		flex: 0 0 auto;
		max-width: 45%;
	}

	.hynca-mc__deposit .hynca-mc__prefixed {
		flex: 1 1 0;
	}
}

/* The wave

   The brand mark, blown up and cropped into the corner, the way it is used on
   the brand sheet. It is decoration: it takes its colour from the accent, sits
   behind everything, and is not in the accessibility tree at all.

   z-index -1 rather than 0, because an absolutely positioned child paints
   above ordinary in-flow content, which would put it over the figures. */

.hynca-mc__wave {
	/* A fixed offset, not a percentage. Percentages here resolve against the
	   frame's height, which grows with the results, so the mark slid further
	   and further below the frame as the answer got longer: a few hundred
	   pixels of it hanging out of sight on a tall mobile layout, held in by
	   nothing but overflow. A fixed bleed sits the same way whatever the
	   content does. */
	bottom: -40px;
	color: var( --hynca-mc-accent );
	fill: currentColor;
	height: auto;
	pointer-events: none;
	position: absolute;
	right: -6%;
	user-select: none;
	width: 46%;
	/* Never so big on a wide frame that it reads as a graphic rather than a
	   watermark, nor so small on a narrow one that it disappears. */
	max-width: 320px;
	min-width: 150px;
	z-index: -1;
}

@media ( max-width: 480px ) {
	.hynca-mc__wave {
		bottom: -24px;
		width: 60%;
	}
}

/* Anything sitting behind text costs a little contrast, so for somebody who
   has asked for more of it the wave goes entirely. Reduced motion is the wrong
   question here: the wave does not move. */
@media ( prefers-contrast: more ) {
	.hynca-mc__wave {
		display: none;
	}
}

@media ( forced-colors: active ) {
	.hynca-mc__wave {
		display: none;
	}
}
