/**
 * Quick order — the short order form (product page and cart).
 */

/* ============================================ quick order, under the sizes === */

/*
 * The order form. Same field look as the checkout, kept short: name, phone,
 * country, city, an optional address, then the total with delivery and how
 * she pays. The buy button below (and in the bar on a phone) sends it.
 */
.zd-qo {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	max-width: 520px;
	margin: 6px 0 4px;
	padding: 18px;
	border: 1px solid var(--rule-strong);
	background: #FBF9F4;
	box-sizing: border-box;
	scroll-margin-top: 90px;
	scroll-margin-bottom: 170px;
}

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

.zd-qo__head {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.zd-qo__title {
	font-size: 15px;
	font-weight: 600;
	color: var(--ink);
}

.zd-qo__sub {
	font-size: 12px;
	color: var(--muted);
}

.zd-qo__fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 14px 12px;
}

.zd-qo__f {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	margin: 0;
}

.zd-qo__f--full {
	grid-column: 1 / -1;
}

.zd-qo__label {
	font-size: 12px;
	color: #1A1A1A;
}

.zd-qo__label em {
	font-style: normal;
	color: var(--muted);
}

.zd-qo input[type="text"],
.zd-qo input[type="tel"],
.zd-qo select {
	width: 100%;
	min-width: 0;
	height: 46px;
	padding: 0 12px;
	border: 1px solid var(--rule-strong);
	border-radius: 0;
	background: var(--paper);
	font-family: var(--font-body);
	/* 16px stops iPhone zooming the page in when a field is tapped. */
	font-size: 16px;
	color: var(--ink);
	outline: none;
	-webkit-appearance: none;
	appearance: none;
}

.zd-qo select {
	padding-inline-end: 30px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-size: 11px 8px;
	background-position: right 11px center;
}

.zd--rtl .zd-qo select {
	background-position: left 11px center;
}

.zd-qo input:focus,
.zd-qo select:focus {
	border-color: #1A1A1A;
}

.zd-qo .is-invalid,
.zd-qo .is-invalid:focus {
	border-color: var(--accent);
}

.zd-qo__phone {
	display: flex;
	direction: ltr;
}

.zd-qo__dial,
.zd-qo select.zd-qo__dial {
	flex: 0 0 auto;
	width: 104px;
	padding: 0 22px 0 8px;
	border-right: 0;
	background-color: #F1EEE6;
	background-position: right 7px center;
	font-size: 14px;
}

.zd--rtl .zd-qo select.zd-qo__dial {
	background-position: right 7px center;
}

.zd-qo__phone input {
	flex: 1 1 auto;
}

.zd-qo__err {
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--accent);
}

.zd-qo__city .zd-combo__menu {
	max-height: 240px;
}

.zd-qo__sum {
	display: flex;
	flex-direction: column;
	gap: 7px;
	margin: 0;
	padding: 14px 0 0;
	border-top: 1px solid var(--rule);
	font-size: 13px;
}

.zd-qo__sum > div {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.zd-qo__sum dt {
	color: var(--muted);
}

.zd-qo__sum dd {
	margin: 0;
	color: var(--ink);
}

.zd-qo__total {
	padding-top: 7px;
	border-top: 1px dashed var(--rule-strong);
	font-size: 15px;
	font-weight: 600;
}

.zd-qo__total dt {
	color: var(--ink);
}

.zd-qo__payment {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.zd-qo__payment legend {
	margin-bottom: 8px;
	padding: 0;
}

.zd-qo__payopt {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px;
	border: 1px solid var(--rule-strong);
	background: var(--paper);
	cursor: pointer;
}

.zd-qo__payopt[hidden] {
	display: none;
}

.zd-qo__payopt:has(input:checked) {
	border-color: #1A1A1A;
	box-shadow: inset 0 0 0 1px #1A1A1A;
}

.zd-qo__payopt input {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	margin: 1px 0 0;
	accent-color: #1A1A1A;
}

.zd-qo__paytext {
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 13px;
	color: var(--ink);
}

.zd-qo__paytext b {
	font-weight: 600;
}

.zd-qo__paytext small {
	font-size: 11.5px;
	color: var(--muted);
}

.zd-qo__msg {
	margin: 0;
	padding: 10px 12px;
	border-inline-start: 3px solid var(--accent);
	background: #FDF1F1;
	font-size: 12.5px;
	color: var(--ink);
}

/*
 * On a computer the product page's own order button sits straight under the
 * form, so this one stays out of sight there. On a phone that button lives in
 * the bar pinned to the foot of the screen, and this one ends the form.
 */
@media (min-width: 900px) {
	.zd-qo[data-zd-qo-mode="product"] .zd-qo__submit {
		display: none;
	}
}

.zd-qo[data-zd-qo-mode="product"] .zd-qo__submit {
	min-height: 52px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
}

.zd-qo__submit {
	height: 50px;
	background: #1A1A1A;
	border: 1px solid #1A1A1A;
	color: #FFFFFF;
	font-family: var(--font-body);
	font-size: 13px;
	letter-spacing: 0.1em;
	cursor: pointer;
}

.zd-qo__terms {
	margin: 0;
	font-size: 11px;
	color: var(--muted);
}

.zd-qo__terms a {
	color: inherit;
	text-decoration: underline;
}

.zd-qo.is-sending {
	opacity: 0.7;
	pointer-events: none;
}

@media (max-width: 899px) {
	.zd-qo {
		max-width: none;
		margin: 18px var(--gutter) 0;
		padding: 16px 14px;
	}

	.zd-qo__fields {
		grid-template-columns: 1fr;
	}
}

/* In the cart it sits inside the summary column, which has its own padding. */
.zd-qo[data-zd-qo-mode="cart"],
.zd-qo[data-zd-qo-mode="cart"]:is(*) {
	max-width: none;
	margin: 18px 0 0;
}

@media (max-width: 899px) {
	.zd-qo[data-zd-qo-mode="cart"] {
		margin: 18px 0 0;
	}
}

.zd-qo-form {
	margin: 0;
}


/* ================================ the cart: the form over the whole screen === */

html.zd-qo-lock,
html.zd-qo-lock body {
	overflow: hidden;
}

.zd-qo-sheet:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 300;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	/* Room above for the close button, below for the pinned order button. */
	padding: 58px 16px calc(96px + env(safe-area-inset-bottom, 0px));
	background: var(--paper);
}

.zd-qo-sheet .zd-qo,
.zd-qo-sheet .zd-qo[data-zd-qo-mode="cart"] {
	max-width: 560px;
	margin: 0 auto;
	padding: 0;
	border: 0;
	background: none;
}

.zd-qo-sheet .zd-qo__title {
	font-size: 18px;
}

.zd-qo-sheet__close {
	position: fixed;
	top: 10px;
	inset-inline-end: 10px;
	z-index: 302;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.zd-qo-sheet__close svg {
	width: 22px;
	height: 22px;
	stroke: var(--ink);
	stroke-width: 1.4;
}

/* The order button, pinned along the foot of the screen. */
/* Under the form, in the flow of the page — the end of what she fills in. */
.zd-qo-sheet .zd-qo__submit {
	width: 100%;
	min-height: 54px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
}

.zd-qo__submit--bar {
	display: none;
}

.zd-qo-sheet .zd-qo__submit--bar {
	display: block;
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 301;
	width: 100%;
	height: auto;
	min-height: 58px;
	padding: 0 16px env(safe-area-inset-bottom, 0px);
	border: 0;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	box-shadow: 0 -10px 24px -18px rgba(0, 0, 0, 0.5);
}

/* ======================= the cart form on a computer: a window in the middle === */

@media (min-width: 900px) {
	.zd-qo-sheet:not([hidden]) {
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 0;
		overflow: hidden;
		background: rgba(17, 17, 17, 0.5);
	}

	.zd-qo-sheet .zd-qo,
	.zd-qo-sheet .zd-qo[data-zd-qo-mode="cart"] {
		position: relative;
		width: min(560px, 92vw);
		max-height: 88vh;
		margin: 0;
		padding: 30px 30px 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		background: var(--paper);
		box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55);
	}

	/* One button in the window: pinned to its foot, so it is always in reach. */
	.zd-qo-sheet .zd-qo__submit:not(.zd-qo__submit--bar) {
		display: none;
	}

	.zd-qo-sheet .zd-qo__submit--bar {
		position: sticky;
		bottom: 0;
		inset-inline: auto;
		width: calc(100% + 60px);
		margin: 4px -30px 0;
		padding: 0 16px;
		box-shadow: none;
	}

	/* The button ends the window, so it moves after the terms line. */
	.zd-qo-sheet .zd-qo__submit--bar {
		order: 1;
	}

	.zd-qo-sheet__close {
		top: calc(6vh + 6px);
		inset-inline-end: calc(50% - min(280px, 46vw) + 14px);
		z-index: 303;
		background: var(--paper);
	}
}


/* =================== the product page on a computer: the form as a window === */

@media (min-width: 900px) {
	/* Out of the page until the order button opens it. */
	.zd-qo[data-zd-qo-mode="product"]:not(.is-modal) {
		display: none;
	}
}

.zd-qo-modal:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 300;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(17, 17, 17, 0.5);
}

.zd-qo-modal .zd-qo {
	position: relative;
	width: min(560px, 92vw);
	max-height: 88vh;
	margin: 0;
	padding: 30px 30px 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 0;
	background: var(--paper);
	box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55);
}

.zd-qo-modal .zd-qo__title {
	font-size: 18px;
}

/* Its one button, pinned to the foot of the window. */
.zd-qo-modal .zd-qo[data-zd-qo-mode="product"] .zd-qo__submit {
	display: block;
	position: sticky;
	bottom: 0;
	order: 1;
	width: calc(100% + 60px);
	min-height: 56px;
	margin: 4px -30px 0;
	border: 0;
}

.zd-qo-modal .zd-qo-sheet__close {
	top: calc(6vh + 6px);
	inset-inline-end: calc(50% - min(280px, 46vw) + 14px);
		z-index: 303;
		background: var(--paper);
}

/* ========== the scroll bar: the same thin black rail as the product photos === */

.zd-qo-sheet,
.zd-qo-sheet .zd-qo,
.zd-qo-modal .zd-qo,
.zd-qo .zd-combo__menu {
	scrollbar-width: thin;
	scrollbar-color: #1A1A1A var(--rule);
}

.zd-qo-sheet::-webkit-scrollbar,
.zd-qo-sheet .zd-qo::-webkit-scrollbar,
.zd-qo-modal .zd-qo::-webkit-scrollbar,
.zd-qo .zd-combo__menu::-webkit-scrollbar {
	width: 3px;
}

.zd-qo-sheet::-webkit-scrollbar-track,
.zd-qo-sheet .zd-qo::-webkit-scrollbar-track,
.zd-qo-modal .zd-qo::-webkit-scrollbar-track,
.zd-qo .zd-combo__menu::-webkit-scrollbar-track {
	background: var(--rule);
}

.zd-qo-sheet::-webkit-scrollbar-thumb,
.zd-qo-sheet .zd-qo::-webkit-scrollbar-thumb,
.zd-qo-modal .zd-qo::-webkit-scrollbar-thumb,
.zd-qo .zd-combo__menu::-webkit-scrollbar-thumb {
	background: #1A1A1A;
	border-radius: 0;
}
