/* ============================================================
   Haytam Shami - Photography Portfolio
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600&family=Archivo:wght@300;400;500;600&family=Tajawal:wght@200;300;400;500;700&display=swap');

/* ---------- 1. Design tokens ---------- */
:root {
  /* الوضع الداكن (افتراضي) */
  --bg-base:      #0a0a0b;
  --ink:          #f6f4f0;
  --ink-soft:     rgba(246, 244, 240, .66);
  --ink-faint:    rgba(246, 244, 240, .34);
  --line:         rgba(246, 244, 240, .14);
  --line-strong:  rgba(246, 244, 240, .30);
  --accent:       #c9a227;
  --panel:        rgba(12, 12, 13, .72);
  --panel-solid:  #121213;
  --scrim:        linear-gradient(180deg, rgba(6,6,7,.80) 0%, rgba(6,6,7,.64) 45%, rgba(6,6,7,.93) 100%);
  --shadow:       0 18px 60px rgba(0, 0, 0, .55);

  /* مقاسات */
  --wrap:         min(1240px, 92vw);
  --gap:          clamp(1rem, 2.2vw, 1.75rem);
  --sec-y:        clamp(4.5rem, 11vh, 9rem);
  --radius:       2px;

  /* حركة */
  --t-fast:       200ms cubic-bezier(.4, 0, .2, 1);
  --t-mid:        380ms cubic-bezier(.4, 0, .2, 1);
  --t-bg:         900ms cubic-bezier(.4, 0, .2, 1);

  /* طبقات */
  --z-bg: 0; --z-body: 10; --z-nav: 30; --z-lightbox: 50;

  --font-head: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Archivo', system-ui, sans-serif;
}

html.is-ar {
  --font-head: 'Tajawal', system-ui, sans-serif;
  --font-body: 'Tajawal', system-ui, sans-serif;
}

/* الوضع الخشبي الفاتح */
html[data-theme="wood"] {
  --bg-base:      #e8ddcd;
  --ink:          #241a12;
  --ink-soft:     rgba(36, 26, 18, .74);
  --ink-faint:    rgba(36, 26, 18, .45);
  --line:         rgba(36, 26, 18, .24);
  --line-strong:  rgba(36, 26, 18, .44);
  --accent:       #8a5a2b;
  --panel:        rgba(240, 232, 219, .82);
  --panel-solid:  #f1e9dd;
  --scrim:        linear-gradient(180deg, rgba(240,231,216,.72) 0%, rgba(240,231,216,.58) 45%, rgba(240,231,216,.88) 100%);
  --shadow:       0 18px 50px rgba(60, 40, 22, .22);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: color var(--t-bg), background-color var(--t-bg);
}

img, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: #0a0a0b; }

/* ---------- 3. Background layers ---------- */
.bg-stack { position: fixed; inset: 0; z-index: var(--z-bg); pointer-events: none; }

.bg-layer {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity var(--t-bg);
  will-change: opacity;
  /* تنعيم خفيف: بيهدّي تفاصيل الصورة حتى يضل النص هو البطل */
  filter: blur(3px);
  transform: scale(1.04);
}
/* صورة العدسات — الوضع الداكن. الجريدنت احتياطي لو الصورة ما حمّلت */
.bg-layer--dark {
  opacity: 1; background-color: #0a0a0b;
  background-image: url("../img/bg-dark.webp"),
                    radial-gradient(120% 90% at 50% 8%, #26262b 0%, #0d0d0f 48%, #050506 100%);
}
/* صورة المعدات على الخشب — الوضع الفاتح */
.bg-layer--wood {
  opacity: 0; background-color: #d9c6a8;
  background-image: url("../img/bg-wood.webp"),
                    radial-gradient(120% 90% at 50% 12%, #e8d2b2 0%, #cfae86 55%, #a9825a 100%);
}

html[data-theme="wood"] .bg-layer--dark { opacity: 0; }
html[data-theme="wood"] .bg-layer--wood { opacity: 1; filter: blur(7px); transform: scale(1.06); }

/* طبقة تهدئة فوق الخلفية حتى يضل النص مقروء */
.bg-scrim { position: absolute; inset: 0; background: var(--scrim); transition: background var(--t-bg); }

/* ---------- 4. Layout ---------- */
.wrap { width: var(--wrap); margin-inline: auto; }
.page { position: relative; z-index: var(--z-body); }
section { padding-block: var(--sec-y); }

.sec-head { margin-bottom: clamp(2rem, 5vh, 3.5rem); }
.sec-head h2 {
  font-family: var(--font-head);
  font-weight: 300;
  font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  letter-spacing: .01em;
  line-height: 1.15;
}
html.is-en .sec-head h2 { letter-spacing: .04em; }
.sec-head p { color: var(--ink-soft); max-width: 62ch; margin-top: .6rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-body);
  font-size: .74rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 1rem;
}
html.is-ar .eyebrow { letter-spacing: 0; font-size: .82rem; }
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--line-strong); }

/* ---------- 5. Nav ---------- */
.nav {
  position: fixed; inset-inline: 0; top: 0; z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.05rem clamp(1rem, 4vw, 2.5rem);
  transition: background var(--t-mid), backdrop-filter var(--t-mid), border-color var(--t-mid);
  border-bottom: 1px solid transparent;
}
.nav.is-stuck {
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom-color: var(--line);
}

.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-family: var(--font-head); font-weight: 500; font-size: 1.22rem; letter-spacing: .06em; }
html.is-ar .brand b { letter-spacing: 0; font-weight: 700; }
.brand span { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-faint); }
html.is-ar .brand span { letter-spacing: 0; font-size: .74rem; text-transform: none; }
/* على الشاشات الضيقة نخفي الوصف تحت الاسم حتى ما يزدحم الشريط */
@media (max-width: 780px) { .brand span { display: none; } }

.nav-links { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2rem); }
.nav-links a {
  position: relative; font-size: .88rem; letter-spacing: .06em;
  padding-block: .35rem; color: var(--ink-soft); transition: color var(--t-fast);
}
html.is-ar .nav-links a { letter-spacing: 0; font-size: .95rem; }
.nav-links a::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: var(--origin, left);
  transition: transform var(--t-fast);
}
html[dir="rtl"] .nav-links a::after { --origin: right; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }

.nav-tools { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: var(--ink-soft);
  transition: color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { color: var(--ink); background: var(--line); }
.icon-btn svg { width: 19px; height: 19px; }

.lang-btn {
  min-width: 44px; height: 44px; padding-inline: .85rem;
  font-size: .78rem; letter-spacing: .1em;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft);
  transition: color var(--t-fast), border-color var(--t-fast);
}
.lang-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- 6. Hero ---------- */
.hero { min-height: 100svh; display: grid; align-content: center; padding-block: 7rem 5rem; }
.hero h1 {
  font-family: var(--font-head); font-weight: 300;
  font-size: clamp(2.8rem, 9vw, 7rem);
  line-height: .98; letter-spacing: .01em;
}
html.is-en .hero h1 { letter-spacing: .03em; }
html.is-ar .hero h1 { font-weight: 200; line-height: 1.18; }
.hero p { margin-top: 1.4rem; max-width: 46ch; font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--ink-soft); }
.hero-scroll {
  margin-top: clamp(3rem, 8vh, 5rem);
  display: inline-flex; align-items: center; gap: .7rem;
  font-size: .72rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-faint);
}
html.is-ar .hero-scroll { letter-spacing: 0; font-size: .82rem; text-transform: none; }
.hero-scroll i { width: 1px; height: 44px; background: linear-gradient(var(--line-strong), transparent); animation: drop 2.4s ease-in-out infinite; }
@keyframes drop { 0%,100% { transform: scaleY(.45); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

/* ---------- 7. About ---------- */
.about-grid { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .about-grid { grid-template-columns: .9fr 1.1fr; } }
.about-portrait { aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--line); background: var(--panel-solid); }
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.about-text p { font-size: clamp(1.02rem, 1.7vw, 1.2rem); color: var(--ink-soft); max-width: 60ch; }

/* ---------- 8. Services ---------- */
.svc-grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
@media (min-width: 640px)  { .svc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .svc-grid { grid-template-columns: repeat(4, 1fr); } }
.svc { background: var(--bg-base); padding: clamp(1.6rem, 3vw, 2.3rem); transition: background var(--t-mid); }
.svc:hover { background: var(--panel-solid); }
.svc svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 1.1rem; }
.svc h3 { font-family: var(--font-head); font-weight: 500; font-size: 1.28rem; margin-bottom: .5rem; }
html.is-ar .svc h3 { font-weight: 700; font-size: 1.15rem; }
.svc p { font-size: .93rem; color: var(--ink-soft); }

/* ---------- 9. Gallery grid (masonry) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: clamp(1.6rem, 4vh, 2.6rem); }
.filter {
  min-height: 44px; padding: .55rem 1.15rem;
  font-size: .85rem; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-soft);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
html.is-ar .filter { letter-spacing: 0; font-size: .92rem; }
.filter:hover { color: var(--ink); border-color: var(--line-strong); }
.filter[aria-pressed="true"] { color: var(--bg-base); background: var(--ink); border-color: var(--ink); }

.masonry { columns: 1; column-gap: var(--gap); }
@media (min-width: 620px)  { .masonry { columns: 2; } }
@media (min-width: 1024px) { .masonry { columns: 3; } }

.tile {
  position: relative; break-inside: avoid; margin-bottom: var(--gap);
  width: 100%; overflow: hidden; cursor: pointer; display: block;
  background: var(--panel-solid);
  opacity: 0; transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}
.tile.is-in { opacity: 1; transform: none; }
.tile img { width: 100%; transition: transform 620ms cubic-bezier(.4,0,.2,1); }
.tile:hover img { transform: scale(1.045); }

.tile-info {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 2.6rem 1.15rem 1.05rem;
  background: linear-gradient(transparent, rgba(0,0,0,.78));
  color: #fff; opacity: 0; transition: opacity var(--t-mid);
}
.tile:hover .tile-info, .tile:focus-visible .tile-info { opacity: 1; }
.tile-info b { display: block; font-weight: 500; font-size: .98rem; }
.tile-info span { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; opacity: .72; }
html.is-ar .tile-info span { letter-spacing: 0; text-transform: none; }

.tile-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.22); transition: background var(--t-mid); }
.tile:hover .tile-play { background: rgba(0,0,0,.42); }
.tile-play i {
  display: grid; place-items: center;
  width: 58px; height: 58px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%;
  backdrop-filter: blur(3px);
}
.tile-play svg { width: 18px; height: 18px; color: #fff; margin-inline-start: 3px; }

.skeleton {
  aspect-ratio: 3 / 4; margin-bottom: var(--gap); break-inside: avoid;
  background: linear-gradient(100deg, var(--panel-solid) 30%, var(--line) 50%, var(--panel-solid) 70%) 0 0 / 220% 100%;
  animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.empty-state { padding: 4rem 0; text-align: center; color: var(--ink-faint); }

/* ---------- 10. Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: var(--z-lightbox);
  display: grid; grid-template-rows: auto 1fr auto;
  background: rgba(5,5,6,.97); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity var(--t-mid), visibility var(--t-mid);
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 1rem clamp(1rem, 4vw, 2rem); color: #fff; }
.lb-count { font-size: .8rem; letter-spacing: .14em; color: rgba(255,255,255,.6); }
.lb-stage { position: relative; display: grid; place-items: center; padding: 0 clamp(.5rem, 5vw, 4.5rem); overflow: hidden; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: calc(100svh - 200px); width: auto; object-fit: contain; }
.lb-stage iframe { width: min(1100px, 92vw); aspect-ratio: 16 / 9; height: auto; border: 0; }
.lb-foot { padding: 1rem clamp(1rem, 4vw, 2rem) 1.6rem; text-align: center; color: rgba(255,255,255,.82); }
.lb-foot b { display: block; font-family: var(--font-head); font-size: 1.2rem; font-weight: 400; }
.lb-foot span { font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.5); }
html.is-ar .lb-foot span { letter-spacing: 0; text-transform: none; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.22); border-radius: 50%;
  color: #fff; transition: background var(--t-fast), border-color var(--t-fast);
}
.lb-nav:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); }
.lb-nav svg { width: 18px; height: 18px; }
.lb-prev { inset-inline-start: clamp(.4rem, 2vw, 1.5rem); }
.lb-next { inset-inline-end: clamp(.4rem, 2vw, 1.5rem); }
html[dir="rtl"] .lb-prev svg, html[dir="rtl"] .lb-next svg { transform: scaleX(-1); }
@media (max-width: 640px) { .lb-nav { display: none; } }

/* ---------- 11. Contact / footer ---------- */
.contact-links { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }
.c-link {
  display: inline-flex; align-items: center; gap: .65rem;
  min-height: 48px; padding: .7rem 1.4rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: .92rem;
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.c-link svg { width: 18px; height: 18px; }
.c-link:hover { background: var(--ink); color: var(--bg-base); border-color: var(--ink); }

.foot {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  display: flex; flex-wrap: wrap; gap: .6rem 1.5rem;
  justify-content: space-between; align-items: center;
  font-size: .8rem; color: var(--ink-faint);
}

/* ---------- 12. Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal, .tile { opacity: 1; transform: none; }
}

/* ---------- 13. ختم المطوّر ---------- */
.sig {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-body);
  font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-faint);
  transition: color var(--t-mid);
}
html.is-ar .sig { letter-spacing: 0; font-size: .78rem; text-transform: none; }
a.sig { cursor: pointer; }
a.sig:hover .sig-dot { animation-duration: 1.2s; }
.sig:hover { color: var(--ink-soft); }

/* النقطة النابضة */
.sig-dot {
  flex: none; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  animation: sigPulse 2.8s ease-in-out infinite;
}
@keyframes sigPulse {
  0%, 100% { opacity: .3;  transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
  .sig-dot { animation: none; opacity: .6; }
}
