/* The same faces as iotcr.com: Outfit for headings, Nunito for everything else. */
@font-face {
	font-family: "Outfit";
	src: url("fonts/outfit-latin.woff2") format("woff2");
	font-weight: 100 900;
	font-display: swap;
}

@font-face {
	font-family: "Nunito";
	src: url("fonts/nunito-latin.woff2") format("woff2");
	font-weight: 200 1000;
	font-display: swap;
}

/* Gruvbox dark, as on iotcr.com. */
:root {
	--background: #282828;
	--surface: #32302f;
	--surface-raised: #3c3836;
	--border: #504945;
	--border-strong: #665c54;
	--text: #ebdbb2;
	--text-soft: #d5c4a1;
	--muted: #a89984;
	--brand: #83a598;
	--brand-hover: color-mix(in srgb, var(--brand), white 18%);
	--ink: #1d2021;
	--error: #fb4934;
	--focus-ring: 0 0 0 3px color-mix(in srgb, var(--brand), transparent 65%);
	/* A darker bottom lip, like the website's and the client's buttons. */
	--lip: inset 0 -3px 0 rgb(0 0 0 / 0.25);
}

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	color-scheme: dark;
	background-color: var(--background);
	color: var(--text);
	font: 400 16px/1.5 "Nunito", system-ui, sans-serif;
}

body {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 20px;
	/* The height with a phone's toolbars showing, so a short page doesn't scroll. */
	min-height: 100svh;
	padding: 32px 16px;
}

a,
.link {
	color: var(--brand);
	text-decoration-color: color-mix(in srgb, var(--brand), transparent 50%);
	text-underline-offset: 3px;

	&:hover {
		color: var(--brand-hover);
		text-decoration-color: currentColor;
	}
}

:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
}

/* Layout */

.shell {
	display: grid;
	width: 100%;
	max-width: 440px;
	overflow: hidden;
	border-radius: 12px;
	background: var(--surface);
	box-shadow:
		0 0 0 1px var(--border),
		0 24px 64px rgb(0 0 0 / 0.35);
}

.panel {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 32px 40px 36px;
}

.panel-body {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.logo {
	align-self: center;

	& img {
		display: block;
		/* The emails' size: 2.5 times the art, from a 5x image so it is exact on a 2x
		   screen. It scales smoothly, so a 1x screen gets even edges rather than
		   pixels 2px and 3px wide. */
		width: 190px;
		height: auto;
	}
}

/* Only wide screens get the art, so phones keep the form at the top and never
   download it. */
.art {
	display: none;
}

@media (min-width: 900px) {
	.shell {
		grid-template-columns: 440px 1fr;
		max-width: 1080px;
		min-height: 640px;
	}

	/* The logo stays at the top, and the page centers between it and the bottom
	   edge: the gap below the logo matches the panel's bottom padding. */
	.panel {
		gap: 36px;
	}

	.panel-body {
		margin-block: auto;
	}

	.art {
		display: block;
		position: relative;
		background: var(--ink) url("images/eldenmere-mining.webp") 40% 50% / cover no-repeat;

		&::after {
			content: "";
			position: absolute;
			inset: 0;
			background: linear-gradient(to top, rgb(29 32 33 / 0.92), rgb(29 32 33 / 0) 50%);
		}
	}

	.art-caption {
		position: absolute;
		z-index: 1;
		right: 36px;
		bottom: 32px;
		left: 36px;
	}

	.tagline {
		max-width: 460px;
		font: 500 28px/1.2 "Outfit", sans-serif;
		color: var(--text);
		text-wrap: balance;
	}
}

@media (max-width: 480px) {
	body {
		justify-content: flex-start;
		padding: 12px;
	}

	.panel {
		padding: 28px 20px 32px;
	}
}

.footer {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px 24px;
	font-size: 14px;

	& a {
		color: var(--muted);
		text-decoration: none;

		&:hover {
			color: var(--text);
		}
	}
}

/* Text */

.intro {
	display: flex;
	flex-direction: column;
	gap: 6px;

	& h1 {
		font: 500 32px/1.15 "Outfit", sans-serif;
		color: var(--text);
		text-wrap: balance;
	}

	& p {
		color: var(--text-soft);
		text-wrap: pretty;
	}

	& strong {
		color: var(--text);
		overflow-wrap: anywhere;
	}
}

.signed-in {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	min-width: 0;
}

.settings {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: 4px;
	padding-top: 24px;
	border-top: 1px solid var(--border);

	& h2 {
		font: 500 20px/1.2 "Outfit", sans-serif;
		color: var(--text);
	}

	& > a {
		align-self: flex-start;
		font-size: 14px;
	}
}

.switch {
	color: var(--muted);
}

.alert {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border-radius: 6px;
	background: color-mix(in srgb, var(--error), transparent 88%);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--error), transparent 55%);

	& svg {
		flex: none;
		width: 20px;
		height: 20px;
		margin-top: 2px;
		color: var(--error);
	}
}

.notice {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 14px;
	border-radius: 6px;
	background: color-mix(in srgb, var(--brand), transparent 88%);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand), transparent 55%);

	& svg {
		flex: none;
		width: 20px;
		height: 20px;
		margin-top: 2px;
		color: var(--brand);
	}
}

.details {
	border-radius: 8px;
	box-shadow: inset 0 0 0 1px var(--border);

	& > div {
		display: flex;
		justify-content: space-between;
		gap: 16px;
		padding: 14px 16px;
	}

	& > div + div {
		border-top: 1px solid var(--border);
	}

	& dt {
		color: var(--muted);
	}

	& dd {
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		gap: 2px;
		min-width: 0;
		font-weight: 600;
		text-align: right;
		overflow-wrap: anywhere;

		& a {
			font-size: 14px;
			font-weight: 400;
		}
	}
}

/* Forms */

.form {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

/* A hidden Turnstile widget gives back the form's gap above it. */
.cf-turnstile:not(.shown) {
	margin-top: -18px;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

hr {
	margin-block: 4px;
	border: 0;
	border-top: 1px solid var(--border);
}

label {
	font-weight: 600;
	font-size: 15px;
}

.hint {
	font-size: 14px;
	color: var(--muted);
}

input {
	width: 100%;
	height: 48px;
	padding: 0 14px;
	border: 1px solid var(--border-strong);
	border-radius: 6px;
	background: var(--background);
	color: var(--text);
	/* 16px keeps iOS from zooming in on focus. */
	font: inherit;
	font-size: 16px;
	transition:
		border-color 0.15s,
		box-shadow 0.15s;

	&:hover {
		border-color: var(--muted);
	}

	&:focus {
		outline: none;
		border-color: var(--brand);
		box-shadow: var(--focus-ring);
	}

	&[aria-invalid="true"] {
		border-color: var(--error);
	}

	/* Autofill would otherwise paint a light background under light text. */
	&:autofill {
		-webkit-text-fill-color: var(--text);
		box-shadow: 0 0 0 100px var(--background) inset;
		caret-color: var(--text);
	}

	&:autofill:focus {
		box-shadow:
			0 0 0 100px var(--background) inset,
			var(--focus-ring);
	}
}

.password {
	position: relative;

	& input {
		padding-right: 72px;
	}
}

/* Edge draws its own reveal button beside the Show checkbox. */
input::-ms-reveal {
	display: none;
}

.reveal {
	position: absolute;
	top: 50%;
	right: 6px;
	display: flex;
	align-items: center;
	height: 36px;
	padding: 0 12px;
	transform: translateY(-50%);
	border-radius: 4px;
	color: var(--brand);
	font: 600 14px "Nunito", sans-serif;
	cursor: pointer;

	&:hover {
		background: var(--surface-raised);
	}

	&:has(:checked) {
		background: color-mix(in srgb, var(--brand), transparent 85%);
		box-shadow: inset 0 0 0 1px var(--brand);
	}

	&:has(:focus-visible) {
		outline: 2px solid var(--brand);
		outline-offset: 2px;
	}

	& input {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		border: 0;
		overflow: hidden;
		clip-path: inset(50%);
	}
}

/* Buttons */

.primary,
.secondary,
.google {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 0 20px;
	border: 0;
	border-radius: 6px;
	font: 600 16px/1 "Nunito", sans-serif;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s;
}

.primary {
	background: var(--brand);
	color: var(--ink);
	box-shadow: var(--lip);

	&:hover {
		background: var(--brand-hover);
		color: var(--ink);
	}

	&:active {
		transform: translateY(1px);
		box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.25);
	}

	&:disabled {
		cursor: progress;
		opacity: 0.7;
	}
}

.secondary {
	background: var(--surface-raised);
	color: var(--text);
	box-shadow:
		inset 0 0 0 1px var(--border-strong),
		var(--lip);

	&:hover {
		background: var(--border);
		color: var(--text);
	}
}

/* A button that reads as a link, for a POST that sits in a line of text. */
.link {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	text-decoration-line: underline;
	cursor: pointer;
}

/* Google's dark theme: https://developers.google.com/identity/branding-guidelines */
.google {
	min-height: 44px;
	padding: 0 12px;
	border: 1px solid #8e918f;
	background: #131314;
	color: #e3e3e3;
	font-size: 15px;
	line-height: 20px;

	&:hover {
		background: color-mix(in srgb, #131314, #e3e3e3 8%);
		color: #e3e3e3;
	}

	& svg {
		width: 18px;
		height: 18px;
	}
}

.divider {
	display: flex;
	align-items: center;
	gap: 12px;
	font-size: 13px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--muted);

	&::before,
	&::after {
		content: "";
		flex: 1;
		height: 1px;
		background: var(--border);
	}
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;

	& > * {
		flex: 1 1 0;
		/* A label too long to sit beside the other button drops its button to a
		   row of its own, rather than wrapping inside it. */
		min-width: max-content;
	}
}
