/**
 * MediaHub — RTE image alignment + YouTube/Vimeo embed wrappers.
 *
 * Loaded on the live site and inside TinyMCE via content_css (see MediaHub.module.php).
 * Class names match ProcessWire ProcessPageEditImageSelect defaults.
 */

img.align_left,
img.align-left {
  float: left;
  margin: 0 1em 1em 0;
}

img.align_right,
img.align-right {
  float: right;
  margin: 0 0 1em 1em;
}

img.align_center,
img.align-center,
img.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

img.align_left,
img.align-left,
img.align_right,
img.align-right,
img.align_center,
img.align-center,
img.center {
  max-width: 100%;
  height: auto;
}

/* Responsive 16:9 iframe wrapper for YouTube/Vimeo embed assets.
 * Sized embeds store inline width:Npx;max-width:100% from the insert dialog.
 * Position/overflow live here (not inline) so HTMLPurifier does not strip them. */
.pkd-mh-embed-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  overflow: hidden;
  margin: 1em 0;
  box-sizing: border-box;
}

@supports not (aspect-ratio: 16 / 9) {
  .pkd-mh-embed-wrap {
    height: 0;
    padding-bottom: 56.25%;
    aspect-ratio: auto;
  }
}

.pkd-mh-embed-wrap > iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  /* Beat theme prose rules that set iframe { height: auto; max-width: 100% } */
  max-width: none;
  max-height: none;
}

/* Alignment — same model as RTE images (ProcessPageEditImageSelect classes) */
.pkd-mh-embed-wrap.align_left,
.pkd-mh-embed-wrap.align-left {
  float: left;
  margin: 0 1em 1em 0;
}

.pkd-mh-embed-wrap.align_right,
.pkd-mh-embed-wrap.align-right {
  float: right;
  margin: 0 0 1em 1em;
}

.pkd-mh-embed-wrap.align_center,
.pkd-mh-embed-wrap.align-center,
.pkd-mh-embed-wrap.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
