/*
 * Lex Home calculators.
 *
 * Tokens read off the live theme so the widget belongs to the page rather than
 * sitting on top of it: headings Domine 700, body Poppins, brand #7a1223 with
 * #541b11 for hover, page ground #fff6f3, text #333. Both faces are already
 * enqueued site-wide by the theme, so nothing extra is loaded here.
 *
 * Everything is scoped under .lhc and kept to a single specificity level so the
 * theme's own rules neither leak in nor get overridden by accident.
 */

.lhc {
	--lhc-brand: #7a1223;
	--lhc-brand-dark: #541b11;
	--lhc-ground: #fff6f3;
	--lhc-surface: #ffffff;
	--lhc-surface-2: #fdf0ec;
	--lhc-ink: #333333;
	--lhc-ink-2: #6d5350;
	--lhc-rule: #ecd7d1;
	--lhc-rule-strong: #d9b9b2;
	--lhc-soft: #f6e0dc;
	--lhc-warn: #8a5a12;

	--lhc-display: "Domine", Georgia, serif;
	--lhc-body: "Poppins", -apple-system, "Segoe UI", Roboto, sans-serif;

	font-family: var(--lhc-body);
	font-size: 16px;
	line-height: 1.6;
	color: var(--lhc-ink);
	max-width: 100%;
}

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

.lhc-num,
.lhc-ladder td,
.lhc-v {
	font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */

.lhc-grid {
	display: grid;
	grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
	border: 1px solid var(--lhc-rule-strong);
	background: var(--lhc-surface);
	align-items: start;
}

@media (max-width: 880px) {
	.lhc-grid {
		grid-template-columns: 1fr;
	}
}

.lhc-inputs {
	display: flex;
	flex-direction: column;
	gap: 1.35rem;
	padding: 1.5rem;
	border-right: 1px solid var(--lhc-rule);
}

@media (max-width: 880px) {
	.lhc-inputs {
		border-right: 0;
		border-bottom: 1px solid var(--lhc-rule);
	}
}

.lhc-out {
	display: flex;
	flex-direction: column;
	gap: 1.4rem;
	padding: 1.5rem;
}

/* ---------- inputs ---------- */

.lhc-field {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.lhc-label {
	font-size: 0.78rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--lhc-ink-2);
	margin: 0;
	font-weight: 500;
}

.lhc-money {
	display: flex;
	align-items: center;
	border: 1px solid var(--lhc-rule-strong);
	background: var(--lhc-ground);
	border-radius: 2px;
}

.lhc-money > span {
	padding: 0 0.6rem;
	color: var(--lhc-ink-2);
	font-family: var(--lhc-display);
	flex: none;
}

.lhc-money > input {
	flex: 1 1 auto;
	min-width: 0;
	width: 100%;
	border: 0;
	background: transparent;
	color: var(--lhc-ink);
	font-family: var(--lhc-display);
	font-size: 1.2rem;
	font-variant-numeric: tabular-nums;
	padding: 0.5rem 0.6rem 0.5rem 0;
	margin: 0;
	box-shadow: none;
}

.lhc-money-pc > input {
	text-align: right;
	padding-left: 0.6rem;
}

.lhc-money > input:focus {
	outline: 0;
	box-shadow: none;
}

.lhc-money:focus-within {
	border-color: var(--lhc-brand);
	box-shadow: 0 0 0 2px var(--lhc-soft);
}

.lhc-pair {
	display: flex;
	gap: 0.5rem;
}

.lhc-pair > .lhc-money {
	flex: 1 1 0;
	min-width: 0;
}

.lhc input[type="range"] {
	width: 100%;
	margin: 0;
	accent-color: var(--lhc-brand);
}

.lhc input[type="range"]:focus-visible {
	outline: 2px solid var(--lhc-brand);
	outline-offset: 3px;
}

/* ---------- switches ---------- */

.lhc-switches {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--lhc-rule);
	padding-top: 0.9rem;
}

.lhc-sw {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.5rem 0;
	margin: 0;
	cursor: pointer;
}

.lhc-sw > input[type="checkbox"] {
	flex: none;
	width: 1.05rem;
	height: 1.05rem;
	margin: 0.3rem 0 0;
	accent-color: var(--lhc-brand);
}

.lhc-sw > input[type="checkbox"]:focus-visible {
	outline: 2px solid var(--lhc-brand);
	outline-offset: 2px;
}

.lhc-sw-t {
	display: block;
	font-size: 0.95rem;
	line-height: 1.4;
}

.lhc-sw-h {
	display: block;
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--lhc-ink-2);
	margin-top: 0.15rem;
}

.lhc-sw-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

/* The opt-in stamp duty block sits across the full width under both columns.
   Four switches with explanations need horizontal room; stacking them inside
   the input column wrapped every label onto three lines and left the results
   column empty beside it. */

.lhc-extras {
	grid-column: 1 / -1;
	border-top: 1px solid var(--lhc-rule);
	padding: 1.1rem 1.5rem 1.3rem;
	background: var(--lhc-surface-2);
}

.lhc-extras > .lhc-sw {
	padding-top: 0;
}

.lhc-extras > .lhc-sw .lhc-sw-t {
	font-weight: 500;
}

/* Four across on a wide panel, folding to two and then one. */
.lhc-subswitches {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
	gap: 0 1.75rem;
	margin-top: 0.45rem;
	padding-top: 0.85rem;
	border-top: 1px dashed var(--lhc-rule-strong);
}

.lhc-subswitches[hidden] {
	display: none;
}

.lhc-subswitches .lhc-sw {
	align-items: flex-start;
	padding: 0.4rem 0;
}

/* ---------- segmented control ---------- */

.lhc-seg {
	display: flex;
	border: 1px solid var(--lhc-rule-strong);
	border-radius: 2px;
	overflow: hidden;
}

.lhc-seg > button {
	flex: 1 1 0;
	font-family: var(--lhc-body);
	font-size: 0.85rem;
	padding: 0.55rem 0.4rem;
	border: 0;
	background: transparent;
	color: var(--lhc-ink-2);
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.lhc-seg > button + button {
	border-left: 1px solid var(--lhc-rule);
}

.lhc-seg > button[aria-pressed="true"] {
	background: var(--lhc-brand);
	color: #ffffff;
}

.lhc-seg > button:focus-visible {
	outline: 2px solid var(--lhc-brand);
	outline-offset: -3px;
}

/* ---------- results ---------- */

.lhc-headline {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem 1.9rem;
}

.lhc-big,
.lhc-sub {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.lhc-big > .lhc-v {
	font-family: var(--lhc-display);
	font-weight: 700;
	font-size: clamp(2.1rem, 1.5rem + 2.4vw, 3.1rem);
	line-height: 1;
	color: var(--lhc-brand);
}

.lhc-sub > .lhc-v {
	font-family: var(--lhc-display);
	font-weight: 700;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--lhc-ink);
}

.lhc-big > .lhc-k,
.lhc-sub > .lhc-k {
	font-size: 0.78rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--lhc-ink-2);
}

.lhc-stack {
	display: flex;
	height: 0.7rem;
	border: 1px solid var(--lhc-rule-strong);
	background: var(--lhc-ground);
}

.lhc-stack > i {
	display: block;
	height: 100%;
	background: var(--lhc-brand);
}

/* the surcharge story: the number that makes the page worth visiting */

.lhc-story {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	border: 1px solid var(--lhc-brand);
	background: var(--lhc-soft);
	padding: 0.9rem 1rem;
}

.lhc-story-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	font-size: 0.85rem;
}

.lhc-story-row > .lhc-num {
	font-family: var(--lhc-display);
	white-space: nowrap;
}

.lhc-story-total {
	border-top: 1px solid var(--lhc-rule-strong);
	padding-top: 0.5rem;
	font-size: 1rem;
}

.lhc-story-total > strong {
	color: var(--lhc-brand);
}

/* ---------- ladder ---------- */

.lhc-eyebrow {
	font-size: 0.78rem;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: var(--lhc-ink-2);
	margin: 0 0 0.5rem;
}

.lhc-scroll {
	overflow-x: auto;
	max-width: 100%;
}

table.lhc-ladder {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
	margin: 0;
	background: transparent;
}

table.lhc-ladder th {
	text-align: left;
	font-weight: 500;
	font-size: 0.74rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--lhc-ink-2);
	padding: 0.4rem 0.6rem;
	border: 0;
	border-bottom: 1px solid var(--lhc-rule-strong);
	background: transparent;
}

table.lhc-ladder td {
	padding: 0.45rem 0.6rem;
	border: 0;
	border-bottom: 1px solid var(--lhc-rule);
	background: transparent;
}

table.lhc-ladder tbody tr:last-child td {
	border-bottom: 0;
}

table.lhc-ladder .lhc-r {
	text-align: right;
	white-space: nowrap;
}

table.lhc-ladder tr.lhc-zero td {
	color: var(--lhc-ink-2);
}

.lhc-decomp {
	color: var(--lhc-ink-2);
	font-size: 0.78rem;
}

.lhc-decomp em {
	font-style: normal;
	color: var(--lhc-brand);
}

/* ---------- notes ---------- */

.lhc-note,
.lhc-flag {
	font-size: 0.85rem;
	line-height: 1.55;
	color: var(--lhc-ink-2);
	margin: 0;
}

.lhc-flag {
	color: var(--lhc-warn);
}

/* ---------- cta ---------- */

.lhc-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1.25rem;
	margin-top: 1.5rem;
	padding: 1.5rem;
	border: 1px solid var(--lhc-rule-strong);
	background: var(--lhc-surface-2);
}

.lhc-cta-copy {
	flex: 1 1 20rem;
}

.lhc-cta-copy h3 {
	font-family: var(--lhc-display);
	font-weight: 700;
	font-size: 1.25rem;
	line-height: 1.25;
	color: var(--lhc-brand);
	margin: 0 0 0.35rem;
}

.lhc-cta-copy p {
	margin: 0;
	font-size: 0.92rem;
}

.lhc-cta-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
}

.lhc-btn {
	display: inline-block;
	font-family: var(--lhc-display);
	font-weight: 500;
	font-size: 1rem;
	line-height: 1.4;
	padding: 10px 25px;
	border: 1px solid var(--lhc-brand);
	border-radius: 2px;
	background: var(--lhc-brand);
	color: #ffffff;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.lhc-btn:hover,
.lhc-btn:focus {
	background: var(--lhc-brand-dark);
	border-color: var(--lhc-brand-dark);
	color: #ffffff;
	text-decoration: none;
}

.lhc-btn-ghost {
	background: transparent;
	color: var(--lhc-brand);
}

.lhc-btn-ghost:hover,
.lhc-btn-ghost:focus {
	background: var(--lhc-soft);
	border-color: var(--lhc-brand);
	color: var(--lhc-brand-dark);
}

.lhc-btn:focus-visible {
	outline: 2px solid var(--lhc-ink);
	outline-offset: 2px;
}

/* ---------- disclaimer ---------- */

.lhc-disclaim {
	margin-top: 1.5rem;
	padding-top: 0.9rem;
	border-top: 2px solid var(--lhc-brand);
	font-size: 0.8rem;
	line-height: 1.55;
	color: var(--lhc-ink-2);
}

.lhc-disclaim p {
	margin: 0 0 0.4rem;
}

.lhc-disclaim p:last-child {
	margin-bottom: 0;
}

.lhc-disclaim strong {
	color: var(--lhc-ink);
}

@media (prefers-reduced-motion: reduce) {
	.lhc-btn,
	.lhc-seg > button {
		transition: none;
	}
}
