/*
 * Mellowmail's website, in the app's own Paper look (app/src/lib/styles/app.css): warm paper under a fine grain,
 * near-black ink, Instrument Serif for the few big words, Geist for the rest, Manrope for the wordmark, and the
 * logo's terracotta used sparingly. The front page is one screen that never scrolls: a bar, a line of words, the
 * app itself in a window (website/demo, the real page on its mock), and the foot. Privacy and Terms are ordinary
 * pages that read top to bottom.
 */

/* ---------------------------------------------------------------- faces */
/* Each face with its licence in fonts/. Latin and Latin Extended, as the app ships them. */
@font-face {
	font-family: 'Geist';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Geist';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url('fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: 'Instrument Serif';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/instrument-serif-latin-400-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Instrument Serif';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/instrument-serif-latin-ext-400-normal.woff2') format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: 'Instrument Serif';
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/instrument-serif-latin-400-italic.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Instrument Serif';
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/instrument-serif-latin-ext-400-italic.woff2') format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: 'Manrope';
	font-style: normal;
	font-weight: 200 800;
	font-display: swap;
	src: url('fonts/manrope-latin-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- Paper, by day */
:root {
	--bg: #f5f3ee;
	--paper: #f8f6f1;
	--ink: #121110;
	--muted: #67645e;
	--accent: #9c543c;
	--spark: #d87758;
	--primary-hover: #2e2c29;
	--sheet: #ffffff;
	--line: #e2dfd8;
	--chip: #ebe8e2;

	--font: 'Geist', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
	--display: 'Instrument Serif', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
	--brand: 'Manrope', 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
	--ease-in: cubic-bezier(0.2, 0.8, 0.2, 1);

	--gutter: max(20px, 4vw);
	--col: 1180px;
	color-scheme: light;
}

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

html {
	background: var(--paper) url('assets/grain.svg');
	color: var(--ink);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-synthesis: none;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
}

a {
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--ink);
	outline-offset: 3px;
	border-radius: 6px;
}

.skip {
	position: absolute;
	left: 12px;
	top: -60px;
	z-index: 10;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--ink);
	color: #fff;
	font-weight: 600;
	text-decoration: none;
}

.skip:focus-visible {
	top: 12px;
}

/* One column for everything, with the gutter inside it. */
.col {
	width: 100%;
	max-width: calc(var(--col) + 2 * var(--gutter));
	margin-inline: auto;
	padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
	padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* ---------------------------------------------------------------- the bar */
.bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding-top: max(14px, env(safe-area-inset-top, 0px));
	padding-bottom: 14px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	border-radius: 8px;
}

.brand img {
	width: 28px;
	height: 28px;
	flex: none;
}

.brand span {
	font-family: var(--brand);
	font-size: 19px;
	font-weight: 800;
	letter-spacing: -0.02em;
}

.get {
	display: flex;
	align-items: center;
	gap: 16px;
	min-width: 0;
}

.get__note {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
	white-space: nowrap;
}

/* The button that does the thing: ink, as the app's Send is. */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 42px;
	padding: 0 18px 0 15px;
	border-radius: 999px;
	background: var(--ink);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition:
		background-color 0.2s ease,
		transform 0.15s ease;
}

.btn:active {
	transform: scale(0.96);
}

@media (hover: hover) {
	.btn:hover {
		background: var(--primary-hover);
	}
}

.btn__icon {
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* A button that reads as a link. */
.link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
	cursor: pointer;
	white-space: nowrap;
	transition: text-decoration-color 0.2s ease;
}

@media (hover: hover) {
	.link:hover {
		text-decoration-color: currentColor;
	}
}

/* ---------------------------------------------------------------- the front page: one screen */
body.home {
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	display: grid;
	grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.intro {
	display: grid;
	grid-template-columns: auto minmax(0, 47ch);
	justify-content: space-between;
	align-items: end;
	gap: 10px 56px;
	padding-top: clamp(2px, 1.6vh, 18px);
	padding-bottom: clamp(14px, 2.8vh, 28px);
}

.intro h1 {
	margin: 0;
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(34px, min(5.2vw, 7.4vh), 66px);
	line-height: 0.95;
	letter-spacing: -0.01em;
	white-space: nowrap;
}

.intro h1 em {
	color: var(--accent);
}

.lede {
	margin: 0;
	color: var(--muted);
	font-size: 15px;
	line-height: 1.55;
	text-wrap: pretty;
}

.stage {
	display: flex;
	min-height: 0;
	padding-bottom: clamp(10px, 2.2vh, 22px);
}

/*
 * The app's window. Mellowmail draws its own title bar and caption buttons, so the frame is only what Windows 11
 * adds: rounded corners, a hairline and its shadow. Narrower or lower than the app likes (a phone), the page inside
 * keeps a usable size and is drawn smaller to fit (--s, from script.js).
 */
.window {
	position: relative;
	flex: 1;
	min-width: 0;
	min-height: 0;
	border-radius: 10px;
	overflow: hidden;
	background: var(--bg);
	isolation: isolate;
	box-shadow:
		0 0 0 1px rgba(18, 17, 16, 0.09),
		0 1px 2px rgba(18, 17, 16, 0.05),
		0 14px 32px -10px rgba(18, 17, 16, 0.16),
		0 44px 90px -30px rgba(93, 53, 35, 0.26);
}

.window iframe {
	position: absolute;
	left: 0;
	top: 0;
	display: block;
	width: calc(100% / var(--s, 1));
	height: calc(100% / var(--s, 1));
	border: 0;
	transform: scale(var(--s, 1));
	transform-origin: 0 0;
	opacity: 0;
	transition: opacity 0.4s var(--ease-in);
}

.window.is-ready iframe {
	opacity: 1;
}

.window__cover {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 14px;
	color: var(--muted);
	font-size: 14px;
	transition:
		opacity 0.3s ease,
		visibility 0s linear 0.3s;
}

.window__cover p {
	margin: 0;
}

.window__cover img {
	animation: breathe 2.4s ease-in-out infinite alternate;
}

.window.is-ready .window__cover {
	opacity: 0;
	visibility: hidden;
}

@keyframes breathe {
	to {
		transform: scale(1.05);
	}
}

.window__nojs {
	position: absolute;
	inset: auto 0 32px;
	margin: 0;
	text-align: center;
	color: var(--muted);
}

/* ---------------------------------------------------------------- the foot */
.foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px 24px;
	padding-top: 4px;
	padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
	font-size: 13px;
	color: var(--muted);
}

.foot p {
	margin: 0;
}

.foot__links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 20px;
}

.foot__links a {
	text-decoration: none;
	border-radius: 4px;
	transition: color 0.2s ease;
}

.foot__links a[aria-current='page'] {
	color: var(--ink);
}

@media (hover: hover) {
	.foot__links a:hover {
		color: var(--ink);
		text-decoration: underline;
		text-underline-offset: 3px;
	}
}

/*
 * An egg: point at (or tap) NOMNOM Inc. and the logo's postage stamp comes in from the right, its two halves a jaw,
 * and eats the name a letter at a time, last letter first. It gulps, goes, and the name comes back (script.js,
 * setupNom). As on the Flexera Launcher site, where a launcher icon does it.
 */
.nom {
	position: relative;
	display: inline-block;
	white-space: nowrap;
	color: var(--ink);
	font-weight: 500;
	cursor: default;
}

.nom__l {
	transition: opacity 0.1s linear;
}

.nom__l.is-eaten {
	opacity: 0;
}

.nom__muncher {
	position: absolute;
	left: 0;
	top: 50%;
	width: 22px;
	height: 22px;
	margin-top: -11px;
	pointer-events: none;
	opacity: 0;
}

.nom__muncher i {
	position: absolute;
	left: 0;
	display: block;
	width: 22px;
	height: 11px;
}

.nom__muncher svg {
	display: block;
	width: 22px;
	height: 11px;
}

.nom__muncher i:first-of-type {
	top: 0;
	transform-origin: 100% 100%;
}

.nom__muncher i:last-of-type {
	bottom: 0;
	transform-origin: 100% 0;
}

/* The inside of the mouth, seen only while it's open. */
.nom__muncher b {
	position: absolute;
	left: 2px;
	top: 5px;
	width: 13px;
	height: 12px;
	background: #9c543c;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.nom__muncher.is-chomping i:first-of-type {
	animation: nom-up 0.15s ease-in-out infinite alternate;
}

.nom__muncher.is-chomping i:last-of-type {
	animation: nom-down 0.15s ease-in-out infinite alternate;
}

.nom__muncher.is-full {
	animation: nom-gulp 0.55s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.nom__muncher.is-leaving {
	transition: opacity 0.25s ease;
}

@keyframes nom-up {
	from {
		transform: rotate(2deg);
	}
	to {
		transform: rotate(34deg);
	}
}

@keyframes nom-down {
	from {
		transform: rotate(-2deg);
	}
	to {
		transform: rotate(-34deg);
	}
}

@keyframes nom-gulp {
	30% {
		transform: translateX(-2px) scale(1.2, 0.8);
	}
	62% {
		transform: translateX(-2px) scale(0.9, 1.12);
	}
}

/* ---------------------------------------------------------------- Privacy and Terms */
body.doc {
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
}

.doc main {
	flex: 1;
	padding-top: clamp(24px, 6vh, 64px);
	padding-bottom: 72px;
}

/* The text, with what's on the page beside it: the list stays in view while the text goes by. */
.page {
	display: grid;
	grid-template-columns: 220px minmax(0, 680px);
	gap: 88px;
	align-items: start;
}

.toc {
	position: sticky;
	top: 32px;
	padding-top: 6px;
	font-size: 14px;
}

.toc p {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--muted);
}

.toc ol {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: 1px solid var(--line);
}

.toc li {
	margin: 0;
}

.toc a {
	display: block;
	padding: 5px 0 5px 14px;
	margin-left: -1px;
	border-left: 1px solid transparent;
	color: var(--muted);
	text-decoration: none;
	transition:
		color 0.2s ease,
		border-color 0.2s ease;
}

@media (hover: hover) {
	.toc a:hover {
		color: var(--ink);
		border-left-color: var(--ink);
	}
}

.paper {
	max-width: 680px;
}

.paper h2 {
	scroll-margin-top: 24px;
}

.paper .kicker {
	margin: 0 0 12px;
	font-size: 13px;
	color: var(--muted);
}

.paper h1 {
	margin: 0 0 20px;
	font-family: var(--display);
	font-weight: 400;
	font-size: clamp(42px, 6vw, 60px);
	line-height: 1;
	letter-spacing: -0.01em;
}

.paper h1 em {
	color: var(--accent);
}

.paper .lead {
	margin: 0 0 40px;
	font-size: 18px;
	line-height: 1.55;
	text-wrap: pretty;
}

.paper h2 {
	margin: 44px 0 12px;
	padding-top: 22px;
	border-top: 1px solid var(--line);
	font-family: var(--display);
	font-weight: 400;
	font-size: 30px;
	line-height: 1.1;
}

.paper h3 {
	margin: 24px 0 4px;
	font-size: 15px;
	font-weight: 600;
}

.paper p,
.paper li {
	font-size: 16px;
	line-height: 1.65;
	text-wrap: pretty;
}

.paper p {
	margin: 0 0 14px;
}

.paper ul {
	margin: 0 0 14px;
	padding-left: 20px;
}

.paper li {
	margin-bottom: 6px;
}

.paper li::marker {
	color: var(--spark);
}

.paper a {
	text-decoration-color: var(--line);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 3px;
}

@media (hover: hover) {
	.paper a:hover {
		text-decoration-color: currentColor;
	}
}

.paper code {
	font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
	font-size: 0.9em;
	padding: 1px 5px;
	border-radius: 5px;
	background: var(--chip);
}

.paper .updated {
	margin-top: 40px;
	font-size: 13px;
	color: var(--muted);
}

.doc .foot {
	border-top: 1px solid var(--line);
	padding-top: 16px;
}

/* ---------------------------------------------------------------- narrower and lower */
@media (max-width: 1000px) {
	.page {
		grid-template-columns: minmax(0, 1fr);
	}

	.toc {
		display: none;
	}

	.intro {
		grid-template-columns: minmax(0, 1fr);
		justify-content: start;
	}

	.lede {
		max-width: 62ch;
	}
}

@media (max-width: 720px) {
	.get__note {
		display: none;
	}
}

@media (max-width: 480px) {
	.wide {
		display: none;
	}

	.btn {
		height: 38px;
		padding: 0 15px 0 12px;
	}

	.intro h1 {
		white-space: normal;
	}

	.lede {
		font-size: 14px;
	}
}

/* A low window (a landscape phone, a small laptop with the browser's bars): the words give way to the app. */
@media (max-height: 720px) {
	.bar {
		padding-top: max(10px, env(safe-area-inset-top, 0px));
		padding-bottom: 10px;
	}
}

@media (max-height: 640px) and (min-width: 1001px) {
	.lede {
		font-size: 14px;
	}
}

@media (max-height: 560px) {
	.home .intro {
		display: none;
	}

	.home .bar {
		padding-top: max(8px, env(safe-area-inset-top, 0px));
		padding-bottom: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.window iframe,
	.window__cover,
	.btn,
	.link {
		transition: none;
	}

	.window__cover img {
		animation: none;
	}
}

@media (forced-colors: active) {
	html {
		background-image: none;
	}

	.window {
		border: 1px solid CanvasText;
	}
}

@media print {
	html {
		background: #fff;
	}

	.bar .get,
	.skip {
		display: none;
	}
}
