/*
 * CPWL authentication screens — CPWL UI/UX Specification v9.0.0 §8.14.
 *
 * The sign-in route is the one surface that is not a page: no shell, no signed
 * in user, no context to load. It is also the application's largest brand
 * moment. Loaded after cpwl/brand.css, which supplies every token used here.
 */

body.cpwl-auth {
	background: color-mix(in oklab, var(--muted) 40%, var(--background));
	margin: 0;
	min-height: 100svh;
}

.cpwl-auth-main {
	align-items: center;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 100svh;
	padding: 1.5rem;
}

@media (min-width: 48rem) {
	.cpwl-auth-main {
		padding: 2.5rem;
	}
}

.cpwl-auth-shell {
	max-width: 24rem;
	width: 100%;
}

@media (min-width: 48rem) {
	.cpwl-auth-shell {
		max-width: 48rem;
	}
}

/*
 * shadow-2xl, deliberately heavier than anything in §8.1: this card floats on
 * an empty page with nothing else to establish depth.
 */
.cpwl-auth-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) + 4px);
	box-shadow: 0 25px 50px -12px color-mix(in oklab, var(--primary) 30%, transparent);
	overflow: hidden;
}

.cpwl-auth-card__grid {
	display: grid;
	grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
	.cpwl-auth-card__grid {
		grid-template-columns: 1fr 1fr;
	}
}

/* ------------------------------------------------------------------ *
 * Brand panel
 *
 * The supplied primary logo, white variant, reversed out of dark blue — the
 * treatment §3.4 sanctions explicitly. No strapline text: the artwork carries
 * both lines already, which is why this screen cannot repeat the italicised
 * strapline defect. No campaign line either.
 * ------------------------------------------------------------------ */

.cpwl-auth-brand {
	align-items: center;
	background: var(--sidebar);
	display: none;
	flex-direction: column;
	gap: 1.5rem;
	justify-content: center;
	padding: 2rem;
}

@media (min-width: 48rem) {
	.cpwl-auth-brand {
		display: flex;
	}
}

/*
 * On light the white card against navy is the split. On dark, --card and
 * --sidebar sit two steps apart in lightness and the seam disappears, so the
 * panel takes the sidebar's own border token to keep its edge.
 */
html.dark .cpwl-auth-brand {
	border-left: 1px solid var(--sidebar-border);
}

.cpwl-auth-brand__mark {
	height: auto;
	max-width: 17rem;
	width: 100%;
}

.cpwl-auth-brand__rule {
	background: color-mix(in oklab, var(--sidebar-foreground) 25%, transparent);
	height: 1px;
	width: 3rem;
}

/*
 * The product name is a <p>, not a heading: §3.3 self-colours every heading
 * navy, and a navy heading on a navy panel is invisible.
 */
.cpwl-auth-brand__product {
	color: var(--sidebar-foreground);
	font-family: var(--font-display);
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0;
	text-align: center;
}

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

.cpwl-auth-form-col {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	padding: 1.5rem;
}

@media (min-width: 48rem) {
	.cpwl-auth-form-col {
		padding: 2rem;
	}
}

/* Below md the panel is hidden rather than stacked; the dark-blue mark stands
   in at the top of the form column. */
.cpwl-auth-form-col__mark {
	height: auto;
	max-width: 17rem;
	width: 100%;
}

@media (min-width: 48rem) {
	.cpwl-auth-form-col__mark {
		display: none;
	}
}

/* The heading block is centred; the fields below are left-labelled. The
   asymmetry separates "where am I" from "what do I type". */
.cpwl-auth-head {
	text-align: center;
}

.cpwl-auth-head svg {
	color: var(--primary);
	height: 2rem;
	margin: 0 auto 0.5rem;
	width: 2rem;
}

.cpwl-auth-head h1 {
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.2;
	margin: 0;
}

.cpwl-auth-head p {
	color: var(--muted-foreground);
	font-size: 0.875rem;
	margin: 0.375rem 0 0;
}

.cpwl-auth-form {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
	margin: 0;
}

.cpwl-field {
	display: grid;
	gap: 0.5rem;
}

.cpwl-field label {
	color: var(--foreground);
	font-size: 0.875rem;
	font-weight: 500;
}

/* §8.11 — every typed control computes to at least 16px below md, or iOS
   Safari zooms the page on focus. */
.cpwl-field input {
	background: var(--card);
	border: 1px solid var(--input);
	border-radius: calc(var(--radius) - 2px);
	box-sizing: border-box;
	color: var(--foreground);
	font-family: var(--font-sans);
	font-size: 1rem;
	min-height: 2.75rem;
	padding: 0.5rem 0.75rem;
	width: 100%;
}

@media (min-width: 48rem) {
	.cpwl-field input {
		font-size: 0.875rem;
	}
}

.cpwl-field input:focus {
	border-color: var(--ring);
	outline: 2px solid var(--ring);
	outline-offset: 1px;
}

.cpwl-submit {
	background: var(--primary);
	border: 1px solid var(--primary);
	border-radius: calc(var(--radius) - 2px);
	color: var(--primary-foreground);
	cursor: pointer;
	font-family: var(--font-sans);
	font-size: 0.875rem;
	font-weight: 600;
	min-height: 2.75rem;
	padding: 0.5rem 1rem;
	transition: background-color 0.15s ease;
	width: 100%;
}

a.cpwl-submit {
	align-items: center;
	box-sizing: border-box;
	display: inline-flex;
	justify-content: center;
	text-decoration: none;
}

@media (hover: hover) {
	.cpwl-submit:hover:not(:disabled) {
		background: color-mix(in oklab, var(--primary) 88%, black);
	}
}

.cpwl-submit:disabled {
	cursor: not-allowed;
	opacity: 0.6;
}

/* One error surface per screen, in the flow rather than over it, so it pushes
   the button down instead of covering it. Never per field. */
.cpwl-auth-error {
	background: var(--status-danger-bg);
	border: 1px solid var(--destructive);
	border-radius: calc(var(--radius) - 2px);
	color: var(--status-danger);
	font-size: 0.875rem;
	margin: 0;
	padding: 0.75rem;
}

.cpwl-auth-note {
	color: var(--muted-foreground);
	font-size: 0.8125rem;
	margin: 0;
	text-align: center;
}

.cpwl-auth-note a {
	color: var(--status-info);
}

.cpwl-auth-foot {
	color: var(--muted-foreground);
	font-size: 0.75rem;
	margin-top: 1.5rem;
	text-align: center;
}

.cpwl-auth-foot p {
	margin: 0.125rem 0;
}

.cpwl-auth-actions {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.cpwl-auth-secondary {
	align-items: center;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) - 2px);
	color: var(--foreground);
	display: inline-flex;
	font-size: 0.875rem;
	font-weight: 500;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0.5rem 1rem;
	text-decoration: none;
	transition:
		background-color 0.15s ease,
		border-color 0.15s ease;
}

@media (hover: hover) {
	.cpwl-auth-secondary:hover {
		background: var(--secondary);
		border-color: var(--ring);
	}
}
