/* ==========================================================================
   PA EITC Calculator
   All rules are scoped under .paeitc-calc so the plugin never leaks into
   the host theme, and the theme never leaks in past our resets below.
   ========================================================================== */

.paeitc-calc {
	/* Brand palette — matches the site's theme tokens. */
	--paeitc-black: #000000;
	--paeitc-white: #FFFFFF;
	--paeitc-grey: #707070;
	--paeitc-orange: #F47925;
	--paeitc-red: #F04E31;
	--paeitc-light-blue: #6C76D3;
	--paeitc-blue: #0044B5;

	/* Semantic tokens, mapped from the palette above. */
	--paeitc-ink: var(--paeitc-black);
	--paeitc-slate: var(--paeitc-grey);
	--paeitc-wash: #F5F5F6;
	--paeitc-card: var(--paeitc-white);
	--paeitc-line: #E1E1E2;
	--paeitc-accent: var(--paeitc-blue);
	--paeitc-accent-dark: #003080;
	--paeitc-award: var(--paeitc-blue);
	--paeitc-award-wash: #EBEDF9;
	--paeitc-cost: var(--paeitc-orange);
	--paeitc-cost-wash: #FDEEE2;
	--paeitc-alert: var(--paeitc-red);
	--paeitc-alert-wash: #FDEBE8;
	--paeitc-radius: 14px;

	/* Type — inherits the theme's own faces; falls back gracefully if a
	   page ever loads this calculator without the theme's font-face rules. */
	--paeitc-heading-font: 'League Gothic', 'Oswald', Impact, 'Arial Narrow Bold', sans-serif;
	--paeitc-sans: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

	all: initial;
	display: block;
	box-sizing: border-box;
	font-family: var(--paeitc-sans);
	color: var(--paeitc-ink);
	max-width: 920px;
	margin: 0 auto;
	line-height: 1.5;
}

.paeitc-calc *,
.paeitc-calc *::before,
.paeitc-calc *::after {
	box-sizing: border-box;
	font-family: inherit;
	color: inherit;
	line-height: inherit;
}

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

/* ---------------------------------- Card --------------------------------- */

.paeitc-card {
	background: var(--paeitc-card);
	border: 1px solid var(--paeitc-line);
	border-radius: var(--paeitc-radius);
	overflow: hidden;
}

.paeitc-head {
	background: var(--paeitc-wash);
	border-bottom: 1px solid var(--paeitc-line);
	padding: 28px clamp(20px, 4vw, 40px);
}

.paeitc-eyebrow {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--paeitc-accent-dark);
}

.paeitc-title {
	margin: 0 0 10px;
	font-family: var(--paeitc-heading-font);
	font-weight: 400;
	font-size: clamp(28px, 4vw, 40px);
	line-height: 1.1;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: var(--paeitc-ink);
}

.paeitc-intro {
	margin: 0;
	max-width: 60ch;
	font-size: 15px;
	color: var(--paeitc-slate);
}

.paeitc-body {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
}

@media (min-width: 720px) {
	.paeitc-body {
		grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	}
	.paeitc-inputs {
		border-right: 1px solid var(--paeitc-line);
	}
}

/* --------------------------------- Inputs -------------------------------- */

.paeitc-inputs {
	padding: clamp(20px, 4vw, 32px);
	border-bottom: 1px solid var(--paeitc-line);
}

@media (min-width: 720px) {
	.paeitc-inputs {
		border-bottom: none;
	}
}

.paeitc-field {
	margin-bottom: 22px;
}

.paeitc-field:last-child {
	margin-bottom: 0;
}

.paeitc-field-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	flex-wrap: wrap;
}

.paeitc-field label {
	display: block;
	font-size: 13px;
	font-weight: 700;
	color: var(--paeitc-ink);
	margin-bottom: 8px;
}

.paeitc-max-note {
	font-size: 12px;
	color: var(--paeitc-slate);
	margin-bottom: 8px;
}

.paeitc-input-wrap {
	position: relative;
	display: flex;
	align-items: center;
	border: 1px solid var(--paeitc-line);
	border-radius: 10px;
	background: #FFFFFF;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.paeitc-input-wrap:focus-within {
	border-color: var(--paeitc-accent);
	box-shadow: 0 0 0 3px rgba(0, 68, 181, 0.15);
}

.paeitc-prefix {
	padding: 0 0 0 14px;
	font-size: 18px;
	font-weight: 600;
	color: var(--paeitc-slate);
	user-select: none;
}

.paeitc-input-wrap input[type="number"],
.paeitc-input-wrap input[type="text"] {
	width: 100%;
	border: none;
	background: transparent;
	padding: 13px 14px 13px 6px;
	font-size: 18px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--paeitc-ink);
	appearance: textfield;
}

.paeitc-input-wrap input[type="number"]::-webkit-outer-spin-button,
.paeitc-input-wrap input[type="number"]::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}

.paeitc-input-wrap input:focus {
	outline: none;
}

.paeitc-hint {
	margin: 8px 2px 0;
	font-size: 12px;
	color: var(--paeitc-slate);
}

.paeitc-warning {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 10px 0 0;
	padding: 10px 12px;
	font-size: 12px;
	line-height: 1.5;
	color: var(--paeitc-alert);
	background: var(--paeitc-alert-wash);
	border: 1px solid var(--paeitc-alert);
	border-radius: 8px;
}

.paeitc-warning[hidden] {
	display: none;
}

.paeitc-warning::before {
	content: "!";
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--paeitc-alert);
	color: var(--paeitc-white);
	font-size: 11px;
	font-weight: 700;
}

.paeitc-clear-btn {
	appearance: none;
	margin-top: 22px;
	padding: 10px 18px;
	background: transparent;
	border: 1px solid var(--paeitc-line);
	border-radius: 999px;
	color: var(--paeitc-slate);
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.paeitc-clear-btn:hover {
	border-color: var(--paeitc-accent);
	color: var(--paeitc-accent);
	background: var(--paeitc-award-wash);
}

.paeitc-rate-label {
	font-weight: 700;
	color: var(--paeitc-accent-dark);
}

.paeitc-derived {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--paeitc-wash);
	border: 1px dashed var(--paeitc-line);
	border-radius: 10px;
	padding: 12px 16px;
	margin: 4px 0 26px;
}

.paeitc-derived-label {
	font-size: 13px;
	color: var(--paeitc-slate);
}

.paeitc-derived-value {
	font-family: var(--paeitc-heading-font);
	font-size: 24px;
	letter-spacing: 0.02em;
	font-variant-numeric: tabular-nums;
	color: var(--paeitc-ink);
}

/* Range slider */

.paeitc-slider {
	width: 100%;
	margin-top: 14px;
	-webkit-appearance: none;
	appearance: none;
	height: 4px;
	border-radius: 999px;
	background: var(--paeitc-line);
	outline: none;
}

.paeitc-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--paeitc-accent);
	border: 3px solid #FFFFFF;
	box-shadow: 0 0 0 1px var(--paeitc-accent);
	cursor: pointer;
	margin-top: -7px;
}

.paeitc-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--paeitc-accent);
	border: 3px solid #FFFFFF;
	box-shadow: 0 0 0 1px var(--paeitc-accent);
	cursor: pointer;
}

.paeitc-slider::-moz-range-track {
	height: 4px;
	border-radius: 999px;
	background: var(--paeitc-line);
}

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

.paeitc-results {
	padding: clamp(20px, 4vw, 32px);
}

.paeitc-flow {
	display: flex;
	width: 100%;
	height: 34px;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid var(--paeitc-line);
	margin-bottom: 20px;
}

.paeitc-flow-segment {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	color: #FFFFFF;
	transition: flex-basis 0.25s ease;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
}

.paeitc-flow-award {
	background: var(--paeitc-award);
}

.paeitc-flow-cost {
	background: var(--paeitc-cost);
}

.paeitc-flow-pct {
	padding: 0 6px;
}

.paeitc-ledger {
	margin: 0;
	border-top: 1px solid var(--paeitc-line);
}

.paeitc-ledger-row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 2px;
	border-bottom: 1px solid var(--paeitc-line);
}

.paeitc-ledger-row dt {
	font-size: 14px;
	font-weight: 600;
	color: var(--paeitc-ink);
}

.paeitc-ledger-sub {
	display: block;
	font-size: 12px;
	font-weight: 400;
	color: var(--paeitc-slate);
	margin-top: 2px;
}

.paeitc-ledger-row dd {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.paeitc-ledger-award dd {
	color: var(--paeitc-award);
}

.paeitc-ledger-subtract dd {
	color: var(--paeitc-cost);
}

.paeitc-ledger-total {
	border-bottom: none;
	padding-top: 18px;
	margin-top: 4px;
	border-top: 2px solid var(--paeitc-ink);
}

.paeitc-ledger-total dt {
	font-family: var(--paeitc-heading-font);
	font-size: 18px;
	font-weight: 400;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	align-self: center;
}

.paeitc-ledger-total dd {
	font-family: var(--paeitc-heading-font);
	font-size: clamp(30px, 4vw, 38px);
	font-weight: 400;
	letter-spacing: 0.01em;
	color: var(--paeitc-ink);
}

.paeitc-disclaimer {
	margin: 18px 0 0;
	font-size: 11.5px;
	line-height: 1.5;
	color: var(--paeitc-slate);
}

/* ------------------------------ Small screens ----------------------------- */

@media (max-width: 419px) {
	.paeitc-ledger-row {
		flex-direction: column;
		gap: 4px;
	}
	.paeitc-ledger-row dd {
		font-size: 15px;
	}
	.paeitc-flow-segment {
		font-size: 11px;
	}
}

/* ------------------------------ Reduced motion ----------------------------- */

@media (prefers-reduced-motion: reduce) {
	.paeitc-flow-segment {
		transition: none;
	}
}
