/**
 * Area81 Pricing Calculator — front end.
 *
 * Everything is scoped under .a81pc and driven by the tokens below. The accent
 * colour and the font come from the plugin settings (printed inline after this
 * file); a theme can override any token on .a81pc.
 *
 * Mobile first: one column with 16px gutters. The wider layouts depend on the
 * width of the calculator itself (container queries), not of the window, so
 * it also behaves in a narrow column and in the admin preview. From 880px the
 * add-ons and the summary sit in a pane to the right of the packages.
 */

.a81pc {
	--a81pc-accent: #ba166c;
	--a81pc-font: 'Poppins', 'Segoe UI', system-ui, sans-serif;

	--a81pc-bg: #ffffff;
	--a81pc-card: #fafafc;
	--a81pc-text: #1e1e24;
	--a81pc-muted: #6b6b76;
	--a81pc-line: #e2e2e8;
	--a81pc-on-accent: #ffffff;
	/* The summary's tint: the accent, mostly washed out into the background. */
	--a81pc-tint: color-mix(in srgb, var(--a81pc-accent) 10%, var(--a81pc-bg));
	--a81pc-gutter: 16px;

	box-sizing: border-box;
	max-width: 1120px;
	margin-inline: auto;
	padding: var(--a81pc-gutter);
	color: var(--a81pc-text);
	background: var(--a81pc-bg);
	font-family: var(--a81pc-font);
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
	color-scheme: light;
	container: a81pc / inline-size;
}

/* Dark tokens: forced with data-theme="dark", or following the visitor's
   system setting with data-theme="auto". */
.a81pc[data-theme='dark'] {
	--a81pc-bg: #151519;
	--a81pc-card: #1e1e24;
	--a81pc-text: #f1f1f4;
	--a81pc-muted: #a0a0aa;
	--a81pc-line: #33333b;
	--a81pc-tint: color-mix(in srgb, var(--a81pc-accent) 22%, var(--a81pc-bg));
	color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
	.a81pc[data-theme='auto'] {
		--a81pc-bg: #151519;
		--a81pc-card: #1e1e24;
		--a81pc-text: #f1f1f4;
		--a81pc-muted: #a0a0aa;
		--a81pc-line: #33333b;
		--a81pc-tint: color-mix(in srgb, var(--a81pc-accent) 22%, var(--a81pc-bg));
		color-scheme: dark;
	}
}

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

.a81pc [hidden] {
	display: none !important;
}

.a81pc h2,
.a81pc h3,
.a81pc p {
	margin: 0;
	padding: 0;
	font-family: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
}

/* ---- Header ------------------------------------------------------------ */

.a81pc .a81pc-kicker {
	color: var(--a81pc-accent);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.a81pc .a81pc-title {
	margin: 4px 0 8px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
}

.a81pc .a81pc-lead {
	margin: 0 0 24px;
	color: var(--a81pc-muted);
	white-space: pre-line;
}

/* ---- Contract type: segmented control ---------------------------------- */

.a81pc-contract {
	margin-bottom: 20px;
}

.a81pc-contract-label {
	display: block;
	margin-bottom: 6px;
	color: var(--a81pc-muted);
	font-size: 13px;
}

.a81pc-seg {
	display: inline-flex;
	max-width: 100%;
	border: 1px solid var(--a81pc-line);
	border-radius: 10px;
	overflow: hidden;
}

.a81pc-seg-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	opacity: 0;
}

.a81pc-seg-label {
	display: block;
	padding: 10px 18px;
	color: var(--a81pc-text);
	font: inherit;
	cursor: pointer;
}

.a81pc-seg-input:checked + .a81pc-seg-label {
	background: var(--a81pc-accent);
	color: var(--a81pc-on-accent);
}

.a81pc-seg-input:focus-visible + .a81pc-seg-label {
	outline: 2px solid var(--a81pc-accent);
	outline-offset: -4px;
}

.a81pc-seg-input:checked:focus-visible + .a81pc-seg-label {
	outline-color: var(--a81pc-on-accent);
}

/* ---- Columns ------------------------------------------------------------- */

.a81pc-cols {
	display: grid;
	gap: 0;
}

.a81pc-main,
.a81pc-side {
	min-width: 0;
}

@container a81pc (min-width: 880px) {
	.a81pc-cols {
		grid-template-columns: minmax(0, 1fr) 360px;
		gap: 20px;
		align-items: start;
	}

	.a81pc-side {
		position: sticky;
		top: 16px;
	}

	.a81pc-side .a81pc-summary {
		margin-top: 0;
	}

	.a81pc-side .a81pc-figures {
		grid-template-columns: 1fr;
	}
}

/* ---- Cards and rows ------------------------------------------------------ */

.a81pc-card {
	margin-bottom: 14px;
	padding: 18px 16px;
	border: 1px solid var(--a81pc-line);
	border-radius: 14px;
	background: var(--a81pc-card);
}

.a81pc .a81pc-group-title {
	margin: 0 0 6px;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.5;
}

/* Narrow: name and description on top, price and stepper beneath. */
.a81pc-item {
	padding: 10px 0;
	border-bottom: 1px solid var(--a81pc-line);
}

/* The last package or add-on in its card; a line of text may follow it. */
.a81pc-item:last-of-type {
	border-bottom: 0;
}

.a81pc-row {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 6px 14px;
	align-items: center;
}

/* ---- A package's parts --------------------------------------------------- */

.a81pc .a81pc-customize {
	margin: 4px 0 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: var(--a81pc-accent);
	font: 500 13px/1.5 var(--a81pc-font);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.a81pc-customize::after {
	content: ' +';
}

.a81pc-customize[aria-expanded='true']::after {
	content: ' \2212';
}

.a81pc .a81pc-parts {
	margin: 10px 0 2px;
	padding: 4px 12px;
	border: 1px solid var(--a81pc-line);
	border-radius: 10px;
	background: var(--a81pc-bg);
	list-style: none;
}

.a81pc .a81pc-part {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 4px 10px;
	align-items: center;
	margin: 0;
	padding: 8px 0;
	border-bottom: 1px solid var(--a81pc-line);
	font-size: 14px;
	list-style: none;
}

.a81pc .a81pc-part:last-child {
	border-bottom: 0;
}

.a81pc-part-name {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	min-width: 0;
}

.a81pc-part-note {
	color: var(--a81pc-muted);
	font-size: 12px;
}

.a81pc-part-price {
	color: var(--a81pc-muted);
	font-size: 13px;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.a81pc-part.is-off .a81pc-part-name > span:first-child {
	color: var(--a81pc-muted);
	text-decoration: line-through;
}

.a81pc-part .a81pc-info-text {
	grid-column: 1 / -1;
}

/* ---- Switch -------------------------------------------------------------- */

.a81pc-switch {
	position: relative;
	display: inline-block;
	flex: none;
	width: 40px;
	height: 24px;
}

.a81pc .a81pc-switch-input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.a81pc .a81pc-switch-input:disabled {
	cursor: default;
}

.a81pc-switch-track {
	position: absolute;
	inset: 0;
	border: 1px solid var(--a81pc-line);
	border-radius: 999px;
	background: var(--a81pc-line);
	pointer-events: none;
	transition: background-color 0.15s;
}

.a81pc-switch-track::after {
	content: '';
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	transition: transform 0.15s;
}

.a81pc-switch-input:checked + .a81pc-switch-track {
	border-color: var(--a81pc-accent);
	background: var(--a81pc-accent);
}

.a81pc-switch-input:checked + .a81pc-switch-track::after {
	transform: translateX(16px);
}

.a81pc-switch-input:disabled + .a81pc-switch-track {
	opacity: 0.45;
}

.a81pc-switch-input:focus-visible + .a81pc-switch-track {
	outline: 2px solid var(--a81pc-accent);
	outline-offset: 2px;
}

/* ---- "Switch package" hint ----------------------------------------------- */

.a81pc-hint {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-top: 10px;
	padding: 10px 12px;
	border-left: 4px solid var(--a81pc-accent);
	border-radius: 10px;
	background: var(--a81pc-tint);
	font-size: 14px;
}

.a81pc .a81pc-hint-button {
	margin: 0;
	padding: 6px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--a81pc-accent);
	box-shadow: none;
	color: var(--a81pc-on-accent);
	font: 500 14px/1.2 var(--a81pc-font);
	cursor: pointer;
}

.a81pc-row-text {
	grid-column: 1 / -1;
	min-width: 0;
}

.a81pc-row-name {
	display: flex;
	align-items: center;
	gap: 8px;
	font-weight: 500;
}

.a81pc .a81pc-row-desc {
	color: var(--a81pc-muted);
	font-size: 13px;
	white-space: pre-line;
}

.a81pc-price {
	display: flex;
	flex-wrap: wrap;
	gap: 0 6px;
	color: var(--a81pc-muted);
	font-size: 13px;
}

.a81pc-price-amount {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* From 520px wide: one line — text, price, control. */
@container a81pc (min-width: 520px) {
	.a81pc-card {
		padding: 18px 20px;
	}

	.a81pc-row {
		grid-template-columns: 1fr auto auto;
		gap: 14px;
	}

	.a81pc-row-text {
		grid-column: auto;
	}

	.a81pc-price {
		flex-direction: column;
		align-items: flex-end;
		font-size: 14px;
		text-align: right;
	}
}

/* In the right-hand pane the rows are narrow again: stack them. */
@container a81pc (min-width: 880px) {
	.a81pc-side .a81pc-row {
		grid-template-columns: 1fr auto;
		gap: 6px 14px;
	}

	.a81pc-side .a81pc-row-text {
		grid-column: 1 / -1;
	}

	.a81pc-side .a81pc-price {
		flex-direction: row;
		align-items: baseline;
		font-size: 13px;
		text-align: left;
	}
}

.a81pc-info {
	flex: none;
	display: inline-grid;
	place-items: center;
	width: 20px;
	height: 20px;
	padding: 0;
	border: 1px solid var(--a81pc-line);
	border-radius: 50%;
	background: var(--a81pc-bg);
	color: var(--a81pc-muted);
	font: italic 700 12px/1 Georgia, 'Times New Roman', serif;
	cursor: pointer;
}

.a81pc-info[aria-expanded='true'] {
	border-color: var(--a81pc-accent);
	background: var(--a81pc-accent);
	color: var(--a81pc-on-accent);
}

.a81pc .a81pc-info-text {
	margin-top: 6px;
	padding: 8px 10px;
	border: 1px solid var(--a81pc-line);
	border-radius: 8px;
	background: var(--a81pc-bg);
	font-size: 13px;
	white-space: pre-line;
}

/* ---- Quantity stepper --------------------------------------------------- */

.a81pc-stepper {
	display: flex;
	align-items: center;
	gap: 6px;
}

.a81pc .a81pc-step {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--a81pc-line);
	border-radius: 8px;
	background: var(--a81pc-bg);
	box-shadow: none;
	color: var(--a81pc-text);
	font: 400 18px/1 var(--a81pc-font);
	cursor: pointer;
}

.a81pc .a81pc-step:hover:not(:disabled) {
	border-color: var(--a81pc-accent);
	color: var(--a81pc-accent);
}

.a81pc .a81pc-step:disabled {
	color: var(--a81pc-line);
	cursor: default;
}

.a81pc .a81pc-qty {
	width: 56px;
	height: 40px;
	margin: 0;
	padding: 0 4px;
	border: 1px solid var(--a81pc-line);
	border-radius: 8px;
	background: var(--a81pc-bg);
	box-shadow: none;
	color: var(--a81pc-text);
	font: 400 16px/1 var(--a81pc-font);
	font-variant-numeric: tabular-nums;
	text-align: center;
	appearance: textfield;
	-moz-appearance: textfield;
}

.a81pc-qty::-webkit-outer-spin-button,
.a81pc-qty::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

/* With a mouse the reference's tighter 32px controls; touch keeps 40px. */
@media (hover: hover) and (pointer: fine) {
	.a81pc .a81pc-step {
		width: 32px;
		height: 32px;
	}

	.a81pc .a81pc-qty {
		height: 32px;
	}
}

.a81pc-step:focus-visible,
.a81pc-qty:focus-visible,
.a81pc-info:focus-visible,
.a81pc-customize:focus-visible,
.a81pc-hint-button:focus-visible,
.a81pc-button:focus-visible,
.a81pc-field input:focus-visible,
.a81pc-field textarea:focus-visible {
	outline: 2px solid var(--a81pc-accent);
	outline-offset: 2px;
}

/* ---- Summary ------------------------------------------------------------ */

.a81pc-summary {
	margin-top: 18px;
	padding: 18px 16px;
	border-left: 4px solid var(--a81pc-accent);
	border-radius: 14px;
	background: var(--a81pc-tint);
}

@container a81pc (min-width: 520px) {
	.a81pc-summary {
		padding: 18px 20px;
	}
}

.a81pc .a81pc-summary-title {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 700;
}

.a81pc-figures {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 14px;
}

.a81pc-figure-value {
	color: var(--a81pc-accent);
	font-size: 34px;
	font-weight: 700;
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

/* The accent on its own dark tint is too dim to read at this size. */
.a81pc[data-theme='dark'] .a81pc-figure-value {
	color: color-mix(in srgb, var(--a81pc-accent) 55%, #ffffff);
}

@media (prefers-color-scheme: dark) {
	.a81pc[data-theme='auto'] .a81pc-figure-value {
		color: color-mix(in srgb, var(--a81pc-accent) 55%, #ffffff);
	}
}

.a81pc-figure-label {
	color: var(--a81pc-muted);
	font-size: 13px;
}

.a81pc .a81pc-detail,
.a81pc .a81pc-vat,
.a81pc .a81pc-summary-note,
.a81pc .a81pc-footnote {
	margin-top: 18px;
	color: var(--a81pc-muted);
	font-size: 13px;
	white-space: pre-line;
}

.a81pc .a81pc-vat,
.a81pc .a81pc-summary-note {
	margin-top: 8px;
}

/* "Lower price from 6 users." */
.a81pc .a81pc-volume {
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px solid var(--a81pc-line);
	color: var(--a81pc-accent);
	font-size: 13px;
	font-weight: 500;
}

/* The implementation estimate: an explanation under the figure and a switch. */
.a81pc-figure-note {
	margin-top: 4px;
	color: var(--a81pc-muted);
	font-size: 12px;
	font-style: italic;
}

.a81pc-impl-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
	font-size: 14px;
}

/* Cost and margin: only present in the wp-admin preview. */
.a81pc .a81pc-margin {
	margin-top: 14px;
	padding: 8px 10px;
	border: 1px dashed var(--a81pc-muted);
	border-radius: 8px;
	color: var(--a81pc-text);
	font-size: 13px;
}

.a81pc .a81pc-form-intro {
	font-size: 14px;
}

/* ---- "Send my estimate" -------------------------------------------------- */

.a81pc-submit {
	display: grid;
	gap: 12px;
	margin-top: 18px;
}

.a81pc .a81pc-button {
	justify-self: start;
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	border: 0;
	border-radius: 10px;
	background: var(--a81pc-accent);
	box-shadow: none;
	color: var(--a81pc-on-accent);
	font: 500 16px/1.2 var(--a81pc-font);
	cursor: pointer;
}

.a81pc .a81pc-button:disabled {
	opacity: 0.6;
	cursor: default;
}

.a81pc-form {
	display: grid;
	gap: 10px;
	max-width: 420px;
}

.a81pc-field {
	display: grid;
	gap: 4px;
}

.a81pc-field label {
	font-size: 13px;
	font-weight: 500;
}

.a81pc .a81pc-field input,
.a81pc .a81pc-field textarea {
	width: 100%;
	min-height: 40px;
	margin: 0;
	padding: 8px 10px;
	border: 1px solid var(--a81pc-line);
	border-radius: 8px;
	background: var(--a81pc-bg);
	box-shadow: none;
	color: var(--a81pc-text);
	font: 400 16px/1.4 var(--a81pc-font);
}

.a81pc-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.a81pc .a81pc-form-status {
	font-size: 14px;
}

.a81pc-form-status:empty {
	display: none;
}

.a81pc-form-status.is-success {
	font-weight: 500;
}

.a81pc-missing {
	padding: 12px 16px;
	border: 1px dashed currentColor;
	border-radius: 8px;
}
