/**
 * Registration, login and verification pages. Tokens и типографика — из design.css.
 */

.nr-auth {
	align-items: center;
	background: var(--nr-bg);
	display: flex;
	justify-content: center;
	min-height: 80vh;
	padding: 6rem 20px;
}

.nr-auth__card {
	background: var(--nr-surface);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius-lg);
	box-shadow: var(--nr-shadow);
	margin: 0 auto;
	max-width: 520px;
	padding: 44px;
	width: 100%;
}

.nr-auth__title {
	font-size: 2.1rem;
	margin: 0 0 10px;
}

.nr-auth__lead {
	color: var(--nr-ink-soft);
	font-size: 0.98rem;
	margin: 0 0 30px;
}

.nr-auth .nr-form,
.nr-auth-modal .nr-form,
.nr-auth-embed .nr-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nr-auth-modal .cform__line,
.nr-auth-embed .cform__line {
	margin-bottom: 10px;
}

.nr-auth .nr-field,
.nr-auth-modal .nr-field,
.nr-auth-embed .nr-field {
	display: flex;
	flex-direction: column;
	gap: 7px;
}

.nr-auth .nr-field > span,
.nr-auth-modal .nr-field > span,
.nr-auth-embed .nr-field > span {
	font-size: 0.9rem;
	font-weight: 500;
}

.nr-auth .nr-field small,
.nr-auth-modal .nr-field small,
.nr-auth-embed .nr-field small {
	display: none;
}

.nr-auth input[type='text'],
.nr-auth input[type='email'],
.nr-auth input[type='password'],
.nr-auth input[type='url'],
.nr-auth-modal input[type='text'],
.nr-auth-embed input[type='text'],
.nr-auth-modal input[type='email'],
.nr-auth-embed input[type='email'],
.nr-auth-modal input[type='password'],
.nr-auth-embed input[type='password'],
.nr-auth-modal input[type='url'],
.nr-auth-embed input[type='url'] {
	background: var(--nr-bg);
	border: 1px solid transparent;
	border-radius: var(--nr-radius-sm);
	color: var(--nr-ink);
	font-family: var(--nr-font-body);
	font-size: 0.95rem;
	padding: 13px 15px;
	transition: all 0.4s;
	width: 100%;
}

.nr-auth input:focus,
.nr-auth-modal input:focus,
.nr-auth-embed input:focus {
	background: var(--nr-surface);
	border-color: var(--nr-accent);
	box-shadow: 0 0 0 4px var(--nr-accent-soft);
	outline: none;
}

.nr-auth .nr-field--checkbox,
.nr-auth-modal .nr-field--checkbox,
.nr-auth-embed .nr-field--checkbox {
	align-items: flex-start;
	flex-direction: row;
	gap: 10px;
}

.nr-auth .nr-field--checkbox input,
.nr-auth-modal .nr-field--checkbox input,
.nr-auth-embed .nr-field--checkbox input {
	accent-color: var(--nr-accent);
	margin-top: 0px;
}

.nr-auth__alt {
	color: var(--nr-muted);
	font-size: 0.9rem;
	margin: 22px 0 0;
	text-align: center;
}

.nr-auth__alt a {
	color: var(--nr-accent-strong);
	text-decoration: none;
}

.nr-auth__alt a:hover {
	text-decoration: underline;
}

.nr-auth__success {
	background: var(--nr-accent-soft);
	border: 1px solid rgba(110, 97, 252, 0.25);
	border-radius: var(--nr-radius);
	margin-top: 24px;
	padding: 24px;
	text-align: center;
}

.nr-auth__success h2 {
	font-size: 1.4rem;
	margin: 0 0 8px;
}

.nr-auth__success-actions {
	text-align: left;
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 10px;
}

.nr-auth__success-note {
	text-align: left;
}

.nr-auth .nr-btn,
.nr-auth-modal .nr-btn,
.nr-auth-embed .nr-btn {
	width: 100%;
}

/* Кнопка Join в register-панели модалки: своя геометрия. */
.nr-auth-modal [data-nr-auth-view='register'] .cform__submit {
	padding: 10px 35px;
	width: 100%;
}

.nr-auth .nr-btn--link,
.nr-auth-modal .nr-btn--link,
.nr-auth-embed .nr-btn--link {
	background: none;
	border: none;
	color: var(--nr-accent-strong);
	padding: 0;
	text-decoration: underline;
	width: auto;
}

.nr-auth-modal {
	align-items: center;
	display: none;
	inset: 0;
	justify-content: center;
	padding: 20px;
	position: fixed;
	z-index: 1000;
}

.nr-auth-modal.is-open {
	display: flex;
}

/* Плавное появление: фон гаснет, карточка всплывает. */
.nr-auth-modal.is-open .nr-auth-modal__overlay {
	animation: nr-auth-fade 0.4s ease;
}

.nr-auth-modal.is-open .nr-auth-modal__card {
	animation: nr-auth-pop 0.4s ease;
}

@keyframes nr-auth-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

@keyframes nr-auth-pop {
	from {
		opacity: 0;
		transform: translateY(16px) scale(0.98);
	}

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

.nr-auth-modal__overlay {
	background: rgba(0, 0, 0, 0.5);
	inset: 0;
	position: absolute;
}

.nr-auth-modal__card {
	background: var(--nr-surface);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius-lg);
	box-shadow: var(--nr-shadow);
	max-height: 90vh;
	max-width: 520px;
	overflow-y: auto;
	padding: 44px;
	position: relative;
	width: 100%;
}

.nr-auth-modal .modal-title p {
	font-family: var(--font-family-serif);
	font-size: 2.1rem;
	font-weight: 800;
	margin: 0 0 10px;
	text-align: left;
}

.nr-auth-modal .modal-subtitle p {
	color: var(--nr-ink-soft);
	font-size: 0.98rem;
	font-weight: 500;
	margin: 0 0 30px;
	text-align: left;
}

.nr-auth-modal__x {
	background: none;
	border: 0;
	color: var(--nr-muted);
	cursor: pointer;
	font-size: 1.6rem;
	line-height: 1;
	padding: 8px 12px;
	position: absolute;
	right: 8px;
	top: 8px;
}

/* Панели плавно скрываются/открываются. */
.nr-auth-modal [data-nr-auth-view] {
	display: none;
}

.nr-auth-modal [data-nr-auth-view].is-active {
	animation: nr-auth-in 0.4s ease;
	display: block;
}

/* Скрытые состояния — классами, не hidden. */
[data-nr-form-error].is-hidden,
[data-nr-resend].is-hidden,
[data-nr-register-success].is-hidden,
[data-nr-reset-sent].is-hidden,
[data-nr-form].is-hidden {
	display: none;
}

@keyframes nr-auth-in {
	from {
		opacity: 0;
		transform: translateY(10px);
	}

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

body.nr-modal-open {
	overflow: hidden;
}

@media (max-width: 520px) {
	.nr-auth-modal__card {
		padding: 28px 22px;
	}
}

/* Плашка «Вы запрашиваете доступ к: X» (?claim=): акцентная карточка. */
.nr-claim-intent {
	align-items: center;
	background: var(--nr-accent-soft);
	border: 1px solid rgba(110, 97, 252, 0.35);
	border-radius: var(--nr-radius);
	display: flex;
	gap: 14px;
	margin: 0 0 24px;
	padding: 16px;
}

.nr-claim-intent__logo {
	border-radius: 12px;
	flex: none;
	height: 56px;
	object-fit: cover;
	width: 56px;
}

.nr-claim-intent__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.nr-claim-intent__kicker {
	color: var(--nr-accent-strong);
	font-size: 0.8rem;
	font-weight: 600;
}

.nr-claim-intent__title {
	font-size: 1.05rem;
	line-height: 1.3;
}

.nr-claim-intent__host {
	color: var(--nr-muted);
	font-size: 0.85rem;
}

/* Ошибки под полями входа/регистрации — в потоке, а не абсолютом
   (design.css): абсолют с bottom:-20px при gap 18px наезжал на следующую
   подпись или кнопку, а длинный текст не переносился. Теперь ошибка
   раздвигает форму. */
.nr-auth .nr-field > .nr-field-error,
.nr-auth-modal .nr-field > .nr-field-error,
.nr-auth-embed .nr-field > .nr-field-error {
	bottom: auto;
	/* Пустая ошибка не добавляет gap поля (7px): гасим его отрицательным отступом. */
	margin: -7px 0 0;
	max-height: 0;
	position: static;
	white-space: normal;
}

.nr-auth .nr-field > .nr-field-error.is-shown,
.nr-auth-modal .nr-field > .nr-field-error.is-shown,
.nr-auth-embed .nr-field > .nr-field-error.is-shown {
	margin-top: -2px;
	max-height: 5em;
}

.nr-auth [data-nr-step],
.nr-auth-modal [data-nr-step],
.nr-auth-embed [data-nr-step] {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nr-auth [data-nr-step][hidden],
.nr-auth-modal [data-nr-step][hidden],
.nr-auth-embed [data-nr-step][hidden] {
	display: none;
}

/* Нажатая кнопка: спиннер (design.css) + приглушена, повтор заблокирован (auth.js setBusy). */
.nr-auth .nr-btn:disabled,
.nr-auth-modal .nr-btn:disabled,
.nr-auth-embed .nr-btn:disabled {
	cursor: progress;
	opacity: 0.75;
}

.nr-auth .nr-btn.is-loading,
.nr-auth-modal .nr-btn.is-loading,
.nr-auth-embed .nr-btn.is-loading {
	gap: 10px;
	opacity: 0.9;
}

/* Подсказки беспарольного входа (templates/partials/login-form.php). */
.nr-auth__hint {
	color: var(--nr-muted);
	font-size: 0.88rem;
	margin: 10px 0 0;
}

[data-nr-step="code"] .nr-auth__hint {
	margin: 0 0 16px;
}

[data-nr-step="code"] input[name="code"] {
	font-size: 1.4rem;
	letter-spacing: 0.4em;
	text-align: center;
}

/* Переключатель Sign up / Sign in в попапе: тот же сегмент, что в кабинете. */
.nr-auth-switch {
	background: var(--nr-surface);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius);
	display: flex;
	gap: 4px;
	margin: -10px 0 24px;
	padding: 4px;
}

.nr-auth-switch__btn {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: calc(var(--nr-radius) - 4px);
	color: var(--nr-ink-soft);
	cursor: pointer;
	display: inline-flex;
	flex: 1;
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 600;
	justify-content: center;
	min-height: 44px;
	padding: 10px 18px;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.nr-auth-switch__btn:hover {
	color: var(--nr-ink);
}

.nr-auth-switch__btn.is-active {
	background: var(--nr-accent-soft);
	color: var(--nr-accent-strong);
	cursor: default;
}

.nr-auth-switch__btn:focus-visible {
	outline: 2px solid var(--nr-accent);
	outline-offset: 2px;
}

/* После отправки регистрации форма скрыта — переключатель тоже. */
.nr-auth-switch:has(~ .nr-form.is-hidden) {
	display: none;
}

/* Honeypot: спрятан от людей, но остаётся в разметке для ботов. */
.nr-honeypot {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	top: -9999px;
	width: 0;
}

@media (max-width: 520px) {
	.nr-auth__card {
		padding: 28px 22px;
	}

	.nr-auth__title {
		font-size: 1.6rem;
	}
}

/* Sign-up form embedded in a page (theme: /agency-form/), styled like the popup. */
.nr-auth-embed .nr-auth__title {
	font-size: 1.75rem;
	margin: 0 0 8px;
}

.nr-auth-embed .nr-auth__lead {
	margin-bottom: 22px;
}

.nr-auth-embed .nr-btn--accent {
	width: 100%;
}

.nr-auth-embed .nr-auth__alt {
	margin-bottom: 0;
}
