:root {
  --bg: #ECE9E2;
  --ink: #141414;
  --muted: #5b5851;
  --line: rgba(20, 20, 20, .16);
  --accent: #14532D;
  --splash: #0A141F;
  --pad: clamp(20px, 4vw, 64px);
  --head-h: 64px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --f-head: "Noto Kufi Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
}
html[lang="en"] {
  --f-head: "Space Grotesk", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; scroll-padding-top: var(--head-h); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 clamp(1rem, .95rem + .25vw, 1.125rem)/1.75 var(--f-body);
  overflow-x: hidden;
}
body.is-intro { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
html { scrollbar-color: var(--ink) var(--bg); scrollbar-width: thin; }
.muted { color: var(--muted); }

.skip-link { position: fixed; inset-block-start: -80px; inset-inline-start: 12px; z-index: 200; background: var(--ink); color: var(--bg); padding: 8px 14px; }
.skip-link:focus { inset-block-start: 12px; }

/* ---------- Intro ---------- */
.intro {
  position: fixed; inset: 0; z-index: 150; background: var(--splash);
  display: grid; place-items: center; cursor: pointer;
  transition: opacity .8s var(--ease), visibility 0s .8s;
}
.intro video { width: 100%; height: 100%; object-fit: contain; }
.intro.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
.intro__skip {
  position: absolute; inset-block-end: max(28px, env(safe-area-inset-bottom)); inset-inline: 0; margin-inline: auto; width: max-content;
  font: 500 .95rem/1 var(--f-body); color: #F1EEE6; background: transparent;
  border: 1px solid rgba(241, 238, 230, .55); padding: 14px 28px; border-radius: 999px; cursor: pointer;
  transition: background .25s, color .25s;
}
.intro__skip:hover { background: #F1EEE6; color: var(--splash); }
.intro__skip:focus-visible { outline-color: #F1EEE6; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 100; height: var(--head-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding-inline: var(--pad); background: var(--bg); border-block-end: 1px solid var(--line);
  font-size: .9rem;
}
.brand { font-weight: 500; white-space: nowrap; }
.brand__yr { color: var(--muted); font-variant-numeric: tabular-nums; }
.nav { display: flex; gap: clamp(16px, 2.4vw, 36px); }
.nav a, .lang button { position: relative; }
.nav a::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: -3px; height: 1px; background: var(--accent); transform: scaleX(0); transition: transform .35s var(--ease); }
.nav a:hover { color: var(--accent); }
.nav a:hover::after { transform: scaleX(1); }
.header-end { display: flex; justify-content: flex-end; align-items: center; gap: 18px; }
.clock { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lang { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.lang button { font: inherit; background: none; border: 0; padding: 8px 2px; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { color: var(--ink); font-weight: 500; }
.lang button:hover { color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: calc(var(--head-h) + clamp(28px, 5vw, 64px)) var(--pad) 0; }
.hero__line { color: var(--muted); font-size: clamp(.95rem, .9rem + .3vw, 1.1rem); }
.hero__eng { color: var(--muted); font-size: clamp(1.1rem, 1rem + .6vw, 1.5rem); font-weight: 500; margin-block: .6em 0; }
.hero__name {
  font: 900 clamp(2.8rem, .6rem + 10.6vw, 9.5rem)/1.3 var(--f-head);
  margin-block: .1em .3em; text-wrap: balance;
}
html[lang="en"] .hero__name { font-size: clamp(2.6rem, .5rem + 8.4vw, 8.5rem); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.hero__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--pad); align-items: end; }
.hero__photo { aspect-ratio: 5 / 4; overflow: hidden; background: #1b1b1b; width: 100%; }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.hero__side { display: flex; flex-direction: column; justify-content: space-between; align-self: stretch; gap: 32px; padding-block-end: 4px; }
.status { display: inline-flex; align-items: center; gap: 12px; font-size: clamp(1rem, .9rem + .5vw, 1.35rem); font-weight: 500; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); position: relative; flex: none; }
.dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: pulse 2.2s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(3.2); opacity: 0; } }
.scroll-cue { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; padding: 10px 0; border-block-end: 1px solid var(--ink); }
.scroll-cue:hover { color: var(--accent); border-color: var(--accent); }

.marquee { margin-block-start: clamp(36px, 6vw, 80px); margin-inline: calc(var(--pad) * -1); border-block: 1px solid var(--line); overflow: hidden; direction: ltr; }
.marquee__track { display: flex; width: max-content; animation: marquee 38s linear infinite; }
.marquee ul { display: flex; flex: none; }
.marquee li { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); padding: 22px clamp(10px, 1.5vw, 20px) 22px 0; font: 800 clamp(1.4rem, 1rem + 1.8vw, 2.6rem)/1.3 var(--f-head); white-space: nowrap; padding-inline-end: clamp(20px, 3vw, 40px); }
html[lang="en"] .marquee li { font-weight: 600; }
.marquee [data-ar] { direction: rtl; unicode-bidi: isolate; }
html[lang="en"] .marquee [data-ar] { direction: ltr; }
.star { width: .55em; height: .55em; fill: var(--ink); flex: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 180px) var(--pad) 0; }
.section__head { display: flex; align-items: baseline; gap: 20px; padding-block-end: 20px; border-block-end: 1px solid var(--ink); margin-block-end: 0; }
.section__no { color: var(--accent); font-variant-numeric: tabular-nums; font-size: .95rem; }
.section__head h2 { font: 800 clamp(1.5rem, 1.1rem + 1.4vw, 2.4rem)/1.3 var(--f-head); }
html[lang="en"] .section__head h2 { font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 28px; border-radius: 999px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); font-weight: 500; transition: background .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease); }
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { color: var(--bg); }
.btn--big { min-height: 60px; padding: 0 40px; font-size: 1.1rem; }
.link { border-block-end: 1px solid currentColor; padding-block-end: 2px; }
.link:hover { color: var(--accent); }

/* Projects */
.project { display: grid; grid-template-columns: 3.5rem minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--pad); padding-block: clamp(40px, 6vw, 88px); border-block-end: 1px solid var(--line); align-items: center; }
.project__no { color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; align-self: start; padding-block-start: .6em; }
.project__main { display: grid; gap: 22px; max-width: 60ch; }
.project__title { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 32px); }
.project__icon { width: clamp(64px, 8vw, 120px); height: auto; border-radius: 22%; flex: none; }
.project__mono { width: clamp(64px, 8vw, 120px); aspect-ratio: 1; border-radius: 22%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font: 900 clamp(2rem, 4vw, 3.6rem)/1 var(--f-head); flex: none; }
.project h3 { font: 900 clamp(2.4rem, 1rem + 6vw, 6rem)/1.2 var(--f-head); }
html[lang="en"] .project h3 { font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.project--light h3 { font-size: clamp(1.5rem, 1rem + 2vw, 2.6rem); }
.project--light { padding-block: clamp(32px, 4vw, 56px); }
.project__links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.project__shots { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.5vw, 20px); }
.project__shots img { border-radius: 14px; border: 1px solid var(--line); }
.project__shots img:nth-child(2) { margin-block-start: 12%; }
.project--text, .project--light { grid-template-columns: 3.5rem minmax(0, 1fr); }

.project--tawseela .project__shots { grid-template-columns: minmax(0, .7fr) minmax(0, 1fr); align-items: center; }
.project--tawseela .project__shots img:nth-child(2) { margin-block-start: 0; }

/* Embedded */
.embedded__story { display: grid; gap: 20px; max-width: 62ch; padding-block: clamp(32px, 5vw, 72px) clamp(28px, 4vw, 56px); color: var(--muted); }
.embedded__lead { font: 500 clamp(1.3rem, 1rem + 1.4vw, 2.1rem)/1.7 var(--f-body); color: var(--ink); text-wrap: pretty; }
html[lang="en"] .embedded__lead { line-height: 1.45; }
.gallery { column-count: 3; column-gap: clamp(10px, 1.5vw, 20px); }
.gallery__item { break-inside: avoid; margin-block-end: clamp(14px, 2vw, 28px); min-width: 0; }
.gallery__item img { width: 100%; height: auto; background: #1b1b1b; }
.gallery figcaption { font-size: .9rem; line-height: 1.5; color: var(--muted); padding-block-start: 8px; }

/* Certificates */
.cert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); padding-block-start: clamp(28px, 4vw, 56px); }
.cert { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cert img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #dfdbd2; border: 1px solid var(--line); padding: 8px; }
.cert__body { display: grid; gap: 4px; align-content: start; }
.cert h3 { font: 700 1.05rem/1.5 var(--f-head); }
html[lang="en"] .cert h3 { font-weight: 600; }
.cert p { font-size: .92rem; line-height: 1.6; }
.cert__yr { color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 500; }
.cert .link { justify-self: start; font-size: .92rem; }

/* About */
.about__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--pad); padding-block-start: clamp(32px, 5vw, 72px); align-items: start; }
.about__photo { aspect-ratio: 4 / 5; overflow: hidden; background: #1b1b1b; }
.about__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.about__text { display: grid; gap: clamp(40px, 6vw, 80px); }
.about__lead { font: 500 clamp(1.3rem, 1rem + 1.4vw, 2.1rem)/1.7 var(--f-body); max-width: 32em; text-wrap: pretty; }
html[lang="en"] .about__lead { line-height: 1.45; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; border-block-start: 1px solid var(--line); padding-block-start: 28px; }
.facts dt { font: 800 clamp(1.8rem, 1rem + 2.4vw, 3.2rem)/1.2 var(--f-head); font-variant-numeric: tabular-nums; color: var(--accent); direction: ltr; text-align: start; }
html[lang="en"] .facts dt { font-weight: 600; }
.facts dd { color: var(--muted); font-size: .95rem; line-height: 1.6; }

/* Services */
.service-list li { border-block-end: 1px solid var(--line); }
.service-list span { display: block; padding-block: clamp(20px, 3vw, 40px); font: 800 clamp(1.8rem, 1rem + 4.6vw, 5rem)/1.3 var(--f-head); transition: transform .5s var(--ease), color .3s; cursor: default; }
html[lang="en"] .service-list span { font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.service-list li:hover span { color: var(--accent); transform: translateX(-2.5%); }
html[dir="ltr"] .service-list li:hover span { transform: translateX(2.5%); }

/* Footer */
.footer { margin-block-start: clamp(100px, 14vw, 200px); background: var(--ink); color: var(--bg); padding: clamp(64px, 9vw, 140px) var(--pad) 28px; }
.footer ::selection { background: var(--bg); color: var(--ink); }
.footer :focus-visible { outline-color: var(--bg); }
.footer__top { display: grid; gap: clamp(28px, 4vw, 56px); }
.footer__title { font: 900 clamp(2.6rem, 1rem + 8vw, 8.5rem)/1.2 var(--f-head); text-wrap: balance; max-width: 14em; }
html[lang="en"] .footer__title { font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.footer__cta { display: flex; flex-wrap: wrap; gap: 14px; }
.footer .btn { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.footer .btn:hover { background: #fff; border-color: #fff; color: var(--accent); }
.footer .btn--ghost { background: transparent; color: var(--bg); border-color: rgba(236, 233, 226, .5); }
.footer .btn--ghost:hover { background: var(--bg); color: var(--ink); border-color: var(--bg); }
.footer__photo { margin-block: clamp(56px, 8vw, 110px); width: min(100%, 380px); aspect-ratio: 4 / 5; overflow: hidden; }
.footer__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 8%; }
.footer__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; border-block-start: 1px solid rgba(236, 233, 226, .22); padding-block-start: 22px; font-size: .9rem; color: rgba(236, 233, 226, .78); font-variant-numeric: tabular-nums; }

/* Reveal: content is visible by default; GSAP (app.js) sets hidden start states after load */

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .site-header { grid-template-columns: 1fr auto; row-gap: 0; }
  .nav { display: none; }
  .clock { display: none; }
  .hero__body { grid-template-columns: 1fr; }
  .hero__photo { aspect-ratio: 4 / 4.6; }
  .hero__side { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .project, .project--text, .project--light { grid-template-columns: 1fr; gap: 20px; }
  .project__no { padding: 0; }
  .project__shots { max-width: 460px; }
  .about__grid { grid-template-columns: 1fr; }
  .about__photo { max-width: 420px; }
  .gallery { column-count: 2; }
  .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  /* vw-based: longest word (الموسوي ≈ 4.95em) fits one line inside the padded container at 360px */
  .hero__name { font-size: 14.5vw; }
  html[lang="en"] .hero__name { font-size: 11.5vw; }
  .hero__line, .brand { overflow-wrap: anywhere; }
  .brand { white-space: normal; min-width: 0; }
  .cert-grid { grid-template-columns: 1fr; }
  .gallery { column-count: 1; }
  .facts { grid-template-columns: 1fr; gap: 20px; }
  .facts div { display: flex; align-items: baseline; gap: 16px; }
  .facts dt { min-width: 5.5ch; }
  .btn--big { width: 100%; }
  .project__links .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee__track { animation: none; }
  .dot::after { animation: none; }
  .intro { display: none; }
  * { transition-duration: .01ms !important; }
}
