/* Reset, typography and base elements. */

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

/* Components set display:flex/grid; make the hidden attribute always win. */
[hidden] {
	display: none !important;
}

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

body {
	margin: 0;
	background: var(--mi-bg-page);
	color: var(--mi-text-primary);
	font-family: var(--mi-font-ar);
	font-size: var(--mi-fs-body);
	font-weight: 400;
	line-height: var(--mi-lh-body);
	direction: rtl;
	text-align: right;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

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

a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s var(--mi-ease), opacity 0.2s var(--mi-ease);
}

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

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	color: var(--mi-text-primary);
	font-family: var(--mi-font-ar);
	text-wrap: balance;
}

h1 { font-size: var(--mi-fs-h1); font-weight: 600; line-height: var(--mi-lh-heading); }
h2 { font-size: var(--mi-fs-h2); font-weight: 600; line-height: var(--mi-lh-heading); }
h3 { font-size: var(--mi-fs-h3); font-weight: 600; line-height: var(--mi-lh-h3); }
h4, h5, h6 { font-size: var(--mi-fs-h4); font-weight: 600; line-height: var(--mi-lh-h4); }

p {
	margin: 0;
	text-wrap: pretty;
}

ul,
ol {
	margin: 0;
	padding: 0;
}

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

::selection {
	background: var(--mi-blue-500);
	color: var(--mi-white);
}

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

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.skip-link:focus {
	position: fixed;
	top: 12px;
	inset-inline-start: 12px;
	z-index: 1000;
	width: auto;
	height: auto;
	clip: auto;
	padding: 12px 20px;
	background: var(--mi-bg-surface);
	color: var(--mi-text-brand);
}

/* Type utilities (match Figma text styles) */
.mi-display { font-size: var(--mi-fs-display); font-weight: 600; line-height: var(--mi-lh-display); }
.mi-h1 { font-size: var(--mi-fs-h1); font-weight: 600; line-height: var(--mi-lh-heading); }
.mi-h2 { font-size: var(--mi-fs-h2); font-weight: 600; line-height: var(--mi-lh-heading); }
.mi-h3 { font-size: var(--mi-fs-h3); font-weight: 600; line-height: var(--mi-lh-h3); }
.mi-h4 { font-size: var(--mi-fs-h4); font-weight: 600; line-height: var(--mi-lh-h4); }
.mi-body-lg { font-size: var(--mi-fs-body-lg); line-height: var(--mi-lh-body); }
.mi-small { font-size: var(--mi-fs-small); font-weight: 400; line-height: 1.7; }
.mi-muted { color: var(--mi-text-secondary); }
.mi-script { font-family: var(--mi-font-latin); font-size: var(--mi-fs-h3); font-weight: 400; line-height: 1.5; direction: ltr; color: var(--mi-text-brand); }
.mi-latin-caps { font-family: var(--mi-font-latin); font-size: 0.875rem; font-weight: 500; letter-spacing: 0.3em; direction: ltr; display: inline-block; color: var(--mi-text-brand); }

.mi-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--mi-text-brand);
	font-size: var(--mi-fs-label);
	font-weight: 600;
	line-height: 1.7;
}

.mi-eyebrow::after {
	content: "";
	width: 36px;
	height: 2px;
	background: currentColor;
}

/* Latin eyebrow (only the tagline BUILDING FOR EXCELLENCE). */
.mi-eyebrow--latin {
	font-family: var(--mi-font-latin);
	font-size: var(--mi-fs-eyebrow-latin);
	letter-spacing: var(--mi-tracking-latin);
	text-transform: uppercase;
	line-height: 1.4;
}

/* Prose (blog posts, default pages) */
.mi-prose {
	font-size: var(--mi-fs-body-lg);
	line-height: var(--mi-lh-body);
}

.mi-prose > * + * {
	margin-top: 1.5em;
}

.mi-prose h2,
.mi-prose h3 {
	margin-top: 2em;
	font-size: var(--mi-fs-h3);
	font-weight: 500;
}

.mi-prose h4 {
	margin-top: 1.6em;
}

.mi-prose p,
.mi-prose li {
	color: var(--mi-text-primary);
}

.mi-prose a {
	color: var(--mi-text-brand);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.mi-prose ul,
.mi-prose ol {
	padding-inline-start: 1.4em;
}

.mi-prose ul li::marker {
	color: var(--mi-text-brand);
}

.mi-prose li + li {
	margin-top: 0.5em;
}

.mi-prose blockquote {
	margin-inline: 0;
	padding: 4px 28px 4px 0;
	border-inline-start: 3px solid var(--mi-border-strong);
	color: var(--mi-text-brand);
	font-size: var(--mi-fs-h4);
	font-weight: 500;
	line-height: var(--mi-lh-h4);
}

.mi-prose img,
.mi-prose figure {
	margin-inline: 0;
	width: 100%;
}

.mi-prose figcaption {
	margin-top: 8px;
	color: var(--mi-text-secondary);
	font-size: var(--mi-fs-small);
}

.mi-prose table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--mi-fs-body);
}

.mi-prose th,
.mi-prose td {
	padding: 12px;
	border-bottom: 1px solid var(--mi-border-default);
	text-align: right;
}
