/* ============================================================
   Renee — Base
   Reset, typography, RTL/LTR logical properties.
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-base);
  line-height: 1.6;
  min-height: 100vh;
  font-feature-settings: "ss01", "cv02";
}

/* Language-specific body fonts */
[dir="ltr"] body { font-family: var(--font-en-body); }
[dir="rtl"] body {
  font-family: var(--font-ar-body);
  /* Arabic needs more breathing room between lines */
  line-height: 1.9;
  /* Noto Serif Arabic renders slightly smaller optically — compensate */
  font-size: 1.05rem;
}

/* ── Headings (shared) ─────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.2;
  color: var(--ink);
}

/* English headings */
[dir="ltr"] h1, [dir="ltr"] h2, [dir="ltr"] h3,
[dir="ltr"] h4, [dir="ltr"] h5, [dir="ltr"] h6 {
  font-family: var(--font-en-display);
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Arabic headings — Noto Serif Arabic specific tuning */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3,
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
  font-family: var(--font-ar-display);
  font-weight: 600;
  letter-spacing: 0;
  /* Arabic needs more line-height in headings too */
  line-height: 1.4;
  /* Slightly reduce heading sizes for Arabic — Noto Serif Arabic
     has larger x-height than Cormorant, so the same px reads bigger */
  font-size: calc(var(--heading-size) * 0.88);
}

h1 { --heading-size: var(--fs-4xl); font-size: var(--fs-4xl); }
h2 { --heading-size: var(--fs-3xl); font-size: var(--fs-3xl); }
h3 { --heading-size: var(--fs-2xl); font-size: var(--fs-2xl); }
h4 { --heading-size: var(--fs-xl);  font-size: var(--fs-xl);  }
h5 { --heading-size: var(--fs-lg);  font-size: var(--fs-lg);  }
h6 { --heading-size: var(--fs-md);  font-size: var(--fs-md);  }

/* Arabic heading size reduction applied via the variable */
[dir="rtl"] h1 { font-size: calc(var(--fs-4xl) * 0.88); }
[dir="rtl"] h2 { font-size: calc(var(--fs-3xl) * 0.88); }
[dir="rtl"] h3 { font-size: calc(var(--fs-2xl) * 0.88); }
[dir="rtl"] h4 { font-size: calc(var(--fs-xl)  * 0.92); }
[dir="rtl"] h5 { font-size: calc(var(--fs-lg)  * 0.92); }
[dir="rtl"] h6 { font-size: var(--fs-md); }

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--accent); }

/* Form elements */
input, button, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

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

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

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: var(--space-6) 0;
}

/* Selection */
::selection {
  background: var(--terracotta);
  color: var(--white);
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--primary-dark);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

/* ── Section spacing ───────────────────────────────────────── */
.section       { padding-block: var(--space-8); }
.section-tight { padding-block: var(--space-6); }

@media (max-width: 768px) {
  .section { padding-block: var(--space-6); }
  h1 { font-size: var(--fs-3xl); }
  h2 { font-size: var(--fs-2xl); }
  h3 { font-size: var(--fs-xl); }
  [dir="rtl"] h1 { font-size: calc(var(--fs-3xl) * 0.88); }
  [dir="rtl"] h2 { font-size: calc(var(--fs-2xl) * 0.88); }
  [dir="rtl"] h3 { font-size: calc(var(--fs-xl)  * 0.92); }
}

/* ── Section header ────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-block-end: var(--space-5);
  padding-block-end: var(--space-3);
  border-block-end: 1px solid var(--line);
}
.section-head h2 {
  font-size: clamp(var(--fs-xl), 2.5vw, var(--fs-2xl));
  margin: 0;
}
[dir="rtl"] .section-head h2 {
  font-size: clamp(var(--fs-lg), 2.2vw, var(--fs-xl));
}
.section-head .section-link {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
[dir="rtl"] .section-head .section-link {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-ar-body);
}
.section-head .section-link:hover { color: var(--accent); }
.section-head .section-link::after {
  content: "→";
  margin-inline-start: var(--space-2);
  transition: transform var(--t-fast) var(--ease);
  display: inline-block;
}
[dir="rtl"] .section-head .section-link::after { content: "←"; }
.section-head .section-link:hover::after { transform: translateX(2px); }
[dir="rtl"] .section-head .section-link:hover::after { transform: translateX(-2px); }

/* ── Eyebrow text ──────────────────────────────────────────── */
.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
[dir="rtl"] .eyebrow {
  letter-spacing: 0.04em;
  text-transform: none;
  font-family: var(--font-ar-body);
  font-size: var(--fs-sm); /* slightly larger — Arabic xs is too small */
  font-weight: 600;
}

/* ── Visually hidden ───────────────────────────────────────── */
.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;
}