/* ==========================================================================
   Maktabi — reset, layout primitives, utilities
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body) / var(--lh-body) var(--ff-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
svg { flex: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
p { margin: 0; }
figure, blockquote, fieldset, dl, dd { margin: 0; }
table { border-collapse: collapse; }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--ff-head);
  font-weight: 800;
  letter-spacing: -.02em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--accent-soft); color: var(--accent); }

/* ---------- layout ---------- */

/* Reference content column is 1120px wide with a 40px gutter (mock/card borders
   land on x40 and x1159 in a 1200px shot), so the cap is content + both gutters. */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--pad) * 2);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section { padding-block: var(--sec); position: relative; }
.section--sm { padding-block: var(--sec-sm); }
.section--alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.split  { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
/* Grid items must be allowed to shrink below their min-content, otherwise a
   nowrap row (vault file names, table cells) widens the track past the viewport. */
.grid-2 > *, .grid-3 > *, .split > * { min-width: 0; }

.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.center { text-align: center; margin-inline: auto; }
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

/* ---------- type utilities ---------- */

/* Reference eyebrows are NOT tracked out: per-word ink widths of
   "THE MAKTABI DIFFERENCE" match 11.5px at letter-spacing: normal. */
.eyebrow {
  font: 700 var(--fs-eyebrow) / 1 var(--ff-body);
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow--muted { color: var(--muted); }

.h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
.h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
.h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }
.h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: 700; letter-spacing: -.01em; }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  color: var(--text-2);
}
.sm    { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.xs    { font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; }
.muted { color: var(--muted); }
.t2    { color: var(--text-2); }
.accent{ color: var(--accent); }
.nums  { font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; 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; inset-inline-start: 12px; top: -60px; z-index: 200;
  background: var(--surface-solid); border: 1px solid var(--border-strong);
  border-radius: var(--r-sm); padding: 10px 16px; font: 500 14px var(--ff-body);
  transition: top var(--t);
}
.skip-link:focus { top: 12px; }

/* ---------- responsive ---------- */

@media (max-width: 1023px) {
  :root { --fs-h1: 52px; --fs-h2: 38px; --fs-h3: 30px; --fs-h4: 19px; --fs-stat: 38px; --sec: 96px; --sec-sm: 80px; }
  .grid-2, .grid-3, .split { grid-template-columns: 1fr; }
  .grid-3 { gap: 20px; }
}

@media (max-width: 767px) {
  :root { --fs-h1: 40px; --fs-h2: 33px; --fs-h3: 26px; --fs-h4: 18px; --fs-lead: 17px; --fs-stat: 34px; --pad: 20px; --sec: 72px; --sec-sm: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
