/*
 * SYL — sessionVersion 2 auth screens.
 * Loaded by templates/auth/shell.tpl when the active app is SYL, alongside
 * syl/nav.css (minimal header) and syl-footer.css.
 *
 * Follows syl-login.css: white canvas, centred 480px column, Montserrat,
 * 2px-bordered fields, green CTA, dark ink.
 *
 * Self-contained. style.css loads only for non-Preauth visitors, so it is
 * absent on step-up, recovery codes and sign-out-everywhere; and design.tpl's
 * {if $syl} CSS block does not fire at all here, because siteCustomHeader
 * runs after authRequest has already rendered and exited.
 */

nav.main-nav,
nav.main-nav.ttai-navbar,
nav.main-nav-rwrdrc {
	display: none !important;
}

/* syl-login.css does this with a bare `*`; scoped to the flow so it cannot
   reach the rest of the site. The minimal header inside is styled against a
   zeroed baseline, so it needs the same treatment here. */
.auth-syl,
.auth-syl * {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: "montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.auth-syl {
	--muted: #6b6b6b;
	--line: #e7e7e7;
	--bg: #ffffff;
	--dark: rgba(30, 30, 30, 1);
	--grey: #727272;
	--cta: rgba(2, 219, 115, 1);
	--cta-hover: rgba(1, 190, 100, 1);
	--error: #c0392b;
	--radius: 8px;

	display: flex;
	flex-direction: column;
	width: 100%;
	min-height: 100vh;
	padding: 20px 20px 40px;
	background: var(--bg);
	color: #000000;
}

/* nav.css paints the body #0b0a0c and the column is narrower than the
   viewport, so the body would show as dark gutters. */
body.syl {
	background-color: #ffffff;
}

.auth-syl .auth-wrap {
	align-self: center;
	width: 100%;
	max-width: 480px;
	margin-top: 40px;
}

/* The card is the column itself, as on the SYL login page — no panel. */
.auth-syl .auth-card {
	width: 100%;
}

/* ---- Copy ---- */

.auth-syl .auth-title {
	margin-bottom: 10px;
	font-size: 24px;
	font-weight: 900;
	letter-spacing: 0.4px;
	line-height: 1.25;
}

.auth-syl .auth-lead {
	margin-bottom: 24px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--dark);
}

.auth-syl .auth-lead strong {
	font-weight: 800;
}

.auth-syl .auth-context {
	margin-bottom: 24px;
	padding: 12px 14px;
	border-left: 3px solid var(--cta);
	border-radius: 0 var(--radius) var(--radius) 0;
	background: #f3fdf7;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--dark);
}

.auth-syl .auth-notice {
	margin-bottom: 24px;
	padding: 12px 14px;
	border-radius: var(--radius);
	background: #fdeceb;
	color: var(--error);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.5;
}

/* ---- Form ---- */

.auth-syl .auth-field {
	margin-bottom: 20px;
}

.auth-syl .auth-field:last-child {
	margin-bottom: 0;
}

.auth-syl .auth-label {
	display: block;
	margin-bottom: 8px;
	font-size: 16px;
	font-weight: 600;
	color: var(--dark);
}

.auth-syl .auth-input {
	width: 100%;
	padding: 12px 16px;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	background: #ffffff;
	color: var(--dark);
	font-size: 16px;
	transition: border-color 0.2s;
}

.auth-syl .auth-input::placeholder {
	color: #a8a8a8;
	letter-spacing: normal;
}

.auth-syl .auth-input:focus {
	outline: none;
	border-color: var(--dark);
}

.auth-syl .auth-code {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: 10px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.auth-syl .auth-mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 16px;
	letter-spacing: 2px;
	text-align: center;
}

/* No error class reaches the input itself, so key off the message that
   follows it — an unsupported :has() simply leaves the border unchanged. */
.auth-syl .auth-input:has(+ .auth-error) {
	border-color: var(--error);
}

.auth-syl .auth-error {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--error);
}

.auth-syl .auth-check {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.45;
	cursor: pointer;
	color: var(--dark);
}

.auth-syl .auth-check input {
	flex: 0 0 auto;
	margin-top: 2px;
	accent-color: var(--cta);
}

.auth-syl .auth-submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 14px 24px;
	border: none;
	border-radius: var(--radius);
	background: var(--cta);
	color: var(--dark);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s;
}

.auth-syl .auth-submit:hover {
	background: var(--cta-hover);
}

.auth-syl .auth-submit:focus-visible {
	outline: 3px solid rgba(2, 219, 115, 0.45);
	outline-offset: 2px;
}

/* Revoking every session is destructive — it does not get the green CTA. */
.auth-syl .auth-submit-danger {
	background: #ffffff;
	border: 2px solid rgba(192, 57, 43, 0.35);
	color: var(--error);
}

.auth-syl .auth-submit-danger:hover {
	background: #fdeceb;
	border-color: var(--error);
}

/* ---- Secondary links ---- */

.auth-syl .auth-fine {
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-start;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--line);
}

.auth-syl .auth-fine a,
.auth-syl .auth-fine a:link,
.auth-syl .auth-fine a:visited {
	font-size: 14px;
	font-weight: 600;
	color: var(--dark);
	text-decoration: underline;
}

.auth-syl .auth-fine a:hover {
	color: #000000;
}

/* ---- Enrolment: QR + manual key ---- */

/* config::renderQR() returns false in MWE core and Readocracy does not override
   it yet, so $qr is empty and this does not render. */
.auth-syl .auth-qr {
	display: flex;
	justify-content: center;
	margin-bottom: 20px;
	padding: 14px;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	background: #ffffff;
}

.auth-syl .auth-qr img,
.auth-syl .auth-qr svg,
.auth-syl .auth-qr canvas {
	display: block;
	width: 180px;
	height: 180px;
	image-rendering: pixelated;
}

.auth-syl .auth-key {
	margin-bottom: 24px;
	padding: 14px 16px;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	background: #fafafa;
}

.auth-syl .auth-key p {
	margin-bottom: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	color: var(--grey);
}

.auth-syl .auth-key p:last-child {
	margin-bottom: 0;
}

.auth-syl .auth-key code {
	display: block;
	word-break: break-all;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 1px;
	color: var(--dark);
	-webkit-user-select: all;
	user-select: all;
}

.auth-syl .auth-key-account {
	font-size: 13px;
	color: var(--muted);
}

/* ---- Recovery codes ---- */

.auth-syl .auth-codes {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin-bottom: 24px;
	padding: 14px;
	list-style: none;
	border: 2px solid var(--line);
	border-radius: var(--radius);
	background: #fafafa;
}

.auth-syl .auth-codes code {
	display: block;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 1px;
	color: var(--dark);
	-webkit-user-select: all;
	user-select: all;
}

/* ---- Narrow ---- */

@media screen and (max-width: 700px) {
	.auth-syl .auth-wrap {
		margin-top: 24px;
	}

	.auth-syl .auth-title {
		font-size: 21px;
	}

	.auth-syl .auth-code {
		letter-spacing: 6px;
		font-size: 21px;
	}

	.auth-syl .auth-codes {
		grid-template-columns: 1fr;
	}
}
