/* ═══════════════════════════════════════════════════════════════
   SPW Calculators — Frontend Styles
   v1.0.4 · Splendid Websites

   Colour usage:
   - All text (body, labels, results, disclaimers) uses var(--primary)
     and its tint scale (--primary-l-1 through --primary-l-10).
   - Accent lines (top border, active tab underline, results left
     border, focus ring) use var(--secondary).
   - Field backgrounds and borders use the dedicated black tint scale
     (--black-l-1 through --black-l-20), not primary/secondary tints,
     since these are neutral UI chrome rather than brand colour.
   No color-mix(), no hardcoded hex values, no invented variables —
   every colour below is a direct reference to a variable defined in
   the site's Bricks colour palette.

   Sizing:
   - Font sizes use the --text-* scale (a separate fluid scale from
     spacing). --space-* is for padding/margin/gap only.
   - The spacing scale's smallest step is --space-2xs — there is no
     --space-3xs, so the tightest gaps in this file use --space-2xs.
   ═══════════════════════════════════════════════════════════════ */

/* ── Wrap ───────────────────────────────────────────────────── */
.spwcalc-wrap {
	display: block;
	width: 100%;
	background: var(--white);
	border: 1px solid var(--black-l-18);
	border-top: 2px solid var(--secondary);
	border-radius: 0;
	padding: var(--space-l);
	font-size: var(--text-s);
	color: var(--primary);
	box-sizing: border-box;
}

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

/* ── Tab navigation ─────────────────────────────────────────── */
.spwcalc-tabnav {
	display: flex;
	gap: var(--space-2xs);
	border-bottom: 1px solid var(--black-l-18);
	margin-bottom: var(--space-l);
}

.spwcalc-tabbtn {
	appearance: none;
	background: transparent;
	border: none;
	border-bottom: 2px solid transparent;
	padding: var(--space-xs) var(--space-s);
	margin-bottom: -1px;
	font-family: inherit;
	font-size: var(--text-s);
	font-weight: 600;
	color: var(--primary-l-5);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease;
}

.spwcalc-tabbtn:hover {
	color: var(--primary);
}

.spwcalc-tabbtn.is-active {
	color: var(--primary);
	border-bottom-color: var(--secondary);
}

.spwcalc-tabbtn:focus-visible {
	outline: 2px solid var(--secondary);
	outline-offset: 2px;
}

/* ── Panels ─────────────────────────────────────────────────── */
.spwcalc-panel {
	display: none;
}

.spwcalc-panel.is-active {
	display: block;
}

/* ── Field layout ───────────────────────────────────────────── */
.spwcalc-field-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-s);
	margin-bottom: var(--space-s);
}

.spwcalc-field {
	flex: 1 1 200px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
}

.spwcalc-field label {
	font-size: var(--text-2xs);
	font-weight: 600;
	color: var(--primary-l-5);
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

/* ── Inputs ─────────────────────────────────────────────────── */
.spwcalc-input {
	width: 100%;
	background: var(--black-l-20);
	border: 1px solid var(--black-l-18);
	border-radius: 0;
	padding: var(--space-xs) var(--space-s);
	font-family: inherit;
	font-size: var(--text-s);
	color: var(--primary);
	transition: border-color 0.2s ease;
}

.spwcalc-input:focus {
	outline: none;
	border-color: var(--secondary);
}

.spwcalc-input::placeholder {
	color: var(--primary-l-5);
}

/* Select arrow kept native; just align colours */
.spwcalc-input[type="text"],
.spwcalc-input[type="number"],
select.spwcalc-input {
	appearance: none;
}

select.spwcalc-input {
	background-image: linear-gradient(45deg, transparent 50%, var(--primary-l-5) 50%),
		linear-gradient(135deg, var(--primary-l-5) 50%, transparent 50%);
	background-position: calc(100% - var(--space-s) - 5px) center, calc(100% - var(--space-s)) center;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	padding-right: var(--space-xl);
}

/* ── Results ────────────────────────────────────────────────── */
.spwcalc-result {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-s);
	background: var(--black-l-20);
	border-left: 2px solid var(--secondary);
	padding: var(--space-s) var(--space-m);
	margin-top: var(--space-m);
}

.spwcalc-result-row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-s);
	margin-top: var(--space-m);
}

.spwcalc-result-row .spwcalc-result {
	flex: 1 1 200px;
	margin-top: 0;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-2xs);
}

.spwcalc-result-label {
	font-size: var(--text-2xs);
	font-weight: 600;
	color: var(--primary-l-5);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.spwcalc-result-figure {
	font-size: var(--text-l);
	font-weight: 700;
	color: var(--primary);
	line-height: 1.1;
}

/* ── Disclaimer ─────────────────────────────────────────────── */
.spwcalc-disclaimer {
	margin: var(--space-s) 0 0;
	font-size: var(--text-2xs);
	line-height: 1.5;
	color: var(--primary-l-5);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 767px) {
	.spwcalc-wrap {
		padding: var(--space-m);
	}

	.spwcalc-tabnav {
		gap: 0;
	}

	.spwcalc-tabbtn {
		flex: 1 1 auto;
		text-align: center;
		padding: var(--space-xs) var(--space-2xs);
		font-size: var(--text-xs);
	}

	.spwcalc-field-row {
		gap: var(--space-2xs);
	}

	.spwcalc-field {
		flex: 1 1 100%;
	}

	/* Fixed 16px floor (not the fluid --text-s var) — iOS Safari
	   zooms in on focus for any input with a computed font-size
	   below 16px, regardless of viewport meta settings. */
	.spwcalc-input {
		font-size: 16px;
	}

	.spwcalc-result-figure {
		font-size: var(--text-m);
	}
}
