/**
 * Login / forgot / reset gate.
 *
 * Every rule is scoped under #pa-gate so it reliably wins over the active
 * theme's element styles (e.g. h1 { font-size: clamp(2rem, 5vw, 3rem) }).
 * Loaded as a real stylesheet (not inline) so HTML/CSS optimisers can't strip
 * or defer it out of the cascade.
 *
 * @package StKlara\ProtectedAreas
 */

/*
 * Pin the base font size on the gate page. The theme intends body = 1rem
 * (its SCSS sets it), but on this PHP-rendered gate the WordPress global-styles
 * fluid rule (body = clamp up to 20px) wins instead, so the whole page — footer
 * included — inherits an oversized base. "html body" (0,0,2) beats both single
 * "body" rules regardless of load order. Only loaded on the gate page.
 */
html body {
	font-size: 1rem;
}

#pa-gate {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 50vh;
	padding: 2rem 1rem;
	box-sizing: border-box;
}

#pa-gate *,
#pa-gate *::before,
#pa-gate *::after {
	box-sizing: border-box;
}

#pa-gate .pa-gate__card {
	width: 100%;
	max-width: 420px;
	padding: 2rem;
	border-radius: 12px;
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
	background: var(--color-white, #fff);
}

#pa-gate .pa-gate__title {
	margin: 0 0 1rem;
	padding: 0;
	font-size: 1.3rem;
	line-height: 1.3;
	font-weight: 700;
}

#pa-gate .pa-gate__intro,
#pa-gate .pa-gate__hint {
	margin: 0 0 1rem;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--color-gray-500, #555);
}

#pa-gate .pa-gate__form {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin: 0;
}

#pa-gate .pa-gate__label {
	font-weight: 600;
	font-size: 0.95rem;
	margin-top: 0.6rem;
}

#pa-gate .pa-gate__input {
	width: 100%;
	padding: 0.7rem 0.8rem;
	border: 1px solid #ccc;
	border-radius: 8px;
	font-size: 1rem;
	line-height: 1.4;
}

/*
 * Visible focus for EVERY interactive element of the gate, not just the input:
 * keyboard users were previously left without any indication on the submit
 * button and the links (audit N-8).
 */
#pa-gate .pa-gate__input:focus,
#pa-gate .pa-gate__input:focus-visible,
#pa-gate .pa-gate__submit:focus,
#pa-gate .pa-gate__submit:focus-visible,
#pa-gate .pa-gate__links a:focus,
#pa-gate .pa-gate__links a:focus-visible,
#pa-gate .pa-gate__remember input:focus,
#pa-gate .pa-gate__remember input:focus-visible {
	outline: 2px solid var(--color-primary, currentColor);
	outline-offset: 2px;
}

#pa-gate .pa-gate__remember {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.8rem;
	font-size: 0.9rem;
	font-weight: 400;
}

#pa-gate .pa-gate__submit {
	margin-top: 1.2rem;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
	background: var(--color-primary, #aac3a2);
	color: var(--color-black, #000);
}

#pa-gate .pa-gate__submit:hover {
	opacity: 0.9;
}

#pa-gate .pa-gate__links {
	margin-top: 1rem;
	font-size: 0.9rem;
}

#pa-gate .pa-gate__error,
#pa-gate .pa-gate__notice {
	margin: 0 0 1rem;
	padding: 0.6rem 0.8rem;
	border-radius: 8px;
	font-size: 0.9rem;
	line-height: 1.4;
}

#pa-gate .pa-gate__error {
	background: #fde8e8;
	color: #9b1c1c;
}

#pa-gate .pa-gate__notice {
	background: #e6f4ea;
	color: #1e5631;
}

/* Small screens: the card should use the available width. */
@media (max-width: 480px) {
	#pa-gate {
		padding: 1.25rem 0.75rem;
	}

	#pa-gate .pa-gate__card {
		padding: 1.25rem;
		border-radius: 8px;
	}

	#pa-gate .pa-gate__title {
		font-size: 1.15rem;
	}
}

/* Respect the visitor's motion preference. */
@media (prefers-reduced-motion: reduce) {
	#pa-gate *,
	#pa-gate *::before,
	#pa-gate *::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
	}
}

/*
 * Dark mode: only applied when the theme has not defined its own colours for
 * the card (the custom properties keep winning if it has).
 */
@media (prefers-color-scheme: dark) {
	#pa-gate .pa-gate__card {
		background: var(--color-white, #1c1c1e);
		color: var(--color-black, #f2f2f7);
		box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
	}

	#pa-gate .pa-gate__intro,
	#pa-gate .pa-gate__hint {
		color: var(--color-gray-500, #b8b8bd);
	}

	#pa-gate .pa-gate__input {
		background: var(--color-white, #2c2c2e);
		color: var(--color-black, #f2f2f7);
		border-color: #55555a;
	}

	#pa-gate .pa-gate__error {
		background: #4a1d1d;
		color: #ffd7d7;
	}

	#pa-gate .pa-gate__notice {
		background: #17361f;
		color: #cdeed6;
	}
}
