/* The hub: a header bar, one "Apps" grid, a footer bar. Light and dark themes.
   The theme follows the system; the header button sets data-theme on <html> to override it. */
:root {
	--bg: #f5f6f8;
	--surface: #ffffff;
	--ink: #161a1f;
	--muted: #5d6570;
	--line: #e2e5ea;
	--hover: #eceef2;
	--focus: #2f6f8f;
	--icon-shadow: 0 1px 2px rgb(16 24 32 / 0.12), 0 6px 16px -6px rgb(16 24 32 / 0.25);

	--font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--content: 1120px;
	--gutter: clamp(16px, 4vw, 32px);
	--radius: 16px;
	--ease: cubic-bezier(0.2, 0.8, 0.2, 1);
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--bg: #0f1215;
		--surface: #161a1f;
		--ink: #e4e7eb;
		--muted: #949ba5;
		--line: #252b32;
		--hover: #1c2127;
		--focus: #8fc1d6;
		--icon-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 8px 20px -8px rgb(0 0 0 / 0.6);
		color-scheme: dark;
	}
}

:root[data-theme='dark'] {
	--bg: #0f1215;
	--surface: #161a1f;
	--ink: #e4e7eb;
	--muted: #949ba5;
	--line: #252b32;
	--hover: #1c2127;
	--focus: #8fc1d6;
	--icon-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 8px 20px -8px rgb(0 0 0 / 0.6);
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: grid;
	grid-template-rows: auto 1fr auto;
	background: var(--bg);
	color: var(--ink);
	font: 15px/1.5 var(--font);
	-webkit-font-smoothing: antialiased;
}

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

/* Header and footer share one inner bar, as wide as the content. */
.bar {
	max-width: var(--content);
	margin: 0 auto;
	padding: 0 var(--gutter);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.site-header {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

.site-header .bar {
	height: 64px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--ink);
	text-decoration: none;
	border-radius: 8px;
}

.brand-mark {
	display: block;
	border-radius: 7px;
}

.brand-name {
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.005em;
}

.theme-toggle {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
}

.theme-toggle[hidden] {
	display: none;
}

.theme-toggle:hover {
	background: var(--hover);
	color: var(--ink);
}

/* Show the icon of the theme a click switches to. */
.theme-toggle .icon-sun,
.theme-toggle[aria-pressed='true'] .icon-moon {
	display: none;
}

.theme-toggle[aria-pressed='true'] .icon-sun {
	display: block;
}

/* Body: one heading and the grid of app tiles. */
.page {
	width: 100%;
	max-width: var(--content);
	margin: 0 auto;
	padding: clamp(32px, 7vh, 64px) var(--gutter) 64px;
}

h1 {
	margin: 0 0 24px;
	font-size: 24px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.apps {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
	gap: 8px;
}

.tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	height: 100%;
	padding: 20px 12px 18px;
	border-radius: var(--radius);
	color: inherit;
	text-align: center;
	text-decoration: none;
	transition: background-color 150ms var(--ease);
}

.tile:hover {
	background: var(--hover);
}

.tile-icon {
	display: block;
	width: 96px;
	height: 96px;
	margin-bottom: 10px;
	border-radius: 22px;
	box-shadow: var(--icon-shadow);
	transition: transform 150ms var(--ease);
}

.tile:hover .tile-icon {
	transform: translateY(-2px);
}

.tile:active .tile-icon {
	transform: scale(0.97);
}

.tile-name {
	font-size: 15px;
	font-weight: 600;
}

.tile-summary {
	max-width: 22ch;
	font-size: 13px;
	line-height: 1.4;
	color: var(--muted);
}

.note {
	grid-column: 1 / -1;
	margin: 0;
	color: var(--muted);
}

.site-footer {
	border-top: 1px solid var(--line);
}

.site-footer .bar {
	min-height: 56px;
	padding-block: 12px;
	flex-wrap: wrap;
	row-gap: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
	.tile,
	.tile-icon {
		transition: none;
	}

	.tile:hover .tile-icon,
	.tile:active .tile-icon {
		transform: none;
	}
}
