/* ==========================================================
   أحمد الفهيد | Ahmed Al-Fuhaid — Portfolio Stylesheet
   Pure Vanilla CSS3 · RTL · Mobile First
   ========================================================== */

/* ------------------------- 1. الرموز ---------------------- */
:root {
  --white: #ffffff;
  --black: #000000;
  --teal: #28c9a9;
  --teal-dark: #1fa88c;
  --teal-soft: rgba(40, 201, 169, 0.12);

  --ink: #0a0a0a;
  --muted: #6b7280;
  --line: #ececec;
  --surface: #fafafa;

  --header-h: 68px;
  --radius: 14px;
  --radius-lg: 22px;
  --max: 1180px;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.16);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------- 2. الأساس ---------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--white);
  color: var(--ink);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

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

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

::selection { background: var(--teal); color: var(--white); }

/* ------------------------- 3. الهيدر ---------------------- */
.header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}

.header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.header__inner {
  height: 100%;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
}

/* اليمين: البحث · المنتصف: الشعار · اليسار: القائمة */
.header__search {
  grid-column: 1;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  color: var(--teal);
  transition: background .25s var(--ease), transform .25s var(--ease);
}
.header__search:hover { background: var(--teal-soft); transform: scale(1.06); }

.header__logo {
  grid-column: 2;
  display: grid;
  place-items: center;
  min-width: 0;
}
.header__logo img {
  height: clamp(30px, 7vw, 38px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
  transition: opacity .25s var(--ease);
}
.header__logo:hover img { opacity: .72; }

.header__menu {
  grid-column: 3;
  justify-self: start;
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 6px 18px rgba(40, 201, 169, 0.35);
  transition: transform .25s var(--ease), background .25s var(--ease);
}
.header__menu:hover { background: var(--teal-dark); transform: scale(1.06); }
.header__menu:active { transform: scale(0.95); }

/* ------------------------- 4. البحث ----------------------- */
.searchbar {
  position: fixed;
  inset-block-start: var(--header-h);
  inset-inline: 0;
  z-index: 55;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transform: translateY(-110%);
  transition: transform .35s var(--ease);
}
.searchbar.is-open { transform: translateY(0); }

.searchbar__inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 14px;
}

.searchbar input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.searchbar input:focus { border-color: var(--teal); background: var(--white); }

.searchbar__close { color: var(--muted); padding: 8px; }

/* ------------------------- 5. القائمة الجانبية ------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }

/* القائمة تنزلق من الحافة اليسرى — حيث يقع زر الهامبرغر.
   نستخدم left/translateX الفيزيائيين عمداً: الخصائص المنطقية
   (inset-inline-start) تنعكس في RTL بينما translateX لا ينعكس،
   فينتج عنها ظهور القائمة في منتصف الشاشة بدل إخفائها. */
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  width: min(320px, 84vw);
  background: var(--white);
  box-shadow: 6px 0 34px rgba(0, 0, 0, .14);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .4s var(--ease), visibility .4s;
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: 1.15rem; font-weight: 900; }
.drawer__close {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--surface);
  transition: background .2s var(--ease);
}
.drawer__close:hover { background: var(--line); }

.drawer__nav { padding-block: 18px; display: grid; gap: 4px; }
.drawer__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  font-weight: 700;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.drawer__link:hover,
.drawer__link.is-active { background: var(--teal-soft); color: var(--teal-dark); }
.drawer__link svg { width: 20px; height: 20px; flex: none; }

.drawer__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.drawer__social { display: flex; gap: 10px; }
.drawer__social a {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.drawer__social a:hover { background: var(--teal); transform: translateY(-2px); }

/* ------------------------- 6. الهيرو ---------------------- */
.hero {
  position: relative;
  min-height: min(74vh, 620px);
  display: grid;
  place-items: center;
  background: var(--black);
  overflow: hidden;
  isolation: isolate;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.hero__media img,
.hero__media > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.hero__media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.55) 0%,
    rgba(0, 0, 0, 0.25) 38%,
    rgba(0, 0, 0, 0.72) 100%);
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: var(--white);
  padding: 60px 20px 110px;
  animation: rise .9s var(--ease) both;
}

.hero__title { margin: 0; }
.hero__title img {
  width: min(460px, 78vw);
  height: auto;
  margin-inline: auto;
  filter: drop-shadow(0 10px 40px rgba(0, 0, 0, .55));
}

.hero__tagline {
  margin: 10px auto 0;
  max-width: 40ch;
  font-size: clamp(0.95rem, 3.6vw, 1.1rem);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* الموجة السفلية */
.hero__wave {
  position: absolute;
  inset-inline: 0;
  bottom: -1px;
  z-index: 3;
  width: 100%;
  height: clamp(56px, 10vw, 108px);
  display: block;
  color: var(--white);
  pointer-events: none;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------- 7. رأس القسم ------------------- */
.section { padding-block: clamp(34px, 7vw, 64px); }

.section-head { text-align: center; margin-bottom: clamp(24px, 5vw, 42px); }

.section-head__icon {
  display: inline-grid;
  place-items: center;
  width: 72px; height: 72px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal-dark);
}
.section-head__icon svg { width: 38px; height: 38px; }

.section-head__title {
  font-size: clamp(1.7rem, 6.6vw, 2.6rem);
  font-weight: 900;
}

.section-head__sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.section-head__rule {
  width: 62px; height: 4px;
  margin: 16px auto 0;
  border-radius: 999px;
  background: var(--teal);
}

/* ------------------------- 8. فلاتر التصنيف --------------- */
.filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-block: 4px 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filters::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: 9px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all .25s var(--ease);
}
.chip:hover { border-color: var(--teal); color: var(--teal-dark); }
.chip.is-active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
}

/* ------------------------- 9. شبكة الكروت ----------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));  /* عمودان على الجوال */
  gap: 12px;
}

@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, 1fr); gap: 20px; } }

.card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--black);
  box-shadow: var(--shadow-sm);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); }

.card__media {
  position: relative;
  aspect-ratio: 1 / 1;          /* مربع 1:1 */
  background: var(--surface);
  overflow: hidden;
}
.card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease);
}
.card:hover .card__media img { transform: scale(1.07); }

.card__count {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: var(--white);
  font-size: 0.72rem;
  font-weight: 700;
}
.card__count svg { width: 13px; height: 13px; }

/* الشريط الأسود السفلي */
.card__bar {
  background: var(--black);
  color: var(--white);
  padding: 11px 12px 13px;
  text-align: center;
}
.card__name {
  font-size: clamp(0.86rem, 3.4vw, 1rem);
  font-weight: 900;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__date {
  margin-top: 2px;
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.02em;
}

/* ------------------------ 10. الحالات --------------------- */
.skeleton {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.skeleton__box {
  aspect-ratio: 1 / 1;
  background: linear-gradient(100deg, #f1f1f1 30%, #e6e6e6 50%, #f1f1f1 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton__bar { height: 56px; background: #ededed; }

@keyframes shimmer {
  from { background-position: 220% 0; }
  to { background-position: -20% 0; }
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 20px;
  color: var(--muted);
}
.empty svg { width: 46px; height: 46px; color: var(--teal); margin-bottom: 12px; }
.empty p { margin: 0; font-weight: 700; }

/* ------------------------ 11. الألبوم الفردي -------------- */
.album-hero {
  padding-block: clamp(26px, 6vw, 46px) 0;
  text-align: center;
}

.album-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  transition: color .2s var(--ease);
}
.album-back:hover { color: var(--teal-dark); }
.album-back svg { width: 17px; height: 17px; }

.album-title {
  font-size: clamp(1.9rem, 7.5vw, 3rem);
  font-weight: 900;
}

.album-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.album-meta span { display: inline-flex; align-items: center; gap: 6px; }
.album-meta svg { width: 16px; height: 16px; color: var(--teal); }

/* المخطوطة */
.calligraphy {
  position: relative;
  margin: clamp(24px, 5vw, 38px) auto 0;
  max-width: 640px;
  padding: clamp(24px, 5vw, 38px) clamp(20px, 5vw, 42px);
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.calligraphy::before,
.calligraphy::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}
.calligraphy::before { top: 0; }
.calligraphy::after { bottom: 0; }

.calligraphy p {
  margin: 0;
  font-family: 'Amiri', 'Cairo', serif;
  font-size: clamp(1.25rem, 5.4vw, 1.85rem);
  font-weight: 700;
  line-height: 2;
  color: var(--ink);
}
.calligraphy small {
  display: block;
  margin-top: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--teal-dark);
}

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 30px;
  border-radius: 999px;              /* بيضاوي */
  font-weight: 800;
  font-size: 0.95rem;
  transition: transform .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.btn svg { width: 19px; height: 19px; }

.btn--dark {
  background: var(--black);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn--dark:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn--dark:active { transform: translateY(0); }

.btn--teal { background: var(--teal); color: var(--white); }
.btn--teal:hover { background: var(--teal-dark); transform: translateY(-2px); }

.btn--ghost { border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--teal); color: var(--teal-dark); }

.album-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: clamp(20px, 4vw, 30px);
}

/* مشغل يوتيوب */
.video {
  position: relative;
  margin-top: clamp(28px, 6vw, 46px);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--black);
  box-shadow: var(--shadow-md);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video__poster {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.video__poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video__play {
  position: relative;
  display: grid; place-items: center;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  box-shadow: 0 10px 34px rgba(40, 201, 169, 0.5);
  transition: transform .3s var(--ease);
}
.video__poster:hover .video__play { transform: scale(1.1); }
.video__play svg { width: 30px; height: 30px; margin-inline-start: 3px; }

/* التدفق الرأسي للصور */
.stream {
  display: grid;
  gap: clamp(10px, 2.5vw, 18px);
  margin-top: clamp(28px, 6vw, 46px);
  max-width: 900px;
  margin-inline: auto;
}

.stream__item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
}
.stream__item img {
  width: 100%;
  display: block;
  transition: transform .5s var(--ease), opacity .5s var(--ease);
  opacity: 0;
}
.stream__item img.is-loaded { opacity: 1; }
.stream__item:hover img { transform: scale(1.015); }

/* صندوق المشاركة */
.share {
  margin: clamp(34px, 7vw, 54px) auto 0;
  max-width: 620px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}
.share h3 { font-size: 1.1rem; margin-bottom: 14px; }
.share__row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.share__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--white);
  transition: transform .2s var(--ease), filter .2s var(--ease);
}
.share__btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.share__btn svg { width: 17px; height: 17px; }
.share__btn--wa { background: #25d366; }
.share__btn--x { background: #000000; }
.share__btn--native { background: var(--teal); }
.share__btn--copy { background: var(--muted); }

/* شريط الإجراءات السفلي للجوال */
.actionbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  transform: translateY(110%);
  transition: transform .35s var(--ease);
}
.actionbar.is-visible { transform: translateY(0); }
.actionbar .btn { flex: 1; padding: 13px 12px; font-size: 0.88rem; }

@media (min-width: 768px) { .actionbar { display: none; } }
body.has-actionbar { padding-bottom: 78px; }
@media (min-width: 768px) { body.has-actionbar { padding-bottom: 0; } }

/* ------------------------ 12. اللايتبوكس ------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.96);
  display: grid;
  grid-template-rows: auto 1fr auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s;
  touch-action: none;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px calc(14px + env(safe-area-inset-top));
  color: rgba(255, 255, 255, 0.8);
  font-weight: 700;
  font-size: 0.9rem;
}
.lightbox__close,
.lightbox__nav {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  transition: background .2s var(--ease);
}
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox__stage {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.lightbox__track {
  display: flex;
  height: 100%;
  width: 100%;
  will-change: transform;
}
.lightbox__slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  padding: 8px 14px;
}
.lightbox__slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox__bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
}

/* ------------------------ 13. الفوتر ---------------------- */
.footer {
  margin-top: clamp(46px, 9vw, 80px);
  background: var(--black);
  color: rgba(255, 255, 255, 0.72);
  padding-block: 44px 34px;
  text-align: center;
}
.footer__logo img { width: min(280px, 62vw); height: auto; margin-inline: auto; }
.footer__tag { margin: 14px 0 20px; font-size: 0.88rem; }
.footer__social { display: flex; justify-content: center; gap: 10px; margin-bottom: 22px; }
.footer__social a {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--white);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.footer__social a:hover { background: var(--teal); border-color: var(--teal); }
.footer__copy {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
}

/* ------------------------ 14. التوست --------------------- */
.toast {
  position: fixed;
  bottom: 90px;
  inset-inline: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.toast__msg {
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.toast__msg.is-visible { opacity: 1; transform: none; }

/* ------------------------ 15. الظهور التدريجي ------------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .7s var(--ease), transform .7s var(--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 { opacity: 1; transform: none; }
}
