/**
 * Staged Site Refinery images fill the content column (no inset gutters).
 * Body/inline images are height-capped so square/tall photos do not dominate
 * the viewport. Featured/hero wrappers stay theme-friendly (width only).
 */

:root {
  --digitech-body-image-max-height: min(48vh, 480px);
}

.digitech-content-image,
.digitech-featured-image {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

.digitech-content-image img,
.digitech-featured-image img,
.digitech-content-image .wp-post-image,
.digitech-featured-image .wp-post-image {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

/*
 * Body / inline Site Refinery figures: full content-column width, capped height.
 * object-fit: cover keeps width full without stretching tall square assets.
 */
.digitech-content-image:not(.digitech-featured-image) {
  max-height: var(--digitech-body-image-max-height);
  overflow: hidden;
}

.digitech-content-image:not(.digitech-featured-image) img,
.digitech-content-image:not(.digitech-featured-image) .wp-post-image {
  height: var(--digitech-body-image-max-height) !important;
  max-height: var(--digitech-body-image-max-height) !important;
  object-fit: cover !important;
  object-position: center center !important;
}

/* Featured thumbnails on Site Refinery-managed posts (theme may omit our wrapper). */
body.digitech-managed-content .wp-post-image,
body.digitech-managed-content .post-thumbnail img,
body.digitech-managed-content .entry-thumbnail img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

/* Already-staged classic figures (pre-1.3.4 bare <figure><img>) + ACF body HTML. */
body.digitech-managed-content .entry-content figure,
body.digitech-managed-content .entry-content figure img,
body.digitech-managed-content .acf-content figure,
body.digitech-managed-content .acf-content figure img,
body.digitech-managed-content article .entry-content img.size-full,
body.digitech-managed-content article .entry-content img.aligncenter,
body.digitech-managed-content article .entry-content img.alignnone {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box;
}

/* Height-cap body figures that are not featured wrappers. */
body.digitech-managed-content .entry-content figure:not(.digitech-featured-image),
body.digitech-managed-content .acf-content figure:not(.digitech-featured-image) {
  max-height: var(--digitech-body-image-max-height);
  overflow: hidden;
}

body.digitech-managed-content .entry-content figure:not(.digitech-featured-image) img,
body.digitech-managed-content .acf-content figure:not(.digitech-featured-image) img,
body.digitech-managed-content article .entry-content img.size-full,
body.digitech-managed-content article .entry-content img.aligncenter,
body.digitech-managed-content article .entry-content img.alignnone {
  height: var(--digitech-body-image-max-height) !important;
  max-height: var(--digitech-body-image-max-height) !important;
  object-fit: cover !important;
  object-position: center center !important;
}
