/* web/assets/ads.css — WS-F reserved ad spacing (owner Calis).
 *
 * CLS 0: a slot reserves its space from FIRST PAINT (min-height below), so a
 * Google unit filling later never shifts content. Visible ONLY when the SSR
 * marked the page data-ads="on" (anonymous/free); paid/trial sessions get
 * data-ads="off" and these containers are removed from the HTML entirely.
 * Theme-aware: every colour/size comes from theme.css tokens — all five themes
 * (Rainbow default) work unchanged. 390px-safe: no fixed width, max-width only.
 */
.ad-slot {
  display: none;
  box-sizing: border-box;
  max-width: 100%;
}

[data-ads="on"] .ad-slot {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 280px;            /* reserved space -> CLS 0 */
  margin: var(--space-2xl, 2rem) auto;
  padding: var(--space-sm, 1rem) 0;
  border: 1px dashed var(--border);
  border-radius: var(--radius-panel, 12px);
  background: var(--surface-2);
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}

/* Honest, localized label (AdSense policy: never obscure or imitate content). */
.ad-slot__label {
  display: block;
  margin: 0 auto var(--space-xs, .5rem);
  font: 600 var(--type-micro, .72rem)/1 var(--font-mono, monospace);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}

.ad-slot__unit {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 250px;            /* reserved unit body -> CLS 0 */
  text-align: center;
}

.ad-slot ins.adsbygoogle {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

/* Graceful collapse on adblock / timeout / unconfigured unit: no broken box,
   no CLS. Slots are below-fold and lazy, so the collapse is off-screen. */
.ad-slot--empty,
[data-ads="on"] .ad-slot--empty {
  min-height: 0 !important;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  content-visibility: visible;
}
.ad-slot--empty .ad-slot__label,
.ad-slot--empty .ad-slot__unit { display: none; }

@media (max-width: 480px) {
  [data-ads="on"] .ad-slot { min-height: 250px; }
  .ad-slot__unit { min-height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .ad-slot, .ad-slot * { animation: none !important; transition: none !important; }
}
