/*
 * Base element styles — CALEN Official theme.
 * Reset-lite + typography roles + accessibility fundamentals.
 * Depends on tokens.css custom properties.
 */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background-color: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-family-sans);
	font-size: var(--font-size-body);
	line-height: var(--line-height-body);
	letter-spacing: var(--letter-spacing-normal);
	word-break: normal;
	overflow-wrap: break-word;
}

img,
svg,
video,
picture {
	display: block;
	max-width: 100%;
	height: auto;
}

/* ==========================================================
   Typography roles
   Use on any element (heading tags or otherwise) to select a
   role independent of document structure.
   ========================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0;
	font-family: var(--font-family-display);
	font-weight: 600;
	line-height: var(--line-height-heading);
	letter-spacing: var(--letter-spacing-tight);
	color: var(--color-text);
}

h1,
.text-h1 {
	font-size: var(--font-size-h1);
}

h2,
.text-h2 {
	font-size: var(--font-size-h2);
}

h3,
h4,
h5,
h6,
.text-h3 {
	font-size: var(--font-size-h3);
}

.text-display {
	font-family: var(--font-family-display);
	font-size: var(--font-size-display);
	font-weight: 600;
	line-height: var(--line-height-tight);
	letter-spacing: var(--letter-spacing-tight);
}

p {
	margin: 0;
}

.text-body-lg {
	font-size: var(--font-size-body-lg);
}

.text-body {
	font-size: var(--font-size-body);
}

.text-body-sm {
	font-size: var(--font-size-body-sm);
}

.text-label {
	font-family: var(--font-family-mono);
	font-size: var(--font-size-label);
	font-weight: 500;
	letter-spacing: var(--letter-spacing-wide);
}

.text-secondary {
	color: var(--color-text-secondary);
}

.text-caption,
caption,
figcaption {
	font-size: var(--font-size-caption);
	color: var(--color-text-muted);
	line-height: var(--line-height-heading);
}

/* ==========================================================
   Accessibility fundamentals
   ========================================================== */

*:focus-visible {
	outline: 2px solid var(--color-focus);
	outline-offset: 2px;
}

button,
input,
select,
textarea {
	font-family: inherit;
	font-size: 100%;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
