/* ==========================================================================
   Base: reset, typography, layout primitives, utilities, motion safety
   ========================================================================== */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
	margin: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: var(--font-sans);
	font-size: var(--fs-base);
	line-height: var(--lh-body);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: hidden; /* Fallback for old browsers. */
	overflow-x: clip;   /* No sideways scroll from the tilted strip / orbs, sticky still works. */
}

html {
	overflow-x: clip;
}

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

img {
	height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin: 0 0 var(--s-4);
	color: var(--color-heading);
	font-weight: 800;
	line-height: var(--lh-tight);
	letter-spacing: -0.02em;
	text-wrap: balance;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-lg); }

p {
	margin: 0 0 var(--s-4);
	text-wrap: pretty;
}

a {
	color: var(--color-primary);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

a:hover {
	color: var(--color-primary-hover);
}

:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
	border-radius: 6px;
}

::selection {
	background: var(--dli-green-100);
	color: var(--dli-ink-900);
}

/* Bangla text renders a little larger and looser. */
:lang(bn),
.bn {
	font-family: var(--font-bn);
	line-height: 1.75;
}

/* ---- Layout primitives ---- */
.container {
	width: 100%;
	max-width: calc(var(--container) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container--narrow {
	max-width: calc(820px + var(--gutter) * 2);
}

.section {
	padding-block: var(--section-y);
	position: relative;
}

.section--alt {
	background: var(--color-bg-alt);
}

.section--dark {
	background: var(--color-dark);
	color: var(--color-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3 {
	color: #fff;
}

.grid {
	display: grid;
	gap: var(--s-5);
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); }

/* ---- Utilities ---- */
[hidden] {
	display: none !important;
}

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

.skip-link {
	position: absolute;
	left: 16px;
	top: -60px;
	z-index: 1000;
	padding: 12px 18px;
	border-radius: var(--r-md);
	background: var(--dli-night-900);
	color: #fff;
	font-weight: 700;
	transition: top var(--dur) var(--ease-out);
}

.skip-link:focus {
	top: 12px;
	color: #fff;
}

.text-center { text-align: center; }
.muted { color: var(--color-text-muted); }
.nowrap { white-space: nowrap; }

/* ---- Motion: elements start hidden only when JS + motion are available ---- */
.js-motion [data-reveal],
.js-motion [data-stagger] > * {
	opacity: 0;
}

@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;
	}
	.js-motion [data-reveal],
	.js-motion [data-stagger] > * {
		opacity: 1 !important;
		transform: none !important;
	}
}
