/* ============================================================================
   base.css — reset, base elements, RTL defaults, Arabic typography.
   v2 "MERIDIAN" — precision instrument: hairlines, coordinate grid, mono ticks.
   Consumes ONLY tokens from tokens.css. No invented colors/type/motion.
   ============================================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: 84px; /* clear the sticky header on anchor jumps */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100vh;
  background-color: var(--color-canvas);
  color: var(--text-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ---------- Headings (SOLID by default — gradient is scarce) ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-heading);
  line-height: var(--lh-heading);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-tight); font-weight: var(--fw-semibold); }

p { text-wrap: pretty; }

/* ---------- Links ---------- */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out-quart);
}
a:hover { color: var(--coral-300); }

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

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

/* ---------- Lists ---------- */
ul, ol { list-style: none; }

/* ---------- Selection ---------- */
::selection {
  background: var(--coral-400);
  color: var(--text-on-accent);
}

/* ---------- Focus ring (visible only for keyboard) ---------- */
:focus-visible {
  outline: none;
  box-shadow: var(--glow-focus);
  border-radius: var(--radius-xs);
}

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  inset-block-start: var(--space-xs);
  inset-inline-start: var(--space-xs);
  z-index: var(--z-lightbox);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-elevated);
  color: var(--text-heading);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: var(--fw-semibold);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out-quart);
}
.skip-link:focus {
  transform: translateY(0);
  box-shadow: var(--glow-focus);
}

/* ---------- Screen-reader only ---------- */
.sr-only {
  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;
}

/* ---------- Containers ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--narrow { max-width: var(--container-narrow); }
.container--wide   { max-width: var(--container-wide); }

/* ---------- Section rhythm ---------- */
.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--space-2xl); }
.section__head {
  margin-block-end: var(--space-xl);
  max-width: var(--measure);
}

/* ============================================================
   SIGNATURE HEAD TREATMENT — eyebrow + rule-kick + solid title
   ============================================================ */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);      /* Arabic-safe; mono has no Arabic glyphs */
  font-weight: var(--fw-semibold);
  font-size: var(--fs-eyebrow);
  line-height: var(--lh-tight);
  color: var(--coral-400);            /* cyan signal */
  margin-block-end: var(--space-xs);
}
/* mono variant for Latin micro-labels / numerals */
.eyebrow--mono {
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* 2px gradient kicker rule under the eyebrow */
.rule-kick {
  display: block;
  height: 2px;
  width: 48px;
  margin-block: var(--space-sm) var(--space-md);
  background: var(--gradient-rule);
  border-radius: 2px;
}
/* RTL: gradient should fade toward the trailing (leading-edge-anchored) side */
[dir="rtl"] .rule-kick {
  background: linear-gradient(270deg, var(--coral-400) 0%, rgba(34, 211, 238, 0) 100%);
}

.title-display {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h2);
  line-height: var(--lh-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--text-heading);         /* SOLID by default */
  text-wrap: balance;
}
.title-display--hero {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
}

/* ⭐ Gradient-clip — used ONCE per page, on the single focal headline. */
.title-display--gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.lede {
  max-width: var(--measure-narrow);
  font-size: var(--fs-body-lg);
  line-height: var(--lh-body);
  color: var(--text-body);
  margin-block-start: var(--space-md);
}

.measure { max-width: var(--measure); }

/* ============================================================
   COORDINATE GRID — signature decorative layer
   aria-hidden, pointer-events:none, never directly behind body text.
   Faded out with a radial/linear mask so it dissolves before reaching prose.
   ============================================================ */
.coord-grid {
  position: absolute;
  inset: 0;
  z-index: var(--z-base);
  pointer-events: none;
  background-image:
    repeating-linear-gradient(to left,  var(--grid-line)   0, var(--grid-line)   1px, transparent 1px, transparent var(--grid-size)),
    repeating-linear-gradient(to bottom, var(--grid-line-2) 0, var(--grid-line-2) 1px, transparent 1px, transparent var(--grid-size));
  -webkit-mask-image: radial-gradient(120% 100% at 100% 0%, #000 0%, #000 45%, transparent 78%);
  mask-image: radial-gradient(120% 100% at 100% 0%, #000 0%, #000 45%, transparent 78%);
}

/* ---------- Mono numeral utility ---------- */
.mono-num {
  font-family: var(--font-mono);
  font-weight: var(--fw-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-normal);
}

/* ---------- forced-colors: drop gradient clip, keep solid heading ---------- */
@media (forced-colors: active) {
  .title-display--gradient,
  .profile__name,
  .stat__num,
  .notfound__code {
    background: none !important;
    -webkit-text-fill-color: CanvasText !important;
    color: CanvasText !important;
  }
}
