/* =====================================================================
   ILAHIA TRUST — DESIGN SYSTEM  ·  base.css
   Reset · typography · layout primitives · a11y utilities
   ===================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;         /* offset sticky header on anchor jumps */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;                 /* contain the off-canvas drawer; keeps sticky working */
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-body);
  background: var(--color-bg);
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  overflow-x: hidden;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
/* Icons keep their own fill="none"/"currentColor"; never force-fill closed line shapes. */
/* Any inline icon with no width attribute + no sizing rule defaults to a sane icon
   size (zero-specificity :where, so component rules and full-bleed svgs win). */
:where(svg:not([width])) { width: 1.25em; height: 1.25em; }

input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

a { color: var(--color-link); text-decoration: none; transition: color var(--dur-fast) var(--ease-out); }
a:hover { color: var(--color-primary-active); }

:target { scroll-margin-top: 6rem; }

/* ---- Headings ----------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-heading);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: var(--weight-bold);
  text-wrap: balance;
}
h1 { font-size: var(--text-5xl); font-weight: var(--weight-extra); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); letter-spacing: var(--tracking-snug); }
h4 { font-size: var(--text-xl); letter-spacing: var(--tracking-snug); }
p  { text-wrap: pretty; }

strong, b { font-weight: var(--weight-semibold); color: var(--ink-800); }

/* =====================================================================
   Layout primitives
   ===================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-wide   { max-width: var(--container-wide); }
.container-narrow { max-width: var(--container-narrow); }

.section { padding-block: var(--section-y); }
.section-sm { padding-block: clamp(2.5rem, 2rem + 3vw, 4rem); }
.section--tint    { background: var(--bg-tint); }
.section--surface { background: var(--surface); }
.section--ink {
  background: var(--ink-900);
  color: rgba(255,255,255,0.82);
}
.section--ink h1, .section--ink h2, .section--ink h3,
.section--ink h4 { color: #fff; }

.stack > * + * { margin-top: var(--flow, 1.5rem); }

.grid { display: grid; gap: var(--grid-gap, var(--space-6)); }
/* Let tracks shrink: stops aspect-ratio/replaced children from inflating 1fr
   columns past the container (their intrinsic min-content is otherwise a floor). */
.grid > *, .bento > *, .stats > *, .news-layout > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.cluster { display: flex; flex-wrap: wrap; gap: var(--cluster-gap, var(--space-3)); align-items: center; }
.center { text-align: center; }
.mx-auto { margin-inline: auto; }

/* =====================================================================
   Section header (eyebrow + title + lede)
   ===================================================================== */
.section-head { max-width: 46rem; margin-bottom: clamp(1.6rem, 1.2rem + 1.4vw, 2.6rem); }
.section-head.center { margin-inline: auto; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--brand-accent);
  margin-bottom: var(--space-4);
}
.eyebrow::before {
  content: ""; width: 1.75rem; height: 2px; border-radius: 2px;
  background: currentColor; opacity: 0.85;
}
.eyebrow.center::before { display: none; }
.section-head .lede {
  margin-top: var(--space-4);
  font-size: var(--text-lg);
  color: var(--slate-500);
  line-height: var(--leading-relaxed);
}

/* =====================================================================
   Accessibility utilities
   ===================================================================== */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: var(--z-toast);
  background: var(--color-primary); color: #fff;
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  font-weight: var(--weight-semibold); box-shadow: var(--shadow-lg);
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 1rem; color: #fff; }

:focus-visible {
  outline: 3px solid var(--brand-accent);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Only show the ring for keyboard users, never suppress it entirely. */

/* =====================================================================
   Reveal-on-scroll (progressive enhancement — JS adds .in-view)
   ===================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal].in-view { opacity: 1; transform: none; }

/* If JS is disabled, never hide content. */
.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
}

/* Print — clean, ink-on-paper */
@media print {
  .site-header, .site-footer, .to-top, .hero-decor { display: none !important; }
  body { background: #fff; color: #000; }
  .section { padding-block: 1.5rem; }
}
