/**
 * Only what the card adds on top of the theme.
 *
 * The NOIR theme already styles .auth-wrap, .auth-card, .auth-head, .field,
 * .auth-msg and .btn; those are used as-is so the login keeps matching the rest
 * of the site. Every custom property below carries a fallback, so the form is
 * still legible on a theme that has never heard of NOIR.
 */

.noir-otp-wrap {
	display: grid;
	place-items: center;
	padding-block: clamp(1rem, 4vw, 3rem);
}

.noir-otp {
	width: min(450px, 100%);
	margin-inline: auto;
}

/* The checkout reminder sits between other blocks; it brings its own spacing. */
.noir-otp-checkout {
	margin-bottom: 1.6rem;
}

.noir-otp-checkout .noir-otp-wrap {
	padding-block: 0;
}

.noir-otp .noir-otp-form[hidden] {
	display: none;
}

/* --- the number we sent to, and the way back --- */

.noir-otp-sent {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: .75rem;
	flex-wrap: wrap;
	margin: 0 0 1.1rem;
	font-size: .86rem;
	color: var(--muted, #9a9187);
}

.noir-otp-sent-text {
	direction: ltr;
	unicode-bidi: isolate;
	letter-spacing: .04em;
	color: var(--text, #f2ece3);
}

.noir-otp-edit,
.noir-otp-resend {
	background: none;
	border: 0;
	padding: .35em 0;
	font: inherit;
	font-size: .84rem;
	color: var(--accent-soft, #d8b25f);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: .3em;
}

.noir-otp-edit:hover,
.noir-otp-resend:not(:disabled):hover {
	color: var(--accent, #c9a227);
}

.noir-otp-resend {
	display: block;
	width: 100%;
	margin-top: .9rem;
	text-align: center;
}

.noir-otp-resend:disabled {
	color: var(--muted-2, #6d665e);
	cursor: default;
	text-decoration: none;
}

/* --- the code box --- */

.noir-otp .noir-otp-code {
	direction: ltr;
	text-align: center;
	/* One wide box rather than a row of single-digit inputs: it takes a pasted
	   code, and iOS/Android fill it from the SMS through autocomplete. */
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: .5em;
	/* The tracking is added after the last glyph too, which would sit the digits
	   left of centre; half of it back as padding re-centres them. */
	padding-inline-start: calc(1em + .5em);
	padding-inline-end: 1em;
	font-variant-numeric: tabular-nums;
}

/* --- state of the card --- */

.noir-otp-test {
	margin: 0 0 1.2rem;
	padding: .7rem .9rem;
	border: 1px solid rgba(211, 79, 63, .45);
	border-radius: 10px;
	background: rgba(211, 79, 63, .12);
	color: #e9a49b;
	font-size: .82rem;
	line-height: 1.8;
}

.noir-otp-test code {
	direction: ltr;
	unicode-bidi: isolate;
	padding: .05em .45em;
	border-radius: 5px;
	background: rgba(0, 0, 0, .3);
	font-size: .95em;
	letter-spacing: .12em;
}

.noir-otp-msg.is-error {
	border: 1px solid rgba(211, 79, 63, .45);
	background: rgba(211, 79, 63, .12);
	color: #e9a49b;
}

.noir-otp-msg.is-ok {
	border: 1px solid rgba(90, 160, 110, .4);
	background: rgba(90, 160, 110, .12);
	color: #9ed4ad;
}

.noir-otp-msg.is-warn {
	border: 1px solid rgba(200, 160, 70, .45);
	background: rgba(200, 160, 70, .12);
	color: #e2c383;
}

/* .auth-msg fades in on .show; without the theme there is nothing to fade, so
   the message would be invisible. This makes it visible on its own terms. */
.noir-otp-msg {
	margin-top: 1rem;
	padding: .7rem 1rem;
	border-radius: 10px;
	font-size: .86rem;
	text-align: center;
}

.noir-otp-msg:empty {
	display: none;
}

/* --- already signed in --- */

.noir-otp-actions {
	display: flex;
	gap: .7rem;
	margin: 0;
}

.noir-otp-actions .btn {
	flex: 1;
	justify-content: center;
}

@media (max-width: 480px) {
	.noir-otp .noir-otp-code {
		font-size: 1.25rem;
		letter-spacing: .35em;
		padding-inline-start: calc(1em + .35em);
	}

	.noir-otp-actions {
		flex-direction: column;
	}
}
