/**
 * JS Material Calculator - front end styles.
 *
 * The four brand colours come in as custom properties set on the wrapper by the
 * shortcode, so a different site can be recoloured from the settings screen
 * without touching this file. Everything else inherits the theme's typography.
 */

.jsmc {
	/* Overridden inline by the shortcode. */
	--jsmc-accent: #9abc41;
	--jsmc-accent-dark: #416817;
	--jsmc-highlight: #f5751c;
	--jsmc-accent-text: #ffffff;

	--jsmc-panel: #f7f9f1;
	--jsmc-line: #dde5c9;
	--jsmc-muted: #6d7566;
	--jsmc-radius: 6px;

	font-family: inherit;
	max-width: 100%;
}

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

.jsmc-panels {
	display: grid;
	grid-template-columns: 1fr;
	gap: 20px;
}

@media (min-width: 780px) {
	.jsmc-panels {
		grid-template-columns: 1.1fr 1fr;
		align-items: stretch;
	}
}

.jsmc-panel {
	background: var(--jsmc-panel);
	border: 1px solid var(--jsmc-line);
	border-radius: var(--jsmc-radius);
	padding: 26px;
}

/* The results panel is the payoff, so it carries the deep green. */
.jsmc-panel-results {
	background: var(--jsmc-accent-dark);
	border-color: var(--jsmc-accent-dark);
	color: #ffffff;
	display: flex;
	flex-direction: column;
}

/* Fields */

.jsmc-field {
	margin-bottom: 18px;
}

.jsmc-field label,
.jsmc-label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 0.95em;
	color: var(--jsmc-accent-dark);
}

.jsmc select,
.jsmc input[type="number"] {
	width: 100%;
	max-width: none;
	margin: 0;
	height: auto;
	padding: 11px 12px;
	border: 1px solid var(--jsmc-line);
	border-radius: 4px;
	background: #ffffff;
	font: inherit;
	line-height: 1.3;
	color: #333333;
}

.jsmc select:focus,
.jsmc input[type="number"]:focus {
	border-color: var(--jsmc-accent);
}

.jsmc select:focus-visible,
.jsmc input:focus-visible,
.jsmc button:focus-visible,
.jsmc a:focus-visible {
	outline: 2px solid var(--jsmc-highlight);
	outline-offset: 2px;
}

.jsmc-measurement-inputs {
	display: grid;
	grid-template-columns: 1fr 88px;
	gap: 8px;
}

.jsmc-hint {
	margin: 8px 0 0;
	font-size: 0.85em;
	color: var(--jsmc-muted);
	line-height: 1.5;
}

/* Shape picker */

.jsmc-shapes {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.jsmc-shape {
	flex: 1 1 auto;
	margin: 0;
}

.jsmc-shape input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.jsmc-shape span {
	display: block;
	padding: 11px 14px;
	border: 1px solid var(--jsmc-line);
	border-radius: 4px;
	background: #ffffff;
	text-align: center;
	font-size: 0.95em;
	cursor: pointer;
}

.jsmc-shape span:hover {
	border-color: var(--jsmc-accent);
}

.jsmc-shape input:checked + span {
	background: var(--jsmc-accent);
	border-color: var(--jsmc-accent);
	color: var(--jsmc-accent-text);
	font-weight: 600;
}

.jsmc-shape input:focus-visible + span {
	outline: 2px solid var(--jsmc-highlight);
	outline-offset: 2px;
}

.jsmc-depth {
	margin-top: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--jsmc-line);
}

/* Buttons */

.jsmc-button {
	display: inline-block;
	width: 100%;
	padding: 14px 20px;
	border: 1px solid var(--jsmc-accent);
	border-radius: 4px;
	background: var(--jsmc-accent);
	color: var(--jsmc-accent-text);
	font: inherit;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.jsmc-button:hover {
	background: var(--jsmc-accent-dark);
	border-color: var(--jsmc-accent-dark);
	color: var(--jsmc-accent-text);
}

.jsmc-button[disabled] {
	opacity: 0.4;
	cursor: not-allowed;
}

.jsmc-button[disabled]:hover {
	background: var(--jsmc-accent);
	border-color: var(--jsmc-accent);
}

/* Sits on the deep green panel, so it is outlined rather than filled. */
.jsmc-button-secondary {
	margin-top: auto;
	background: transparent;
	border-color: rgba(255, 255, 255, 0.55);
	color: #ffffff;
}

.jsmc-button-secondary:hover {
	background: #ffffff;
	border-color: #ffffff;
	color: var(--jsmc-accent-dark);
}

.jsmc-button-secondary[disabled]:hover {
	background: transparent;
	border-color: rgba(255, 255, 255, 0.55);
	color: #ffffff;
}

.jsmc-error {
	margin: 0 0 16px;
	padding: 11px 14px;
	border-left: 3px solid var(--jsmc-highlight);
	background: #fdf1e7;
	color: #8a3d09;
	font-size: 0.9em;
	line-height: 1.5;
}

/* Results */

.jsmc-results-heading {
	margin: 0 0 6px;
	padding: 0;
	font-size: 0.8em;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.75);
}

.jsmc-result-primary {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 22px;
}

.jsmc-result-value {
	font-size: 3.4rem;
	font-weight: 700;
	line-height: 1;
	color: var(--jsmc-highlight);
}

.jsmc-result-unit {
	font-size: 1.1rem;
	color: rgba(255, 255, 255, 0.8);
}

.jsmc-result-detail {
	margin: 0 0 22px;
	padding: 0;
	border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.jsmc-result-detail > div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 11px 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.jsmc-result-detail dt {
	margin: 0;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.8);
}

.jsmc-result-detail dd {
	margin: 0;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.jsmc-panel-results .jsmc-hint {
	color: rgba(255, 255, 255, 0.7);
}

/* Saved list */

.jsmc-saved {
	margin-top: 26px;
}

.jsmc-saved h3 {
	margin: 0 0 12px;
	font-size: 1.15em;
	color: var(--jsmc-accent-dark);
}

.jsmc-table-scroll {
	overflow-x: auto;
	border: 1px solid var(--jsmc-line);
	border-radius: var(--jsmc-radius);
}

.jsmc-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 0.92em;
}

.jsmc-table th,
.jsmc-table td {
	padding: 11px 14px;
	border-bottom: 1px solid var(--jsmc-line);
	text-align: left;
	white-space: nowrap;
}

.jsmc-table thead th {
	background: var(--jsmc-accent-dark);
	color: #ffffff;
	font-weight: 600;
	border-bottom: none;
}

.jsmc-table tbody tr:nth-child(even) {
	background: var(--jsmc-panel);
}

.jsmc-table .jsmc-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.jsmc-table tfoot th,
.jsmc-table tfoot td {
	background: var(--jsmc-panel);
	border-top: 2px solid var(--jsmc-accent);
	border-bottom: none;
	font-weight: 700;
	color: var(--jsmc-accent-dark);
}

.jsmc-remove {
	padding: 4px 6px;
	border: none;
	background: none;
	font: inherit;
	font-size: 0.9em;
	color: #a03127;
	text-decoration: underline;
	cursor: pointer;
}

.jsmc-disclaimer {
	margin: 12px 0 0;
	font-size: 0.85em;
	line-height: 1.5;
	color: var(--jsmc-muted);
}

/* The quote button is the one conversion action, so it takes the orange. */
.jsmc-enquiry {
	margin: 22px 0 0;
}

.jsmc-enquiry-link {
	background: var(--jsmc-highlight);
	border-color: var(--jsmc-highlight);
}

.jsmc-enquiry-link:hover {
	background: var(--jsmc-accent-dark);
	border-color: var(--jsmc-accent-dark);
}

@media (min-width: 500px) {
	.jsmc-enquiry .jsmc-button {
		width: auto;
		min-width: 270px;
	}
}

.jsmc .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

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