/*
 * Affiliate authentication pages -- shared layout and components (PROD-3781).
 *
 * Covers login.php (per program), lost.php (both its form and result states) and
 * recover_password.php. Every colour here is a custom property; the values come
 * from whichever auth-theme-*.css the page loaded. Adding a brand means adding a
 * theme file, never touching this one.
 *
 * Derived from the Figma auth screens (desktop 1440 / mobile 375). The single
 * breakpoint is 1248px: the fixed-width desktop row (677px text column + 424px
 * form panel + page padding) needs 1229px before it clips, so anything narrower
 * gets the stacked mobile layout.
 */

/* ===== Webfonts =====
 *
 * Served from this origin on purpose. The tour sites expose the same faces, but
 * their font directories send no Access-Control-Allow-Origin header, and a
 * cross-origin @font-face fetch requires one -- linking to them would silently
 * fall back to system fonts. See PROD-3781.
 */

@font-face {
	font-family: 'Montserrat';
	src: url('../font/Montserrat-Bold.woff2') format('woff2'),
	     url('../font/Montserrat-Bold.woff') format('woff');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}


@font-face {
	font-family: 'Roboto';
	src: url('../font/Roboto-Regular.woff2') format('woff2'),
	     url('../font/Roboto-Regular.woff') format('woff');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Roboto';
	src: url('../font/Roboto-Bold.woff2') format('woff2'),
	     url('../font/Roboto-Bold.woff') format('woff');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

/* ===== Reset ===== */

.auth-page,
.auth-page *,
.auth-page *::before,
.auth-page *::after {
	box-sizing: border-box;
}

.auth-page {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	min-height: 100vh;
	margin: 0;
	background-color: var(--bg-primary);
	color: var(--text-paragraphs);
	font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
}

.auth-page img {
	display: block;
}

/* ===== Header ===== */

.auth-header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	width: 100%;
	max-width: 1380px;
	padding: 24px 8px;
}

.auth-header-bar {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 16px 40px;
	border-radius: 8px;
	background-color: var(--header-bg);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.auth-header-bar::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 1px;
	background-color: var(--stroke-secondary);
}

.auth-header-logo {
	display: block;
	flex-shrink: 0;
	width: var(--logo-width);
	height: 55px;
}

.auth-header-logo img {
	width: 100%;
	height: 100%;
	/* The three brand logos have very different aspect ratios; contain keeps each
	   one undistorted inside the box the design specifies. */
	object-fit: contain;
	object-position: left center;
}

.auth-header-actions {
	display: flex;
	align-items: center;
	gap: 32px;
}

/* ===== Buttons ===== */

.auth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	border: 0;
	border-radius: 8px;
	font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 700;
	font-size: 16px;
	line-height: 20px;
	text-align: center;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.auth-btn-primary {
	background-color: var(--btn-primary-bg);
	color: var(--btn-primary-text);
}

.auth-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.auth-btn:focus-visible,
.auth-field-input:focus-visible,
.auth-checkbox-input:focus-visible,
.auth-link:focus-visible {
	outline: 2px solid var(--btn-primary-bg);
	outline-offset: 2px;
}

/* ===== Main: text column left, form panel right ===== */

.auth-main {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	justify-content: space-between;
	width: 100%;
	/* The design frame is 1440px wide with the content inset 120px from each edge;
	   capping here keeps that exact layout and stops ultrawide screens from pushing
	   the text and the form to opposite edges. */
	max-width: 1440px;
	min-height: 495px;
	padding: 0 120px;
	gap: 8px;
	isolation: isolate;
}

/*
 * The result state of lost.php has no form panel; the text column is centred
 * instead of pinned left.
 */
.auth-main-single {
	justify-content: center;
}

.auth-intro {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	gap: 48px;
	width: 677px;
	max-width: 677px;
	flex-shrink: 0;
}

.auth-title {
	margin: 0;
	font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 700;
	font-size: 120px;
	line-height: 1;
	letter-spacing: -2.4px;
	color: var(--text-headings);
}

.auth-intro-copy {
	display: flex;
	flex-direction: column;
	width: 100%;
}

.auth-intro-copy p {
	margin: 0;
	font-size: 24px;
	line-height: 32px;
	color: var(--text-paragraphs);
}

.auth-intro-copy a {
	color: inherit;
	text-decoration: underline;
	text-underline-position: from-font;
}

/* ===== Form ===== */

.auth-form-panel {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	padding: 64px 72px;
	flex-shrink: 0;
}

.auth-form {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 40px;
	width: 280px;
	margin: 0;
}

.auth-form-head {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
	width: 100%;
}

.auth-form-title {
	margin: 0;
	width: 100%;
	font-weight: 700;
	font-size: 24px;
	line-height: 24px;
	text-align: left;
	color: var(--text-headings);
}

.auth-form-error {
	margin: 0;
	width: 100%;
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	color: var(--error);
	white-space: pre-line;
}

.auth-form-error:empty {
	display: none;
}

.auth-fields {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 24px;
	width: 100%;
}

.auth-field {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	width: 100%;
}

.auth-field-label {
	font-size: 14px;
	line-height: 1.4;
	color: var(--text-paragraphs);
}

.auth-field-input {
	display: block;
	width: 100%;
	padding: 8px 12px;
	margin: 0;
	border: 0;
	border-radius: 4px;
	background-color: var(--field-bg);
	color: var(--field-text);
	font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 400;
	font-size: 14px;
	line-height: 1.4;
	appearance: none;
	-webkit-appearance: none;
}

.auth-field-input::placeholder {
	opacity: 1;
	color: var(--field-placeholder);
}

.auth-field-note {
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
	color: var(--error);
}

/* ===== Form actions: remember me, submit, lost password ===== */

.auth-form-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 24px;
}

.auth-checkbox {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 26px;
}

.auth-checkbox-input {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	margin: 0;
	border: 2px solid var(--text-links);
	border-radius: 4px;
	background-color: transparent;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
}

.auth-checkbox-input:checked {
	background-color: var(--text-links);
	/* Tick drawn in --bg-primary, which is #060b04 in all three themes. */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23060b04' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M2 6.5 4.8 9 10 3.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 10px 10px;
}

.auth-checkbox-label {
	font-size: 14px;
	line-height: 1.4;
	color: var(--text-paragraphs);
	cursor: pointer;
}

.auth-link {
	font-size: 14px;
	line-height: 1.4;
	color: var(--text-links);
	text-decoration: underline;
	text-underline-position: from-font;
}

.auth-lost-password {
	display: flex;
	align-items: center;
	height: 26px;
	margin: 0;
}

/* ===== "Don't have an account yet?" band (login page only) ===== */

.auth-cta {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 100%;
	gap: 40px;
	padding: 64px 96px;
}

.auth-cta-title {
	margin: 0;
	width: 100%;
	font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
	font-weight: 700;
	font-size: 64px;
	line-height: 68px;
	letter-spacing: -1.28px;
	text-align: center;
	color: var(--text-headings);
}

.auth-cta-break {
	display: none;
}

/* ===== Footer ===== */

.auth-footer {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
	width: 100%;
	padding: 64px 0;
	margin-top: auto;
	background-color: var(--bg-secondary);
	flex-shrink: 0;
}

.auth-footer-row {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 24px;
	width: 100%;
	padding: 0 96px;
}

.auth-footer-logo {
	width: var(--logo-width-mobile);
	height: 41px;
	object-fit: contain;
}

.auth-footer-link {
	font-size: 13px;
	line-height: 1.4;
	color: var(--text-links);
	text-decoration: underline;
	text-underline-position: from-font;
	white-space: nowrap;
}

.auth-footer-copyright {
	margin: 0;
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
	color: var(--text-links);
}

/* ===== Mobile ===== */

@media (max-width: 1248px) {

	.auth-page {
		gap: 40px;
	}

	.auth-header {
		max-width: none;
		padding: 8px;
	}

	.auth-header-bar {
		padding: 16px;
	}

	.auth-header-logo {
		width: var(--logo-width-mobile);
		height: 43px;
	}

	.auth-main {
		flex-direction: column;
		align-items: stretch;
		min-height: 0;
		padding: 0 24px;
		gap: 64px;
	}

	.auth-intro {
		width: 100%;
		max-width: none;
	}

	.auth-title {
		font-size: 56px;
		line-height: 1.08;
		letter-spacing: -1.12px;
	}

	.auth-intro-copy p {
		font-size: 16px;
		line-height: 1.4;
	}

	.auth-form-panel {
		align-items: stretch;
		padding: 0;
	}

	.auth-form {
		align-items: center;
		width: 100%;
	}

	.auth-form-title {
		font-size: 22px;
		line-height: 20px;
		text-align: center;
	}

	.auth-form-error {
		font-size: 13px;
		text-align: center;
	}

	.auth-field-label {
		font-size: 13px;
	}

	/*
	 * 16px, not the 13px the mockup shows: anything under 16px makes iOS Safari
	 * zoom the viewport when the field takes focus.
	 */
	.auth-field-input {
		font-size: 16px;
	}

	.auth-form-actions {
		align-items: center;
	}

	.auth-checkbox-label,
	.auth-lost-password .auth-link {
		font-size: 13px;
	}

	.auth-cta {
		gap: 24px;
		padding: 40px 24px;
	}

	.auth-cta-title {
		font-size: 32px;
		line-height: 1.2;
		letter-spacing: -0.64px;
	}

	.auth-cta-break {
		display: inline;
	}

	.auth-footer {
		padding: 40px 0;
	}

	.auth-footer-row {
		padding: 0 24px;
	}

	.auth-footer-links {
		flex-wrap: wrap;
	}

	.auth-footer-copyright {
		max-width: 278px;
	}
}
