/**
 * EquityBankLoan home equity calculator.
 *
 * Restrained on purpose. This should read as a financial tool, not as a blog
 * widget. Mobile first, generous tap targets, high contrast, no meaning
 * carried by color alone.
 *
 * @package EquityBankLoan\Core
 */

.ebl-calc {
	--ebl-ink: #16202c;
	--ebl-ink-soft: #55636f;
	--ebl-line: #d7dee5;
	--ebl-accent: #10416b;
	--ebl-surface: #fff;
	--ebl-surface-alt: #f4f7fa;
	--ebl-danger: #9a2515;

	background: var(--ebl-surface);
	border: 1px solid var(--ebl-line);
	border-radius: 10px;
	padding: 1.5rem;
	margin: 0 0 2rem;
	color: var(--ebl-ink);
	max-width: 46rem;
}

.ebl-calc__heading {
	margin: 0 0 0.35em;
	font-size: 1.5rem;
	line-height: 1.25;
}

.ebl-calc__intro {
	margin: 0 0 1.5rem;
	color: var(--ebl-ink-soft);
	font-size: 0.95rem;
	line-height: 1.55;
}

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

.ebl-calc__fields {
	display: grid;
	gap: 1.1rem;
}

.ebl-field__label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
	font-size: 0.95rem;
}

.ebl-field__control {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--ebl-line);
	border-radius: 6px;
	background: #fff;
	overflow: hidden;
}

.ebl-field__control:focus-within {
	outline: 2px solid var(--ebl-accent);
	outline-offset: 1px;
	border-color: var(--ebl-accent);
}

.ebl-field__prefix {
	display: flex;
	align-items: center;
	padding: 0 0.7rem;
	background: var(--ebl-surface-alt);
	border-right: 1px solid var(--ebl-line);
	color: var(--ebl-ink-soft);
	font-weight: 600;
}

.ebl-field__input {
	flex: 1 1 auto;
	border: 0;
	padding: 0.75rem 0.8rem;
	font-size: 1.05rem;
	font-variant-numeric: tabular-nums;
	min-width: 0;
	width: 100%;
	background: transparent;
	color: inherit;
}

.ebl-field__input:focus {
	outline: none;
}

.ebl-field__hint {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
	color: var(--ebl-ink-soft);
	line-height: 1.45;
}

.ebl-field__error {
	margin: 0.35rem 0 0;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ebl-danger);
	line-height: 1.45;
}

/* The border change is backed up by the text of the error message, so the
   state is never communicated by color alone. */
.ebl-field--invalid .ebl-field__control {
	border-color: var(--ebl-danger);
	border-width: 2px;
}

/* Submit ------------------------------------------------------------- */

.ebl-calc__submit {
	margin-top: 1.25rem;
	width: 100%;
	padding: 0.85rem 1.25rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: var(--ebl-accent);
	border: 1px solid var(--ebl-accent);
	border-radius: 6px;
	cursor: pointer;
}

.ebl-calc__submit:hover {
	background: #0c3355;
}

.ebl-calc__submit:focus-visible {
	outline: 3px solid #1d6fb8;
	outline-offset: 2px;
}

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

.ebl-calc__results {
	margin-top: 1.75rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--ebl-line);
}

.ebl-calc__summary {
	display: grid;
	gap: 0.85rem;
	margin-bottom: 1.25rem;
}

.ebl-stat {
	background: var(--ebl-surface-alt);
	border-radius: 8px;
	padding: 0.9rem 1rem;
}

.ebl-stat__label {
	display: block;
	font-size: 0.85rem;
	color: var(--ebl-ink-soft);
	margin-bottom: 0.25rem;
	line-height: 1.4;
}

.ebl-stat__value {
	display: block;
	font-size: 1.35rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.ebl-stat--primary {
	background: #eaf1f7;
	border: 1px solid #cddced;
}

.ebl-stat--primary .ebl-stat__value {
	font-size: 1.9rem;
	color: var(--ebl-accent);
}

.ebl-calc__notices {
	margin: 0 0 1.25rem;
	padding: 0.85rem 1rem;
	background: #fdf6e6;
	border: 1px solid #e6d3a3;
	border-radius: 8px;
	font-size: 0.9rem;
	line-height: 1.5;
}

.ebl-calc__notices ul {
	margin: 0;
	padding-left: 1.15rem;
}

.ebl-calc__notices li + li {
	margin-top: 0.4rem;
}

.ebl-calc__subheading {
	font-size: 1.05rem;
	margin: 0 0 0.5rem;
}

.ebl-calc__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.ebl-calc__caption {
	caption-side: top;
	text-align: left;
	font-size: 0.85rem;
	color: var(--ebl-ink-soft);
	margin-bottom: 0.6rem;
	line-height: 1.45;
}

.ebl-calc__table th,
.ebl-calc__table td {
	text-align: left;
	padding: 0.6rem 0.5rem;
	border-bottom: 1px solid var(--ebl-line);
}

.ebl-calc__table thead th {
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: var(--ebl-ink-soft);
}

.ebl-calc__table td {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.ebl-row--none td {
	font-weight: 400;
	color: var(--ebl-ink-soft);
}

.ebl-calc__disclaimer {
	margin: 1.25rem 0 0;
	font-size: 0.85rem;
	line-height: 1.55;
	color: var(--ebl-ink-soft);
	background: var(--ebl-surface-alt);
	border-left: 3px solid var(--ebl-line);
	padding: 0.85rem 1rem;
}

.ebl-calc__noscript {
	margin: 1rem 0 0;
	padding: 0.85rem 1rem;
	background: #fdf6e6;
	border: 1px solid #e6d3a3;
	border-radius: 8px;
	font-size: 0.9rem;
}

/* Wider screens ------------------------------------------------------ */

@media ( min-width: 40em ) {
	.ebl-calc {
		padding: 2rem;
	}

	.ebl-calc__heading {
		font-size: 1.75rem;
	}

	.ebl-calc__fields {
		grid-template-columns: repeat( 3, 1fr );
		gap: 1.25rem;
	}

	.ebl-calc__summary {
		grid-template-columns: repeat( 3, 1fr );
	}

	.ebl-calc__submit {
		width: auto;
		min-width: 12rem;
	}
}

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