/*
 * Reset, typography and layout primitives.
 *
 * Logical properties (margin-inline, padding-block) are used throughout so the
 * RTL locales planned for a later release need no stylesheet fork.
 */

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

/*
 * The hidden attribute must win.
 *
 * Any component with its own display value (flex, grid) overrides the user
 * agent's [hidden] { display: none } purely on specificity, which silently
 * breaks every element toggled by hidden - empty states, menu panels, tab
 * panels. This one line is the fix.
 */
[hidden] {
	display: none !important;
}

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

body {
	margin: 0;
	background: var(--bg-subtle);
	color: var(--text);
	font-family: var(--ui);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
	margin: 0;
}

h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }

ul, ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

a {
	color: var(--brand);
	text-decoration: none;
}

a:hover {
	color: var(--brand-hover);
	text-decoration: underline;
}

img, svg, video {
	display: block;
	max-width: 100%;
	height: auto;
}

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

table {
	border-collapse: collapse;
	width: 100%;
}

/* One visible focus treatment for the whole product. Removing it is not an
   option: the app must be fully operable without a mouse. */
:focus-visible {
	outline: 2px solid var(--brand);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
	outline: none;
}

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

/* -- Utilities ---------------------------------------------------------- */

/* Every figure that updates in place - response times, uptime percentages,
   countdowns - must not reflow as digits change. */
.um-num {
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}

.um-mono {
	font-family: var(--mono);
	font-variant-numeric: tabular-nums;
}

.um-muted { color: var(--text-muted); }
.um-secondary { color: var(--text-secondary); }

.um-micro {
	font-size: var(--fs-micro);
	line-height: var(--lh-micro);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
}

.um-small {
	font-size: var(--fs-small);
	line-height: var(--lh-small);
}

.um-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Keyboard users get a way past the sidebar on every page. */
.um-skip-link {
	position: absolute;
	inset-inline-start: var(--space-4);
	inset-block-start: -100px;
	z-index: 100;
	padding: var(--space-2) var(--space-4);
	background: var(--brand);
	color: var(--text-inverse);
	border-radius: var(--radius-sm);
	transition: inset-block-start var(--duration-fast) var(--ease);
}

.um-skip-link:focus {
	inset-block-start: var(--space-4);
	color: var(--text-inverse);
	text-decoration: none;
}

.um-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.um-row {
	display: flex;
	align-items: center;
	gap: var(--space-3);
}

.um-row-between {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
}

.um-grid {
	display: grid;
	gap: var(--space-4);
}

/* Wide content - tables, charts, code - scrolls inside its own box. The page
   body itself must never scroll sideways. */
.um-scroll-x {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}
