/* The sign-in, password and error pages. The signed-in app has its own
   stylesheet (web/src/styles.css). Served fingerprinted, so the CSP needs no
   'unsafe-inline', and with no web fonts or external requests. */

/* Theme: dark is the default. With no saved choice, a light operating system gets
   the light palette. theme.js sets data-theme on <html> once the customer picks
   one, which wins over the system setting in either direction. The light values
   appear twice because CSS cannot share one block between a media query and an
   attribute selector; keep the two in step. color-scheme makes form controls and
   scrollbars follow the palette.

   Names: --panel is a card, --panel-2 is a muted hover surface, --primary is
   the solid button. */
:root {
	color-scheme: dark;
	--bg: #09090b;
	--panel: #0f0f12;
	--panel-2: #18181b;
	--line: #27272a;
	--text: #fafafa;
	--muted: #a1a1aa;
	--accent: #3b82f6;
	--bad: #f87171;
	--primary: #fafafa;
	--primary-fg: #18181b;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
	--shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
	--radius-sm: 6px;
}

@media (prefers-color-scheme: light) {
	:root:not([data-theme="dark"]) {
		color-scheme: light;
		--bg: #fafafa;
		--panel: #ffffff;
		--panel-2: #f4f4f5;
		--line: #e4e4e7;
		--text: #09090b;
		--muted: #71717a;
		--accent: #2563eb;
		--bad: #dc2626;
		--primary: #18181b;
		--primary-fg: #fafafa;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.06);
		--shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.18);
	}
}

:root[data-theme="light"] {
	color-scheme: light;
	--bg: #fafafa;
	--panel: #ffffff;
	--panel-2: #f4f4f5;
	--line: #e4e4e7;
	--text: #09090b;
	--muted: #71717a;
	--accent: #2563eb;
	--bad: #dc2626;
	--primary: #18181b;
	--primary-fg: #fafafa;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.06);
	--shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

/* Author display rules (inline-flex buttons) would otherwise beat the
   browser's own [hidden] rule and show things that are meant to stay hidden. */
[hidden] { display: none !important; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

p { margin: 0 0 10px; }

/* Keyboard focus must stay visible: this is an account console, and a customer
   navigating by keyboard should never lose their place. */
:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
	a, button, .provider, input {
		transition: background-color 0.15s ease, border-color 0.15s ease,
			color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
	}
}

/* The wordmark. Only a height is set: the viewBox carries the aspect ratio, so
   width follows and the mark cannot be squashed by a later layout change.
   currentColor comes from the parent, which is how it works in both themes. */
.logo {
	height: 20px;
	width: auto;
	flex: 0 0 auto;
	color: var(--text);
}
.muted { color: var(--muted); font-size: 13px; margin: 2px 0; }

.mono {
	font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
	font-size: 12.5px;
}

/* The default button is the solid "primary" one; .provider is outlined. */
button, .provider {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1;
	height: 36px;
	padding: 0 16px;
	border-radius: var(--radius-sm);
	border: 1px solid transparent;
	background: var(--primary);
	color: var(--primary-fg);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}
button:hover { opacity: 0.88; }

.provider {
	background: var(--panel);
	color: var(--text);
	border-color: var(--line);
	box-shadow: var(--shadow);
}
.provider:hover {
	opacity: 1;
	background: var(--panel-2);
	text-decoration: none;
}

label { display: block; font-size: 13px; font-weight: 500; margin: 14px 0 6px; }
input {
	font: inherit;
	width: 100%;
	max-width: 440px;
	height: 36px;
	padding: 0 12px;
	border-radius: var(--radius-sm);
	border: 1px solid var(--line);
	background: var(--bg);
	color: var(--text);
	box-shadow: var(--shadow);
}
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
form button[type="submit"], form > button { margin-top: 14px; }

/* Login ------------------------------------------------------------------- */

.login-body {
	display: grid;
	place-items: center;
	min-height: 100vh;
	background:
		radial-gradient(60% 45% at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
		var(--bg);
}
.login-shell { width: 100%; max-width: 400px; padding: 24px; }
.login-panel {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 14px;
	box-shadow: var(--shadow-lg);
	padding: 32px;
}
.login-brand { display: flex; align-items: center; gap: 10px; }
/* Larger on the sign-in and error screens, where the wordmark is the only
   branding on the page rather than a header above a nav. */
.login-brand .logo { height: 26px; }
.login-kicker { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.login-panel h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin: 4px 0 20px; }
.login-panel .provider { display: flex; width: 100%; height: 40px; margin-bottom: 10px; }
.login-panel form { margin: 0; }
.login-panel form .provider { margin-top: 0; }
.login-error {
	padding: 10px 14px;
	border-radius: 8px;
	background: color-mix(in srgb, var(--bad) 10%, transparent);
	border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent);
	font-size: 13px;
	margin: 0 0 16px;
}
.login-error a { color: inherit; font-weight: 600; }
.login-note { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

/* Username and password form. Inputs fill the panel rather than the 440px cap. */
.login-form label:first-of-type { margin-top: 0; }
.login-form input[type="text"], .login-form input[type="password"] {
	display: block;
	width: 100%;
	max-width: none;
	height: 40px;
}
.login-help { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.login-panel .login-form .login-submit { width: 100%; height: 40px; margin-top: 20px; }
.login-panel .login-form + .provider, .login-panel .login-form + form { margin-top: 12px; }
