/* AGS stat cards — Al-Ammary layout, AGS blue theme */
:root {
  --ags-stats-blue: #1653ac;
  --ags-stats-blue-dark: #0e2a5a;
  --ags-stats-light: #eef3fb;
}

#home-stats {
  scroll-margin-top: 110px;
}

.ags-stats-sec {
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.25rem, 4vw, 3rem);
  background: #fff;
}

.ags-stats-wrap {
  max-width: 1140px;
  margin: 0 auto;
}

.ags-stats-grid {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  overflow: visible;
}

.ags-stats-cell {
  flex: 1 1 0;
  min-width: 0;
  transition: flex 0.4s ease-in-out;
  cursor: pointer;
}

.ags-stats-cell.custom-active {
  flex: 1.65 1 0;
}

.ags-stats-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  height: 100%;
  min-height: 31.75rem;
  z-index: 1;
}

.ags-stats-item figure {
  margin: 0;
  position: relative;
  height: 100%;
  min-height: 31.75rem;
  overflow: hidden;
  border-radius: 0.5rem;
  border: 1px solid rgba(22, 83, 172, 0.08);
}

.ags-stats-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    20% 50% at 122.9% 7.9%,
    rgba(14, 42, 90, 0) 0%,
    var(--ags-stats-blue-dark) 100%
  );
  z-index: 1;
  transition: opacity 0.4s ease-in-out;
}

.ags-stats-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(14, 42, 90, 0.15) 0%,
    rgba(14, 42, 90, 0.55) 45%,
    rgba(14, 42, 90, 0.92) 100%
  );
  z-index: 2;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.ags-stats-item figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.ags-stats-item .ags-stats-detail {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  color: #fff;
}

.ags-stats-detail strong {
  display: block;
  margin-bottom: auto;
  font-size: clamp(3.5rem, 8vw, 5.625rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ags-stats-detail h3 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ags-stats-detail p {
  margin: 0;
  max-width: 28rem;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ags-stats-light);
  font-weight: 400;
  position: absolute;
  top: 100%;
  transition: all 0.4s ease-in-out;
}

.ags-stats-grid .ags-stats-cell.custom-active .ags-stats-item .ags-stats-detail p {
  position: unset;
}

.ags-stats-grid .ags-stats-cell.custom-active .ags-stats-item::before {
  opacity: 0;
}

.ags-stats-grid .ags-stats-cell.custom-active .ags-stats-item::after,
.ags-stats-grid .ags-stats-cell.custom-active .ags-stats-item figure img {
  opacity: 1;
}

.ags-stats-grid .ags-stats-cell:not(.custom-active) .ags-stats-item .ags-stats-detail p {
  position: absolute;
  top: 100%;
}

@media (max-width: 767px) {
  .ags-stats-grid {
    flex-direction: column;
    gap: 1rem;
  }

  .ags-stats-cell,
  .ags-stats-cell.custom-active {
    flex: 1 1 auto;
  }

  .ags-stats-item,
  .ags-stats-item figure {
    min-height: 22rem;
  }

  .ags-stats-grid .ags-stats-cell .ags-stats-item .ags-stats-detail p {
    position: unset;
  }

  .ags-stats-grid .ags-stats-cell .ags-stats-item::before {
    opacity: 0;
  }

  .ags-stats-grid .ags-stats-cell .ags-stats-item::after,
  .ags-stats-grid .ags-stats-cell .ags-stats-item figure img {
    opacity: 1;
  }
}
