/* ─── Theme tokens ─────────────────────────────────────────────── */
:root {
  --primary: #0b3a5c;
  --primary-dark: #061f33;
  --gold: #c2ab75;
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #0e2536;
  --muted: #5b7484;
  --border: #e6dfd2;
  --link: #0b3a5c;
  --link-hover: #1a5b89;
  --shadow: 0 1px 3px rgba(11, 58, 92, 0.06), 0 8px 24px rgba(11, 58, 92, 0.04);
  --radius: 16px;
  --radius-sm: 10px;

  --font-en: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: "Noto Naskh Arabic", "SF Arabic", "Geeza Pro", Arial, sans-serif;

  --content-max: 760px;
}

/* ─── Reset ────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-en);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html[lang="ar"] body {
  font-family: var(--font-ar);
  line-height: 1.85;
}

img {
  max-width: 100%;
  display: block;
}
a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}
a:hover {
  color: var(--link-hover);
  border-bottom-color: currentColor;
}

button {
  font-family: inherit;
  font-size: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

/* ─── Layout ───────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Header ───────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 248, 244, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-bottom: 0;
  color: var(--text);
  font-weight: 600;
}
.brand:hover {
  color: var(--primary);
  border-bottom: 0;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ar);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0;
  user-select: none;
}
.brand-name {
  letter-spacing: 0.4px;
  font-size: 18px;
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.lang-btn {
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.lang-btn:hover {
  color: var(--text);
  background: rgba(11, 58, 92, 0.05);
}
.lang-btn.is-active {
  color: var(--primary);
  background: rgba(11, 58, 92, 0.08);
  font-weight: 600;
}
.lang-sep {
  color: var(--border);
}

/* ─── Document ─────────────────────────────────────────────────── */
.content {
  padding: 48px 20px 80px;
}

.doc-header {
  margin-bottom: 32px;
}
.doc-header h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 12px;
  color: var(--primary);
}
html[lang="ar"] .doc-header h1 {
  letter-spacing: 0;
}
.doc-meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

/* TOC */
.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 48px;
  box-shadow: var(--shadow);
}
.toc-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin: 0 0 12px;
}
html[lang="ar"] .toc-title {
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}
.toc ol {
  margin: 0;
  padding-inline-start: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
}
@media (max-width: 600px) {
  .toc ol {
    grid-template-columns: 1fr;
  }
}
.toc a {
  color: var(--text);
  font-size: 14.5px;
}
.toc a:hover {
  color: var(--primary);
}

/* Sections */
section {
  margin-bottom: 36px;
}
section:last-of-type {
  margin-bottom: 0;
}
section h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin: 32px 0 14px;
  scroll-margin-top: 96px;
  position: relative;
  padding-bottom: 8px;
}
section h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 36px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
}
section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 22px 0 10px;
}

/* Paragraphs and lists */
p {
  margin: 0 0 14px;
  color: var(--text);
}
ul,
ol {
  padding-inline-start: 22px;
  margin: 0 0 16px;
}
li {
  margin-bottom: 6px;
}
li > strong:first-child {
  color: var(--primary);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
thead {
  background: rgba(11, 58, 92, 0.04);
}
th,
td {
  padding: 10px 14px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
tbody tr:last-child td {
  border-bottom: 0;
}
th {
  font-weight: 600;
  color: var(--primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
html[lang="ar"] th {
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
}

/* Contact card */
.contact-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 12px 0 16px;
  font-style: normal;
  line-height: 1.8;
}

/* ─── Footer ───────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-inner p {
  margin: 0;
}

/* ─── RTL fine tuning ─────────────────────────────────────────── */
html[lang="ar"] .doc-header h1,
html[lang="ar"] section h2 {
  letter-spacing: 0;
}
html[lang="ar"] section h2 {
  font-size: 24px;
}
html[lang="ar"] section h3 {
  font-size: 19px;
}
html[lang="ar"] .toc a,
html[lang="ar"] table {
  font-size: 16px;
}

/* ─── Print ────────────────────────────────────────────────────── */
@media print {
  .site-header,
  .site-footer,
  .lang-toggle,
  .toc {
    display: none !important;
  }
  body {
    background: white;
    color: black;
  }
  .content {
    padding: 0;
  }
  section h2 {
    color: black;
  }
  section h2::after {
    display: none;
  }
  a {
    color: black;
    border-bottom: 0;
  }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
}
