/* MJS Tools 1.1.0 — calculator shell: inputs with sliders on the left, live result on the right. Uses theme tokens with fallbacks. */
.mjs-calc {
	--c-ink: var(--wp--preset--color--contrast, #13213C);
	--c-saffron: var(--wp--preset--color--primary, #FF9933);
	--c-deep: var(--wp--preset--color--saffron-deep, #C2410C);
	--c-soft: var(--wp--preset--color--saffron-soft, #FFEDD5);
	--c-cream: var(--wp--preset--color--surface-alt, #FFF7ED);
	--c-border: var(--wp--preset--color--border, #F1E2CF);
	--c-muted: var(--wp--preset--color--muted, #5F6B7A);
	--c-alert: var(--wp--preset--color--alert, #B91C1C);
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
	margin-block: 24px 40px;
	font-variant-numeric: tabular-nums;
}
@media (min-width: 860px) {
	.mjs-calc.is-ready { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; }
	.mjs-calc__summary { display: none !important; }
}
.mjs-calc__loading { color: var(--c-muted); }

/* Form */
.mjs-calc__form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; background: #FFF; border: 1px solid var(--c-border); border-radius: 18px; padding: 24px; box-shadow: 0 1px 2px rgba(19, 33, 60, 0.04), 0 12px 32px rgba(19, 33, 60, 0.06); }
.mjs-calc__field[hidden] { display: none; }
.mjs-calc__field { min-width: 0; }
.mjs-calc__field label { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; color: var(--c-ink); }
.mjs-calc__field.is-select label { margin-bottom: 8px; }
.mjs-calc__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.mjs-calc__hint { flex: none; font-size: 13px; font-weight: 600; color: var(--c-deep); white-space: nowrap; }
.mjs-calc__hint:empty { display: none; }

.mjs-calc__box { display: flex; align-items: stretch; min-height: 48px; border: 1px solid #E5D5C0; border-radius: 12px; background: #FFF; overflow: hidden; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.mjs-calc__box:focus-within { border-color: var(--c-deep); box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.3); }
.mjs-calc__affix { display: flex; align-items: center; padding: 0 14px; background: var(--c-cream); color: var(--c-muted); font-weight: 600; font-size: 15px; white-space: nowrap; }
.mjs-calc__box.has-prefix .mjs-calc__affix { border-right: 1px solid #F1E2CF; }
.mjs-calc__box.has-suffix .mjs-calc__affix { border-left: 1px solid #F1E2CF; }
.mjs-calc__box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0 14px; font: inherit; font-size: 17px; font-weight: 600; color: var(--c-ink); font-variant-numeric: tabular-nums; }
.mjs-calc__field.has-error .mjs-calc__box { border-color: var(--c-alert); box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12); }
.mjs-calc__err { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: var(--c-alert); }
.mjs-calc__err:empty { display: none; }

.mjs-calc__field select {
	width: 100%;
	max-width: 100%;
	min-width: 0;
	text-overflow: ellipsis;
	box-sizing: border-box;
	min-height: 48px;
	font: inherit;
	font-size: 16px;
	color: var(--c-ink);
	background: #FFF;
	border: 1px solid #E5D5C0;
	border-radius: 12px;
	padding: 8px 12px;
}
.mjs-calc__field select:focus { border-color: var(--c-deep); outline: 3px solid rgba(255, 153, 51, 0.3); outline-offset: 0; }

/* Slider */
.mjs-calc__range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 28px; margin: 10px 0 0; padding: 0; background: transparent; cursor: pointer; touch-action: pan-y; }
.mjs-calc__range:focus { outline: none; }
.mjs-calc__range::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: linear-gradient(to right, var(--c-saffron) 0, var(--c-saffron) var(--p, 0%), #F1E2CF var(--p, 0%), #F1E2CF 100%); }
.mjs-calc__range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #FFF; border: 3px solid var(--c-saffron); box-shadow: 0 2px 6px rgba(19, 33, 60, 0.25); transition: transform 0.12s ease; }
.mjs-calc__range:active::-webkit-slider-thumb { transform: scale(1.12); }
.mjs-calc__range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.35); }
.mjs-calc__range::-moz-range-track { height: 6px; border-radius: 999px; background: #F1E2CF; }
.mjs-calc__range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--c-saffron); }
.mjs-calc__range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #FFF; border: 3px solid var(--c-saffron); box-shadow: 0 2px 6px rgba(19, 33, 60, 0.25); }
.mjs-calc__range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px rgba(194, 65, 12, 0.35); }
.mjs-calc__scale { display: flex; justify-content: space-between; margin-top: 2px; font-size: 12px; color: var(--c-muted); }

/* Result */
.mjs-calc__result {
	background: var(--c-ink);
	color: #FFF;
	border-radius: 18px;
	padding: 28px 24px 24px;
	background-image: radial-gradient(60% 80% at 100% 0%, rgba(255, 153, 51, 0.35), transparent 65%);
	position: sticky;
	top: 96px;
	box-shadow: 0 18px 40px rgba(19, 33, 60, 0.22);
}
.mjs-calc__label { margin: 0; font-size: 15px; color: #FFD8B0; font-weight: 600; letter-spacing: 0.02em; }
.mjs-calc__value { margin: 4px 0 0; font-family: var(--wp--preset--font-family--heading, inherit); font-weight: 700; font-size: clamp(32px, 5vw, 46px); line-height: 1.1; color: #FFF; overflow-wrap: anywhere; }
.mjs-calc__sub { margin: 8px 0 0; color: #E4E8F0; }
.mjs-calc__bar { display: flex; height: 12px; margin: 20px 0 0; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.12); }
.mjs-calc__bar span { display: block; height: 100%; transition: width 0.2s ease; }
.mjs-calc__bar .is-0, .mjs-calc__legend i.is-0 { background: #FF9933; }
.mjs-calc__bar .is-1, .mjs-calc__legend i.is-1 { background: #5FD38D; }
.mjs-calc__bar .is-2, .mjs-calc__legend i.is-2 { background: #9FB0CC; }
.mjs-calc__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; color: #D5DBE6; }
.mjs-calc__legend li { display: inline-flex; align-items: center; gap: 6px; }
.mjs-calc__legend i { width: 10px; height: 10px; border-radius: 3px; }
.mjs-calc__legend b { color: #FFF; font-weight: 600; }
.mjs-calc__rows { margin: 20px 0 0; padding: 0; }
.mjs-calc__rows div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.mjs-calc__rows dt { color: #D5DBE6; }
.mjs-calc__rows dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; }
.mjs-calc__table { margin-top: 16px; overflow: auto; max-height: 340px; border-radius: 10px; }
.mjs-calc__table:focus-visible { outline: 2px solid var(--c-saffron); }
.mjs-calc__table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.mjs-calc__table th, .mjs-calc__table td { padding: 8px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); text-align: right; white-space: nowrap; }
.mjs-calc__table thead th { color: #FFD8B0; font-weight: 600; position: sticky; top: 0; background: var(--c-ink); }
.mjs-calc__table th[scope="row"], .mjs-calc__table thead th:first-child { text-align: left; font-weight: 500; }
.mjs-calc__notes { margin: 16px 0 0; padding-left: 18px; font-size: 14px; color: #C9D1DE; }
.mjs-calc__notes li + li { margin-top: 6px; }

/* Phones: a compact live result stays in view while you move the sliders. */
.mjs-calc__summary { display: none; }
@media (max-width: 859px) {
	.mjs-calc__result { position: static; }
	.mjs-calc.is-ready .mjs-calc__summary {
		display: flex;
		position: sticky;
		top: calc(var(--mjs-header-h, 64px) + var(--wp-admin--admin-bar--height, 0px) + 8px);
		z-index: 5;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
		padding: 12px 16px;
		border-radius: 14px;
		background: var(--c-ink);
		color: #FFD8B0;
		font-size: 14px;
		font-weight: 600;
		box-shadow: 0 10px 24px rgba(19, 33, 60, 0.25);
	}
	.mjs-calc__summary strong { color: #FFF; font-family: var(--wp--preset--font-family--heading, inherit); font-size: 22px; white-space: nowrap; }
	.mjs-calc.is-ready .mjs-calc__summary { transition: opacity .2s ease, visibility .2s; }
	.mjs-calc.has-result-in-view .mjs-calc__summary { opacity: 0; visibility: hidden; }
	.mjs-calc__form { padding: 20px 18px; }
}
/* The WordPress toolbar scrolls away on phones, so it adds no offset there. */
@media (max-width: 600px) {
	.mjs-calc.is-ready .mjs-calc__summary { top: calc(var(--mjs-header-h, 64px) + 8px); }
}
@media (prefers-reduced-motion: reduce) {
	.mjs-calc__bar span, .mjs-calc__range::-webkit-slider-thumb { transition: none; }
}
