/* =====================================================
   عبدالله رجب · بورتفوليو سينمائي بـ scroll-driven 3D
   ===================================================== */

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

:root {
  --bg-0: #0c0a08;
  --bg-1: #110e0b;
  --bg-2: #181410;
  --bg-3: #221d18;
  --surface: rgba(237, 229, 213, 0.03);
  --border: rgba(237, 229, 213, 0.08);
  --border-strong: rgba(237, 229, 213, 0.18);

  --text-0: #ede5d5;
  --text-1: #b8ad9b;
  --text-2: #6e6557;

  --acc: #c47854;
  --acc-soft: #d68d6d;
  --acc-deep: #8e553a;

  --ff-base: 'Almarai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ff-display: 'Almarai', sans-serif;
  --ff-num: 'Reem Kufi', 'Almarai', sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --max: 1320px;
  --pad: clamp(1.25rem, 3vw, 2.5rem);
}

html {
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: calc(5.35rem + env(safe-area-inset-top, 0px));
}
/* Lenis handles smooth scroll — no native smooth */
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
body {
  font-family: var(--ff-base);
  font-weight: 400;
  background: var(--bg-0);
  color: var(--text-0);
  line-height: 1.65;
  /* overflow-x: clip بدل hidden — مش بيكسر sticky */
  overflow-x: clip;
  cursor: auto;
}

body.nav-open {
  overflow: hidden;
  overscroll-behavior: none;
}

::selection { background: var(--acc); color: var(--bg-0); }
::-webkit-scrollbar { width: 0; height: 0; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; background: none; border: none; color: inherit; cursor: pointer; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
  position: relative;
}

/* ====== كانفس 3D خلفي ثابت ====== */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

/* خلفية صورة/فيديو من لوحة التحكم — تحت مشهد Three.js */
.cms-hero-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--bg-0);
}
.cms-hero-backdrop img,
.cms-hero-backdrop video,
.cms-hero-backdrop iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}
body.has-hero-media .bg-canvas {
  opacity: 0.42;
}

/* كل المحتوى فوق الكانفس */
.nav, .hero, .about, .featured, .work, .letters,
.testi, .clients, .contact, .footer {
  position: relative;
  z-index: 2;
}

/* ====== حبيبات سينمائية ====== */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(8) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-6%, 4%); }
  40% { transform: translate(8%, -3%); }
  60% { transform: translate(-4%, -7%); }
  80% { transform: translate(5%, 6%); }
}

/* ====== شاشة التحميل ====== */
.loader {
  position: fixed; inset: 0;
  background: var(--bg-0);
  z-index: 99999;
  display: grid; place-items: center;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; width: min(360px, 80vw); }
.loader-name {
  font-family: var(--ff-display);
  font-weight: 800; font-size: 1.4rem;
  margin-bottom: 1.25rem; color: var(--text-0);
}
.loader-bar {
  height: 1px; background: var(--bg-3);
  position: relative; overflow: hidden;
}
.loader-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(to left, var(--acc), var(--acc-soft));
  animation: loadBar 2s var(--ease) forwards;
}
@keyframes loadBar { to { width: 100%; } }
.loader-pct {
  margin-top: 0.75rem; font-family: var(--ff-num);
  font-size: 0.85rem; color: var(--text-2);
}

/* ====== الشريط العلوي ====== */
/* لون ثابت من أول تحميل الصفحة — بدون شفافية يظهر من خلالها الهيرو */
.nav {
  position: fixed; top: 0; right: 0; left: 0;
  z-index: 100;
  padding: 1.5rem var(--pad);
  padding-top: max(1.5rem, env(safe-area-inset-top, 0px));
  transition: padding 0.4s var(--ease);
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
}
/* بعد التمرير: ضغط بسيط للارتفاع فقط (اللون ثابت) */
.nav.scrolled {
  padding: 1rem var(--pad);
  padding-top: max(1rem, env(safe-area-inset-top, 0px));
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem;
}
.lang-toggle {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--acc);
  border: 1px solid rgba(196, 120, 84, 0.45);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  flex-shrink: 0;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.lang-toggle:hover {
  background: rgba(196, 120, 84, 0.12);
  color: var(--acc-soft);
}
html[dir="ltr"] .nav-links { flex-direction: row; }
html[dir="ltr"] .nav-link::after {
  right: auto;
  left: 0;
}
.nav-logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--acc); color: var(--acc);
  font-family: var(--ff-display);
  font-weight: 800; font-size: 1.2rem;
  transition: all 0.4s var(--ease);
}
.nav-logo:hover .logo-mark:not(.logo-mark--img) { background: var(--acc); color: var(--bg-0); }
.logo-mark--img {
  padding: 0;
  border: none;
  background: transparent;
  object-fit: contain;
}
.nav-logo:hover .logo-mark--img { opacity: 0.88; }
.logo-text { font-weight: 700; font-size: 0.95rem; }
.nav-links { display: flex; align-items: center; gap: 2.25rem; }
.nav-link.is-active,
.nav-link.is-active i { color: var(--acc); }
.page-inner { padding-top: 6.5rem; }
.page-work-intro { padding-top: 6.5rem; padding-bottom: 1rem; }
.page-inner-hero { padding-top: 6.5rem; }
.nav-link {
  position: relative;
  font-size: 0.95rem;
  color: var(--text-1);
  transition: color 0.3s ease;
  display: flex; align-items: center; gap: 0.55rem;
}
.nav-link i {
  font-family: var(--ff-num);
  font-style: normal;
  font-size: 0.7rem;
  color: var(--acc); font-weight: 500;
}
.nav-link::after {
  content: ''; position: absolute;
  bottom: -6px; right: 0;
  width: 0; height: 1px;
  background: var(--acc);
  transition: width 0.4s var(--ease);
}
.nav-link:hover { color: var(--text-0); }
.nav-link:hover::after { width: 100%; }
.nav-toggle {
  display: none; flex-direction: column; gap: 5px; padding: 0.5rem;
}
.nav-toggle span {
  display: block; width: 24px; height: 1px; background: var(--text-0);
  transition: all 0.4s var(--ease);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ====================================================
   1. البطل — Pinned Scrollytell
   ==================================================== */
.hero {
  position: relative;
  height: 300vh; /* مساحة سكرول للـ pin */
  background: transparent;
}
.hero-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2rem;
  padding: 7rem var(--pad) 2.5rem;
  max-width: var(--max);
  margin: 0 auto;
  overflow: hidden;
}
.hero-top { display: flex; justify-content: flex-end; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  font-size: 0.85rem; color: var(--text-1);
  background: rgba(12, 10, 8, 0.4);
  backdrop-filter: blur(8px);
}
.hero-tag .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 12px var(--acc);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero-stage {
  position: relative;
  width: 100%;
  min-height: 0;
  align-self: stretch;
  isolation: isolate;
}
.hero-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(40px);
  will-change: transform, opacity;
  pointer-events: none;
}
.hero-frame[data-frame="0"] { opacity: 1; transform: translateY(0); pointer-events: auto; visibility: visible; }
.frame-eyebrow {
  font-family: var(--ff-num);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--acc);
  margin-bottom: 1.25rem;
}
.hero-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 11vw, 10rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
  color: var(--text-0);
  text-shadow: 0 4px 60px rgba(0,0,0,0.5);
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.4s var(--ease-out);
  transition-delay: 0.6s;
}
.hero-title .line:nth-child(2) > span { transition-delay: 0.85s; }
.loaded .hero-title .line > span { transform: translateY(0); }

.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--text-1); font-weight: 300;
}

.frame-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 7.5vw, 6.5rem);
  line-height: 1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.03em;
}
.frame-title em {
  font-style: normal;
  color: var(--acc);
  font-weight: 700;
}
.frame-text {
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  color: var(--text-1);
  font-weight: 300;
  line-height: 1.7;
}

.frame-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: flex-end;
}
.stat-big b {
  display: block;
  font-family: var(--ff-num);
  font-weight: 600;
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 0.9;
  color: var(--acc);
  margin-bottom: 0.5rem;
}
.stat-big b em {
  font-style: normal;
  font-size: 0.55em;
  color: var(--acc-soft);
}
.stat-big span {
  font-size: 0.95rem;
  color: var(--text-1);
  font-weight: 300;
}

.hero-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-scroll {
  display: inline-flex; align-items: center;
  gap: 0.85rem;
  font-size: 0.85rem; color: var(--text-2);
}
.scroll-line {
  width: 60px; height: 1px;
  background: var(--text-2);
  position: relative; overflow: hidden;
}
.scroll-line span {
  position: absolute; inset: 0;
  background: var(--acc);
  transform: translateX(100%);
  animation: scrollGo 2.4s ease-in-out infinite;
}
@keyframes scrollGo {
  0%,100% { transform: translateX(100%); }
  50% { transform: translateX(-100%); }
}

.hero-progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  min-width: 200px;
}
.progress-num {
  font-family: var(--ff-num);
  font-size: 0.95rem;
  color: var(--text-1);
}
.progress-num i { color: var(--acc); font-style: normal; font-weight: 600; }
.progress-num em { color: var(--text-2); font-style: normal; margin: 0 0.4rem; }
.progress-bar {
  width: 200px; height: 1px;
  background: var(--bg-3);
  position: relative; overflow: hidden;
}
.progress-bar span {
  display: block; height: 100%;
  background: var(--acc);
  width: 0;
  transition: width 0.1s linear;
}

@media (max-width: 700px) {
  .hero-pin {
    padding: max(6.25rem, calc(5.25rem + env(safe-area-inset-top, 0px))) var(--pad) 2rem;
  }
  .hero-foot { gap: 1.5rem; }
  .progress-bar { width: 140px; }
}

/* ====================================================
   علامة القسم
   ==================================================== */
.section-marker {
  display: flex;
  align-items: flex-end;
  gap: 2rem;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.section-num {
  font-family: var(--ff-num);
  font-weight: 500;
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: 0.85;
  color: var(--bg-3);
  flex-shrink: 0;
}
.section-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
}
.section-label {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 3.2vw, 2.5rem);
  line-height: 1.1;
  color: var(--text-0);
}
.section-desc {
  font-size: 1rem;
  color: var(--text-1);
  max-width: 480px;
}
@media (max-width: 700px) {
  .section-marker { gap: 1rem; margin-bottom: 2.5rem; }
}

/* ====================================================
   2. عنّي
   ==================================================== */
.about {
  padding: 8rem 0 6rem;
  background: linear-gradient(180deg, rgba(12,10,8,0.4), var(--bg-0) 60%);
}
.about-grid {
  display: grid;
  grid-template-columns: 0.8fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; } }
.about-photo { position: relative; margin-top: 2rem; }
.about-photo-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-2);
}
.about-photo-frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(20%) contrast(1.05);
  transition: transform 1.5s var(--ease), filter 1s ease;
}
.about-photo:hover .about-photo-frame img {
  transform: scale(1.04);
  filter: grayscale(0%) contrast(1.1);
}
.photo-corner {
  position: absolute;
  width: 22px; height: 22px;
  border: 0 solid var(--acc);
  transition: all 0.5s var(--ease);
}
.photo-corner-tl { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.photo-corner-tr { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.photo-corner-bl { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.photo-corner-br { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.about-photo:hover .photo-corner { width: 40px; height: 40px; }
.photo-credit {
  display: flex; justify-content: space-between;
  margin-top: 1rem; font-size: 0.8rem; color: var(--text-2);
}
.about-text { padding-top: 1rem; }
.about-lede {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.4;
  margin-bottom: 2rem;
  color: var(--text-0);
}
.about-body {
  font-size: 1.05rem; color: var(--text-1);
  line-height: 1.95; margin-bottom: 2.5rem;
}
.about-skills {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  list-style: none; margin-bottom: 2.5rem;
}
.about-skills li {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  color: var(--text-1);
  transition: all 0.3s ease;
}
.about-skills li:hover {
  border-color: var(--acc);
  color: var(--acc);
  transform: translateY(-2px);
}
.about-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ====================================================
   أزرار
   ==================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  padding: 0.95rem 1.5rem;
  font-size: 0.95rem; font-weight: 700;
  position: relative; overflow: hidden;
  transition: all 0.4s var(--ease);
}
.btn svg { transition: transform 0.4s var(--ease); transform: scaleX(-1); }
.btn:hover svg { transform: scaleX(-1) translateX(4px); }
.btn-primary {
  background: var(--acc); color: var(--bg-0); border: 1px solid var(--acc);
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: var(--text-0);
  transform: translateX(-100%);
  transition: transform 0.5s var(--ease);
  z-index: 0;
}
.btn-primary:hover::before { transform: translateX(0); }
.btn-primary span, .btn-primary svg { position: relative; z-index: 1; }
.btn-ghost {
  border: 1px solid var(--border-strong);
  color: var(--text-0);
}
.btn-ghost:hover { border-color: var(--acc); color: var(--acc); }
.btn-block { width: 100%; justify-content: center; }

/* ====================================================
   3. أعمال مختارة — Carousel (بدون scroll أفقي مثبت)
   ==================================================== */
.featured {
  position: relative;
  overflow-x: clip;
  background: linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 50%, var(--bg-0) 100%);
  padding: clamp(3rem, 8vw, 5rem) 0;
}
.featured-carousel__layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
/* كاروسيل بعرض الصفحة (خارج حواف الـ container الضيقة) */
.featured-carousel__layout .featured-carousel__shell {
  width: 100vw;
  max-width: 100vw;
  margin-inline: calc(50% - 50vw);
  padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
}
/* تنويعات بصرية لتمييز السكشنات */
.featured-warm {
  background:
    radial-gradient(ellipse at 20% 30%, rgba(196,120,84,0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 50%, var(--bg-0) 100%);
}
.featured-cool {
  background:
    radial-gradient(ellipse at 80% 70%, rgba(74,106,138,0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 50%, var(--bg-0) 100%);
}
.featured-intro {
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
  padding-bottom: 0;
  border-bottom: none;
}

.featured-carousel__shell {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  gap: 0.65rem;
  --carousel-gap: 1rem;
  --carousel-card-w: 280px;
}

.featured-carousel__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-block: 0.35rem;
  min-width: 0;
  cursor: grab;
  touch-action: pan-x;
}
.featured-carousel__viewport a.proj-card__link {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.featured-carousel__viewport.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}
html[dir="rtl"] .featured-carousel__viewport {
  direction: ltr;
}
.featured-carousel__viewport::-webkit-scrollbar { display: none; }

.featured-carousel__track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: var(--carousel-gap);
  width: max-content;
  min-height: 0;
  padding-inline: 2px;
}
html[dir="rtl"] .featured-carousel__track {
  direction: rtl;
}

.featured-carousel__nav {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 8, 0.55);
  backdrop-filter: blur(8px);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.featured-carousel__nav:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: rgba(196, 120, 84, 0.12);
}
.featured-carousel__nav:disabled {
  opacity: 0.35;
  pointer-events: none;
}

.featured-carousel__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.featured-num {
  font-family: var(--ff-num);
  font-weight: 500;
  font-size: clamp(4rem, 10vw, 8rem);
  color: var(--bg-3);
  line-height: 0.85;
  display: block;
  margin-bottom: 1rem;
}
.featured-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}
.featured-desc {
  font-size: 1.1rem;
  color: var(--text-1);
  line-height: 1.7;
  margin-bottom: 3rem;
}
.featured-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  color: var(--text-1);
  font-size: 0.9rem;
}
.featured-hint svg { color: var(--acc); transform: scaleX(-1); }

.proj-card {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.featured-carousel .proj-card {
  flex: 0 0 var(--carousel-card-w);
  width: var(--carousel-card-w);
  min-width: 0;
  max-width: none;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.featured-carousel .proj-img {
  aspect-ratio: 4 / 5;
}
.featured-carousel .proj-open-hint {
  opacity: 1;
  font-size: 0.75rem;
}
.featured-carousel .proj-meta h3 {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.25;
}
.proj-card--linked .proj-card__link {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
}
.proj-card--linked:hover .proj-img img { transform: scale(1.03); }
.proj-lock { font-size: 0.85rem; opacity: 0.85; }
.proj-open-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--acc);
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.proj-card--linked:hover .proj-open-hint { opacity: 1; }
.work-catalog { padding: 3rem 0 4rem; }
.work-catalog__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.work-catalog__filter {
  padding: 0.45rem 1rem;
  border-radius: 100px;
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  color: var(--text-1);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.work-catalog__filter.is-active,
.work-catalog__filter:hover {
  border-color: var(--acc);
  color: var(--acc);
  background: rgba(196, 120, 84, 0.1);
}
.work-catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 1.5rem;
}
.work-catalog__grid .proj-card { width: 100%; }
.work-catalog__empty { padding: 2rem 0; }
.proj-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--ff-num);
  color: var(--text-2);
}
.proj-num {
  font-size: 1.1rem;
  color: var(--acc);
  font-weight: 600;
}
.proj-year {
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}
.proj-img {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-2);
  position: relative;
}
.proj-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(20%) brightness(0.9);
  transition: all 0.9s var(--ease);
}
.proj-card:hover .proj-img img {
  filter: grayscale(0%) brightness(1);
  transform: scale(1.06);
}
.proj-img--embed .proj-embed-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}
.proj-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: rgba(12, 10, 8, 0.72);
  border: 1px solid rgba(237, 229, 213, 0.35);
  color: var(--text-0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  padding-inline-start: 0.2rem;
  pointer-events: none;
}
.proj-meta { display: flex; flex-direction: column; gap: 0.35rem; }
.proj-type {
  font-size: 0.82rem;
  color: var(--acc);
}
.proj-meta h3 {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-0);
  transition: color 0.3s ease;
}
.proj-card:hover .proj-meta h3 { color: var(--acc); }
.proj-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-family: var(--ff-num);
  font-size: 0.78rem;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.proj-tags span:not(:nth-child(2n)) {
  color: var(--text-1);
}

.featured-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--ff-num);
  font-size: 0.85rem;
  color: var(--text-1);
}
.featured-progress i { color: var(--acc); font-style: normal; font-weight: 600; }
.featured-bar {
  width: 180px; height: 1px;
  background: var(--bg-3);
  position: relative; overflow: hidden;
}
.featured-bar span {
  display: block; height: 100%; width: 0;
  background: var(--acc);
}

/* الموبايل: الـ horizontal scroll معطّل (الـ class is-horizontal مش بيتطبّق) */
@media (max-width: 900px) {
  .featured-intro { padding: 0 0 1.5rem 0; }
}

/* ====================================================
   4 + 5. كاروسيلات (صور + درون)
   ==================================================== */
.work {
  padding: 6rem 0;
  background: rgba(12, 10, 8, 0.92);
}
.work-alt {
  background: linear-gradient(180deg, rgba(12,10,8,0.92), rgba(17,14,11,0.92) 50%, rgba(12,10,8,0.92));
}

.carousel { position: relative; }
.car-track {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 0.5rem 0 2rem;
  scrollbar-width: none;
  perspective: 1200px;
}
.car-track::-webkit-scrollbar { display: none; }
.car-card {
  flex: 0 0 calc((100% - 3rem) / 3);
  scroll-snap-align: start;
  cursor: none;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease);
}
@media (max-width: 900px) { .car-card { flex: 0 0 calc((100% - 1.5rem) / 2); } }
@media (max-width: 600px) { .car-card { flex: 0 0 82%; } }

.car-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-2);
}
.car-media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(25%) brightness(0.88);
  transition: all 0.9s var(--ease);
}
.car-card:hover .car-media img {
  filter: grayscale(0%) brightness(1);
  transform: scale(1.07);
}
.car-meta { padding-top: 1rem; display: flex; flex-direction: column; gap: 0.35rem; }
.car-tag { font-size: 0.78rem; color: var(--acc); }
.car-meta h3 {
  font-family: var(--ff-display);
  font-weight: 700; font-size: 1.1rem;
  color: var(--text-0);
  transition: color 0.3s ease;
}
.car-card:hover .car-meta h3 { color: var(--acc); }

.car-arrow {
  position: absolute; top: 38%;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(12,10,8,0.7);
  backdrop-filter: blur(8px);
  color: var(--text-0);
  z-index: 10;
  transition: all 0.4s var(--ease);
}
.car-arrow svg { width: 22px; height: 22px; }
.car-arrow:hover {
  border-color: var(--acc); color: var(--acc);
  background: rgba(12,10,8,0.92);
}
.car-arrow-prev { right: -24px; }
.car-arrow-next { left: -24px; }
@media (max-width: 900px) {
  .car-arrow-prev { right: 0; }
  .car-arrow-next { left: 0; }
}

/* ====================================================
   6. حروف ضخمة — "حكاية"
   ==================================================== */
.letters {
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6rem var(--pad);
  background: transparent;
  position: relative;
}
.letters-stage {
  display: flex;
  flex-direction: row-reverse; /* RTL flow */
  gap: clamp(0.5rem, 1vw, 1.5rem);
  align-items: center;
  perspective: 1200px;
}
.big-letter {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(6rem, 22vw, 18rem);
  line-height: 0.85;
  color: var(--text-0);
  display: inline-block;
  letter-spacing: -0.04em;
  will-change: transform, opacity;
  opacity: 0;
  transform: translateY(40px) rotateX(35deg);
  text-shadow:
    0 4px 40px rgba(0,0,0,0.5),
    0 0 80px rgba(196, 120, 84, 0.15);
}
.big-letter:nth-child(odd) { color: var(--acc); }
.letters-caption {
  margin-top: 2.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.letters-caption.in { opacity: 1; transform: translateY(0); }
.letters-caption span {
  font-size: 0.85rem; color: var(--text-2);
  letter-spacing: 0.05em;
}
.letters-caption strong {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  color: var(--text-0);
}

/* ====================================================
   7. آراء العملاء
   ==================================================== */
.testi {
  padding: 7rem 0;
  background: rgba(17,14,11,0.95);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.testi-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}
.testi-card {
  position: relative;
  padding: 2.5rem 2rem 2rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  transition: all 0.5s var(--ease);
}
.testi-card:nth-child(1) { grid-column: span 7; }
.testi-card:nth-child(2) { grid-column: span 5; }
.testi-card:nth-child(3) { grid-column: span 5; }
.testi-card:nth-child(4) { grid-column: span 7; }
@media (max-width: 900px) {
  .testi-card { grid-column: span 12 !important; }
}
.testi-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 100%; height: 1px;
  background: linear-gradient(to left, transparent, var(--acc), transparent);
  transform: scaleX(0);
  transition: transform 0.6s var(--ease);
}
.testi-card:hover { background: var(--bg-3); transform: translateY(-4px); }
.testi-card:hover::before { transform: scaleX(1); }
.testi-quote {
  font-family: var(--ff-display);
  font-size: 4.5rem;
  color: var(--acc);
  line-height: 0.5;
  margin-bottom: 1rem; height: 30px;
}
.testi-card p {
  font-size: 1.05rem; color: var(--text-0);
  line-height: 1.85; margin-bottom: 2rem;
}
.testi-card footer { display: flex; flex-direction: column; gap: 0.2rem; }
.testi-card footer strong {
  font-weight: 700; color: var(--text-0); font-size: 0.95rem;
}
.testi-card footer span { font-size: 0.85rem; color: var(--text-2); }

/* ====================================================
   8. عملاء — marquee
   ==================================================== */
.clients {
  padding: 6rem 0 8rem;
  background: rgba(12,10,8,0.95);
}
.marquee {
  overflow: hidden; position: relative; padding: 2rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.marquee-track {
  display: flex; gap: 4rem;
  width: max-content;
  animation: marquee 35s linear infinite;
}
@keyframes marquee { to { transform: translateX(50%); } }
a.cli-logo {
  display: grid; place-items: center;
  min-width: 180px; height: 60px;
  font-family: var(--ff-display);
  font-size: 1.4rem; font-weight: 700;
  color: var(--text-2);
  transition: color 0.3s ease, transform 0.3s var(--ease);
  text-decoration: none;
  cursor: pointer;
}
a.cli-logo:hover { color: var(--acc); transform: scale(1.02); }
html[dir="ltr"] .marquee-track {
  animation-name: marqueeLtr;
}
@keyframes marqueeLtr {
  to { transform: translateX(-50%); }
}

/* ====================================================
   9. تواصل
   ==================================================== */
.contact {
  padding: 7rem 0;
  background: rgba(12,10,8,0.96);
  position: relative; overflow: hidden;
}
.contact::before {
  content: '';
  position: absolute;
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(196,120,84,0.08), transparent 70%);
  pointer-events: none;
}
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-title {
  font-family: var(--ff-display);
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800; line-height: 0.95;
  letter-spacing: -0.02em; margin-bottom: 1.5rem;
}
.contact-sub {
  font-size: 1.05rem; color: var(--text-1);
  margin-bottom: 3rem; max-width: 400px;
}
.contact-info {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.contact-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}
a.contact-row:hover {
  padding-right: 0.5rem; border-bottom-color: var(--acc);
}
.contact-label { font-size: 0.85rem; color: var(--text-2); }
.contact-value {
  font-size: 1rem; color: var(--text-0); font-weight: 700;
}
.contact-form {
  background: var(--bg-2); padding: 2.5rem;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 1.25rem;
  position: relative;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.8rem; color: var(--text-2); }
.field input, .field textarea {
  background: transparent; border: none;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0;
  color: var(--text-0);
  font: inherit; font-family: var(--ff-base); font-size: 0.95rem;
  transition: border-color 0.3s ease;
  outline: none; resize: vertical;
}
.field input:focus, .field textarea:focus { border-bottom-color: var(--acc); }
.form-msg {
  position: absolute;
  inset-inline-start: 2.5rem;
  inset-inline-end: 2.5rem;
  bottom: -3rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--acc);
  background: rgba(196,120,84,0.08);
  color: var(--acc);
  font-size: 0.9rem; text-align: center;
  opacity: 0;
  transition: all 0.4s var(--ease);
  pointer-events: none;
}
.form-msg.show { opacity: 1; bottom: -3.5rem; }

/* ====================================================
   التذييل
   ==================================================== */
.footer {
  padding: 5rem 0 2rem;
  border-top: 1px solid var(--border);
  background: rgba(17,14,11,0.97);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}
.footer-title {
  font-family: var(--ff-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.2;
  margin: 0;
}
.footer-socials {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
}
html[dir="rtl"] .footer-socials { justify-content: flex-start; }
html[dir="ltr"] .footer-socials { justify-content: flex-end; }

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  color: var(--text-1);
  border: 1px solid var(--border-strong);
  background: rgba(237, 229, 213, 0.03);
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}
.social-icon__svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}
.social-icon:hover,
.social-icon:focus-visible {
  color: var(--acc);
  border-color: var(--acc);
  background: rgba(196, 120, 84, 0.12);
  transform: translateY(-2px);
}
.social-icon:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

.footer-socials--circle .social-icon { border-radius: 50%; }
.footer-socials--rounded .social-icon { border-radius: 14px; }
.footer-socials--square .social-icon { border-radius: 4px; }
.footer-socials--ghost .social-icon {
  border-color: transparent;
  background: rgba(237, 229, 213, 0.06);
}
.footer-socials--ghost .social-icon:hover {
  background: rgba(196, 120, 84, 0.15);
}

@media (max-width: 600px) {
  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .footer-socials {
    justify-content: flex-start;
    width: 100%;
  }
}
.footer-bottom {
  display: flex; justify-content: space-between;
  gap: 1rem; padding-top: 2rem;
  font-size: 0.85rem; color: var(--text-2);
  flex-wrap: wrap;
}
.back-top { color: var(--text-1); transition: color 0.3s ease; }
.back-top:hover { color: var(--acc); }

/* ====== Scroll Reveal ====== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }

/* ====== Mobile ====== */
@media (max-width: 768px) {
  html {
    scroll-padding-top: calc(4.85rem + env(safe-area-inset-top, 0px));
  }

  .nav-inner {
    gap: 1rem;
  }
  .logo-text {
    max-width: min(52vw, 14rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .nav-links {
    position: fixed;
    inset: 0;
    z-index: 99;
    padding-inline: var(--pad);
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
    padding-top: max(7rem, calc(env(safe-area-inset-top, 0px) + 5.75rem));
    background: rgba(12, 10, 8, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.25rem;
    /* LTR: القائمة خارج الشاشة من اليسار */
    transform: translate3d(-100%, 0, 0);
    transition: transform 0.6s var(--ease);
    pointer-events: none;
  }
  html[dir="rtl"] .nav-links {
    /* RTL: انزلاق من اليمين */
    transform: translate3d(100%, 0, 0);
  }
  .nav-links.open {
    transform: translate3d(0, 0, 0);
    pointer-events: auto;
  }
  .nav-link {
    font-size: 1.35rem;
    min-height: 52px;
    padding-block: 0.65rem;
    padding-inline: 0.75rem;
    margin-inline: calc(var(--pad) * -0.35);
    border-radius: 10px;
  }
  .nav-link:active {
    background: rgba(237, 229, 213, 0.06);
  }
  .nav-toggle {
    display: flex;
    z-index: 101;
    min-width: 46px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
  }
  .lang-toggle {
    min-height: 46px;
    min-width: 46px;
    padding-inline: 0.85rem;
  }
  .nav-toggle,
  .lang-toggle {
    -webkit-tap-highlight-color: rgba(196, 120, 84, 0.2);
  }

  .hero-progress {
    min-width: 0;
    max-width: 100%;
    align-items: flex-end;
  }
  .progress-bar {
    width: min(160px, 46vw);
  }

  .contact-form input,
  .contact-form textarea,
  .contact-form select {
    font-size: 16px;
  }

  .btn {
    min-height: 48px;
    -webkit-tap-highlight-color: rgba(196, 120, 84, 0.25);
  }

  .about { padding: 5rem 0; }
  .work, .testi, .contact { padding: 5rem 0; }
  .letters { height: auto; padding: 5rem var(--pad); }
  .footer {
    padding: 3rem 0 max(1.5rem, env(safe-area-inset-bottom, 0px));
  }
  .contact-form { padding: 1.75rem; }
  .form-msg { inset-inline-start: 1.75rem; inset-inline-end: 1.75rem; }
}

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