/* Keep fallback copy in the reserved ad area and hide only that copy once
   the individual slot confirms that a real creative rendered. */
.network-ad-unit:not(.network-ad-unit--monetag),
.adsense-shell,
.timeline-faves-banner-ad,
.timeline-faves-banner-ad__media {
  position: relative;
}

.network-ad-unit:not(.network-ad-unit--monetag) > [data-ad-placeholder],
.adsense-shell > [data-ad-placeholder] {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  margin: 0;
  pointer-events: none;
}

.timeline-faves-banner-ad {
  grid-template-rows: minmax(0, 1fr);
}

.timeline-faves-banner-ad > .timeline-faves-banner-ad__label,
.timeline-faves-banner-ad__media > .timeline-faves-banner-ad__placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  margin: 0;
  pointer-events: none;
}

.timeline-faves-banner-ad__media > .timeline-faves-banner-ad__link,
.timeline-faves-banner-ad__media > .timeline-faves-banner-ad__image {
  position: relative;
  z-index: 0;
}

.adsense-shell > .adsense-unit {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  min-height: inherit;
}

[data-ad-loaded="true"] > [data-ad-placeholder],
.has-ad > [data-ad-placeholder],
[data-ad-loaded="true"] .profile-page-ad-placeholder,
.has-ad .profile-page-ad-placeholder,
[data-ad-loaded="true"] .adsense-placeholder,
.has-ad .adsense-placeholder,
[data-ad-loaded="true"] .timeline-story-bottom-ad__placeholder,
.has-ad .timeline-story-bottom-ad__placeholder,
[data-ad-loaded="true"] .timeline-faves-banner-ad__placeholder,
.has-ad .timeline-faves-banner-ad__placeholder,
[data-ad-loaded="true"] .ms-doc-access-ad-placeholder,
.has-ad .ms-doc-access-ad-placeholder {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* A confirmed creative owns the slot surface. Remove every piece of fallback
   chrome while retaining the slot's normal outer margin in the page flow. */
:is(
  .network-ad-unit,
  .adsense-shell,
  .profile-page-ad-slot,
  .app-display-ad,
  .timeline-faves-banner-ad,
  [data-story-ad],
  [aria-label="Advertisement"]
)[data-ad-loaded="true"],
:is(
  .network-ad-unit,
  .adsense-shell,
  .profile-page-ad-slot,
  .app-display-ad,
  .timeline-faves-banner-ad,
  [data-story-ad],
  [aria-label="Advertisement"]
).has-ad {
  min-height: 0 !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

@media (max-width: 640px) {
  .network-ad-unit:not(.network-ad-unit--monetag) > [data-ad-placeholder],
  .adsense-shell > [data-ad-placeholder] {
    width: 100%;
  }
}
