/* ── Adsterra slots ─────────────────────────────────────────────────────
   Reserved heights keep layout stable while the frame is still empty, and an
   unfilled slot (.is-empty) disappears instead of leaving a hole.
   ─────────────────────────────────────────────────────────────────────── */

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  max-width: 728px;
  margin: clamp(1.25rem, 3vw, 2rem) auto;
  padding: 0;
}

.ad-slot-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  opacity: 0.65;
}

.ad-slot-box {
  display: flex;
  justify-content: center;
  width: 100%;
}

.ad-frame {
  display: block;
  border: 0;
  background: transparent;
  color-scheme: light;
  overflow: hidden;
}

/* Leaderboard 728×90 — desktop only; mobile uses the sticky 320×50. */
.ad-slot--leaderboard .ad-frame {
  width: 728px;
  height: 90px;
  max-width: 100%;
}

@media (max-width: 767px) {
  .ad-slot--leaderboard {
    display: none;
  }
}

/* Native banner — fluid width, height driven by the frame's resize report. */
.ad-slot--native .ad-frame {
  width: 100%;
  height: 320px;
}

.ad-slot--native {
  max-width: 728px;
}

/* Sticky 320×50 bar (mobile only) */
.ad-slot--sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: none;
  max-width: none;
  margin: 0;
  padding: 0.35rem 0 max(0.35rem, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -6px 20px rgba(7, 11, 36, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ad-slot--sticky.is-active {
  display: flex;
}

.ad-slot--sticky .ad-frame {
  width: 320px;
  height: 50px;
}

.ad-slot--sticky .ad-slot-label {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 0.35rem;
  background: rgba(255, 255, 255, 0.97);
  font-size: 0.5625rem;
  opacity: 0.5;
}

.ad-slot-close {
  position: absolute;
  top: -1.65rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(7, 11, 36, 0.12);
}

.ad-slot-close:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}

@media (min-width: 768px) {
  .ad-slot--sticky {
    display: none !important;
  }
}

/* While a form field is focused, get out of the way of the keyboard. */
.ad-slot--sticky.is-suppressed {
  display: none;
}

/* Reserve space so content never jumps, then collapse if nothing rendered. */
html.has-ad-sticky body {
  padding-bottom: 4.75rem;
}

@media (min-width: 768px) {
  html.has-ad-sticky body {
    padding-bottom: 0;
  }
}

.ad-slot.is-empty {
  display: none !important;
}

@media print {
  .ad-slot {
    display: none !important;
  }
}
