/* ── حقائق وأرقام ── */
#stats.stats-block {
  --st-blue: #1b355b;
  --st-blue-light: #254a7a;
  --st-brown: #a0874c;
  --st-brown-dark: #7a5a2a;
  --st-gold: #c9a96e;
  --st-cream: #f6f3ed;
  padding: 0 !important;
  background: var(--st-cream) !important;
  position: relative;
  overflow: hidden;
}

.stats-block__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.stats-block__bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 88% 12%, rgba(27, 53, 91, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 8% 88%, rgba(160, 135, 76, 0.12), transparent);
}
.stats-block__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("/assets/img/%D8%B4%D8%B9%D8%A7%D8%B1%20%D8%A7%D9%84%D9%88%D9%82%D9%81%20%D8%B4%D9%81%D8%A7%D9%81%D8%A7.png");
  background-size: 140px;
  background-repeat: repeat;
  animation: st-watermark 52s linear infinite;
}
@keyframes st-watermark {
  0% { background-position: 0 0; }
  100% { background-position: 280px 200px; }
}

.stats-block__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 28px 80px;
  position: relative;
  z-index: 2;
}

/* ── العنوان ── */
.stats-header {
  text-align: center;
  margin-bottom: 48px;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.stats-block.is-visible .stats-header {
  opacity: 1;
  transform: translateY(0);
}
.stats-header__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--st-brown), var(--st-brown-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  box-shadow: 0 10px 28px rgba(160, 135, 76, 0.4);
  animation: st-icon-pulse 3.5s ease-in-out infinite;
}
@keyframes st-icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
.stats-header h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 800;
  color: var(--st-blue);
}
.stats-header__sub {
  margin: 0 auto;
  max-width: 540px;
  color: #5a6472;
  font-size: 1.02rem;
  line-height: 1.7;
}
.stats-header__line {
  width: 90px;
  height: 4px;
  margin: 18px auto 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--st-brown), var(--st-gold), var(--st-brown));
  background-size: 200% 100%;
  animation: st-line-flow 3.5s linear infinite;
}
@keyframes st-line-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ── شبكة البطاقات ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.stat-box {
  background: #fff;
  border-radius: 20px;
  padding: 32px 22px 28px;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(27, 53, 91, 0.08);
  box-shadow: 0 10px 32px rgba(27, 53, 91, 0.08);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s, border-color 0.35s;
  opacity: 0;
  transform: translateY(32px);
}
.stats-block.is-visible .stat-box {
  animation: st-card-enter 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.stat-box:nth-child(1) { animation-delay: 0.15s; }
.stat-box:nth-child(2) { animation-delay: 0.28s; }
.stat-box:nth-child(3) { animation-delay: 0.41s; }
.stat-box:nth-child(4) { animation-delay: 0.54s; }
@keyframes st-card-enter {
  to { opacity: 1; transform: translateY(0); }
}

.stat-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--st-blue), var(--st-brown));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.stats-block.is-visible .stat-box::before {
  transform: scaleX(1);
}
.stat-box:nth-child(1)::before { transition-delay: 0.35s; }
.stat-box:nth-child(2)::before { transition-delay: 0.48s; }
.stat-box:nth-child(3)::before { transition-delay: 0.61s; }
.stat-box:nth-child(4)::before { transition-delay: 0.74s; }

.stat-box:hover {
  transform: translateY(-8px);
  border-color: rgba(160, 135, 76, 0.45);
  box-shadow: 0 18px 44px rgba(27, 53, 91, 0.14);
}

.stat-box__icon-wrap {
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(27, 53, 91, 0.06), rgba(27, 53, 91, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.35s, transform 0.4s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.stat-box:hover .stat-box__icon-wrap {
  background: linear-gradient(145deg, var(--st-blue), var(--st-blue-light));
  transform: scale(1.08) rotate(-3deg);
}

.stat-box .icon-image {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  transition: filter 0.35s;
}
.stat-box:hover .icon-image {
  filter: brightness(0) invert(1);
}

.stat-box .num {
  display: block;
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 800;
  color: var(--st-brown);
  margin: 4px 0 10px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-box .num.counting {
  animation: st-num-glow 0.6s ease;
}
@keyframes st-num-glow {
  0%, 100% { color: var(--st-brown); }
  50% { color: var(--st-blue); }
}

.stat-box .label {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--st-blue);
  line-height: 1.45;
}

.stat-box.reveal-in {
  opacity: 1;
  transform: translateY(0);
}

/* ── استجابة ── */
@media (max-width: 992px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (max-width: 520px) {
  .stats-block__inner { padding: 52px 16px 60px; }
  .stats-grid { gap: 16px; }
  .stat-box { padding: 26px 16px 22px; }
  .stat-box__icon-wrap { width: 68px; height: 68px; }
  .stat-box .icon-image { width: 38px; height: 38px; }
}
