/* ==================== Projects Carousel (card slider) ==================== */

.meta-projects {
  padding: 80px 0 72px;
  overflow: hidden;
  background: var(--meta-bg-offwhite, #f8f7f4);
}

.meta-projects__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 36px;
}

.meta-projects__title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-projects__titles h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  color: #111;
}

.meta-projects__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ececea;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.meta-projects__titles p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #666;
  max-width: 520px;
}

[dir="ltr"] .meta-projects__titles {
  text-align: left;
}

[dir="rtl"] .meta-projects__titles {
  text-align: right;
}

.meta-projects__more {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  background: #111;
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
}

.meta-projects__more:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
  color: #fff !important;
}

/* —— Carousel —— */
.meta-projects__carousel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline: max(12px, calc((100vw - 1320px) / 2 + 12px));
}

.meta-projects__arrow {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  z-index: 3;
  transition: background 0.25s ease, opacity 0.25s ease;
}

.meta-projects__arrow:hover {
  background: rgba(0, 0, 0, 0.22);
}

.meta-projects__arrow.swiper-button-disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.meta-projects__slider {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  padding: 4px 0 8px;
  perspective: 1200px;
}

.meta-projects__swiper {
  overflow: visible;
}

.meta-projects__swiper .swiper-slide {
  width: 300px;
  height: auto;
  transform-style: preserve-3d;
}

.meta-projects__card {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5.15;
  border-radius: 24px;
  overflow: hidden;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg) translateZ(0);
  transition: transform 0.55s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
  will-change: transform;
}

.meta-projects__card.is-tilting {
  transition: transform 0.12s ease-out, box-shadow 0.35s ease;
}

.meta-projects__card:hover,
.meta-projects__card:focus-visible {
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
}

.meta-projects__card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.28) 0%,
    rgba(255, 255, 255, 0.06) 28%,
    transparent 52%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.meta-projects__card.is-tilting::after,
.meta-projects__card:hover::after,
.meta-projects__card:focus-visible::after {
  opacity: 1;
}

.meta-projects__card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #1a1a2e;
  filter: grayscale(0) brightness(1);
  transform: scale(1);
  transition: filter 0.5s ease, transform 0.5s ease;
  will-change: filter, transform;
}

.meta-projects__card.is-tilting .meta-projects__card-bg,
.meta-projects__card:hover .meta-projects__card-bg,
.meta-projects__card:focus-visible .meta-projects__card-bg {
  filter: grayscale(0) brightness(1.05);
  transform: scale(1.05);
}

.meta-projects__card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0.15) 45%,
    rgba(0, 0, 0, 0.72) 100%
  );
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.meta-projects__card:hover .meta-projects__card-overlay,
.meta-projects__card:focus-visible .meta-projects__card-overlay {
  opacity: 0.88;
}

.meta-projects__card-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 22px 22px 20px;
}

[dir="rtl"] .meta-projects__card-body {
  text-align: right;
}

[dir="ltr"] .meta-projects__card-body {
  text-align: left;
}

.meta-projects__card-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
}

.meta-projects__card-desc {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.meta-projects__card-line {
  margin: 0 0 12px;
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.meta-projects__card-cat {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  text-transform: capitalize;
}

.meta-projects__card--fallback .meta-projects__card-bg {
  background: linear-gradient(145deg, #2d2b4e 0%, #871b9c 55%, #c24bda 100%);
}

@media (prefers-reduced-motion: reduce) {
  .meta-projects__card,
  .meta-projects__card-bg,
  .meta-projects__card-overlay {
    transition: none;
  }

  .meta-projects__card:hover .meta-projects__card-bg,
  .meta-projects__card:focus-visible .meta-projects__card-bg {
    transform: none;
  }

  .meta-projects__slider {
    perspective: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .meta-projects__card:hover {
    transform: translateY(-4px);
  }
}

.meta-projects__empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--meta-text-muted, #555);
  font-size: 15px;
}

@media screen and (max-width: 991px) {
  .meta-projects__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
  }

  .meta-projects__more {
    align-self: flex-start;
  }

  [dir="rtl"] .meta-projects__more {
    align-self: flex-end;
  }

  .meta-projects__carousel {
    padding-inline: 12px;
    gap: 6px;
  }

  .meta-projects__arrow {
    width: 36px;
    height: 36px;
    font-size: 11px;
    flex-shrink: 0;
  }

  /* عرض 1.5 مشروع — العرض يُحسب من Swiper */
  .meta-projects__swiper .swiper-slide {
    width: auto;
    max-width: none;
  }

  .meta-projects__card {
    aspect-ratio: 4 / 4.6;
    border-radius: 20px;
  }

  .meta-projects__card-body {
    padding: 16px 16px 14px;
  }

  .meta-projects__card-title {
    font-size: 17px;
  }

  .meta-projects__card-desc {
    font-size: 12px;
    margin-bottom: 10px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
}

@media screen and (max-width: 575px) {
  .meta-projects {
    padding: 48px 0 44px;
  }

  .meta-projects__count {
    min-width: 42px;
    height: 42px;
    font-size: 13px;
  }

  .meta-projects__carousel {
    padding-inline: 10px;
    gap: 4px;
  }

  .meta-projects__arrow {
    width: 32px;
    height: 32px;
  }

  .meta-projects__swiper .swiper-slide {
    width: auto;
  }

  .meta-projects__card {
    border-radius: 18px;
    aspect-ratio: 4 / 4.4;
  }

  .meta-projects__card-title {
    font-size: 16px;
  }
}
