/* -----------------------------------------------------------------------
   Base ad slot
   ----------------------------------------------------------------------- */
.ad-slot {
  position: relative;
  margin: var(--space-4) 0;
}

/* Shared image class — used by all format renderers */
.ad-slot__img-main {
  width: 100%;
  display: block;
  height: auto;
}

/* Shared link wrapper */
.ad-slot__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Shared "Sponsored" text */
.ad-slot__sponsored {
  display: block;
  font-size: 11px;
  color: #888;
  margin-top: 6px;
  font-style: italic;
}

.ad-label {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  color: #888;
  background: rgba(255, 255, 255, .85);
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}

/* -----------------------------------------------------------------------
   Format: banner
   ----------------------------------------------------------------------- */
.ad-slot--banner {
  width: 100%;
  overflow: hidden;
}
.ad-slot--banner .ad-slot__img-main,
.ad-slot--banner img {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  display: block;
}

/* Text-only banner fallback */
.ad-slot__text {
  padding: var(--space-4, 1rem);
}
.ad-slot__text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

/* -----------------------------------------------------------------------
   Format: sidebar
   ----------------------------------------------------------------------- */
.ad-slot--sidebar {
  max-width: 300px;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.ad-slot--sidebar .ad-slot__img-main {
  width: 100%;
  display: block;
  object-fit: cover;   /* desktop: landscape crop looks good */
  max-height: 200px;
}
.ad-slot--sidebar .ad-slot__body {
  padding: 12px 14px 14px;
}
.ad-slot--sidebar .ad-slot__title {
  display: block;
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1a1a2e;
}
.ad-slot--sidebar .ad-slot__content {
  font-size: .8125rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 4px;
}

/* -----------------------------------------------------------------------
   Format: inline
   ----------------------------------------------------------------------- */
.ad-slot--inline {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.ad-slot--inline .ad-slot__inner {
  display: flex;
  text-decoration: none;
  color: inherit;
}
.ad-slot--inline .ad-slot__img {
  width: 120px;
  flex-shrink: 0;
  object-fit: cover;
}
.ad-slot--inline .ad-slot__body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* -----------------------------------------------------------------------
   Format: feed_native (inherits .post-card)
   ----------------------------------------------------------------------- */
.ad-native-card {
  /* inherits .post-card — no extra margin override needed */
}
.post-card__sponsored {
  font-size: 11px;
  color: #888;
  margin-left: 6px;
  font-style: italic;
}
.post-card__avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e5e7eb;
}

/* -----------------------------------------------------------------------
   Format: interstitial
   ----------------------------------------------------------------------- */
.ad-slot--interstitial {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot__overlay-inner {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
  position: relative;
}
.ad-slot__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #e5e7eb;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
}
.ad-slot__close:hover {
  background: #d1d5db;
}

/* -----------------------------------------------------------------------
   Format: video_preroll
   ----------------------------------------------------------------------- */
.ad-slot--video-preroll {
  position: relative;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.ad-slot__video {
  width: 100%;
  display: block;
  max-height: 360px;
  object-fit: contain;
}
.ad-skip-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  border: 1px solid #fff;
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}
.ad-skip-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* -----------------------------------------------------------------------
   Footer leaderboard strip — full width, outside the footer container
   ----------------------------------------------------------------------- */
.footer__ad-strip {
  width: 100%;
  background: #000;
  overflow: hidden;
}
.footer__ad-strip .ad-slot {
  margin: 0;
  width: 100%;
}
.footer__ad-strip .ad-slot--banner img {
  max-height: 90px;
  width: 100%;
  object-fit: cover;
  display: block;
}
.footer__ad-strip .ad-label {
  z-index: 2;
}

/* -----------------------------------------------------------------------
   Mobile responsive — all ad formats adapt to full width on small screens
   ----------------------------------------------------------------------- */
@media (max-width: 768px) {

  /* Every slot takes the full available width */
  .ad-slot {
    width: 100%;
    margin: var(--space-4) 0;
  }

  /* ── Sidebar ad: remove the 300px cap, go full width ── */
  .ad-slot--sidebar {
    max-width: 100%;
    width: 100%;
    border-radius: 8px;
  }

  /* Portrait-style images: use contain so the full image shows */
  .ad-slot--sidebar .ad-slot__img-main {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;   /* show full image — no cropping */
    background: #f5f5f5;   /* neutral fill for any letterbox areas */
    border-radius: 8px 8px 0 0;
  }

  /* ── Banner: taller on mobile, still cover crop ── */
  .ad-slot--banner .ad-slot__img-main,
  .ad-slot--banner img {
    max-height: 180px;
    object-fit: cover;
  }

  /* ── Inline: stack vertically on mobile ── */
  .ad-slot--inline .ad-slot__inner {
    flex-direction: column;
  }
  .ad-slot--inline .ad-slot__img,
  .ad-slot--inline .ad-slot__img-main {
    width: 100%;
    height: 180px;
    object-fit: cover;
  }

  /* ── Native feed ad: full width card ── */
  .ad-native-card {
    width: 100%;
  }

  /* ── Video preroll: full width ── */
  .ad-slot--video-preroll {
    width: 100%;
    border-radius: 8px;
  }
  .ad-slot__video {
    max-height: 220px;
  }

  /* ── Interstitial overlay: padding so content doesn't touch edges ── */
  .ad-slot__overlay-inner {
    width: 92%;
    padding: 20px 16px;
  }

  /* ── Footer leaderboard ── */
  .footer__ad-strip .ad-slot--banner img,
  .footer__ad-strip .ad-slot--banner .ad-slot__img-main {
    max-height: 100px;
  }
}

/* Portrait images without explicit dimensions — always contain on mobile */
@media (max-width: 768px) {
  .ad-slot--sidebar .ad-slot__img-main {
    object-fit: contain;
    background: #f5f5f5;
  }
}
