/* Layout: deep ink hero with an arched portrait, then calm stone pages; logical properties so RTL mirrors itself. */
:root {
  --bg: #EFEFEC;
  --surface: #F8F8F6;
  --ink: #16191E;
  --muted: #5C6168;
  --line: #D6D7D3;
  --accent: #8A6A3B;
  --hero-bg: #15181D;
  --hero-ink: #F2F1EC;
  --hero-muted: #A9ADB3;
  --hero-line: rgba(242, 241, 236, .14);
  --gold: #B8975E;

  --f-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --f-body: "Figtree", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --f-display-ar: "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif;
  --f-body-ar: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;

  --maxw: 1180px;
  --radius: 4px;
  --s1: .5rem; --s2: 1rem; --s3: 1.5rem; --s4: 2.5rem; --s5: 4rem; --s6: 6.5rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1114; --surface: #171A1F; --ink: #ECEBE6; --muted: #9DA2A8; --line: #2A2E35;
    --accent: #CDAE78; --hero-bg: #0B0D10; --hero-ink: #F2F1EC; --hero-muted: #A3A7AD;
    --hero-line: rgba(242,241,236,.12); --gold: #CDAE78; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1114; --surface: #171A1F; --ink: #ECEBE6; --muted: #9DA2A8; --line: #2A2E35;
  --accent: #CDAE78; --hero-bg: #0B0D10; --hero-ink: #F2F1EC; --hero-muted: #A3A7AD;
  --hero-line: rgba(242,241,236,.12); --gold: #CDAE78; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--hero-bg); }
:lang(ar) body, html[lang="ar"] body { font-family: var(--f-body-ar); line-height: 1.85; }
img { max-width: 100%; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 400; text-wrap: balance; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 100; }
.skip:focus { top: 1rem; }

.wrap {
  width: 100%; max-width: var(--maxw); margin-inline: auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- type ---------- */
h2 { font-family: var(--f-display); font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); line-height: 1.08; letter-spacing: -.01em; }
h3 { font-family: var(--f-body); font-weight: 600; font-size: 1.125rem; line-height: 1.35; }
html[lang="ar"] h2, html[lang="ar"] .hero-title, html[lang="ar"] .stat-value, html[lang="ar"] .pull-quote, html[lang="ar"] .contact-title {
  font-family: var(--f-display-ar); font-weight: 600; letter-spacing: 0;
}
html[lang="ar"] h2 { line-height: 1.45; font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); }
html[lang="ar"] h3 { font-family: var(--f-body-ar); }
.eyebrow {
  font: 500 .75rem/1.4 var(--f-mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--s2);
}
html[lang="ar"] .eyebrow { font-family: var(--f-body-ar); font-weight: 600; letter-spacing: 0; font-size: .875rem; }
.eyebrow-light { color: var(--gold); }
.lead { color: var(--muted); max-width: 58ch; margin-top: var(--s2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem; text-decoration: none;
  font: 600 .95rem/1 var(--f-body); padding: .95rem 1.35rem; border-radius: var(--radius);
  border: 1px solid transparent; transition: background .2s, color .2s, border-color .2s;
}
html[lang="ar"] .btn { font-family: var(--f-body-ar); }
.btn-light { background: var(--hero-ink); color: var(--hero-bg); }
.btn-light:hover { background: var(--gold); color: var(--hero-bg); }
.btn-ghost { color: var(--hero-ink); border-color: var(--hero-line); }
.btn-ghost:hover { border-color: var(--hero-ink); }
.btn-small { padding: .6rem .95rem; font-size: .85rem; background: var(--gold); color: var(--hero-bg); }
.btn-small:hover { filter: brightness(1.1); }
.arrow, .ext { width: 1.05em; height: 1.05em; flex: none; }
[dir="rtl"] .arrow { transform: scaleX(-1); }
[dir="rtl"] .ext { transform: scaleX(-1); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--hero-bg) 94%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hero-line); color: var(--hero-ink);
}
.header-inner { display: flex; align-items: center; gap: var(--s3); min-height: 68px; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; margin-inline-end: auto; }
.brand-mark {
  width: 38px; height: 38px; border: 1px solid var(--gold); color: var(--gold);
  display: grid; place-items: center; border-radius: 19px 19px 2px 2px;
  font: 400 1rem/1 var(--f-display); letter-spacing: .04em;
}
html[lang="ar"] .brand-mark { font-family: var(--f-display-ar); font-size: .8rem; }
.brand-name { font: 600 1rem/1 var(--f-body); letter-spacing: .01em; }
html[lang="ar"] .brand-name { font-family: var(--f-body-ar); }
.nav { display: flex; gap: var(--s3); }
.nav a { text-decoration: none; font-size: .92rem; color: var(--hero-muted); transition: color .2s; }
.nav a:hover { color: var(--hero-ink); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.lang-btn {
  background: none; border: 1px solid var(--hero-line); color: var(--hero-ink);
  padding: .5rem .8rem; border-radius: var(--radius); cursor: pointer; font: 600 .88rem/1 var(--f-body-ar);
}
.lang-btn:lang(en) { font-family: var(--f-body); }
.lang-btn:hover { border-color: var(--gold); color: var(--gold); }
.menu-btn { display: none; background: none; border: 1px solid var(--hero-line); color: var(--hero-ink); width: 40px; height: 38px; border-radius: var(--radius); cursor: pointer; }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 16px; height: 1.5px; background: currentColor; margin-inline: auto; position: relative; }
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; inset-inline-start: 0; }
.menu-icon::before { top: -5px; } .menu-icon::after { top: 5px; }

/* ---------- hero ---------- */
.hero { background: var(--hero-bg); color: var(--hero-ink); padding-block: var(--s5) var(--s4); position: relative; overflow: hidden; }
.hero::after { /* faint mashrabiya lattice */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .05;
  background-image:
    linear-gradient(45deg, var(--hero-ink) 1px, transparent 1px),
    linear-gradient(-45deg, var(--hero-ink) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to left, #000 0%, transparent 55%);
  -webkit-mask-image: linear-gradient(to left, #000 0%, transparent 55%);
}
[dir="rtl"] .hero::after { mask-image: linear-gradient(to right, #000 0%, transparent 55%); -webkit-mask-image: linear-gradient(to right, #000 0%, transparent 55%); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr); gap: var(--s5); align-items: center; position: relative; z-index: 1; }
.hero-title { font-family: var(--f-display); font-size: clamp(2.8rem, 1.6rem + 5vw, 5.6rem); line-height: .98; letter-spacing: -.02em; }
html[lang="ar"] .hero-title { font-size: clamp(2.3rem, 1.4rem + 3.8vw, 4.3rem); line-height: 1.35; }
.hero-intro { color: var(--hero-muted); font-size: 1.15rem; max-width: 52ch; margin-top: var(--s3); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: var(--s4); }
.hero-portrait { margin: 0; justify-self: end; width: 100%; max-width: 400px; }
[dir="rtl"] .hero-portrait { justify-self: start; }
.arch {
  position: relative; aspect-ratio: 4 / 5; max-width: 100%;
  border-radius: 999px 999px 6px 6px; overflow: hidden;
  background: linear-gradient(170deg, #2a2f37, #101216);
  outline: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); outline-offset: 10px;
}
.arch img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; opacity: 0; transition: opacity .6s; }
.arch.has-photo img { opacity: 1; }
.arch-fallback { position: absolute; inset: 0; display: grid; place-items: center; font: 400 clamp(4rem, 10vw, 7rem)/1 var(--f-display); color: var(--gold); opacity: .8; }
html[lang="ar"] .arch-fallback { font-family: var(--f-display-ar); font-size: clamp(3rem, 7vw, 5rem); }
.arch.has-photo .arch-fallback { display: none; }
.credentials { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: var(--s5) 0 0; padding-top: var(--s3); border-top: 1px solid var(--hero-line); position: relative; z-index: 1; }
.cred dt { font: 500 .72rem/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hero-muted); }
html[lang="ar"] .cred dt { font-family: var(--f-body-ar); letter-spacing: 0; font-size: .85rem; }
.cred dd { margin: .35rem 0 0; font-weight: 500; }

/* entrance */
@media (prefers-reduced-motion: no-preference) {
  .ready .hero-copy > * { animation: rise .8s cubic-bezier(.2,.7,.2,1) both; }
  .ready .hero-copy > *:nth-child(2) { animation-delay: .08s; }
  .ready .hero-copy > *:nth-child(3) { animation-delay: .16s; }
  .ready .hero-copy > *:nth-child(4) { animation-delay: .24s; }
  .ready .arch { animation: arch 1s .1s cubic-bezier(.2,.7,.2,1) both; }
}
@keyframes rise { from { transform: translateY(14px); opacity: .01; } to { transform: none; opacity: 1; } }
@keyframes arch { from { clip-path: inset(100% 0 0 0 round 999px 999px 6px 6px); } to { clip-path: inset(0 0 0 0 round 999px 999px 6px 6px); } }

/* ---------- sections ---------- */
.section { padding-block: var(--s6); }
.section-tight { padding-block: var(--s5); }
.section-alt { background: var(--surface); border-block: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: var(--s5); }
.section-head-row { max-width: none; display: flex; justify-content: space-between; align-items: end; gap: var(--s3); flex-wrap: wrap; }
.text-link { display: inline-flex; align-items: center; gap: .5rem; color: var(--accent); font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* impact */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--s4); row-gap: var(--s5); }
.stat { border-top: 1px solid var(--ink); padding-top: var(--s2); display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.stat-period { font: 500 .72rem/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
html[lang="ar"] .stat-period { font-family: var(--f-body-ar); letter-spacing: 0; font-size: .85rem; }
.stat-value { font-family: var(--f-display); font-size: clamp(2.6rem, 1.8rem + 2.6vw, 4rem); line-height: 1.02; font-variant-numeric: tabular-nums; }
html[lang="ar"] .stat-value { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); line-height: 1.4; }
.stat-label { color: var(--muted); max-width: 34ch; }

/* work */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.work-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s3) var(--s3); display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.work-tag { font: 500 .72rem/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .work-tag { font-family: var(--f-body-ar); letter-spacing: 0; font-size: .85rem; }
.work-card h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.65rem; line-height: 1.15; }
html[lang="ar"] .work-card h3 { font-family: var(--f-display-ar); font-weight: 600; font-size: 1.35rem; line-height: 1.55; }
.work-card p:not(.work-tag):not(.work-figure) { color: var(--muted); font-size: .98rem; }
.work-figure { margin-top: auto; padding-top: var(--s2); border-top: 1px solid var(--line); color: var(--accent); font-weight: 600; }

/* approach */
.approach-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: var(--s6); align-items: start; }
.prose { display: grid; gap: var(--s2); margin-top: var(--s4); max-width: 62ch; }
.prose p { color: var(--muted); }
.prose p:first-child { color: var(--ink); font-size: 1.15rem; }
.pull-quote { margin: 0 0 var(--s4); font: italic 400 clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem)/1.2 var(--f-display); color: var(--accent); padding-inline-start: var(--s3); border-inline-start: 2px solid var(--gold); }
html[lang="ar"] .pull-quote { font-style: normal; font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); line-height: 1.7; }
.side-title { font-size: .95rem; margin-bottom: var(--s2); }
.principles { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.principles li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--s2); padding-block: .9rem; border-bottom: 1px solid var(--line); }
.principles strong { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; line-height: 1.2; }
html[lang="ar"] .principles strong { font-family: var(--f-display-ar); font-weight: 600; font-size: 1.1rem; line-height: 1.6; }
.principles span { color: var(--muted); }

/* expertise */
.expertise-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); }
.exp { min-width: 0; }
.exp h3 { padding-bottom: var(--s2); border-bottom: 1px solid var(--ink); margin-bottom: var(--s2); min-height: 3.6em; }
.exp ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.exp li { color: var(--muted); font-size: .97rem; padding-inline-start: 1rem; position: relative; }
.exp li::before { content: ""; position: absolute; inset-inline-start: 0; top: .72em; width: 5px; height: 5px; border-radius: 3px 3px 0 0; background: var(--gold); }

/* career */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; top: .6rem; bottom: .6rem; inset-inline-start: calc(9.5rem + 5px); width: 1px; background: var(--line); }
.tl-item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: var(--s4); padding-bottom: var(--s4); position: relative; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 9.5rem; top: .45rem; width: 11px; height: 11px; border-radius: 6px 6px 1px 1px; background: var(--bg); border: 1px solid var(--accent); }
.tl-item.is-current::before { background: var(--accent); }
.tl-years { font: 500 .85rem/1.6 var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; padding-top: .1rem; }
html[lang="ar"] .tl-years { font-family: var(--f-body-ar); }
.tl-body { padding-inline-start: var(--s2); max-width: 64ch; }
.tl-body h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.55rem; line-height: 1.2; }
html[lang="ar"] .tl-body h3 { font-family: var(--f-display-ar); font-weight: 600; font-size: 1.25rem; line-height: 1.6; }
.tl-org { color: var(--accent); font-weight: 600; margin: .2rem 0 .5rem; }
.tl-body p:not(.tl-org) { color: var(--muted); }

/* recognition */
.recognition { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.rec h3 { font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; line-height: 1.2; margin-bottom: .4rem; }
html[lang="ar"] .rec h3 { font-family: var(--f-display-ar); font-weight: 600; font-size: 1.2rem; line-height: 1.6; }
.rec p { color: var(--muted); }

/* insights */
.insights { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.insight { text-decoration: none; display: flex; flex-direction: column; gap: .7rem; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, transform .2s; min-width: 0; }
.insight:hover { border-color: var(--accent); transform: translateY(-2px); }
.insight-topic { font: 500 .72rem/1.4 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
html[lang="ar"] .insight-topic { font-family: var(--f-body-ar); letter-spacing: 0; font-size: .85rem; }
.insight h3 { font-size: 1.08rem; }
.insight p { color: var(--muted); font-size: .95rem; }
.insight-more { margin-top: auto; display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; color: var(--ink); }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.g-item { margin: 0; aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.g-item img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); transition: transform .6s; }
.g-item:hover img { transform: scale(1.03); }

/* contact */
.contact { background: var(--hero-bg); color: var(--hero-ink); padding-block: var(--s6); }
.contact-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: var(--s5); align-items: end; }
.contact-title { font-family: var(--f-display); font-size: clamp(2.4rem, 1.5rem + 3.5vw, 4.4rem); line-height: 1; }
html[lang="ar"] .contact-title { line-height: 1.4; font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); }
.contact-text { color: var(--hero-muted); margin-top: var(--s2); max-width: 48ch; }
.contact-actions { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.contact-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.contact-label { font: 500 .72rem/1.4 var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--hero-muted); }
.contact-value { color: var(--hero-ink); text-decoration: none; font-weight: 500; user-select: all; }
.copy-btn { background: none; border: 1px solid var(--hero-line); color: var(--hero-muted); border-radius: var(--radius); padding: .3rem .6rem; cursor: pointer; font: inherit; font-size: .8rem; }

.site-footer { background: var(--hero-bg); color: var(--hero-muted); border-top: 1px solid var(--hero-line); font-size: .88rem; }
.footer-inner { display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; padding-block: var(--s3) calc(var(--s3) + env(safe-area-inset-bottom, 0px)); }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--hero-ink); }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .expertise-grid, .insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approach-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .header-actions .btn-small { display: none; }
  .nav { position: absolute; top: 100%; inset-inline: 0; flex-direction: column; gap: 0; background: var(--hero-bg); border-bottom: 1px solid var(--hero-line); padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px)); display: none; }
  .nav.open { display: flex; }
  .nav a { padding-block: .9rem; border-top: 1px solid var(--hero-line); font-size: 1rem; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .hero-portrait { order: -1; max-width: 240px; justify-self: start; }
  .stats, .recognition { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-inner { grid-template-columns: minmax(0, 1fr); }
  .exp h3 { min-height: 0; }
}
@media (max-width: 600px) {
  :root { --s5: 3rem; --s6: 4.5rem; }
  .brand-name { display: none; }
  .stats, .recognition, .work-grid, .expertise-grid, .insights { grid-template-columns: minmax(0, 1fr); }
  .credentials { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .timeline::before { inset-inline-start: 5px; }
  .tl-item { grid-template-columns: minmax(0, 1fr); gap: .3rem; padding-inline-start: 1.75rem; }
  .tl-item::before { inset-inline-start: 0; }
  .tl-body { padding-inline-start: 0; }
  .principles li { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
