/* =========================================================
   معرض الصور — Gallery
   Faithful rebuild of Figma node 2207:68 (canvas 1280 / content 1152)
   Background: #f7f7fb  ·  Font: Tajawal (400 / 700)
   All selectors scoped to .gallery — no :root / global styling.
   ========================================================= */

.gallery {
  direction: rtl;
  width: 100%;
  box-sizing: border-box;
  background: #f7f7fb;
  padding: 96px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  font-family: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

.gallery *,
.gallery *::before,
.gallery *::after { box-sizing: border-box; }

/* ---------- head ---------- */
.gallery__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: calc(100% - 48px);
  text-align: center;
}

.gallery__eyebrow {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.42px;
  color: #372873;
}

.gallery__title {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  color: #241b4f;
}

.gallery__sub {
  margin: 0;
  width: 620px;
  max-width: 100%;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--border); /* #6B6790 */
}

.gallery__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  background: #372873;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, filter 0.2s ease;
}
.gallery__cta:hover {
  filter: brightness(1.12);
  box-shadow: 0 10px 26px rgba(55, 40, 115, 0.35);
  transform: translateY(-1px);
}

/* ---------- grid ---------- */
/* grid flows left-to-right to preserve the exact Figma tile arrangement */
.gallery__grid {
  direction: ltr;
  width: 1152px;
  max-width: calc(100% - 48px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gallery__row {
  display: flex;
  gap: 16px;
  width: 100%;
}
.gallery__row--a { height: 360px; }
.gallery__row--b { height: 200px; }

/* row A: big tile + stacked pair */
.gallery__tile--big { flex: 0 0 719px; height: 360px; }

.gallery__col {
  flex: 1 1 auto;      /* ~417px */
  height: 360px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.gallery__col .gallery__tile { height: 172px; }

/* row B: three equal tiles (~373px each) */
.gallery__row--b .gallery__tile { flex: 1 1 0; height: 200px; }

/* ---------- tile ---------- */
.gallery__tile {
  position: relative;
  margin: 0;
  border: 1px solid rgba(34, 211, 238, 0.16);
  border-radius: 16px;
  overflow: hidden;
  background: #10222e;
  cursor: pointer;                 /* every tile opens in the lightbox */
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.3s ease;
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.gallery__tile--big .gallery__img { object-position: center 32%; }

/* dark scrim on selected tiles (rgba(0,0,0,0.30)) */
.gallery__tile--dim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.30);
  border-radius: 16px;
  pointer-events: none;
}

/* ---------- play button ---------- */
.gallery__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}
.gallery__tile:hover .gallery__play {
  transform: translate(-50%, -50%) scale(1.06);
  background: #fff;
}
.gallery__play svg {
  width: 20px;
  height: 20px;
  display: block;
}
.gallery__play-tri { fill: var(--primary); } /* #2A1E59 */

/* =========================================================
   Responsive reflow
   ========================================================= */
@media (max-width: 900px) {
  .gallery { padding: 72px 0; }
  .gallery__title { font-size: clamp(28px, 6vw, 40px); }

  .gallery__row--a { flex-direction: column; height: auto; }
  .gallery__tile--big { flex: 1 1 auto; width: 100%; height: 300px; }

  .gallery__col { width: 100%; flex-direction: row; height: auto; }
  .gallery__col .gallery__tile { flex: 1 1 0; height: 190px; }

  .gallery__row--b { height: auto; flex-wrap: wrap; }
  .gallery__row--b .gallery__tile { flex: 1 1 200px; height: 190px; }
}

@media (max-width: 560px) {
  .gallery { padding: 56px 0; gap: 24px; }
  .gallery__grid { max-width: calc(100% - 32px); gap: 14px; }
  .gallery__row { gap: 14px; }
  .gallery__title { font-size: 28px; }

  .gallery__tile--big { height: 230px; }
  .gallery__col { flex-direction: column; }
  .gallery__col .gallery__tile { height: 200px; }

  .gallery__row--b { flex-direction: column; }
  .gallery__row--b .gallery__tile { flex: 1 1 auto; height: 200px; }

  .gallery__play { width: 46px; height: 46px; }
  .gallery__play svg { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery__cta,
  .gallery__play { transition: none; }
}


/* =========================================================
   Video tiles + lightbox (gallery play buttons open a video)
   ========================================================= */
.gallery__tile--video { cursor: pointer; }
.gallery__tile--video:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* professional lift + soft shadow on hover for any tile */
.gallery__tile:hover,
.gallery__tile:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 22px 46px rgba(36, 27, 79, 0.34);
  border-color: rgba(172, 217, 26, 0.55);
  z-index: 3;
}
.gallery__tile--video:hover .gallery__play {
  transform: translate(-50%, -50%) scale(1.12);
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(172, 217, 26, 0.5);
}
.gallery__tile--video:hover .gallery__play-tri { fill: #10240a; }

@media (prefers-reduced-motion: reduce) {
  .gallery__tile { transition: none; }
}

.videobox {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.videobox.is-open { display: flex; }
.videobox__backdrop {
  position: absolute; inset: 0;
  background: rgba(5, 7, 15, 0.82);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.videobox__dialog {
  position: relative; z-index: 1;
  display: inline-flex;
  /* wraps tightly around the media at its natural aspect ratio */
  max-width: min(1000px, 92vw);
  max-height: 88vh;
}
.videobox__video {
  width: auto; height: auto;
  max-width: min(1000px, 92vw);
  max-height: 88vh;
  border-radius: 16px; background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  object-fit: contain;
}
.videobox__close {
  position: absolute; top: -14px; inset-inline-end: -14px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: #fff; color: #241b4f;
  font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.videobox__close:hover { filter: brightness(0.95); }

/* lightbox media (image variant) */
.videobox__image {
  width: auto;
  height: auto;
  max-width: min(1000px, 92vw);
  max-height: 88vh;
  border-radius: 16px;
  background: #000;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* prev / next arrows */
.videobox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.videobox__nav:hover { background: rgba(255, 255, 255, 0.28); transform: translateY(-50%) scale(1.08); }
.videobox__nav--prev { left: 24px; }
.videobox__nav--next { right: 24px; }

@media (max-width: 560px) {
  .videobox__nav { width: 44px; height: 44px; font-size: 26px; }
  .videobox__nav--prev { left: 10px; }
  .videobox__nav--next { right: 10px; }
}

@media (max-width: 560px) {
  .videobox { padding: 14px; }
  .videobox__close { top: -10px; inset-inline-end: -6px; width: 40px; height: 40px; font-size: 24px; }
}
