/* ==========================================================================
   Base: reset, typography, shared components
   Written with logical properties so RTL mirrors without duplicate rules.
   ========================================================================== */

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

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

body {
	margin: 0;
	background-color: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font-body);
	font-size: var(--fs-body);
	font-weight: 400;
	line-height: var(--lh-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

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

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

button {
	font: inherit;
	color: inherit;
}

h1, h2, h3, h4 {
	margin: 0;
	font-family: var(--font-display);
	font-weight: var(--fw-display);
	line-height: var(--lh-tight);
	text-wrap: balance;
}

/* Arabic is cursive; tracking on headings breaks letter joins. */
html[lang^="ar"] :is(h1, h2, h3, h4) {
	letter-spacing: 0;
}

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

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

/* --- Focus -------------------------------------------------------------- */

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

.tpl-utility :focus-visible,
.tpl-footer :focus-visible {
	outline-color: var(--c-ivory);
}

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

.tpl-container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

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

.tpl-skip-link {
	position: absolute;
	inset-block-start: -100%;
	inset-inline-start: var(--sp-2);
	z-index: 100;
	padding: var(--sp-1) var(--sp-2);
	background: var(--c-forest);
	color: var(--c-ivory);
	border-radius: 0 0 var(--radius-sm) var(--radius-sm);
	text-decoration: none;
}

.tpl-skip-link:focus {
	inset-block-start: 0;
}

.tpl-section {
	padding-block: var(--sp-5);
}

/* --- Type helpers ------------------------------------------------------- */

.tpl-eyebrow {
	margin-block-end: var(--sp-1);
	color: var(--c-muted);
	font-family: var(--font-body);
	font-size: var(--fs-eyebrow);
	font-weight: 500;
	line-height: 1.4;
	letter-spacing: var(--ls-eyebrow);
	text-transform: uppercase;
}

html[lang^="ar"] .tpl-eyebrow {
	text-transform: none;
	font-size: var(--fs-small);
	color: var(--c-sage);
}

.tpl-h2 {
	font-size: var(--fs-h2);
}

/* --- Icons -------------------------------------------------------------- */

.tpl-icon {
	inline-size: 20px;
	block-size: 20px;
	flex: none;
	color: currentColor;
}

.tpl-icon--arrow {
	inline-size: 18px;
	block-size: 18px;
}

/* Directional glyphs flip with the reading direction. */
[dir="rtl"] .tpl-icon--arrow {
	transform: scaleX(-1);
}

/* --- Buttons ------------------------------------------------------------ */

.tpl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-1);
	min-block-size: var(--tap);
	padding: 12px var(--sp-3);
	border: 1px solid transparent;
	border-radius: var(--radius-pill);
	font-family: var(--font-body);
	font-size: var(--fs-small);
	font-weight: 500;
	letter-spacing: var(--ls-label);
	text-decoration: none;
	cursor: pointer;
	transition: background-color var(--speed) var(--ease),
		color var(--speed) var(--ease),
		border-color var(--speed) var(--ease),
		transform var(--speed) var(--ease);
}

.tpl-btn:hover {
	transform: translateY(-1px);
}

.tpl-btn--primary {
	background-color: var(--c-forest);
	border-color: var(--c-forest);
	color: var(--c-ivory);
}

.tpl-btn--primary:hover {
	background-color: var(--c-forest-900);
	border-color: var(--c-forest-900);
}

.tpl-btn--ghost {
	background-color: var(--c-white);
	border-color: var(--c-line);
	color: var(--c-forest);
}

.tpl-btn--ghost:hover {
	border-color: var(--c-forest);
}

.tpl-btn--block {
	inline-size: 100%;
}

/* --- Footer placeholder ------------------------------------------------- */

.tpl-footer {
	margin-block-start: var(--sp-7);
	padding-block: var(--sp-6);
	background-color: var(--c-forest);
	color: var(--c-ivory);
}

.tpl-footer__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--sp-3);
	text-align: center;
}

.tpl-footer__brand {
	display: inline-flex;
}

.tpl-footer__brand .tpl-logo {
	inline-size: clamp(300px, 40vw, 360px);
	block-size: auto;
}

.tpl-footer__meta {
	display: flex;
	flex-direction: column;
	gap: var(--sp-1);
	font-size: var(--fs-small);
	color: var(--c-sage-200);
}

.tpl-footer__copy {
	font-size: var(--fs-small);
	color: var(--c-sage);
}

/* --- Motion ------------------------------------------------------------- */

@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;
	}
}
