/* ---------- Advertising System ---------- */
.ad-zone { max-width: 100%; margin-inline: auto; }
.ad-list { display: grid; gap: 14px; justify-items: center; }
.ad-list.ad-slots-2, .ad-list.ad-slots-3, .ad-list.ad-slots-4, .ad-list.ad-slots-5, .ad-list.ad-slots-6 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}
.ad { position: relative; margin-block: 18px; max-width: 100%; width: 100%; text-align: center; }
.ad-sticky_bottom .ad, .ad-popup .ad { margin-block: 0; }
.ad-link { display: inline-block; max-width: 100%; line-height: 0; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1); }
.ad-link img { max-width: 100%; height: auto; display: block; margin-inline: auto; }
.ad-label { display: block; margin-top: 4px; font-size: .68rem; letter-spacing: .02em; color: #8a93a3; }
.ad-html { display: flex; justify-content: center; max-width: 100%; overflow: hidden; }
.ad-html iframe, .ad-html img, .ad-html video { max-width: 100%; }
.ad-dev-mobile { display: none; }
@media (max-width: 767px) { .ad-dev-desktop { display: none; } .ad-dev-mobile { display: block; } }

/* sidebar: sticky half-page unit */
.ad-z-sidebar_sticky { position: sticky; top: 90px; }
.ad-z-sidebar_top .ad, .ad-z-sidebar_sticky .ad { margin-top: 0; }

/* in-article: separate clearly from the text */
.prose-page .ad, .post-body .ad { margin-block: 1.6em; padding-block: 10px; border-block: 1px dashed rgba(0, 125, 183, 0.2); }

/* ad text isolation: never inherit article link underlines or link colors */
.ad-zone a,
.ad-zone a *,
.ad-link,
.ad-native,
.ad-native *,
.ad-text,
.ad-text * {
  text-decoration: none !important;
}
.ad-text strong,
.ad-text .ad-desc,
.ad-text .ad-desc p,
.ad-native strong,
.ad-native .ad-desc,
.ad-native .ad-desc p {
  color: inherit;
}

/* native sponsored card */
.ad-native {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  text-align: start;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  color: inherit;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}
.ad-native:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(0, 0, 0, .25); }
.ad-native-img { aspect-ratio: 16 / 9; background: #f1f5f9; display: block; overflow: hidden; }
.ad-native-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-native-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; align-items: flex-start; }
.ad-native-body strong { font-size: 1.05rem; line-height: 1.5; }
.ad-desc { font-size: .9rem; opacity: .85; line-height: 1.7; display: block; }
.ad-desc p { margin: 0; line-height: inherit; }
.ad-desc p + p { margin-top: .35rem; }
.ad-desc strong, .ad-desc b { font-weight: 700; opacity: 1; }
.ad-cta { display: inline-block; padding: .45rem 1rem; border-radius: 999px; background: #007db7; color: #ffffff !important; font-size: .85rem; font-weight: 700; text-decoration: none !important; }
@media (min-width: 640px) {
  .ad-list.ad-slots-1 .ad-native:has(.ad-native-img) { grid-template-columns: 38% 1fr; }
  .ad-list.ad-slots-1 .ad-native-img { aspect-ratio: auto; min-height: 140px; }
  .ad-list.ad-slots-1 .ad-t-native { max-width: 760px; }
}

/* text ad */
.ad-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: start;
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 16px;
  color: inherit;
}
.ad-text-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ad-text-body strong { font-size: 1.02rem; line-height: 1.5; }
.ad-text .ad-cta { flex-shrink: 0; }
@media (max-width: 520px) { .ad-text { flex-direction: column; align-items: stretch; text-align: center; } }

/* floating formats */
.ad-close {
  position: absolute;
  top: -12px;
  inset-inline-end: -4px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  z-index: 2;
}
.ad-close:hover { background: #007db7; color: #ffffff; border-color: #007db7; }

.ad-sticky_bottom {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 70;
  display: flex;
  justify-content: center;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.ad-sticky_bottom[hidden] { display: none; }
.ad-sticky_bottom .ad-box {
  position: relative;
  pointer-events: auto;
  max-width: min(100%, 760px);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 6px 8px 2px;
  box-shadow: 0 -8px 30px -12px rgba(0, 0, 0, .35);
  animation: ad-rise .35s ease-out;
}
.ad-sticky_bottom .ad-label { margin-top: 2px; }

.ad-popup {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 12, 22, .66);
  backdrop-filter: blur(3px);
}
.ad-popup[hidden] { display: none; }
.ad-popup .ad-box {
  position: relative;
  width: min(100%, 520px);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 20px;
  padding: 18px 16px 12px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
  animation: ad-pop .3s ease-out;
}
.ad-popup .ad-close { top: 8px; inset-inline-end: 8px; }

@keyframes ad-rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes ad-pop { from { transform: scale(.94); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ad-box { animation: none !important; } }
@media print { .ad-zone { display: none !important; } }
