/**
 * The login step before the checkout.
 *
 * One narrow card in the middle of the page, on the same tokens as the cart
 * drawer and the checkout. Tokens come from gueta-header.css, which loads first.
 */

.gueta-login,
.gueta-login * {
	box-sizing: border-box;
}

.gueta-login {
	display: flex;
	font-family: var(--gueta-font);
	justify-content: center;
	padding: clamp(32px, 8vw, 96px) var(--gueta-gutter) 96px;
}

.gueta-login__card {
	background: var(--gueta-paper);
	border: 1px solid var(--gueta-rule);
	border-radius: var(--gueta-radius);
	color: var(--gueta-ink);
	max-width: 440px;
	padding: clamp(24px, 5vw, 40px);
	transition: opacity .25s ease;
	width: 100%;
}

.gueta-login__card.is-busy {
	opacity: .6;
	pointer-events: none;
}

.gueta-login__title {
	font-size: clamp(24px, 4vw, 30px);
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 8px;
}

.gueta-login__lead {
	color: var(--gueta-muted);
	font-size: 15px;
	line-height: 1.5;
	margin: 0 0 28px;
}

.gueta-login__google {
	display: flex;
	justify-content: center;
	min-height: 44px;
}

.gueta-login__or {
	align-items: center;
	color: var(--gueta-soft);
	display: flex;
	font-size: 13px;
	gap: 12px;
	margin: 24px 0;
}

.gueta-login__or::before,
.gueta-login__or::after {
	border-top: 1px solid var(--gueta-rule);
	content: "";
	flex: 1;
}

.gueta-login__or[hidden],
.gueta-login__step[hidden],
.gueta-login__google[hidden] {
	display: none;
}

.gueta-login__step {
	display: grid;
	gap: 12px;
}

.gueta-login__label {
	font-size: 14px;
	font-weight: 600;
}

.gueta-login__input {
	background: var(--gueta-paper);
	border: 1px solid var(--gueta-rule);
	border-radius: 8px;
	color: var(--gueta-ink);
	font: inherit;
	font-size: 16px;
	min-height: 48px;
	padding: 0 14px;
	text-align: left;
	width: 100%;
}

.gueta-login__input:focus {
	border-color: var(--gueta-ink);
	outline: none;
}

/* -------------------------------------------------------------------------
 * Labels that sit in the box, as at the checkout
 *
 * The label starts where the answer will go and rises to the top of the box
 * once there is something to read. :placeholder-shown decides, which is why
 * each of these fields has a placeholder of one space.
 * ---------------------------------------------------------------------- */

.gueta-login__step[data-login-step="email"] {
	gap: 18px;
}

.gueta-login__row {
	display: grid;
	gap: 12px;
	grid-template-columns: 1fr 1fr;
}

.gueta-login__field {
	position: relative;
}

.gueta-login__field .gueta-login__input {
	line-height: 1.4;
	min-height: 58px;
	padding: 16px;
	text-align: right;
}

.gueta-login__float {
	background: transparent;
	color: var(--gueta-soft);
	font-size: 16px;
	font-weight: 400;
	inset-inline-start: 11px;
	line-height: 1.4;
	margin: 0;
	padding-inline: 6px;
	pointer-events: none;
	position: absolute;
	top: 18px;
	transition: background-color .15s ease, color .15s ease, font-size .15s ease, top .15s ease;
	z-index: 1;
}

.gueta-login__field:has(.gueta-login__input:focus) .gueta-login__float,
.gueta-login__field:has(.gueta-login__input:not(:placeholder-shown)) .gueta-login__float {
	background: var(--gueta-paper);
	color: var(--gueta-muted);
	font-size: 12px;
	top: -11px;
}

.gueta-login__input--code {
	font-size: 24px;
	font-variant-numeric: tabular-nums;
	letter-spacing: .4em;
	text-align: center;
}

.gueta-login__sent {
	color: var(--gueta-muted);
	font-size: 14px;
	line-height: 1.5;
	margin: 0 0 4px;
}

.gueta-login__sent strong {
	color: var(--gueta-ink);
	unicode-bidi: isolate;
}

.gueta-login__links {
	display: flex;
	justify-content: space-between;
	gap: 12px;
}

.gueta-login__link {
	background: none;
	border: 0;
	color: var(--gueta-ink);
	cursor: pointer;
	font: inherit;
	font-size: 14px;
	padding: 4px 0;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Going on without an address: small, under the main button. */
.gueta-login__guest {
	background: none;
	border: 0;
	color: var(--gueta-muted);
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	justify-self: center;
	padding: 2px 8px;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.gueta-login__guest:hover {
	color: var(--gueta-ink);
}

.gueta-login__guest:disabled,
.gueta-login__link:disabled {
	color: var(--gueta-soft);
	cursor: default;
}

.gueta-login__message {
	color: var(--gueta-muted);
	font-size: 14px;
	line-height: 1.5;
	margin: 16px 0 0;
	min-height: 1.5em;
}

.gueta-login__message.is-error {
	color: var(--gueta-accent);
}

.gueta-login__message a {
	color: inherit;
}

.gueta-login__back {
	border-top: 1px solid var(--gueta-rule);
	font-size: 14px;
	margin: 20px 0 0;
	padding-top: 16px;
	text-align: center;
}

.gueta-login__back a {
	color: var(--gueta-muted);
}

/* -------------------------------------------------------------------------
 * The popup
 *
 * The same card, over the page a guest clicked through to the checkout from.
 * Above the cart drawer, since the drawer's button is the usual way in.
 * ---------------------------------------------------------------------- */

.gueta-login-open {
	overflow: hidden;
}

.gueta-login-modal,
.gueta-login-modal * {
	box-sizing: border-box;
}

.gueta-login-modal {
	align-items: center;
	display: flex;
	font-family: var(--gueta-font);
	inset: 0;
	justify-content: center;
	padding: 16px;
	position: fixed;
	transition: visibility 0s linear .3s;
	visibility: hidden;
	z-index: 150;
}

.gueta-login-modal[hidden] {
	display: none;
}

.gueta-login-modal.is-open {
	transition-delay: 0s;
	visibility: visible;
}

.gueta-login-modal__backdrop {
	background: rgb(15 15 15 / 45%);
	inset: 0;
	opacity: 0;
	position: absolute;
	transition: opacity .3s ease;
}

.gueta-login-modal.is-open .gueta-login-modal__backdrop {
	opacity: 1;
}

.gueta-login-modal__panel {
	background: var(--gueta-paper);
	border-radius: var(--gueta-radius);
	box-shadow: 0 32px 60px rgb(0 0 0 / 18%), 0 2px 10px rgb(0 0 0 / 6%);
	max-height: calc(100vh - 32px);
	max-width: 440px;
	opacity: 0;
	overflow-y: auto;
	position: relative;
	transform: translateY(12px);
	transition: opacity .3s ease, transform .3s ease;
	width: 100%;
}

.gueta-login-modal.is-open .gueta-login-modal__panel {
	opacity: 1;
	transform: none;
}

.gueta-login-modal .gueta-login__card {
	border: 0;
}

.gueta-login-modal__close {
	inset-block-start: 10px;
	inset-inline-end: 10px;
	position: absolute;
	z-index: 1;
}

/* Room for the close button beside the title. */
.gueta-login-modal .gueta-login__title {
	padding-inline-end: 36px;
}

@media (prefers-reduced-motion: reduce) {
	.gueta-login-modal__panel,
	.gueta-login-modal__backdrop {
		transition: none;
	}
}
