/*
 * Design tokens and base elements. Colors are variables only; dark mode
 * follows the system unless the user picked a theme (html[data-theme]).
 */
:root {
	--bg: #f9fafb;
	--surface: #ffffff;
	--surface-2: #f3f4f6;
	--border: #e5e7eb;
	--border-strong: #d1d5db;
	--text: #1f2937;
	--text-strong: #111827;
	--muted: #6b7280;
	--faint: #9ca3af;
	--accent: #111827;
	--accent-text: #ffffff;
	--accent-hover: #374151;
	--danger: #dc2626;
	--danger-bg: #fef2f2;
	--ok: #15803d;
	--ok-bg: #dcfce7;
	--focus-ring: #e5e7eb;
	--shadow: 0 1px 2px rgb(0 0 0 / 0.05);

	--radius: 8px;
	--radius-lg: 16px;
	--font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC",
		"Microsoft YaHei", sans-serif;
	--mono: ui-monospace, "SF Mono", "Cascadia Mono", "Noto Sans Mono", monospace;
	--ease: cubic-bezier(0.65, 0, 0.35, 1);
	--ui-scale: 1; /* the text size setting (html[data-font-size]); every font-size is multiplied by it */
	color-scheme: light;
}

:root[data-font-size="medium"] {
	--ui-scale: 1.125;
}
:root[data-font-size="large"] {
	--ui-scale: 1.25;
}
/* phones: each step one size smaller */
@media (max-width: 767px) {
	:root[data-font-size="small"] {
		--ui-scale: 0.9;
	}
	:root[data-font-size="medium"] {
		--ui-scale: 1;
	}
	:root[data-font-size="large"] {
		--ui-scale: 1.125;
	}
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #111827;
		--surface: #1f2937;
		--surface-2: #374151;
		--border: #374151;
		--border-strong: #4b5563;
		--text: #e5e7eb;
		--text-strong: #f9fafb;
		--muted: #9ca3af;
		--faint: #6b7280;
		--accent: #f9fafb;
		--accent-text: #111827;
		--accent-hover: #e5e7eb;
		--danger: #f87171;
		--danger-bg: #450a0a;
		--ok: #4ade80;
		--ok-bg: #14532d;
		--focus-ring: #374151;
		--shadow: none;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #111827;
	--surface: #1f2937;
	--surface-2: #374151;
	--border: #374151;
	--border-strong: #4b5563;
	--text: #e5e7eb;
	--text-strong: #f9fafb;
	--muted: #9ca3af;
	--faint: #6b7280;
	--accent: #f9fafb;
	--accent-text: #111827;
	--accent-hover: #e5e7eb;
	--danger: #f87171;
	--danger-bg: #450a0a;
	--ok: #4ade80;
	--ok-bg: #14532d;
	--focus-ring: #374151;
	--shadow: none;
	color-scheme: dark;
}

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: calc(14px * var(--ui-scale));
	line-height: 1.5;
}

a {
	color: var(--text-strong);
	font-weight: 500;
	text-decoration: underline;
	text-underline-offset: 2px;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

[hidden] {
	display: none !important;
}

.boot-error {
	padding: 48px 16px;
	text-align: center;
	color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
