.gallery-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
  width: 100%;
  padding: 0 0 80px;
}

.gallery-grid__header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.gallery-grid__tabs {
  display: flex;
  align-items: center;
  gap: 24px;
}

.gallery-grid__tab {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 123px; /* Figma: hər tab 123×43px, alt xətt bu enə qədər uzanır */
  height: 43px;
  padding: 9px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  font-family: var(--font-family);
  font-weight: 400;
  font-size: 18px;
  line-height: 24px;
  letter-spacing: 1px;
  color: #0f2942;
  cursor: pointer;
}

.gallery-grid__tab.is-active {
  font-weight: 500;
  color: #2386c8;
  border-bottom-color: #2386c8;
}

/* Tam-en (full-bleed) marquee: .page-main-in konteynerindən çıxıb bütün viewport enini tutur */
.gallery-grid__track {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  overflow: hidden;
}

.gallery-grid__track-inner {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: gallery-marquee 40s linear infinite;
}

/* Track-inner içində eyni 6 sütun iki dəfə təkrarlanır (bax gallery.html) — animasiya məhz -50% qədər sürüşdüyü üçün
   ikinci dəst tam birincinin yerinə keçir və fasilə hiss olunmadan dövr təkrarlanır. */
@keyframes gallery-marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.gallery-grid__column {
  display: flex;
  flex-direction: column;
  flex: 0 0 318px;
  gap: 12px;
}

.gallery-grid__column--offset {
  margin-top: 17px;
}

.gallery-grid__item {
  display: block;
  width: 100%;
  height: 222px;
  border-radius: 24px;
  object-fit: cover;
  background-color: #d9d9d9;
}

/* Ox düymələri yalnız mobildə görünür */
.gallery-grid__nav {
  display: none;
}

/*
 * Figma mobil (390px) dizaynı: marquee əvəzinə oxlarla idarə olunan üfüqi carousel
 * (js/gallery.js → Carousel.js, scroll konteyneri .gallery-grid__track-inner).
 * Sütun 244.8px, şəkil 170.9px, aralar 9.24px, stagger 13px, radius 18.5px.
 * Grid → oxlar 40px.
 */
@media (max-width: 600px) {
  .gallery-grid__tab {
    min-width: 123px; /* Figma: hər tab 123px, alt xətt bu enə qədər uzanır */
    font-size: 16px;
    line-height: 24px;
  }

  .gallery-grid__track-inner {
    width: auto;
    gap: 9.24px;
    padding: 0 var(--page-pad-x);
    scroll-padding-inline: var(--page-pad-x);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    animation: none;
  }

  .gallery-grid__track-inner::-webkit-scrollbar {
    display: none;
  }

  /* Marquee üçün olan dublikat dəst mobildə lazım deyil */
  .gallery-grid__column[aria-hidden="true"] {
    display: none;
  }

  .gallery-grid__column {
    flex: 0 0 244.8px;
    gap: 9.24px;
    scroll-snap-align: start;
  }

  .gallery-grid__column--offset {
    margin-top: 13px;
  }

  .gallery-grid__item {
    height: 170.9px;
    border-radius: 18.5px;
  }

  .gallery-grid__nav {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
  }

  .gallery-grid__arrow {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 5px;
    border: 1px solid #0f2942;
    border-radius: 9999px;
    background: none;
    color: #0f2942;
    cursor: pointer;
  }

  .gallery-grid__arrow svg {
    width: 30px;
    height: 30px;
  }

  .gallery-grid__arrow:disabled {
    border-color: #b7b7b7;
    color: #b7b7b7;
    cursor: not-allowed;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-grid__track-inner {
    animation: none;
  }
}

/* "Videolar" tab-ı: statik, üç sətirlik qarışıq-ölçülü kart grid-i (Figma: 2 geniş + 3 dar + 2 geniş).
   Full-bleed marquee-dən fərqli olaraq bu, `.page-main`-in normal 1280px konteynerində qalır. */
.gallery-videos {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.gallery-videos__row {
  display: flex;
  gap: 20px;
  height: 354px;
}

.gallery-videos__card {
  position: relative;
  display: block;
  flex: 1;
  min-width: 0;
  border-radius: 24px;
  overflow: hidden;
  background-color: #d9d9d9;
  background-size: cover;
  background-position: center;
  text-decoration: none;
}

/* Hover — "Fəaliyyətlərimiz" kartları ilə eyni məntiq (css/activities.css): şəkil
   scale(1.1235) ilə böyüyür (kənarlar overflow:hidden ilə kəsilir), gradientin 0.2 nöqtəsi
   65.61% → 89.13%-ə qalxır. ::before kartın inline background-image-ini miras alıb zoom olur,
   ::after gradientdir (onun üstündə), ikon və başlıq z-index:1 ilə ən üstdə qalır. */
@property --video-grad-stop {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 65.61%;
}

.gallery-videos__card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  transition: transform 0.5s ease;
  pointer-events: none;
}

.gallery-videos__card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0.08deg, rgba(0, 0, 0, 0.8) 17.65%, rgba(0, 0, 0, 0.2) var(--video-grad-stop), rgba(0, 0, 0, 0) 113.57%);
  transition: --video-grad-stop 0.5s ease;
  pointer-events: none;
}

@media (hover: hover) {
  .gallery-videos__card:hover::before {
    transform: scale(1.1235);
  }

  .gallery-videos__card:hover::after {
    --video-grad-stop: 89.13%;
  }
}

.gallery-videos__icon {
  position: absolute;
  left: 31px;
  top: 32px;
  width: 48px;
  height: 48px;
  z-index: 1;
}

.gallery-videos__icon svg {
  width: 100%;
  height: 100%;
}

.gallery-videos__title {
  position: absolute;
  left: 31px;
  right: 24px;
  bottom: 27px;
  z-index: 1;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 24px;
  line-height: 150%;
  color: #ffffff;
}

.gallery-videos__row--narrow .gallery-videos__title {
  left: 24px;
  font-size: 20px;
}

@media (max-width: 900px) {
  .gallery-videos__row {
    flex-direction: column;
    height: auto;
  }

  .gallery-videos__card {
    /* flex:1 (basis 0) collapsed the card to 0px in the column layout (601-900px) */
    flex: none;
    height: 260px;
  }
}

/*
 * Figma mobil (390px) "Videolar": bütün kartlar tam-en kvadrat (350×350), aralar 24px,
 * platforma ikonu 40px sağ-yuxarıda (top/right 20px), başlıq 16px/700 (sol/sağ 20px, alt 33px).
 * Tab-lar → kartlar 48px (Şəkillər-dəki 40px-dən 8px çox).
 */
@media (max-width: 600px) {
  .gallery-grid__panel[data-panel="videos"] {
    margin-top: 8px;
  }

  .gallery-videos,
  .gallery-videos__row {
    gap: 24px;
  }

  .gallery-videos__card {
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 20px;
  }

  .gallery-videos__icon {
    left: auto;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 40px;
  }

  .gallery-videos__title,
  .gallery-videos__row--narrow .gallery-videos__title {
    left: 20px;
    right: 20px;
    bottom: 33px;
    font-weight: 700;
    font-size: 16px;
    line-height: 150%;
  }
}
