/* TAMIM for Artificial Intelligence Solutions
   Brand tokens derived from the client logo: navy #0f2a52, royal blue #1a4f9c.
   Layout uses CSS logical properties throughout so the AR (rtl) and EN (ltr)
   directions share one stylesheet with no mirrored overrides. */

:root {
  --navy: #0f2a52;
  --navy-deep: #0a1c37;
  --blue: #1a4f9c;
  --blue-bright: #2f6fd0;
  --blue-wash: #eef3fa;

  --surface: #ffffff;
  --surface-alt: #f6f8fb;
  --text: #16202f;
  --text-muted: #5b6779;
  --line: #e2e8f1;

  --radius: 14px;
  --radius-sm: 10px;

  --shadow: 0 1px 2px rgb(15 42 82 / 0.04), 0 12px 32px -12px rgb(15 42 82 / 0.16);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shell: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --surface: #0d1420;
    --surface-alt: #121b2b;
    --text: #e8edf5;
    --text-muted: #96a3b6;
    --line: #24334a;
    --blue-wash: #16233a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -12px rgb(0 0 0 / 0.6);
  }
}

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

body,
h1, h2, h3, h4, p, figure, ul { margin: 0; }

ul { padding: 0; list-style: none; }

html { scroll-behavior: smooth; }

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

body {
  font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--blue); text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--blue-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 24px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Type scale ---------- */

.display {
  font-size: clamp(2rem, 1.3rem + 3vw, 3.5rem);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.section-title {
  font-size: clamp(1.65rem, 1.2rem + 1.9vw, 2.5rem);
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.lede {
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.19rem);
  color: var(--text-muted);
  max-width: 62ch;
}

.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-block-end: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-inline-end: auto;
}

.brand img { height: 40px; width: auto; }

/* The supplied logo is a dark mark on white, so it needs its own plate
   wherever it sits on a dark surface. The footer is always dark. */
.footer-logo img {
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
}

@media (prefers-color-scheme: dark) {
  .brand img {
    background: #fff;
    border-radius: 6px;
    padding: 4px 6px;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav-links a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.97rem;
  white-space: nowrap;
  transition: color 0.2s var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--text); }

.nav-links a[aria-current="page"] { font-weight: 700; }

/* A link to the counterpart page, not a runtime switch, so both language
   trees are crawlable. Styled as a pill to read as a control. */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  flex: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}

.lang-toggle:hover { border-color: var(--blue); background: var(--blue-wash); }
.lang-toggle:active { transform: scale(0.98); }

.nav-toggle {
  display: none;
  flex: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    inset-block-start: 72px;
    inset-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-block-end: 1px solid var(--line);
    padding: 8px 24px 20px;
  }
  .nav-links[hidden] { display: none; }
  .nav-links a { padding: 12px 0; border-block-end: 1px solid var(--line); }
  .nav-links a:last-child { border-block-end: 0; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover { background: var(--blue-bright); }

/* Ghost button always sits on the dark hero, so it carries its own stroke. */
.btn-ghost {
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  border-color: rgb(255 255 255 / 0.42);
}

.btn-ghost:hover { background: rgb(255 255 255 / 0.14); }

.btn-outline {
  background: transparent;
  color: var(--blue);
  border-color: var(--blue);
}

.btn-outline:hover { background: var(--blue-wash); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  min-height: min(78dvh, 680px);
  display: flex;
  align-items: center;
  padding-block: 88px 80px;
  background: var(--navy-deep);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Scrim keeps the headline at AA contrast over the generated artwork.
   linear-gradient() takes no logical direction keyword, so the opaque end
   is aimed at the text side per writing mode. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to left,
    rgb(10 28 55 / 0.94) 0%,
    rgb(10 28 55 / 0.78) 48%,
    rgb(10 28 55 / 0.62) 100%
  );
}

html[dir="ltr"] .hero::after {
  background: linear-gradient(
    to right,
    rgb(10 28 55 / 0.94) 0%,
    rgb(10 28 55 / 0.78) 48%,
    rgb(10 28 55 / 0.62) 100%
  );
}

/* On narrow screens the copy spans the full width, so the scrim must too. */
@media (max-width: 700px) {
  .hero::after,
  html[dir="ltr"] .hero::after { background: rgb(10 28 55 / 0.86); }
}

.hero-copy { max-width: 40rem; color: #fff; }

.hero-copy .display { color: #fff; }

/* Keeps the accent phrase whole so the headline never breaks mid-thought
   ("put / to work", or a stranded "في"). It wraps to its own line instead. */
.hero-copy .display .accent {
  white-space: nowrap;
  background: linear-gradient(90deg, #6fa8ff, #2f6fd0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 420px) {
  .hero-copy .display .accent { white-space: normal; }
}

.hero-copy p {
  margin-block-start: 20px;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.22rem);
  color: rgb(233 240 250 / 0.82);
  max-width: 46ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-block-start: 34px;
}

/* Two-column hero on wider screens: copy beside a floating illustration. */
.hero .shell {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
}

.hero-art img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -20px rgb(6 16 34 / 0.7);
}

@media (max-width: 860px) {
  .hero .shell { grid-template-columns: 1fr; }
  .hero-art { display: none; }
}

/* ---------- Section frame ---------- */

.section { padding-block: clamp(64px, 8vw, 112px); }
.section-alt { background: var(--surface-alt); }

.section-head { max-width: 62ch; margin-block-end: 48px; }
.section-head p { margin-block-start: 14px; }

/* ---------- Services bento (1 lead tile + 2 supporting) ---------- */

.bento {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.tile:hover { transform: translateY(-4px); border-color: var(--blue); }

.tile-lead { grid-column: span 2; flex-direction: row; align-items: center; }

.tile-lead .tile-media {
  flex: 0 0 46%;
  align-self: stretch;
  min-height: 280px;
}

.tile-media {
  background: var(--blue-wash);
  overflow: hidden;
}

.tile-media img { width: 100%; height: 100%; object-fit: cover; }

/* Gives an image-less tile a surface of its own so a bento of mixed
   media/text cells does not read as blank cards. */
.tile-wash { background: var(--blue-wash); }

.tile-body { padding: 30px 32px; }

.tile-body h3 { font-size: 1.35rem; font-weight: 800; line-height: 1.4; }
.tile-body p { margin-block-start: 10px; color: var(--text-muted); }

@media (max-width: 860px) {
  .bento { grid-template-columns: 1fr; }
  .tile-lead { grid-column: span 1; flex-direction: column; }
  .tile-lead .tile-media { flex: none; width: 100%; min-height: 220px; }
}

/* ---------- Service groups ----------
   Eleven services would read as a wall if listed flat, so they are clustered
   into four groups: a sticky group heading beside that group's service cards. */

.svc-group {
  display: grid;
  grid-template-columns: 0.85fr 2fr;
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  padding-block: clamp(44px, 5vw, 72px);
  border-block-start: 1px solid var(--line);
}

.svc-group:first-of-type { border-block-start: 0; padding-block-start: 0; }

.svc-heading { position: sticky; inset-block-start: 104px; }

.svc-heading h2 {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.85rem);
  font-weight: 800;
  line-height: 1.35;
}

.svc-heading p { margin-block-start: 12px; color: var(--text-muted); font-size: 0.98rem; }

.svc-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.svc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 26px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.svc-card:hover { border-color: var(--blue); transform: translateY(-3px); }

.svc-card .ph { font-size: 1.6rem; color: var(--blue); line-height: 1.4; }

.svc-card h3 {
  font-size: 1.08rem;
  font-weight: 800;
  margin-block-start: 8px;
  line-height: 1.45;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 14px;
}

.chips li {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--blue-wash);
  border-radius: 999px;
  padding: 5px 12px;
  line-height: 1.6;
}

/* An image cell inside the card grid keeps a long list from reading as
   nothing but boxes of text. */
/* The cell carries the image's own 4:3 ratio, so the whole illustration shows
   with no cropping. */
.svc-card-media {
  padding: 0;
  overflow: hidden;
  background: var(--blue-wash);
  aspect-ratio: 800 / 597;
}

.svc-card-media img { width: 100%; height: 100%; object-fit: contain; }

.svc-card-media.span-2 {
  grid-column: span 2;
}

@media (max-width: 620px) {
  .svc-card-media.span-2 { grid-column: span 1; }
}

@media (max-width: 900px) {
  .svc-group { grid-template-columns: 1fr; }
  .svc-heading { position: static; }
}

@media (max-width: 620px) {
  .svc-cards { grid-template-columns: 1fr; }
}

/* ---------- Split (image + copy) ---------- */

.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.split-media img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.split ul { margin-block-start: 28px; display: grid; gap: 16px; }

.split li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--text-muted);
}

.split li .ph { flex: none; font-size: 1.25rem; line-height: 1.5; color: var(--blue); }
.split li strong { color: var(--text); font-weight: 700; }

/* Flips which column the media occupies without touching source order. */
.split-reverse .split-media { order: 2; }

@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .split-reverse .split-media { order: 0; }
}

/* ---------- Approach (numbered rail, not equal cards) ---------- */

.rail { display: grid; gap: 0; }

.rail-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 24px;
  align-items: start;
  padding-block: 32px;
  border-block-start: 1px solid var(--line);
}

.rail-item:last-child { border-block-end: 1px solid var(--line); }

.rail-index {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: color-mix(in srgb, var(--blue) 32%, transparent);
  font-variant-numeric: tabular-nums;
}

.rail-item h3 { font-size: 1.3rem; font-weight: 800; }
.rail-item p { margin-block-start: 8px; color: var(--text-muted); max-width: 60ch; }

@media (max-width: 560px) {
  .rail-item { grid-template-columns: 1fr; gap: 8px; }
  .rail-index { font-size: 1.9rem; }
}

/* ---------- CTA band ---------- */

.cta-band {
  background: linear-gradient(120deg, var(--navy-deep), var(--blue));
  color: #fff;
  text-align: center;
  padding-block: clamp(56px, 7vw, 96px);
}

.cta-band h2 { color: #fff; }
.cta-band p {
  margin: 16px auto 32px;
  color: rgb(233 240 250 / 0.82);
  max-width: 54ch;
}
.cta-band .btn-primary { background: #fff; color: var(--navy); }
.cta-band .btn-primary:hover { background: var(--blue-wash); }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

@media (max-width: 860px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.contact-detail {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-block: 20px;
  border-block-end: 1px solid var(--line);
}

.contact-detail:first-of-type { border-block-start: 1px solid var(--line); }

.contact-detail .ph { flex: none; font-size: 1.4rem; line-height: 1.6; color: var(--blue); }
.contact-detail .k { font-weight: 700; }
.contact-detail .v { color: var(--text-muted); }
.contact-detail a.v:hover { color: var(--blue); }

/* Directions link under the address. */
.map-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-block-start: 8px;
  font-weight: 700;
  color: var(--blue);
}
.map-link .ph { font-size: 1.05rem; }

/* Embedded Google map. */
.map-embed {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  line-height: 0;
}
.map-embed iframe {
  width: 100%;
  height: clamp(300px, 45vw, 460px);
  display: block;
}

.form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }

.field label { font-weight: 700; font-size: 0.94rem; }

.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  width: 100%;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

/* Placeholder held at AA contrast against --surface in both modes. */
.field input::placeholder,
.field textarea::placeholder { color: #7b8698; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent);
}

.field textarea { min-height: 150px; resize: vertical; }

.field .error {
  font-size: 0.86rem;
  font-weight: 600;
  color: #c0392b;
}

@media (prefers-color-scheme: dark) {
  .field .error { color: #ff8b7d; }
}

.field .error:empty { display: none; }

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: #c0392b; }

.form-status {
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-weight: 600;
}

.form-status:empty { display: none; }
.form-status[data-state="success"] {
  background: color-mix(in srgb, #1e8a5a 14%, transparent);
  color: #1e8a5a;
}
.form-status[data-state="error"] {
  background: color-mix(in srgb, #c0392b 12%, transparent);
  color: #c0392b;
}

@media (prefers-color-scheme: dark) {
  .form-status[data-state="success"] { color: #6ddba6; }
  .form-status[data-state="error"] { color: #ff8b7d; }
}

.btn[aria-busy="true"] { opacity: 0.72; pointer-events: none; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--navy-deep);
  color: rgb(233 240 250 / 0.72);
  padding-block: 64px 28px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 44px;
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
}

.footer-logo img { height: 52px; width: auto; }
.site-footer p { margin-block-start: 16px; max-width: 40ch; font-size: 0.95rem; }

.site-footer h4 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  margin-block-end: 16px;
}

.site-footer li { margin-block-end: 10px; }
.site-footer a { color: rgb(233 240 250 / 0.72); font-size: 0.95rem; }
.site-footer a:hover { color: #fff; }

.footer-base {
  margin-block-start: 48px;
  padding-block-start: 24px;
  border-block-start: 1px solid rgb(255 255 255 / 0.12);
  font-size: 0.88rem;
  text-align: center;
}

/* ---------- Scroll reveal (IntersectionObserver driven) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .reveal.is-visible { opacity: 1; transform: none; }
}
