/* =========================================================
   MGEid — Shared design system
   Global foundations, white site header/footer, page utilities
   ========================================================= */

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/cairo-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/cairo-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011,
    U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

:root {
  color-scheme: light;

  /* Brand palette */
  --color-ink: #172437;
  --color-muted: #526276;
  --color-muted-on-dark: #b7c5d7;
  --color-paper: #ffffff;
  --color-canvas: #f4f7fb;
  --color-border: #dde5ef;
  --color-navy-950: #0a0f1e;
  --color-navy-900: #0d1b2e;
  --color-navy-800: #10233a;
  --color-action: #1565c0;
  --color-action-hover: #0d4f9a;
  --color-accent: #42a5f5;
  --color-focus: #ffbf47;

  /* Typography and layout */
  --font-sans: "Cairo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 3px 12px rgba(15, 35, 60, 0.06);
  --shadow-md: 0 12px 34px rgba(15, 35, 60, 0.1);
  --container-width: 1200px;
  --page-gutter: clamp(18px, 4vw, 40px);
}

/* Reset and document defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--color-ink);
  background: var(--color-canvas);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}

body,
button,
input,
textarea,
select {
  font-family: var(--font-sans);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: var(--color-action);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

:target {
  scroll-margin-top: 96px;
}

::selection {
  color: #ffffff;
  background: var(--color-action);
}

.site-container {
  width: min(calc(100% - var(--page-gutter) * 2), var(--container-width));
  margin-inline: auto;
}

/* =========================================================
   Header — white surface, centered navigation
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  color: var(--color-ink);
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(15, 35, 60, 0.035);
}

.site-header__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  min-height: 78px;
  padding-block: 10px;
}

.site-brand {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 11px;
  min-width: 0;
  color: var(--color-ink);
  text-decoration: none;
}

.site-brand__mark {
  display: block;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
}

.site-brand__name {
  color: var(--color-ink);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.site-nav {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vw, 12px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 10px;
  color: #334155;
  font-size: 0.96rem;
  font-weight: 650;
  text-decoration: none;
  text-underline-offset: 5px;
  transition: color 0.18s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--color-action);
}

.site-nav a[aria-current="page"] {
  color: var(--color-action);
  box-shadow: inset 0 -2px 0 var(--color-action);
}

.site-menu-toggle {
  grid-column: 3;
  justify-self: end;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid #c8d4e2;
  border-radius: var(--radius-sm);
  color: var(--color-ink);
  background: #ffffff;
  cursor: pointer;
}

.site-menu-toggle:hover {
  border-color: var(--color-action);
  color: var(--color-action);
}

.site-menu-toggle svg {
  flex: 0 0 auto;
}

/* =========================================================
   Footer — white surface directly follows the last section
   ========================================================= */
.site-footer {
  margin: 0;
  color: var(--color-ink);
  background: var(--color-paper);
  border-top: 1px solid var(--color-border);
}

.site-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-block: 22px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  color: #334155;
  font-size: 0.9rem;
  text-decoration: none;
}

.site-footer__nav a:hover,
.site-footer__nav a:focus-visible {
  color: var(--color-action);
}

/* Accessibility helpers */
.skip-link {
  position: absolute !important;
  z-index: 1000;
  top: 12px;
  inset-inline-start: 12px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.skip-link:focus {
  width: auto;
  height: auto;
  padding: 11px 16px;
  clip: auto;
  border-radius: 8px;
  color: #111111;
  background: #ffffff;
  box-shadow: var(--shadow-md);
}

.clipboard-helper {
  position: fixed !important;
  top: 0 !important;
  inset-inline-start: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-main {
  min-height: 48vh;
}

/* Privacy policy and other reading pages */
.policy-page {
  background: var(--color-canvas);
}

.policy-document {
  width: min(calc(100% - 32px), 920px);
  margin: clamp(28px, 5vw, 64px) auto;
  padding: clamp(24px, 5vw, 58px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-paper);
  box-shadow: var(--shadow-sm);
}

.policy-document > h1 {
  margin: 0 0 18px;
  color: var(--color-navy-950);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.policy-document h2 {
  margin: 34px 0 12px;
  color: var(--color-navy-900);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.3;
}

.policy-document h3 {
  margin: 24px 0 8px;
  color: var(--color-ink);
  font-size: 1.05rem;
}

.policy-document p,
.policy-document li {
  color: #3d4d61;
  line-height: 1.8;
}

.policy-document p {
  margin: 12px 0;
}

.policy-document ul,
.policy-document ol {
  padding-inline-start: 1.4rem;
}

.policy-document li + li {
  margin-top: 6px;
}

.policy-document .content-divider {
  height: 1px;
  margin: 26px 0;
  border: 0;
  background: var(--color-border);
}

.table-wrap {
  max-width: 100%;
  margin-block: 18px;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.legal-table th,
.legal-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: start;
  vertical-align: top;
}

.legal-table th {
  color: #ffffff;
  background: var(--color-navy-900);
  font-weight: 700;
}

.legal-table tr:last-child td {
  border-bottom: 0;
}

.legal-table td a {
  overflow-wrap: anywhere;
}

/* 404 page */
.not-found-wrap {
  display: flex;
  min-height: 58vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(48px, 8vw, 100px) 20px;
  text-align: center;
}

.not-found-wrap > p:first-child {
  margin: 0;
  color: var(--color-action);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.not-found-wrap h1 {
  margin: 8px 0;
  color: var(--color-navy-950);
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 1.1;
}

.not-found-wrap p {
  max-width: 560px;
  color: var(--color-muted);
}

.not-found-wrap .links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}

.not-found-wrap .links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  color: var(--color-action);
  background: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.not-found-wrap .links a:hover {
  border-color: var(--color-action);
  background: #f4f8fd;
}

.not-found-wrap .links .home {
  border-color: var(--color-action);
  color: #ffffff;
  background: var(--color-action);
}

.not-found-wrap .links .home:hover {
  background: var(--color-action-hover);
}

/* Responsive navigation and footer */
@media (max-width: 900px) {
  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    min-height: 70px;
  }

  .site-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .site-menu-toggle {
    grid-column: 2;
    grid-row: 1;
    display: inline-flex;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: none;
    width: 100%;
    margin: 0;
    padding: 8px 0 2px;
    border-top: 1px solid var(--color-border);
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav ul {
    align-items: stretch;
    flex-direction: column;
    gap: 0;
  }

  .site-nav a {
    display: flex;
    min-height: 44px;
    padding: 8px 4px;
  }

  .site-nav a[aria-current="page"] {
    box-shadow: none;
    color: var(--color-action);
  }
}

@media (max-width: 600px) {
  .site-container {
    width: calc(100% - 28px);
  }

  .site-brand__name {
    font-size: 1.2rem;
  }

  .site-footer__inner {
    padding-block: 18px;
  }

  .policy-document {
    width: calc(100% - 24px);
    margin-block: 16px;
    padding: 22px 18px;
    border-radius: 16px;
  }

  .legal-table {
    min-width: 580px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Language switch */
.site-nav .lang-switch {
  margin-inline-start: 30px;
  padding-inline: 15px;
  border-radius: 999px;
  color: var(--color-action);
  box-shadow: inset 0 0 0 1.5px var(--color-action);
}
.site-nav .lang-switch:hover {
  background: #eff6ff;
}
@media (max-width: 900px) {
  .site-nav .lang-switch {
    margin: 0;
    padding: 8px 4px;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Arabic typography: no letter-spacing/uppercase (breaks cursive joining) */
html[lang="ar"] body {
  line-height: 1.75;
}
html[lang="ar"] :is([class], h1, h2, h3, p, span, a) {
  letter-spacing: 0;
  text-transform: none;
}

@media (min-width: 901px) {
  .site-header__inner {
    position: relative;
  }
  .site-nav li:last-child {
    position: absolute;
    inset-inline-end: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  .site-nav .lang-switch {
    margin-inline-start: 0;
  }
}

img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
