/* Portable editorial media skin: load after the theme and WordPress core block styles.
   No block replacement, extra wrappers, scripts, fixed image heights or forced crops. */

.reader-page,
.archive-page,
.entry-content,
.wp-block-post-content {
  --znit-media-radius: 16px;
}

/* Native block names also work inside the WordPress editor iframe.
   The fallback avoids coupling the editor to a frontend body class. */
.article-body img,
.entry-content img,
.wp-block-post-content img,
.wp-block-image img,
.wp-block-gallery img,
.wp-block-media-text__media img,
.wp-block-post-featured-image img,
.wp-block-cover__image-background,
.wp-block-freeform img,
body.mce-content-body img,
.wp-caption img,
.gallery-item img {
  border-radius: var(--znit-media-radius, 16px);
}

/* Preserve the explicitly selected native circular image style. */
.wp-block-image.is-style-rounded img {
  border-radius: 9999px;
}

/* Low-specificity defaults: native gallery crop/aspect-ratio settings still win. */
:where(.article-body, .entry-content, .wp-block-post-content, .wp-caption) img {
  max-width: 100%;
  height: auto;
}
:where(.entry-content, .wp-block-post-content) .wp-caption {
  max-width: 100%;
}

/* Clip only the existing visual stages, not whole figures, links, captions or
   lightbox controls. Rounded corners do not change the original image framing. */
.reader-page .cover-stage,
.reader-page .related-cover,
.reader-page .full-project,
.archive-page .archive-cover {
  border-radius: var(--znit-media-radius, 16px);
}
.reader-page .post-cover img,
.reader-page .related-cover img,
.archive-page .archive-cover img {
  border-radius: var(--znit-media-radius, 16px);
}

/* Caption surfaces follow each gallery image; no overflow clipping that could
   hide keyboard outlines, editor handles or the native enlarge button. */
.wp-block-gallery .wp-block-image,
.wp-block-cover,
.wp-block-cover__background {
  border-radius: var(--znit-media-radius, 16px);
}
.wp-block-gallery .wp-block-image figcaption {
  border-bottom-left-radius: var(--znit-media-radius, 16px);
  border-bottom-right-radius: var(--znit-media-radius, 16px);
}
