/*
 * ARR Cost Calculator — front-end wizard.
 *
 * Standalone but visually aligned with the "ararai" theme: every color and
 * size resolves through the theme's semantic tokens when the theme is
 * active, and falls back to the same Executive Energy palette when it is
 * not. Logical properties only, so RTL and LTR both work untouched.
 */

.arr-scc {
	/* local tokens — theme values win when present */
	--scc-bg: var(--c-surface, #f7f7f5);
	--scc-bg-2: var(--c-surface-2, #ebe9e3);
	--scc-page: var(--c-bg, #f5f4f0);
	--scc-text: var(--c-text, #191919);
	--scc-muted: var(--c-text-muted, #646467);
	--scc-heading: var(--c-heading, #191919);
	--scc-border: var(--c-border, #d8d5cd);
	--scc-border-strong: var(--c-border-strong, #a7a7aa);
	--scc-accent: var(--c-accent, #ff5a1f);
	--scc-accent-ink: var(--c-accent-ink, #b93405);
	--scc-accent-soft: var(--c-accent-soft, rgb(255 90 31 / 0.16));
	--scc-highlight: var(--c-highlight, #ffd338);
	--scc-btn-bg: var(--c-btn-bg, #ff5a1f);
	--scc-btn-fg: var(--c-btn-fg, #111111);
	--scc-power: var(--c-power, #e63946);
	--scc-shadow-s: var(--shadow-s, 0 1px 2px rgb(17 17 17 / 0.08), 0 4px 12px rgb(17 17 17 / 0.07));
	--scc-shadow: var(--shadow, 0 2px 6px rgb(17 17 17 / 0.08), 0 14px 34px rgb(17 17 17 / 0.13));
	--scc-radius-s: var(--radius-s, 10px);
	--scc-radius: var(--radius, 16px);
	--scc-radius-l: var(--radius-l, 24px);
	--scc-transition: var(--transition, 160ms ease);
	--scc-font: var(--font-body, "Vazirmatn", system-ui, -apple-system, sans-serif);
	--scc-mono: var(--font-mono, ui-monospace, monospace);

	/* full-bleed: escape any parent container (page templates render the
	   shortcode inside a narrow column). Symmetric margins, RTL-safe. */
	inline-size: 100vw;
	margin-inline-start: calc(50% - 50vw);
	margin-block: var(--space-5, 2.5rem);
	padding-block: clamp(2.5rem, 2rem + 2.5vw, 4rem);
	/* transparent by design: the wizard sits directly on the site background;
	   only the cards, breakdown box and sticky bar paint their own surface. */
	background: transparent;
	font-family: var(--scc-font);
	color: var(--scc-text);
	line-height: 1.7;
}

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

/* The hidden attribute must always win, even over display:flex rules —
   conditional steps and their progress dots rely on it. */
.arr-scc [hidden] {
	display: none !important;
}

.arr-scc__inner {
	inline-size: min(100% - 2.5rem, 71.25rem);
	margin-inline: auto;
}

/* ------------------------------------------------------------ header */
.arr-scc__kicker {
	font-family: var(--scc-mono);
	font-size: 0.85rem;
	color: var(--scc-accent-ink);
	letter-spacing: 0;
	margin-block: 0 0.5rem;
	font-weight: 600;
}

.arr-scc__title {
	font-size: var(--step-3, clamp(1.7rem, 1.4rem + 1.6vw, 2.3rem));
	color: var(--scc-heading);
	line-height: 1.25;
	margin-block: 0 0.75rem;
	font-weight: 700;
	text-wrap: balance;
}

.arr-scc__intro {
	max-inline-size: 46rem;
	color: var(--scc-muted);
	margin-block: 0;
}

/* ---------------------------------------------------------- progress */
/* The step indicator is a centered strip: the current step is pinned to
   the middle (the track is translated by JS) and neighbours fade toward
   the edges. Never wraps, whatever the viewport width. */
.arr-scc__progress-viewport {
	position: relative; /* the JS centering measures the track against this box */
	overflow: hidden;
	margin-block: 2rem 2.25rem;
	-webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
	mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}

.arr-scc.is-result .arr-scc__progress-viewport {
	display: none;
}

.arr-scc__progress {
	list-style: none;
	display: flex;
	flex-wrap: nowrap;
	gap: 1.6rem;
	padding: 0;
	margin: 0;
	inline-size: max-content;
	transition: transform 300ms ease;
}

.arr-scc__progress-item {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	white-space: nowrap;
	color: var(--scc-muted);
	font-size: 0.85rem;
	font-weight: 500;
	transition: color var(--scc-transition), opacity 300ms ease;
}

@media (prefers-reduced-motion: reduce) {
	.arr-scc__progress,
	.arr-scc__progress-item {
		transition: none;
	}
}

.arr-scc__progress-dot {
	display: inline-grid;
	place-items: center;
	inline-size: 1.7rem;
	block-size: 1.7rem;
	border-radius: 50%;
	border: 1px solid var(--scc-border-strong);
	background: var(--scc-bg);
	font-family: var(--scc-mono);
	font-size: 0.8rem;
	transition: background-color var(--scc-transition), border-color var(--scc-transition), color var(--scc-transition);
}

.arr-scc__progress-item.is-current {
	color: var(--scc-heading);
}

.arr-scc__progress-item.is-current .arr-scc__progress-dot {
	background: var(--scc-accent);
	border-color: var(--scc-accent);
	color: var(--scc-btn-fg);
}

.arr-scc__progress-item.is-done {
	color: var(--scc-text);
}

.arr-scc__progress-item.is-done .arr-scc__progress-dot {
	background: var(--scc-accent-soft);
	border-color: var(--scc-accent);
	color: var(--scc-accent-ink);
}

/* ------------------------------------------------------------- steps */
.arr-scc__step {
	animation: arr-scc-in 260ms ease both;
}

@keyframes arr-scc-in {
	from {
		opacity: 0;
		translate: 0 10px;
	}
	to {
		opacity: 1;
		translate: 0 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.arr-scc__step {
		animation: none;
	}
}

.arr-scc__fieldset {
	border: 0;
	padding: 0;
	margin: 0;
}

.arr-scc__step-title {
	font-size: var(--step-1, 1.25rem);
	font-weight: 700;
	color: var(--scc-heading);
	padding: 0;
	margin-block-end: 1.25rem;
	line-height: 1.35;
}

.arr-scc__step-no {
	font-family: var(--scc-mono);
	color: var(--scc-accent-ink);
	margin-inline-end: 0.25rem;
}

.arr-scc__hint {
	color: var(--scc-muted);
	font-size: 0.9rem;
	margin-block: -0.5rem 1.25rem;
}

/* ------------------------------------------------------------- cards */
.arr-scc__cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
	gap: 0.9rem;
}

.arr-scc__card {
	position: relative;
	display: block;
	cursor: pointer;
}

.arr-scc__input {
	position: absolute;
	opacity: 0;
	inline-size: 1px;
	block-size: 1px;
}

.arr-scc__card-body {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	block-size: 100%;
	padding: 1.1rem 1.2rem;
	background: var(--scc-bg);
	border: 1.5px solid var(--scc-border);
	border-radius: var(--scc-radius);
	transition: border-color var(--scc-transition), background-color var(--scc-transition), box-shadow var(--scc-transition), translate var(--scc-transition);
}

.arr-scc__card:hover .arr-scc__card-body {
	border-color: var(--scc-border-strong);
	translate: 0 -2px;
	box-shadow: var(--scc-shadow-s);
}

.arr-scc__input:checked + .arr-scc__card-body {
	border-color: var(--scc-accent);
	background: var(--scc-accent-soft);
	box-shadow: var(--scc-shadow-s);
}

.arr-scc__input:focus-visible + .arr-scc__card-body {
	outline: 2px solid var(--scc-accent);
	outline-offset: 3px;
}

.arr-scc__card-label {
	font-weight: 700;
	color: var(--scc-heading);
	padding-inline-end: 1.6rem;
	overflow-wrap: anywhere;
}

.arr-scc__card-desc {
	font-size: 0.85rem;
	color: var(--scc-muted);
	line-height: 1.6;
	/* long unspaced strings (e.g. PHP,Laravel,React) must wrap, not overflow */
	overflow-wrap: anywhere;
}

.arr-scc__card-price {
	margin-block-start: auto;
	padding-block-start: 0.5rem;
	font-family: var(--scc-mono);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--scc-accent-ink);
}

/* selection tick */
.arr-scc__card-body::after {
	content: "";
	position: absolute;
	inset-block-start: 1rem;
	inset-inline-end: 1rem;
	inline-size: 1.15rem;
	block-size: 1.15rem;
	border-radius: 50%;
	border: 1.5px solid var(--scc-border-strong);
	background: var(--scc-bg);
	transition: border-color var(--scc-transition), background-color var(--scc-transition);
}

.arr-scc__card--check .arr-scc__card-body::after {
	border-radius: 6px;
}

.arr-scc__input:checked + .arr-scc__card-body::after {
	border-color: var(--scc-accent);
	background:
		center / 70% no-repeat
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E")
		var(--scc-accent);
}

/* ------------------------------------------------------------ slider */
.arr-scc__slider-wrap {
	max-inline-size: 40rem;
}

.arr-scc__slider-value {
	display: block;
	font-size: var(--step-2, 1.5rem);
	font-weight: 700;
	color: var(--scc-heading);
	margin-block-end: 1rem;
}

.arr-scc__slider-value [data-scc-pages-out] {
	font-family: var(--scc-mono);
	color: var(--scc-accent-ink);
}

.arr-scc__slider {
	appearance: none;
	inline-size: 100%;
	block-size: 0.5rem;
	border-radius: 999px;
	background: var(--scc-bg);
	border: 1px solid var(--scc-border-strong);
	outline-offset: 6px;
	cursor: pointer;
}

.arr-scc__slider::-webkit-slider-thumb {
	appearance: none;
	inline-size: 1.5rem;
	block-size: 1.5rem;
	border-radius: 50%;
	background: var(--scc-accent);
	border: 3px solid var(--scc-page);
	box-shadow: var(--scc-shadow-s);
	transition: scale var(--scc-transition);
}

.arr-scc__slider::-moz-range-thumb {
	inline-size: 1.5rem;
	block-size: 1.5rem;
	border-radius: 50%;
	background: var(--scc-accent);
	border: 3px solid var(--scc-page);
	box-shadow: var(--scc-shadow-s);
}

.arr-scc__slider:active::-webkit-slider-thumb {
	scale: 1.15;
}

.arr-scc__slider-scale {
	display: flex;
	justify-content: space-between;
	font-family: var(--scc-mono);
	font-size: 0.8rem;
	color: var(--scc-muted);
	margin-block: 0.5rem 1rem;
}

/* ------------------------------------------------------------ result */
.arr-scc__step--result {
	text-align: center;
	max-inline-size: 46rem;
	margin-inline: auto;
}

/* the result screen stands alone: hide the calculator intro */
.arr-scc.is-result .arr-scc__head {
	display: none;
}

.arr-scc__result-range {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: center;
	gap: 0.35em 0.6em;
	margin-block: 1.5rem 2rem;
}

.arr-scc__result-amount {
	display: inline-flex;
	align-items: baseline;
	gap: 0.3em;
	font-family: var(--scc-mono);
	font-size: var(--step-3, clamp(1.7rem, 1.4rem + 1.6vw, 2.3rem));
	font-weight: 700;
	color: var(--scc-heading);
	line-height: 1.2;
	letter-spacing: 0;
}

.arr-scc__result-cur {
	font-family: var(--scc-font);
	font-size: 0.45em;
	font-weight: 600;
	color: var(--scc-accent-ink);
}

.arr-scc__result-sep {
	font-size: var(--step-1, 1.25rem);
	font-weight: 500;
	color: var(--scc-muted);
}

.arr-scc__breakdown {
	display: grid;
	gap: 0;
	margin: 0 auto 1.5rem;
	padding: 0.5rem 1.4rem;
	text-align: start;
	background: var(--scc-bg);
	border: 1px solid var(--scc-border);
	border-radius: var(--scc-radius);
}

.arr-scc__breakdown > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding-block: 0.65rem;
	border-block-end: 1px dashed var(--scc-border);
}

.arr-scc__breakdown > div:last-child {
	border-block-end: 0;
}

.arr-scc__breakdown dt {
	color: var(--scc-text);
	margin: 0;
	overflow-wrap: anywhere;
}

.arr-scc__breakdown dt small {
	display: block;
	color: var(--scc-muted);
	font-size: 0.8rem;
}

.arr-scc__breakdown dd {
	margin: 0;
	font-family: var(--scc-mono);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--scc-heading);
	white-space: nowrap;
}

.arr-scc__note {
	color: var(--scc-muted);
	font-size: 0.9rem;
	max-inline-size: 38rem;
	margin-inline: auto;
}

.arr-scc__result-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	margin-block-start: 1.5rem;
}

/* ----------------------------------------------------- buttons & bar */
.arr-scc__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.7em 1.6em;
	border-radius: 999px;
	border: 1px solid transparent;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	text-decoration: none;
	transition: background-color var(--scc-transition), border-color var(--scc-transition), color var(--scc-transition), translate var(--scc-transition), box-shadow var(--scc-transition), opacity var(--scc-transition);
}

.arr-scc__btn:hover {
	text-decoration: none;
	translate: 0 -1px;
}

.arr-scc__btn--primary {
	background: var(--scc-btn-bg);
	color: var(--scc-btn-fg);
	border-color: var(--scc-btn-bg);
	box-shadow: var(--scc-shadow-s);
}

.arr-scc__btn--primary:hover {
	background: var(--scc-power);
	border-color: var(--scc-power);
	color: #f7f7f5;
	box-shadow: var(--scc-shadow);
}

.arr-scc__btn--ghost {
	border-color: var(--scc-border-strong);
	color: var(--scc-heading);
	background: var(--scc-bg);
}

.arr-scc__btn--ghost:hover {
	border-color: var(--scc-heading);
}

.arr-scc__btn[disabled] {
	opacity: 0.45;
	cursor: default;
	pointer-events: none;
}

.arr-scc__btn-icon {
	inline-size: 1.1em;
	block-size: 1.1em;
}

html[dir="ltr"] .arr-scc__btn-icon {
	scale: -1 1;
}

.arr-scc__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	margin-block-start: 2.25rem;
	padding: 0.85rem 1.25rem;
	background: var(--scc-bg);
	border: 1px solid var(--scc-border);
	border-radius: var(--scc-radius-l);
	box-shadow: var(--scc-shadow-s);
}

.arr-scc__bar.is-hidden {
	display: none;
}

.arr-scc__bar-label {
	display: block;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--scc-muted);
}

.arr-scc__bar-amount {
	font-family: var(--scc-mono);
	font-size: 1.15rem;
	color: var(--scc-heading);
	letter-spacing: 0;
}

.arr-scc__bar-unit {
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--scc-accent-ink);
}

.arr-scc__bar-nav {
	display: flex;
	gap: 0.5rem;
	margin-inline-start: auto;
}

@media (max-width: 640px) {
	/* number-only dots, except the centered current step which keeps its name */
	.arr-scc__progress-item:not(.is-current) .arr-scc__progress-label {
		display: none;
	}

	.arr-scc__bar {
		inset-block-end: 0.5rem;
	}

	.arr-scc__bar-nav {
		inline-size: 100%;
	}

	.arr-scc__bar-nav .arr-scc__btn {
		flex: 1;
		justify-content: center;
	}
}
