/*
 * klementine.net: one calm page. Warm off-white ground (as the Klementine app), ink near black,
 * the clementine as the only colour. System fonts for text; the wordmark's Instrument Sans is hosted
 * here (fonts/, OFL), so the page loads nothing but itself and needs no consent for fonts.
 */
@font-face {
	font-family: 'Instrument Sans';
	font-style: normal;
	font-weight: 600;
	font-display: block;
	src: url('fonts/instrument-sans-600.woff2') format('woff2');
}
:root {
	color-scheme: light dark;
	--ground: light-dark(#f5f3ee, #1b1916);
	--ink: light-dark(#24231d, #f2efe7);
	--ink-2: light-dark(#5c594e, #bdb6a8);
	--rule: light-dark(#e2ddd0, #34312b);
	--clementine: light-dark(#f26b1d, #f47a32);
	--leaf: light-dark(#4f7d3a, #6f9b55);
	--focus: light-dark(#5c594e, #bdb6a8);
	--measure: 34rem;
	font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	font-size: 100%;
	line-height: 1.55;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

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

html {
	background: var(--ground);
	color: var(--ink);
}

body {
	margin: 0;
	min-height: 100svh;
	display: flex;
	flex-direction: column;
	padding: max(env(safe-area-inset-top), 1.5rem) max(env(safe-area-inset-right), 1rem)
		max(env(safe-area-inset-bottom), 1.5rem) max(env(safe-area-inset-left), 1rem);
}

main {
	flex: 1;
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 1.75rem;
	padding-block: 3rem;
}

/*
 * The hero: the drawn tree and the wordmark share one font size, so the tree (3.2em wide) and the
 * clementine on the i keep their proportions at every width. The tree's left edge sits on the k's ink
 * (Instrument Sans 600: the k's left side bearing is 0.0634em). The ground line reaches right just as far
 * as the falling clementine needs: its first bounce lands at the line's end, and that bounce and the
 * one onto the i then cover about the same distance.
 */
.hero {
	font-family: 'Instrument Sans', system-ui, sans-serif;
	font-weight: 600;
	font-size: clamp(3.25rem, 2.2rem + 5vw, 5rem);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35em;
}

/* The drawn clementine tree: ink lines, the fruit the only colour. */
.tree {
	width: 3.2em;
	height: auto;
	margin-left: 0.0634em;
	color: var(--ink);
	overflow: visible;
}

/* The wordmark: lowercase, tight. The i is the dotless ı; its dot is a clementine. */
.wordmark {
	font: inherit;
	font-size: 1em;
	letter-spacing: -0.035em;
	line-height: 1;
	margin: 0;
	white-space: nowrap;
}

.i {
	position: relative;
	display: inline-block;
	transform-origin: 50% 100%;
}

/* Placed from the measured glyph: the stem's centre 0.1275em from the glyph's left, its top 0.51em
   above the baseline, the baseline 0.1406em above the line box's bottom; the font's own gap above. */
.dot {
	--d: 0.2em;
	position: absolute;
	left: calc(0.1275em - var(--d) / 2);
	bottom: calc(0.1406em + 0.51em + 0.0875em);
	width: var(--d);
}

.dot-y {
	display: block;
	transform-origin: 50% 100%;
}

.dot svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/*
 * The intro (once the script is there, and only for people who don't ask for less motion), slow and
 * calm, one stage flowing into the next: the ground is drawn, the trunk grows up out of it, the crown
 * is drawn around, the fruit comes small and green and ripens. intro.js then lets the ripe one go:
 * it bounces twice on the ground and jumps onto the i. The words never move.
 */
.tree .fruit-wrap {
	transform-box: fill-box;
	transform-origin: center;
}

/* The ground line lies in front of the trunk, so it's a solid grey (the tone 35% ink makes on the
   ground), not see-through ink, which would vanish against the white trunk. */
.tree .ground {
	stroke: color-mix(in oklab, currentColor 35%, var(--ground));
	opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
	.js .hero .ground {
		stroke-dasharray: 1;
		animation: draw-line 1s cubic-bezier(0.65, 0, 0.35, 1) both;
	}

	.js .hero .trunk {
		animation: reveal-up 1.3s 0.5s cubic-bezier(0.65, 0, 0.35, 1) both;
	}

	.js .hero .crown-line {
		stroke-dasharray: 1;
		animation: draw-line 1.9s 1.4s cubic-bezier(0.65, 0, 0.35, 1) both;
	}

	.js .hero .fruit-wrap {
		animation: grow-in 0.8s calc(2.9s + var(--n) * 90ms) cubic-bezier(0.23, 1, 0.32, 1) both;
	}

	.js .hero .fruit-body {
		animation: ripen 1.6s calc(3.1s + var(--n) * 90ms) cubic-bezier(0.45, 0, 0.55, 1) both;
	}

	.js .hero .fruit-pores {
		animation: fade-in 0.8s calc(4s + var(--n) * 90ms) ease-out both;
	}

	/* the dot waits in the tree until the script lets it fall */
	.js .hero .dot {
		opacity: 0;
	}

}

@keyframes reveal-up {
	from {
		clip-path: inset(100% 0 0 0);
	}
	to {
		clip-path: inset(0 0 0 0);
	}
}

@keyframes grow-in {
	from {
		transform: scale(0.6);
		opacity: 0;
	}
}

@keyframes draw-line {
	from {
		stroke-dashoffset: 1;
	}
	to {
		stroke-dashoffset: 0;
	}
}

@keyframes ripen {
	from {
		fill: var(--leaf);
	}
	to {
		fill: var(--clementine);
	}
}

@keyframes fade-in {
	from {
		opacity: 0;
	}
}

/* Her face, the app icon (favicon.svg): the logo beside her name. */
.mark {
	display: block;
	width: 4.5rem;
	height: 4.5rem;
	flex: none;
}

h1 {
	margin: 0;
	font-size: clamp(2.25rem, 1.6rem + 3vw, 3.25rem);
	line-height: 1.05;
	font-weight: 700;
	letter-spacing: -0.02em;
}

p {
	margin: 0;
	font-size: 1.125rem;
	color: var(--ink-2);
	text-wrap: pretty;
}

/* Long legal text may hyphenate; the short lines on the home page never need to. */
.legal p {
	hyphens: auto;
}

p strong {
	color: var(--ink);
	font-weight: 600;
}

/*
 * The lede is set like a short poem, on every screen: two sentences as two stanzas, each broken
 * where you'd pause ("We design calm apps / for everyday life." and "Apps that work for you, / not
 * for your attention.").
 */
.lede .tail {
	display: block;
}

.lede .clause {
	display: block;
	margin-top: 0.6em;
}

.lede {
	color: var(--ink-2);
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
	line-height: 1.4;
	text-wrap: balance;
}

a {
	color: inherit;
	text-decoration-color: var(--rule);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.2em;
	transition: text-decoration-color 140ms;
}

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

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

footer {
	width: 100%;
	max-width: var(--measure);
	margin: 0 auto;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1.5rem 4rem;
	padding-block: 3rem 2rem;
	font-size: 0.9375rem;
	color: var(--ink-2);
}

/* The copyright line: Phosphor's Copyright glyph at the text's size, in its ink. */
.copy {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
}

.copy-icon {
	width: 1.05em;
	height: 1.05em;
	flex: none;
}

footer .spacer {
	flex: 1;
}

/* The legal pages: a readable column, headings in ink. */
.legal main {
	justify-content: flex-start;
	gap: 1.25rem;
	padding-top: 1.75rem;
}

/* The legal pages' header: sticky, the full width (it reaches past the body's padding), her ground
   colour at 92% with the text blurred under it (solid where blur isn't there), light and dark from
   the tokens; a hairline under it once the page scrolls. Its row lines up with the column. */
.legal-head {
	position: sticky;
	top: 0;
	z-index: 10;
	margin: calc(-1 * max(env(safe-area-inset-top), 1.5rem)) calc(-1 * max(env(safe-area-inset-right), 1rem)) 0
		calc(-1 * max(env(safe-area-inset-left), 1rem));
	padding: calc(env(safe-area-inset-top) + 0.75rem) max(env(safe-area-inset-right), 1rem) 0.75rem
		max(env(safe-area-inset-left), 1rem);
	border-bottom: 1px solid transparent;
	background: var(--ground);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
	.legal-head {
		background: color-mix(in oklab, var(--ground) 92%, transparent);
		-webkit-backdrop-filter: saturate(180%) blur(16px);
		backdrop-filter: saturate(180%) blur(16px);
	}
}

@supports (animation-timeline: scroll()) {
	.legal-head {
		animation: legal-head-rule linear both;
		animation-timeline: scroll();
		animation-range: 0 2rem;
	}
}

@keyframes legal-head-rule {
	to {
		border-bottom-color: var(--rule);
	}
}

.legal-head-row {
	max-width: var(--measure);
	margin: 0 auto;
}

.legal h1 {
	font-size: 2rem;
}

.legal h2 {
	margin: 1rem 0 0;
	font-size: 1.125rem;
	line-height: 1.3;
}

.legal p,
.legal address {
	font-size: 1rem;
	font-style: normal;
	color: var(--ink-2);
}

/* Her mark and name, the link home. Only the link is a target, not the row. */
.legal-home {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 2.75rem;
	font-weight: 600;
	text-decoration: none;
}

.legal-home .mark {
	width: 1.5rem;
	height: 1.5rem;
}

/* The investors' gate: one field and its key, the note on what is recorded below. */
.gate-form {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.gate-form label {
	font-weight: 600;
	color: var(--ink);
}

.gate-row {
	display: flex;
	gap: 0.5rem;
}

.gate-row input {
	flex: 1;
	min-width: 0;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--rule);
	border-radius: 0.6rem;
	background: transparent;
	color: var(--ink);
	font: inherit;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.gate-row button {
	padding: 0.6rem 1.1rem;
	border: 0;
	border-radius: 0.6rem;
	background: var(--ink);
	color: var(--ground);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.gate-row input:focus-visible,
.gate-row button:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.legal .gate-wrong {
	color: var(--ink);
}

.legal .gate-note {
	font-size: 0.875rem;
}

.legal .updated {
	font-size: 0.875rem;
}

/* The imprint's contact form: two fields like the gate's, the key in ink, the note beside it. */
.contact-form {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

.contact-form label {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	font-weight: 600;
	color: var(--ink);
}

.contact-form input,
.contact-form textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--rule);
	border-radius: 0.6rem;
	background: transparent;
	color: var(--ink);
	font: inherit;
	font-weight: 400;
}

.contact-form textarea {
	min-height: 8rem;
	resize: vertical;
}

.contact-form [aria-invalid='true'] {
	border-color: var(--ink);
}

.contact-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
}

.contact-actions button {
	padding: 0.6rem 1.25rem;
	border: 0;
	border-radius: 0.6rem;
	background: var(--ink);
	color: var(--ground);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.contact-actions button:disabled {
	opacity: 0.6;
	cursor: default;
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible,
.contact-actions button:focus-visible,
.contact-sent:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.legal .contact-note {
	flex: 1;
	min-width: 12rem;
	font-size: 0.875rem;
}

.legal .contact-error,
.legal .contact-sent {
	color: var(--ink);
}

/* A field for bots only: off screen, out of the tab order, hidden from screen readers. */
.trap {
	position: absolute;
	left: -10000px;
	width: 1px;
	height: 1px;
	opacity: 0;
}

/* Placeholders Simon has to fill in before going live: impossible to overlook. */
.todo {
	background: light-dark(#fff1c2, #4a3f12);
	color: var(--ink);
	padding: 0 0.25em;
	border-radius: 0.25em;
}

/*
 * The suite: Klementine's rows, then the two apps beside it, one row each, hairlines between
 * them (the sidebar's rhythm in the apps), each with its glyph from the apps' own rail (Phosphor regular; Today wears Klementine's line
 * glyph). The names in the wordmark's face, the lines in the second ink. Klemi at rest after them,
 * then the one sentence that is the point, and where to sign in.
 */
.suite {
	margin-top: 0.75rem;
}

.suite-title {
	margin: 0 0 0.75rem;
	font-family: 'Instrument Sans', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1.125rem;
	line-height: 1.35;
	color: var(--ink);
	text-wrap: balance;
}

.apps {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--rule);
}

.app,
.companion {
	display: grid;
	grid-template-columns: 1.5rem 1fr;
	gap: 0.75rem;
	align-items: start;
	margin: 0;
	padding: 0.8rem 0;
	border-bottom: 1px solid var(--rule);
}

.app-icon {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0.2rem auto 0;
	color: var(--ink-2);
}

.app-text {
	margin: 0;
	line-height: 1.5;
}

.app-name {
	font-family: 'Instrument Sans', system-ui, sans-serif;
	font-weight: 600;
	color: var(--ink);
}

.app-line {
	color: var(--ink-2);
}

/* The rest of the app in one line under its rows, and the two places beside it with their own
   heading: quieter than the section's title, the same family. */
.also {
	margin: 0.75rem 0 0;
	color: var(--ink-2);
	line-height: 1.5;
	text-wrap: pretty;
}

.beside-title {
	margin: 1.75rem 0 0.75rem;
	font-family: 'Instrument Sans', system-ui, sans-serif;
	font-weight: 600;
	font-size: 1rem;
	line-height: 1.35;
	color: var(--ink);
	text-wrap: balance;
}

/* Klemi, still, at the size of a glyph with a little room: the row's column holds her. */
.klemi {
	width: 1.75rem;
	height: auto;
	margin: 0.05rem 0 0 -0.125rem;
}

.principle {
	margin: 1.25rem 0 0;
	color: var(--ink-2);
	line-height: 1.5;
	text-wrap: pretty;
}

.principle strong {
	font-weight: 600;
	color: var(--ink);
}

.status {
	margin: 0.75rem 0 0;
	font-size: 0.9375rem;
	color: var(--ink-2);
}

/* The languages in the footer (Languages.svelte), each in itself; the one in use in ink. */

.languages a[aria-current='true'] {
	color: var(--ink);
	font-weight: 600;
}

/* The footer's two columns at the right: the legal pages, then the languages, each stacked. */
.footer-column,
footer .languages {
	display: flex;
	flex-direction: column;
	gap: 0.625rem;
}

/* On a phone the footer is one column: the legal pages, then the languages. */
@media (max-width: 40rem) {
	footer {
		flex-direction: column;
	}

	footer .spacer {
		display: none;
	}
}
