/* The site's terminal look, shared by the landing page and the mail app:
   JetBrains Mono, a tab bar on top and a status line below, like tmux and
   lualine, and titled panes like lazygit's. Dark unless the visitor picks
   light. The bundled font has no box-drawing glyphs, so borders are CSS
   borders, not characters. */

@font-face {
	font-family: "JetBrains Mono";
	src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
	font-weight: 100 800;
	font-style: normal;
	font-display: swap;
}

:root {
	color-scheme: dark;
	--background: oklch(0.17 0.015 260);
	--bar: oklch(0.22 0.02 260);
	--foreground: oklch(0.9 0.02 260);
	--muted: oklch(0.72 0.03 260);
	--border: oklch(0.38 0.03 260);
	--selection: oklch(0.29 0.05 150);
	--green: oklch(0.8 0.15 150);
	--cyan: oklch(0.8 0.1 200);
	--blue: oklch(0.74 0.13 255);
	--magenta: oklch(0.74 0.14 320);
	--yellow: oklch(0.85 0.13 85);
	--red: oklch(0.7 0.17 25);
	--accent: var(--green);
	--accent-foreground: var(--background);
	--font-mono: "JetBrains Mono", ui-monospace, monospace;
	--gutter: 1rem;
}

/* Dark unless the visitor picks light with the toggle in the tab bar. */
:root[data-theme="light"] {
	color-scheme: light;
	--background: oklch(0.985 0.004 260);
	--bar: oklch(0.94 0.01 260);
	--foreground: oklch(0.27 0.02 260);
	--muted: oklch(0.46 0.02 260);
	--border: oklch(0.8 0.02 260);
	--selection: oklch(0.93 0.04 150);
	--green: oklch(0.5 0.13 150);
	--cyan: oklch(0.5 0.08 210);
	--blue: oklch(0.5 0.15 260);
	--magenta: oklch(0.5 0.17 320);
	--yellow: oklch(0.55 0.11 75);
	--red: oklch(0.52 0.18 25);
}

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

ul {
	padding: 0;
	list-style: none;
}

body {
	background: var(--background);
	color: var(--foreground);
	font-family: var(--font-mono);
	font-size: 1rem;
	line-height: 1.6;
}

a {
	color: inherit;
	text-underline-offset: 4px;
}

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

pre,
code,
kbd {
	font: inherit;
}

.skip-link {
	position: absolute;
	top: -4rem;
	left: 1rem;
	z-index: 10;
	padding: 0.5rem 1rem;
	background: var(--accent);
	color: var(--accent-foreground);
}

.skip-link:focus {
	top: 1rem;
}

.container {
	max-width: 72rem;
	margin-inline: auto;
	padding-inline: var(--gutter);
}

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

/* Glyphs rain faintly behind the whole page, dimmer still behind the panes. */
.rain {
	position: fixed;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	color: var(--green);
	opacity: 0.22;
	pointer-events: none;
}

.cursor {
	display: inline-block;
	width: 0.6em;
	height: 1.1em;
	vertical-align: -0.2em;
	background: var(--accent);
	animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
	50% {
		opacity: 0;
	}
}

/* The tab bar and the status line, like tmux and lualine. */

.bar {
	background: var(--bar);
	font-size: 0.875rem;
}

.tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 1rem;
}

.tabs a {
	display: inline-block;
	padding-block: 0.625rem;
	text-decoration: none;
}

.tabs a:hover {
	text-decoration: underline;
}

.tabs .session {
	padding-inline: 1ch;
	background: var(--accent);
	color: var(--accent-foreground);
	font-weight: 700;
}

.tabs ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0 1.5ch;
}

.tabs li span {
	color: var(--accent);
}

.theme-toggle {
	margin-left: auto;
	padding-block: 0.625rem;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.theme-toggle::before {
	content: "[ ] " / "";
	color: var(--accent);
	white-space: pre;
}

.theme-toggle[aria-pressed="true"]::before {
	content: "[x] " / "";
}

.theme-toggle:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.theme-toggle:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.tabs .github {
	color: var(--cyan);
}

.theme-toggle[hidden] + .github {
	margin-left: auto;
}

.statusline {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 1rem;
	padding-block: 0.5rem;
	color: var(--muted);
}

.mode {
	padding-inline: 1ch;
	background: var(--accent);
	color: var(--accent-foreground);
	font-weight: 700;
}

.legal {
	margin-left: auto;
}

/* The panes. Each one's title sits on its top border, and the border
   lights up while the pointer or focus is inside, like lazygit's. */

.pane {
	position: relative;
	padding: 1.5rem 1rem 1rem;
	border: 1px solid var(--border);
	border-radius: 0.5rem;
	background: color-mix(in oklab, var(--background) 85%, transparent);
	scroll-margin-top: 1.5rem;
}

.pane:hover,
.pane:focus-within {
	border-color: var(--accent);
}

.pane-title {
	position: absolute;
	top: 0;
	left: 0.75rem;
	translate: 0 -50%;
	padding-inline: 1ch;
	background: var(--background);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
}

.pane:hover .pane-title,
.pane:focus-within .pane-title {
	color: var(--accent);
}

.pane-lead {
	max-width: 70ch;
	color: var(--muted);
}

.button {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding-inline: 1.5ch;
	border: 1px solid var(--border);
	background: transparent;
	color: inherit;
	font: inherit;
	text-decoration: none;
	cursor: pointer;
}

.button:hover {
	border-color: var(--accent);
	background: var(--selection);
}

.button[data-variant="primary"] {
	border-color: var(--accent);
	background: var(--accent);
	color: var(--accent-foreground);
	font-weight: 700;
}

.button[data-variant="primary"]:hover {
	background: color-mix(in oklab, var(--accent) 85%, var(--foreground));
}

.button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.button[data-size="sm"] {
	min-height: 2rem;
	padding-inline: 1ch;
	font-size: 0.875rem;
}

.button[data-variant="ghost"] {
	border-color: transparent;
}

@media (prefers-reduced-motion: reduce) {
	.cursor {
		animation: none;
	}
}
