/* ==========================================================================
   Al Bunian Engineering Company - global stylesheet
   ========================================================================== */

:root {
  --accent: #ea422b;
  --accent-dark: #c9321f;
  --dark: #16181d;
  --heading: #1a1a1a;
  --body: #4a4f57;
  --muted: #7a828c;
  --light: #f4f8fd;
  --border: #e6e9ef;
  --white: #ffffff;
  --container: 1200px;
  --radius: 10px;
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, .06);
  --shadow: 0 12px 32px rgba(16, 24, 40, .10);
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  color: var(--body);
  background: var(--white);
  overflow-x: hidden;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4, h5 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
  letter-spacing: -.01em;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }

ul { margin: 0 0 1rem; padding-left: 1.1rem; }
li { margin-bottom: .35rem; }

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

.section { padding: 84px 0; }
.section--tight { padding: 60px 0; }
.section--light { background: var(--light); }

.section-head { max-width: 760px; margin-bottom: 40px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.rule { width: 64px; height: 4px; background: var(--accent); border-radius: 2px; margin: 14px 0 22px; }
.section-head.center .rule { margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: .18s ease;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .7); }
.btn--ghost:hover { background: #fff; color: var(--heading); }
.btn--dark { background: var(--dark); color: #fff; }
.btn--dark:hover { background: #000; color: #fff; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 78px;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.brand img { height: 52px; width: auto; }
.brand-text { display: none; font-weight: 600; color: var(--heading); line-height: 1.15; }
.brand-text small { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; }

.nav { display: flex; align-items: center; gap: 30px; }
.nav a {
  color: var(--heading);
  font-weight: 500;
  font-size: .98rem;
  padding: 6px 0;
  position: relative;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
  transition: right .2s ease;
}
.nav a:hover::after, .nav a.active::after { right: 0; }
.nav a.active { color: var(--accent); }

.header-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
}
.header-phone svg { width: 18px; height: 18px; color: var(--accent); }

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  font-size: .85rem;
  font-weight: 600;
}
.lang-switch a { padding: 6px 12px; color: var(--body); }
.lang-switch a.active { background: var(--accent); color: #fff; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  padding: 11px;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  content: "";
  display: block;
  height: 2px;
  background: var(--heading);
  border-radius: 2px;
  position: relative;
  transition: .2s ease;
}
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 5px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  color: #fff;
  background: #111 center/cover no-repeat;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12,14,18,.82) 0%, rgba(12,14,18,.55) 45%, rgba(12,14,18,.25) 100%);
}
.hero .container { position: relative; padding-top: 90px; padding-bottom: 90px; }
.hero h1 { color: #fff; font-size: clamp(2.4rem, 6vw, 4.2rem); margin-bottom: 20px; max-width: 18ch; }
.hero p { color: rgba(255,255,255,.88); font-size: 1.15rem; max-width: 52ch; margin-bottom: 30px; }
.hero .btn-row { display: flex; flex-wrap: wrap; gap: 14px; }

.page-hero {
  position: relative;
  color: #fff;
  background: #111 center/cover no-repeat;
  padding: 90px 0 70px;
}
.page-hero::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(12,14,18,.85), rgba(12,14,18,.5));
}
.page-hero .container { position: relative; }
.page-hero h1 { color: #fff; margin: 0; }
.page-hero .crumbs { color: rgba(255,255,255,.75); font-size: .9rem; margin-bottom: 10px; }
.page-hero .crumbs a { color: rgba(255,255,255,.75); }

/* ---------- Split (image + text) ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.split--reverse .split-media { order: 2; }
.split-media img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.split-body p:last-child { margin-bottom: 0; }

/* ---------- Feature list ---------- */
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 28px; list-style: none; padding: 0; margin: 26px 0 0; }
.features li { position: relative; padding-left: 30px; font-weight: 500; color: var(--heading); }
.features li::before {
  content: "";
  position: absolute; left: 0; top: .55em;
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--accent);
}

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 26px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  transition: .2s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); }

.icon-card { text-align: center; }
.icon-card img { width: 66px; height: 66px; object-fit: contain; margin: 0 auto 18px; }
.icon-card h3 { font-size: 1.1rem; margin: 0; }

.service-card .num { font-size: .85rem; font-weight: 600; color: var(--accent); letter-spacing: .1em; }
.service-card h3 { margin: 8px 0 12px; font-size: 1.3rem; }
.service-card ul { margin-bottom: 0; }
.service-card p:last-child { margin-bottom: 0; }

/* ---------- Vision / Mission ---------- */
.vm { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.vm .card h3 { display: flex; align-items: center; gap: 10px; }
.vm .card h3::before { content: ""; width: 26px; height: 4px; background: var(--accent); border-radius: 2px; }

/* ---------- CTA band ---------- */
.cta {
  position: relative;
  color: #fff;
  text-align: center;
  background: #111 center/cover no-repeat;
  padding: 90px 0;
}
.cta::before { content: ""; position: absolute; inset: 0; background: rgba(12,14,18,.72); }
.cta .container { position: relative; }
.cta h2 { color: #fff; margin-bottom: 10px; }
.cta p { color: rgba(255,255,255,.85); margin-bottom: 26px; }

/* ---------- Projects ---------- */
.project-block { padding: 54px 0; border-bottom: 1px solid var(--border); }
.project-block:last-of-type { border-bottom: 0; }
.project-block h2 { font-size: 1.5rem; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 24px; }
.gallery a { display: block; overflow: hidden; border-radius: 8px; }
.gallery img { width: 100%; height: 260px; object-fit: cover; transition: transform .35s ease; }
.gallery a:hover img { transform: scale(1.06); }
.gallery--wide { grid-template-columns: repeat(4, 1fr); }
.gallery--two { grid-template-columns: repeat(2, 1fr); }

/* Single image tile (project previews) */
.thumb { display: block; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-sm); }
.thumb img { width: 100%; height: 280px; object-fit: cover; transition: transform .35s ease; }
.thumb:hover img { transform: scale(1.06); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.info-card { background: var(--light); border-radius: var(--radius); padding: 34px; }
.info-card h2, .info-card h3 { margin-bottom: 20px; }
.info-row { margin-bottom: 22px; }
.info-row:last-child { margin-bottom: 0; }
.info-row .label { font-weight: 600; color: var(--heading); display: block; margin-bottom: 4px; }
.info-row a { color: var(--body); }
.info-row a:hover { color: var(--accent); }
.map-embed { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); min-height: 320px; }
.map-embed iframe { width: 100%; height: 100%; min-height: 320px; border: 0; display: block; }
.social { display: flex; gap: 12px; margin-top: 6px; }
.social a {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
}
.social a:hover { background: var(--accent-dark); }
.social svg { width: 18px; height: 18px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: #b9bec7; padding: 66px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr; gap: 40px; }
/* Footer column headings are h2 for a valid document outline; the h4 selector
   is kept so any legacy markup still renders identically. */
.site-footer h2, .site-footer h4 { color: #fff; font-size: 1.02rem; margin-bottom: 18px; }
.site-footer a { color: #b9bec7; }
.site-footer a:hover { color: #fff; }
.footer-brand img { height: 56px; margin-bottom: 16px; }
.footer-brand p { font-size: .94rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 10px; }
.footer-contact li { list-style: none; display: flex; gap: 10px; margin-bottom: 12px; }
.footer-contact svg { width: 18px; height: 18px; color: var(--accent); flex: 0 0 auto; margin-top: 4px; }
.footer-contact { list-style: none; padding: 0; margin: 0; }
.footer-bottom {
  margin-top: 50px;
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 22px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .88rem;
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.lead { font-size: 1.12rem; }

/* A <picture> wrapper must not disturb the box its <img> sits in.
   `display: contents` makes the <img> behave as a direct child, so existing
   `.gallery img`, `.thumb img` etc. rules keep applying unchanged.
   Chrome lays <source> out as display:block rather than the spec's display:none,
   which would leave a zero-width flex item and trip the parent's `gap`, so it is
   hidden explicitly here. */
picture { display: contents; }
picture > source { display: none; }

/* ---------- Background imagery ----------
   Full-bleed section backgrounds are CSS images, so they cannot use <picture>.
   image-set() lets the browser pick WebP and fall back to JPEG in the same
   declaration; the -webkit- prefixed copy covers older Safari/Chrome, which
   ignore the unprefixed syntax and keep the original file. */
.bg-home,
.bg-about,
.bg-services,
.bg-contact,
.bg-projects,
.bg-cta {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.bg-home {
  background-image: -webkit-image-set(url("/assets/img/hero.webp") type("image/webp"), url("/assets/img/hero.jpg") type("image/jpeg"));
  background-image: image-set(url("/assets/img/hero.webp") type("image/webp"), url("/assets/img/hero.jpg") type("image/jpeg"));
}
.bg-about {
  background-image: -webkit-image-set(url("/assets/img/about.webp") type("image/webp"), url("/assets/img/about.jpg") type("image/jpeg"));
  background-image: image-set(url("/assets/img/about.webp") type("image/webp"), url("/assets/img/about.jpg") type("image/jpeg"));
}
.bg-services {
  background-image: -webkit-image-set(url("/assets/img/services-hero.webp") type("image/webp"), url("/assets/img/services-hero.jpg") type("image/jpeg"));
  background-image: image-set(url("/assets/img/services-hero.webp") type("image/webp"), url("/assets/img/services-hero.jpg") type("image/jpeg"));
}
.bg-contact {
  background-image: -webkit-image-set(url("/assets/img/contact-hero.webp") type("image/webp"), url("/assets/img/contact-hero.jpg") type("image/jpeg"));
  background-image: image-set(url("/assets/img/contact-hero.webp") type("image/webp"), url("/assets/img/contact-hero.jpg") type("image/jpeg"));
}
.bg-projects {
  background-image: -webkit-image-set(url("/assets/img/projects/tunnels-1.webp") type("image/webp"), url("/assets/img/projects/tunnels-1.jpg") type("image/jpeg"));
  background-image: image-set(url("/assets/img/projects/tunnels-1.webp") type("image/webp"), url("/assets/img/projects/tunnels-1.jpg") type("image/jpeg"));
}
.bg-cta {
  background-image: -webkit-image-set(url("/assets/img/cta-band.webp") type("image/webp"), url("/assets/img/cta-band.png") type("image/png"));
  background-image: image-set(url("/assets/img/cta-band.webp") type("image/webp"), url("/assets/img/cta-band.png") type("image/png"));
}

/* ---------- RTL ---------- */
[dir="rtl"] .nav a::after { left: 100%; right: 0; }
[dir="rtl"] .nav a:hover::after, [dir="rtl"] .nav a.active::after { left: 0; }
[dir="rtl"] .brand { margin-right: 0; margin-left: auto; }
[dir="rtl"] .features li { padding-left: 0; padding-right: 30px; }
[dir="rtl"] .features li::before { left: auto; right: 0; }
[dir="rtl"] ul { padding-left: 0; padding-right: 1.1rem; }
[dir="rtl"] .hero::before { background: linear-gradient(270deg, rgba(12,14,18,.82) 0%, rgba(12,14,18,.55) 45%, rgba(12,14,18,.25) 100%); }

/* Bidi: numbers and Latin runs must stay left-to-right inside RTL pages.
   Both properties are required - on their own they are not enough: without the
   isolate the bidi algorithm reorders the digit groups ("+966 55 647 7881"
   renders as "7881 647 55 966+"), and `direction: ltr` without the isolate
   lets the neighbouring Arabic bleed into the number run. */
[dir="rtl"] .ltr { unicode-bidi: isolate; direction: ltr; }
[dir="rtl"] a[href^="mailto:"] { unicode-bidi: isolate; direction: ltr; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; gap: 34px; }
  .split--reverse .split-media { order: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .gallery--wide { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .header-phone { display: none; }
  .nav-toggle { display: block; }
  .nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 8px 24px 18px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 13px 0; border-bottom: 1px solid var(--border); }
  .nav a::after { display: none; }
  .header-inner { position: relative; }
  .lang-switch { margin-left: auto; }
  [dir="rtl"] .lang-switch { margin-left: 0; margin-right: auto; }
}

@media (max-width: 640px) {
  .section { padding: 60px 0; }
  .grid--4, .grid--3, .grid--2, .features { grid-template-columns: 1fr; }
  .gallery, .gallery--wide, .gallery--two { grid-template-columns: 1fr 1fr; }
  .gallery img { height: 180px; }
  .vm { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 30px; }
  .hero { min-height: 68vh; }
  .brand img { height: 44px; }
  .card { padding: 24px; }
}
