/**
 * ads-banners.css — بنر تبلیغاتی (بهینه، بدون تکرار)
 * v4
 */
:root {
  --ad-banner-max-h: 140px;
  --ad-banner-max-h-md: 150px;
  --ad-banner-max-h-lg: 160px;
  --ad-banner-max-h-solo: 180px;
  --ad-radius: 16px;
}

/* ظرف */
.asy-banners-wrap {
  width: 100%;
  margin: 12px 0 16px;
  box-sizing: border-box;
  content-visibility: auto;
  contain-intrinsic-size: auto 180px;
}

.asy-banners--duo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}

@media (min-width: 560px) {
  .asy-banners--duo {
    grid-template-columns: 1fr 1fr;
  }
  .asy-banners--duo .asy-banner-slot.is-wide,
  .asy-banners--duo .asy-banner-slot:only-child {
    grid-column: 1 / -1;
  }
}

.asy-banner-slot {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* کارت تبلیغ */
.pm-ad {
  margin: 0;
  width: 100%;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: var(--ad-radius);
  overflow: hidden;
}

.pm-ad-hit {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
  border-radius: var(--ad-radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

[data-theme="light"] .pm-ad-hit,
html[data-theme="light"] .pm-ad-hit {
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  border: 1px solid var(--border, #e2e8f0);
}

.pm-ad-hit:active {
  opacity: 0.97;
}

/* تصویر — cover پیش‌فرض، ارتفاع از متغیر (قابل تنظیم در مدیریت) */
.pm-ad-img,
.site-ad-img,
.pm-ad picture,
.pm-ad picture img {
  display: block;
  width: 100%;
  line-height: 0;
}

.pm-ad-img,
.site-ad-img,
.pm-ad picture img {
  height: var(--ad-banner-max-h);
  max-height: var(--ad-banner-max-h);
  object-fit: cover;
  object-position: center;
  background: var(--bg-2, #0f172a);
}

/* contain از کلاس روی wrap */
.asy-banners-wrap.ad-fit-contain .pm-ad-img,
.asy-banners-wrap.ad-fit-contain .site-ad-img,
.asy-banners-wrap.ad-fit-contain .pm-ad picture img {
  object-fit: contain;
  height: auto;
  max-height: var(--ad-banner-max-h);
}

@media (min-width: 560px) {
  .pm-ad-img,
  .site-ad-img,
  .pm-ad picture img {
    height: var(--ad-banner-max-h-md);
    max-height: var(--ad-banner-max-h-md);
  }
  .asy-banners-wrap.ad-fit-contain .pm-ad-img,
  .asy-banners-wrap.ad-fit-contain .pm-ad picture img {
    height: auto;
    max-height: var(--ad-banner-max-h-md);
  }
  .asy-banners--duo .asy-banner-slot:only-child .pm-ad-img,
  .asy-banners--duo .asy-banner-slot:only-child picture img {
    height: var(--ad-banner-max-h-solo);
    max-height: var(--ad-banner-max-h-solo);
  }
  .asy-banners-wrap.ad-fit-contain .asy-banner-slot:only-child .pm-ad-img,
  .asy-banners-wrap.ad-fit-contain .asy-banner-slot:only-child picture img {
    height: auto;
    max-height: var(--ad-banner-max-h-solo);
  }
}

@media (min-width: 900px) {
  .pm-ad-img,
  .site-ad-img,
  .pm-ad picture img {
    height: var(--ad-banner-max-h-lg);
    max-height: var(--ad-banner-max-h-lg);
  }
  .asy-banners-wrap.ad-fit-contain .pm-ad-img,
  .asy-banners-wrap.ad-fit-contain .pm-ad picture img {
    height: auto;
    max-height: var(--ad-banner-max-h-lg);
  }
}

/* HTML / متن */
.pm-ad-html {
  border-radius: var(--ad-radius);
  overflow: hidden;
  line-height: 1.5;
}
.pm-ad-html img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.pm-ad-caption {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pm-ad-hit--text {
  padding: 14px 16px;
  gap: 8px;
}

.pm-ad-chip {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #f59e0b;
  line-height: 1.2;
}

.pm-ad-title {
  font-size: clamp(0.82rem, 2.5vw, 0.95rem);
  font-weight: 800;
  line-height: 1.4;
  word-break: break-word;
}

.pm-ad-desc {
  margin: 0;
  font-size: clamp(0.75rem, 2.2vw, 0.84rem);
  color: var(--muted, #94a3b8);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.pm-ad-cta {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary, #0d9488);
}

/* رزرو خالی */
.pm-ad-reserve-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  max-height: var(--ad-banner-max-h);
  background: repeating-linear-gradient(
    -45deg,
    rgba(148, 163, 184, 0.08),
    rgba(148, 163, 184, 0.08) 8px,
    transparent 8px,
    transparent 16px
  );
}
.pm-ad-reserve-ico {
  font-size: 1.5rem;
  opacity: 0.7;
}

/* درخواست تبلیغ زیر هر بنر */
.pm-ad-order-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted, #64748b);
  text-decoration: none;
  border-radius: 10px;
  border: 1px dashed var(--border, #e2e8f0);
  background: var(--bg-2, #f8fafc);
}
.pm-ad-order-hint:hover {
  color: var(--primary, #0d9488);
  border-color: var(--primary, #0d9488);
}
.pm-ad-order-ico {
  font-weight: 800;
}

/* نوار زیر ردیف */
.asy-banners-order-bar {
  margin-top: 8px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.5;
}
.asy-banners-order-bar a {
  color: var(--muted, #64748b);
  text-decoration: none;
}
.asy-banners-order-bar a:hover,
.asy-banners-order-bar strong {
  color: var(--primary, #0d9488);
}

.ads-between-wrap .asy-banners--duo {
  margin: 8px 0;
}

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