/*
 * Layout-shift (Core Web Vitals CLS) fixes. Loaded right after style.css.
 *
 * Hand-written on purpose, kept apart from style.css:
 *  - style.css is served with ?v=APP_VERSION, so edits there stay stale behind Cloudflare until
 *    the version is bumped; this file gets its own ?v=<mtime>.
 *  - small and easy to review or roll back (delete the <link> in app_new.blade.php).
 * Nothing here moves an ad: it only reserves the height a slot will take anyway.
 */

/* Logos have width/height attributes; keep the aspect ratio when CSS changes the width. */
.logo img {
  height: auto;
}

/* Image ads: ad_block.blade.php writes the real pixel width into --ad-w. style.css gives ad
   images width:auto, which collapses an unloaded image to 0x0; this restores the same rendered
   size (natural width, capped by max-width:100%) before the image arrives. object-fit keeps the
   picture undistorted where a fixed-height slot (300x250 sidebar) caps the height. */
.RE a > img[style*="--ad-w"] {
  width: var(--ad-w);
  height: auto;
  object-fit: contain;
}

/* Main photo of a post/event has width/height attributes; on phones style.css caps it at
   max-height:500px, object-fit keeps a tall photo undistorted inside that box. */
.single-post .post-media img[width][height] {
  object-fit: contain;
}

/* Responsive AdSense slots (data-ad-format auto/fluid) are filled after window.load and then
   push the content below them down. Reserve the usual height of the format. A slot Google
   leaves empty (data-ad-status="unfilled") gives the space back. Fixed-size slots (HEADER 728x90,
   sidebars 300x250, BOTTOM_FIXED) already reserve space through their inline size. */
.POST_MOBILE_RE.google,
.POST_1_RE.google, .POST_2_RE.google, .POST_3_RE.google,
.POST_1_RE_mobile.google, .POST_2_RE_mobile.google, .POST_3_RE_mobile.google,
.HOME_LEADERBORD_RE.google,
.CATEGORY_RE.google,
.FOOTER_RE.google {
  min-height: 250px;
}
@media (min-width: 992px) {
  .HOME_LEADERBORD_RE.google,
  .CATEGORY_RE.google {
    min-height: 90px;
  }
}
.RE.google:has(> ins.adsbygoogle[data-ad-status="unfilled"]) {
  min-height: 0;
}
