/* Order window content: form and success view (components/order/*). Shell and animation: order-modal.css. */
.order-form__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Views: the form and the success screen share the card, JS crossfades them */
.order-view {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	opacity: 1;
}

.order-view[hidden] {
	display: none;
}

.order-view.is-fading {
	opacity: 0;
}

.order-modal__card.is-resizing {
	overflow: hidden;
}

@media (prefers-reduced-motion: no-preference) {
	.order-view {
		transition: opacity 0.18s ease;
	}

	.order-modal__card.is-sizing {
		transition: height 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
	}
}

/* Form frame: fixed header, scrolling body, fixed footer with the submit */
.order-form {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
}

.order-form__header {
	flex: 0 0 auto;
	padding: 30px 24px 0;
	text-align: center;
}

.order-form__title {
	margin: 0;
	padding: 12px 52px;
	color: #000;
	font-size: 28px;
	font-weight: 600;
	letter-spacing: -0.005em;
	line-height: 32px;
}

.order-form__title:focus,
.order-success__title:focus {
	outline: none;
}

.order-form__subtitle {
	max-width: 520px;
	margin: 0 auto;
	padding-bottom: 16px;
	color: #3c3c43;
	font-size: 15px;
	line-height: 1.4;
}

.order-form__scroll {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 0 24px 24px;
	scrollbar-width: thin;
	scrollbar-color: rgba(115, 120, 141, 0.5) transparent;
}

.order-form__scroll > * + * {
	margin-top: 16px;
}

.order-form__scroll fieldset {
	min-width: 0;
	margin-right: 0;
	margin-left: 0;
	margin-bottom: 0;
	padding: 0;
	border: 0;
}

.order-form__legend {
	display: block;
	margin: 0 0 8px;
	padding: 0 4px;
	color: #000;
	font-size: 16px;
	font-weight: 700;
	line-height: 22px;
}

.order-form__error {
	margin: 6px 4px 0;
	color: #d3382f;
	font-size: 13px;
	line-height: 1.4;
}

.order-form__error[hidden] {
	display: none;
}

@media (prefers-reduced-motion: no-preference) {
	.order-form__error:not([hidden]) {
		animation: order-fade-in 0.22s ease both;
	}
}

@keyframes order-fade-in {
	from {
		opacity: 0;
		transform: translateY(-3px);
	}
}

/* Products */
.order-products {
	position: relative;
}

.order-products__note {
	position: absolute;
	top: 0;
	right: 4px;
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	color: #999;
	font-size: 13px;
	line-height: 19px;
}

.order-products__note svg {
	flex: none;
}

.order-products__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.order-tile {
	display: grid;
	grid-template-columns: 100px minmax(0, 1fr);
	align-items: center;
	gap: 0;
	min-height: 116px;
	padding: 8px 12px 8px 8px;
	border: 2px solid #f4f9fd;
	border-radius: 20px;
	background: var(--color-white);
	transition: border-color 0.25s ease, background-color 0.25s ease;
}

.order-tile.is-selected {
	border-color: #b9d9f7;
	background: #f8fbff;
}

.order-tile.is-flash {
	animation: order-tile-flash 1.2s ease-out;
}

@keyframes order-tile-flash {
	0% {
		box-shadow: 0 0 0 0 rgba(0, 106, 200, 0.4);
	}

	100% {
		box-shadow: 0 0 0 12px rgba(0, 106, 200, 0);
	}
}

.order-tile__image {
	display: block;
	width: 100px;
	height: 100px;
	object-fit: contain;
	mix-blend-mode: multiply;
}

.order-tile__body {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

.order-tile__value,
.order-tile__tags,
.order-tile__pack {
	margin: 0;
}

.order-tile__value {
	color: #000;
	font-size: 18px;
	line-height: 28px;
}

.order-tile__tags span {
	display: inline-block;
	white-space: nowrap;
}

.order-tile__tags,
.order-tile__pack {
	color: #313131;
	font-size: 13px;
	line-height: 19px;
}

/* Stepper */
.order-stepper {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

.order-stepper__btn {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--color-soft-blue);
	color: var(--color-blue);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.order-stepper__btn:focus-visible {
	outline: 2px solid var(--color-blue);
	outline-offset: 2px;
}

.order-stepper__btn.is-off {
	color: rgba(0, 106, 200, 0.3);
	cursor: default;
}

@media (hover: hover) {
	.order-stepper__btn:not(.is-off):hover {
		background: #d3e9fc;
	}
}

.order-stepper__btn:not(.is-off):active {
	transform: scale(0.9);
}

.order-stepper__input {
	width: 35px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--color-blue);
	font-family: inherit;
	font-size: 18px;
	line-height: 28px;
	text-align: center;
	-moz-appearance: textfield;
}

.order-stepper__input:focus {
	outline: none;
	background: var(--color-soft-blue);
}

.order-stepper__input.is-bump {
	animation: order-bump 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes order-bump {
	0% {
		opacity: 0.4;
		transform: scale(0.8);
	}

	100% {
		opacity: 1;
		transform: none;
	}
}

.order-stepper--sm .order-stepper__btn {
	width: 28px;
	height: 28px;
}

.order-stepper--sm .order-stepper__input {
	width: 32px;
	height: 28px;
	font-size: 16px;
}

/* Collapsing panels (equipment, tare): grid rows 0fr to 1fr */
.order-collapse {
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden;
	transition: grid-template-rows 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.3s;
}

.order-collapse.is-open {
	grid-template-rows: 1fr;
	visibility: visible;
	transition-delay: 0s;
}

.order-collapse__inner {
	min-height: 0;
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.order-collapse {
		transition: none;
	}
}

/* Equipment */
.order-equip__toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 0 6px 0 4px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: #000;
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.order-equip__toggle:focus-visible {
	outline: 2px solid var(--color-blue);
	outline-offset: 2px;
}

.order-equip__head {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.order-equip__title {
	font-size: 16px;
	font-weight: 700;
	line-height: 22px;
}

.order-equip__hint,
.order-equip__note {
	color: rgba(32, 32, 32, 0.6);
	font-size: 13px;
	line-height: 19px;
}

.order-equip__note {
	display: none;
	color: #999;
}

.order-equip__toggle[aria-expanded="true"] .order-equip__hint {
	display: none;
}

.order-equip__toggle[aria-expanded="true"] .order-equip__note {
	display: block;
}

.order-equip__chevron {
	display: flex;
	flex: none;
}

.order-equip__chevron svg {
	transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.order-equip__toggle[aria-expanded="true"] .order-equip__chevron svg {
	transform: rotate(180deg);
}

.order-equip__items {
	display: flex;
	flex-wrap: wrap;
	gap: 0 28px;
	padding: 4px 4px 0 !important;
}

.order-equip__item {
	display: flex;
	align-items: center;
	gap: 6px;
	min-height: 48px;
}

.order-equip__stepper {
	display: none;
}

.order-equip__item.is-checked .order-equip__stepper {
	display: inline-flex;
}

@media (prefers-reduced-motion: no-preference) {
	.order-equip__item.is-checked .order-equip__stepper {
		animation: order-fade-in 0.22s ease both;
	}
}

/* "1×100 шт" under the item name (like the "1×12 шт" line of the water tiles). In one line with the name the
   checked row grows by the stepper and jumps to the next line on desktop. */
.order-equip__pack {
	display: block;
	color: #313131;
	font-size: 13px;
	line-height: 19px;
}

/* Checkboxes */
.order-check {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: 48px;
	padding: 4px 8px 4px 4px;
	color: #000;
	font-size: 16px;
	line-height: 1.4;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.order-check__input {
	position: absolute;
	width: 18px;
	height: 18px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.order-check__box {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(32, 32, 32, 0.5);
	border-radius: 4px;
	background: var(--color-white);
	transition: background-color 0.18s ease, border-color 0.18s ease;
}

.order-check__box svg {
	opacity: 0;
	transform: scale(0.5);
	transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.order-check__input:checked + .order-check__box {
	border-color: var(--color-blue);
	background: var(--color-blue);
}

.order-check__input:checked + .order-check__box svg {
	opacity: 1;
	transform: none;
}

.order-check__input:focus-visible + .order-check__box {
	outline: 2px solid var(--color-blue);
	outline-offset: 3px;
}

.order-check__input[aria-invalid="true"] + .order-check__box {
	border-color: #d3382f;
}

.order-check__label a {
	color: var(--color-blue);
	text-decoration: none;
}

@media (hover: hover) {
	.order-check__label a:hover {
		text-decoration: underline;
	}
}

/* Contacts and comment */
.order-contacts__row {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
}

.order-field {
	position: relative;
}

.order-field__input {
	display: block;
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 10px 48px 10px 16px;
	border: 1px solid var(--color-soft-blue);
	border-radius: 8px;
	background: var(--color-white);
	color: #000;
	font-family: inherit;
	font-size: 16px;
	line-height: 24px;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.order-field__input::placeholder {
	color: #999;
	opacity: 1;
}

.order-field__input:focus {
	outline: none;
	border-color: rgba(0, 106, 200, 0.55);
	box-shadow: 0 0 0 3px rgba(0, 106, 200, 0.12);
}

.order-field__input[aria-invalid="true"] {
	border-color: #d3382f;
	box-shadow: 0 0 0 3px rgba(211, 56, 47, 0.1);
}

.order-field__icon {
	position: absolute;
	top: 12px;
	right: 16px;
	display: flex;
	color: rgba(0, 106, 200, 0.4);
	pointer-events: none;
}

/* Red asterisk after the phone placeholder, only while the field is empty */
.order-field__ghost {
	position: absolute;
	top: 1px;
	left: 17px;
	display: none;
	padding: 10px 0;
	font-size: 16px;
	line-height: 24px;
	pointer-events: none;
}

.order-field__ghost span {
	visibility: hidden;
}

.order-field__ghost i {
	color: #e5484d;
	font-style: normal;
}

.order-field__input:placeholder-shown + .order-field__ghost {
	display: block;
}

.order-comment__input {
	height: auto;
	min-height: 48px;
	max-height: 140px;
	padding-right: 16px;
	resize: none;
}

.order-comment .order-form__legend {
	margin-bottom: 8px;
}

/* Captcha slot (empty until the next slice) */
.order-form__captcha {
	display: flex;
	justify-content: center;
}

.order-form__captcha[hidden] {
	display: none;
}

/* Consent and tare */
.order-form__checks {
	width: fit-content;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.order-form__check-wrap .order-form__error {
	margin: 0 4px 4px 36px;
}

/* Footer */
.order-form__footer {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 8px 20px 12px;
	border-top: 2px solid #f4f9fd;
	background: var(--color-white);
}

.order-form__submit {
	margin: 8px 0 0;
	transition: opacity 0.3s ease, filter 0.3s ease, transform var(--dur-fast, 160ms) var(--ease-out, ease-out), box-shadow var(--dur, 320ms) var(--ease-out, ease-out);
}

.order-form__submit.is-disabled {
	opacity: 0.42;
	filter: saturate(0.8);
}

.order-form__submit.is-loading {
	pointer-events: none;
}

.order-form__submit.is-loading .button__label {
	color: transparent;
}

.order-form__submit.is-loading .button__label::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 3px solid rgba(255, 255, 255, 0.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: order-spin 0.7s linear infinite;
}

@keyframes order-spin {
	to {
		transform: rotate(360deg);
	}
}

.order-form__secure {
	display: flex;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0;
	color: rgba(32, 32, 32, 0.5);
	font-size: 13px;
	line-height: 21px;
}

.order-form__send-error {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 2px 12px;
	max-width: 100%;
	margin-top: 4px;
	padding: 6px 8px 6px 18px;
	border-radius: 20px;
	background: #fff3f1;
	color: #a5302a;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
}

.order-form__send-error[hidden] {
	display: none;
}

.order-form__send-error p {
	margin: 0;
}

/* Success */
.order-view--success {
	position: relative;
}

.order-success__mountains {
	display: none;
}

.order-success__inner {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	align-items: center;
	gap: clamp(28px, 5vh, 52px);
	min-height: 0;
	padding: clamp(72px, 12vh, 116px) 24px clamp(32px, 6vh, 64px);
	overflow-y: auto;
	text-align: center;
}

.order-success__check {
	display: flex;
	width: 70px;
	height: 70px;
}

.order-success__check svg {
	width: 70px;
	height: 70px;
}

.order-success__check circle {
	fill: #3e9c53;
}

.order-success__title {
	margin: 0;
	color: #000;
	font-size: 28px;
	font-weight: 600;
	line-height: 32px;
}

.order-success__copy {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.order-success__text {
	max-width: 526px;
	margin: 0;
	color: #202020;
	font-size: 18px;
	font-weight: 300;
	line-height: 26px;
}

.order-success__phone {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px 30px 12px 20px;
	border: 2px solid #f4f9fd;
	border-radius: 20px;
	background: #f4f9fd;
}

.order-success__phone .phone-teaser__toggle {
	margin-right: 0;
}

.order-success__footer {
	flex: 0 0 auto;
	display: flex;
	justify-content: center;
	padding: 8px 20px;
	border-top: 2px solid #f4f9fd;
	background: var(--color-white);
}

.order-success__button {
	height: 54px;
}

@media (prefers-reduced-motion: no-preference) {
	.order-view--success.is-active .order-success__check svg {
		animation: order-pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) 0.12s both;
	}

	.order-view--success.is-active .order-success__tick {
		stroke-dasharray: 1;
		stroke-dashoffset: 1;
		animation: order-tick 0.38s ease-out 0.45s forwards;
	}
}

@keyframes order-pop {
	from {
		opacity: 0;
		transform: scale(0.5);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes order-tick {
	to {
		stroke-dashoffset: 0;
	}
}

/* Tablet width: two columns of tiles */
@media (max-width: 1023px) and (min-width: 768px) {
	.order-products__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Phones: one scroll for header, body and the sticky submit */
@media (max-width: 767px) {
	.order-form {
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.order-form__header {
		padding: 16px 24px 0;
	}

	.order-form__title {
		padding: 8px 0;
	}

	.order-comment__input {
		min-height: 72px;
	}

	.order-form__subtitle {
		font-size: 13px;
		color: #313131;
	}

	.order-form__scroll {
		flex: none;
		overflow: visible;
		padding: 0 16px 16px;
	}

	.order-products__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 4px;
	}

	.order-tile__body {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
	}

	.order-contacts__row {
		grid-template-columns: minmax(0, 1fr);
	}

	.order-equip__items {
		flex-direction: column;
	}

	.order-form__checks {
		margin-left: 0;
		margin-right: 0;
		width: 100%;
	}

	.order-form__footer {
		position: sticky;
		bottom: 0;
		z-index: 2;
		padding: 24px 24px 12px;
		border-top: 0;
		background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 22%, #fff 40%);
	}

	.order-form__submit {
		width: min(100%, 332px);
	}

	.order-modal__close {
		background: rgba(255, 255, 255, 0.92);
		box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
	}

	/* Success: mountain strip on top, as in Figma */
	.order-view--success {
		background: linear-gradient(180deg, #e7f3fe 0, #fff 140px);
	}

	.order-success__mountains {
		position: absolute;
		top: 0;
		left: 0;
		display: block;
		width: 100%;
		height: 140px;
		object-fit: cover;
		object-position: 50% 100%;
		-webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
		mask-image: linear-gradient(180deg, #000 70%, transparent);
		pointer-events: none;
	}

	.order-success__inner {
		position: relative;
		flex: none;
		gap: 40px;
		padding: 70px 24px 24px;
		overflow: visible;
	}

	.order-success__check {
		margin-top: -4px;
	}

	.order-success__text {
		font-size: 16px;
		font-weight: 400;
		line-height: 24px;
	}

	.order-success__footer {
		padding: 0 20px;
		border-top: 0;
		background: transparent;
	}
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
	.order-modal__card {
		transform: none;
	}
}

/* Narrow phones: smaller title and cost note */
@media (max-width: 400px) {
	.order-form__title {
		font-size: 24px;
	}

	.order-products__note {
		font-size: 12px;
	}

	.order-products__note svg {
		display: none;
	}
}
