/**
 * Order page ("سفارش پروژه", page-order.php, /order/). Loaded only on that page, after site.css.
 * Uses the site tokens (style.css), the .at-btn buttons and the contact-card look (white, 24px radius,
 * 0 0 2px shadow). Hover / focus / checked / invalid states only change colours, borders of a fixed width,
 * shadows or opacity, never a box size. Field errors sit in a reserved row gap, so showing one never moves
 * anything. Without JS (.ord-form without .is-js) every step is visible.
 */

.site-main--order {
	--ord-r-lg: 32px;
	--ord-r-md: 16px;
	--ord-teal-soft: #eef7f7;
	--ord-err: #c0392b; /* 5.4:1 on white, 5.0:1 on --at-soft */
}

.site-main--order :where(h1, h2, h3, p, ol, ul, dl, dd, fieldset) {
	margin: 0;
}

.site-main--order :where(ol, ul) {
	padding: 0;
	list-style: none;
}

/* ---------- 1. Intro ---------- */
.ord-hero {
	padding-block: clamp(24px, 2.8vw, 48px) clamp(24px, 2.2vw, 40px);
}

.ord-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--at-btn);
	font-size: 14px;
	font-weight: 500;
}

.ord-eyebrow::before {
	content: "";
	width: 18px;
	height: 2px;
	border-radius: 2px;
	background: var(--at-teal);
}

.ord-hero__title {
	margin-top: 8px;
	color: var(--at-ink);
	font-size: clamp(24px, 1.6vw + 6px, 32px);
	font-weight: 600;
	line-height: 1.6;
}

.ord-hero__lead {
	max-width: 760px;
	margin-top: 10px;
	color: var(--at-muted);
	font-size: 16px;
	line-height: 2;
}

/* ---------- 2. Layout: form card + side column ---------- */
.ord-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 360px;
	align-items: start;
	gap: 32px;
}

.ord-card,
.ord-side {
	border-radius: 24px;
	background: #fff;
	box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
}

.ord-card {
	padding: clamp(20px, 2.8vw, 40px);
	scroll-margin-top: 16px;
}

/* ---------- 3. Progress (JS only) ---------- */
.ord-progress {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	margin-bottom: 32px;
	counter-reset: none;
}

.ord-progress[hidden] {
	display: none;
}

.ord-progress__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	text-align: center;
}

/* Connector to the next step (towards the inline end = left in RTL). */
.ord-progress__item:not(:last-child)::after {
	content: "";
	position: absolute;
	top: 19px;
	inset-inline-start: calc(50% + 28px);
	inset-inline-end: calc(-50% + 28px);
	height: 2px;
	border-radius: 2px;
	background: var(--at-line);
	transition: background-color 0.3s ease;
}

.ord-progress__item.is-done:not(:last-child)::after {
	background: var(--at-teal);
}

.ord-progress__num {
	position: relative;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 1.5px solid var(--at-line);
	border-radius: 50%;
	background: #fff;
	color: var(--at-muted);
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.ord-progress__tick {
	position: absolute;
	width: 20px;
	height: 20px;
	opacity: 0;
}

.ord-progress__item.is-current .ord-progress__num {
	border-color: var(--at-btn);
	background: var(--at-btn);
	color: #fff;
}

.ord-progress__item.is-done .ord-progress__num {
	border-color: var(--at-teal);
	background: var(--ord-teal-soft);
	color: var(--at-btn);
}

.ord-progress__item.is-done .ord-progress__digit {
	opacity: 0;
}

.ord-progress__item.is-done .ord-progress__tick {
	opacity: 1;
}

.ord-progress__label {
	color: var(--at-muted);
	font-size: 14px;
	line-height: 1.6;
}

.ord-progress__item.is-current .ord-progress__label {
	color: var(--at-ink);
	font-weight: 600;
}

/* ---------- 4. Notice (after a rejected submit) ---------- */
.ord-notice {
	margin-bottom: 24px;
	padding: 12px 16px;
	border-radius: 12px;
	background: #fdecea;
	color: #8e2a1f;
	font-size: 15px;
	line-height: 1.8;
}

.ord-notice:focus {
	outline: 2px solid var(--ord-err);
	outline-offset: 2px;
}

/* ---------- 5. Steps ---------- */
.ord-step + .ord-step {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 1px solid var(--at-line);
}

.ord-form.is-js .ord-step + .ord-step {
	margin-top: 0;
	padding-top: 0;
	border-top: 0;
}

.ord-step[hidden] {
	display: none;
}

.ord-form.is-js .ord-step.is-entering {
	animation: ord-in 0.28s var(--at-ease) both;
}

@keyframes ord-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

.ord-step__head {
	margin-bottom: 24px;
}

.ord-step__count {
	color: var(--at-btn);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.6;
}

.ord-step__title {
	margin-top: 4px;
	color: var(--at-ink);
	font-size: clamp(20px, 0.6vw + 14px, 24px);
	font-weight: 600;
	line-height: 1.6;
}

.ord-step__title:focus {
	outline: none;
}

.ord-step__title:focus-visible {
	border-radius: 4px;
	outline: 2px solid var(--at-teal);
	outline-offset: 4px;
}

.ord-step__hint {
	margin-top: 4px;
	color: var(--at-muted);
	font-size: 15px;
	line-height: 1.8;
}

/* ---------- 6. Step 1: service cards (checkboxes) ---------- */
.ord-services {
	min-width: 0;
	padding: 0;
	border: 0;
}

.ord-services__list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

.ord-svc {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	height: 100%;
	min-height: 80px;
	padding: 14px 16px;
	padding-inline-end: 44px; /* room for the check badge */
	border: 1.5px solid var(--at-line);
	border-radius: var(--ord-r-md);
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

/* Visually hidden but focusable; the whole card is the label. */
.ord-svc__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	opacity: 0;
}

.ord-svc:hover {
	border-color: rgba(87, 179, 183, 0.6);
}

.ord-svc:has(.ord-svc__input:checked) {
	border-color: var(--at-btn);
	background: var(--ord-teal-soft);
}

.ord-svc:has(.ord-svc__input:focus-visible) {
	box-shadow: 0 0 0 4px rgba(87, 179, 183, 0.35);
	outline: 2px solid var(--at-ink);
	outline-offset: 2px;
}

.ord-svc:has(.ord-svc__input[aria-invalid="true"]) {
	border-color: #e05a5a;
}

.ord-svc__ico {
	flex: 0 0 44px;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: var(--ord-teal-soft);
	color: var(--at-btn);
	transition: background-color 0.2s ease, color 0.2s ease;
}

.ord-svc:has(.ord-svc__input:checked) .ord-svc__ico {
	background: var(--at-btn);
	color: #fff;
}

.ord-ico {
	width: 24px;
	height: 24px;
}

.ord-svc__text {
	display: grid;
	min-width: 0;
}

.ord-svc__name {
	color: var(--at-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.6;
}

.ord-svc__kicker {
	color: var(--at-muted);
	font-size: 13px;
	line-height: 1.6;
}

.ord-svc__check {
	position: absolute;
	top: 50%;
	inset-inline-end: 14px;
	display: grid;
	place-items: center;
	width: 22px;
	height: 22px;
	margin-top: -11px;
	border: 1.5px solid #c9c9d2;
	border-radius: 6px;
	background: #fff;
	color: #fff;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ord-svc__check svg {
	width: 14px;
	height: 14px;
	opacity: 0;
}

.ord-svc:has(.ord-svc__input:checked) .ord-svc__check {
	border-color: var(--at-btn);
	background: var(--at-btn);
}

.ord-svc:has(.ord-svc__input:checked) .ord-svc__check svg {
	opacity: 1;
}

/* ---------- 7. Fields (steps 2-3) ---------- */
.ord-fields {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px 20px; /* the row gap holds the error line */
}

.ord-field {
	position: relative;
	display: grid;
	align-content: start;
	gap: 8px;
}

.ord-field--full {
	grid-column: 1 / -1;
}

.ord-field label {
	color: var(--at-ink);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.6;
}

.ord-req {
	margin-inline-start: 2px;
	color: var(--ord-err);
}

.ord-opt {
	color: var(--at-muted);
	font-size: 13px;
	font-weight: 400;
}

.ord-field input,
.ord-field textarea,
.ord-field select {
	box-sizing: border-box;
	width: 100%;
	min-height: 56px;
	padding: 12px 16px;
	border: 1.5px solid transparent;
	border-radius: var(--ord-r-md);
	background: var(--at-soft);
	color: var(--at-body);
	font: inherit;
	font-size: 15px;
	line-height: 1.6;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.ord-field textarea {
	min-height: 150px;
	resize: vertical;
}

.ord-field select {
	padding-inline-end: 44px;
	cursor: pointer;
	appearance: none;
}

.ord-field select:has(option[value=""]:checked) {
	color: #6e6e6e;
}

.ord-field select option {
	color: var(--at-body);
}

/* Chrome's UA sheet forces tel inputs to LTR (pushes the Persian placeholder to the left). */
.ord-field input[type="tel"] {
	direction: rtl;
	text-align: right;
}

.ord-field input[type="email"] {
	text-align: left;
}

.ord-field input::placeholder,
.ord-field textarea::placeholder {
	color: #767676;
	font-size: 14px;
}

.ord-field input:hover,
.ord-field textarea:hover,
.ord-field select:hover {
	border-color: rgba(87, 179, 183, 0.6);
}

.ord-field input:focus,
.ord-field textarea:focus,
.ord-field select:focus {
	border-color: var(--at-teal);
	outline: none;
	background: #fff;
	box-shadow: 0 0 0 4px rgba(87, 179, 183, 0.35);
}

.ord-field [aria-invalid="true"] {
	border-color: #e05a5a;
}

.ord-chevron {
	position: absolute;
	inset-inline-end: 20px;
	bottom: 24px;
	width: 9px;
	height: 9px;
	border-right: 1.5px solid #6e6e6e; /* physical on purpose: a down chevron after rotate(45deg) */
	border-bottom: 1.5px solid #6e6e6e;
	transform: rotate(45deg);
	pointer-events: none;
}

.ord-err {
	color: var(--ord-err);
	font-size: 13px;
	line-height: 20px;
}

.ord-err[hidden] {
	display: none;
}

.ord-field .ord-err {
	position: absolute;
	top: 100%;
	inset-inline: 0;
	margin-top: 4px;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* The group error has its own reserved line under the cards. */
.ord-err--group {
	display: block;
	min-height: 20px;
	margin-top: 8px;
}

.ord-err--group[hidden] {
	display: block;
	visibility: hidden;
}

/* ---------- 8. Step 4: review ---------- */
.ord-review {
	display: grid;
	gap: 12px;
}

.ord-review[hidden] {
	display: none;
}

.ord-review__group {
	padding: 16px 20px;
	border-radius: var(--ord-r-md);
	background: var(--at-soft);
}

.ord-review__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.ord-review__title {
	color: var(--at-ink);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.6;
}

.ord-review__edit {
	min-height: 32px;
	padding: 2px 14px;
	border: 1.5px solid var(--at-btn);
	border-radius: 999px;
	background: transparent;
	color: var(--at-btn);
	font: inherit;
	font-size: 14px;
	line-height: 1.5;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.ord-review__edit:hover,
.ord-review__edit:focus-visible {
	border-color: var(--at-btn-hover);
	background: rgba(87, 179, 183, 0.1);
	color: var(--at-btn-hover);
}

.ord-review__edit:focus-visible {
	outline: 2px solid var(--at-ink);
	outline-offset: 2px;
}

.ord-review__list {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 6px 16px;
	font-size: 15px;
	line-height: 1.8;
}

.ord-review__list dt {
	color: var(--at-muted);
}

.ord-review__list dd {
	color: var(--at-body);
	overflow-wrap: anywhere;
	white-space: pre-line;
}

/* Phone / email: LTR so digits and addresses keep their order, still aligned with the RTL list. */
.ord-review__list dd[dir="ltr"] {
	text-align: right;
}

.ord-privacy {
	margin-top: 16px;
	color: var(--at-muted);
	font-size: 14px;
	line-height: 1.8;
}

/* ---------- 9. Navigation ---------- */
.ord-nav {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--at-line);
}

.ord-nav [hidden] {
	display: none;
}

.ord-nav .at-btn {
	min-width: 148px;
	margin-inline-start: 0;
}

/* Next / submit sit at the inline end (left in RTL), back at the start. */
.ord-nav__next,
.ord-nav__submit {
	margin-inline-start: auto !important;
}

/* ---------- 10. Success ---------- */
.ord-result {
	display: grid;
	justify-items: center;
	gap: 12px;
	padding-block: clamp(40px, 5vw, 72px);
	text-align: center;
}

.ord-result__icon {
	display: grid;
	place-items: center;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	background: var(--ord-teal-soft);
	color: var(--at-btn);
}

.ord-result__title {
	margin-top: 8px;
	color: var(--at-ink);
	font-size: clamp(22px, 0.8vw + 14px, 28px);
	font-weight: 600;
	line-height: 1.6;
}

.ord-result__title:focus {
	outline: none;
}

.ord-result__text {
	max-width: 520px;
	color: var(--at-muted);
	font-size: 16px;
	line-height: 2;
}

.ord-result__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 12px;
}

.ord-fallback {
	color: var(--at-body);
}

/* ---------- 11. Side column ---------- */
.ord-aside {
	display: grid;
	gap: 24px;
}

.ord-side {
	padding: 24px 28px;
}

.ord-side__title {
	margin-bottom: 16px;
	color: var(--at-ink);
	font-size: 18px;
	font-weight: 600;
	line-height: 1.6;
}

.ord-next {
	display: grid;
	gap: 16px;
}

.ord-next__item {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.ord-next__num {
	flex: 0 0 32px;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--ord-teal-soft);
	color: var(--at-btn);
	font-size: 15px;
	font-weight: 600;
	line-height: 1;
}

.ord-next__title {
	color: var(--at-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.6;
}

.ord-next__text {
	margin-top: 2px;
	color: var(--at-muted);
	font-size: 14px;
	line-height: 1.8;
}

.ord-contact {
	display: grid;
	gap: 10px;
}

.ord-contact__link {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 64px;
	padding: 10px 14px;
	border: 1.5px solid var(--at-line);
	border-radius: var(--ord-r-md);
	color: inherit;
	text-decoration: none;
	transition: border-color 0.2s ease, background-color 0.2s ease;
}

.ord-contact__link:hover {
	border-color: rgba(87, 179, 183, 0.6);
	background: var(--ord-teal-soft);
}

.ord-contact__link:focus-visible {
	outline: 2px solid var(--at-ink);
	outline-offset: 2px;
}

.ord-contact__ico {
	flex: 0 0 40px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 12px;
	background: var(--ord-teal-soft);
	color: var(--at-btn);
}

.ord-contact__ico .at-icon {
	width: 24px;
	height: 24px;
}

.ord-contact__text {
	display: grid;
	min-width: 0;
}

.ord-contact__label {
	color: var(--at-muted);
	font-size: 13px;
	line-height: 1.6;
}

.ord-contact__value {
	color: var(--at-ink);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.6;
	text-align: start;
}

.ord-side__note {
	margin-top: 14px;
	color: var(--at-muted);
	font-size: 13px;
	line-height: 1.8;
}

/* ---------- Responsive ---------- */
@media (max-width: 1279.98px) {
	.ord-layout {
		grid-template-columns: minmax(0, 1fr) 320px;
		gap: 24px;
	}

	.ord-services__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 991.98px) {
	.ord-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.ord-aside {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		align-items: start;
	}
}

@media (max-width: 767.98px) {
	.ord-aside,
	.ord-fields {
		grid-template-columns: minmax(0, 1fr);
	}

	.ord-services__list {
		grid-template-columns: minmax(0, 1fr);
		gap: 10px;
	}

	.ord-svc {
		min-height: 72px;
	}

	.ord-card {
		border-radius: 20px;
	}

	.ord-progress {
		margin-bottom: 24px;
	}

	/* Only the current step keeps its label on small screens (the step head repeats it). */
	.ord-progress__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.ord-progress__item.is-current .ord-progress__label {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip-path: none;
		font-size: 13px;
		white-space: nowrap;
	}

	.ord-progress__item {
		min-height: 70px; /* the current label line is reserved, so moving between steps never changes the height */
		justify-content: flex-start;
	}

	.ord-review__group {
		padding: 14px 16px;
	}

	.ord-review__list {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.ord-review__list dd + dt {
		margin-top: 6px;
	}

	.ord-side {
		padding: 20px;
	}

	.ord-nav .at-btn {
		min-width: 0;
		flex: 1 1 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ord-form.is-js .ord-step.is-entering {
		animation: none;
	}

	.ord-svc,
	.ord-svc__ico,
	.ord-svc__check,
	.ord-progress__num,
	.ord-progress__item::after,
	.ord-field input,
	.ord-field textarea,
	.ord-field select,
	.ord-review__edit,
	.ord-contact__link {
		transition: none;
	}
}
