@use "sass:map";
@use "../../global/acms-common" as acms;
@use "../../global/common" as global;

/* ------------------------------
 メディア画像・画像・画像URL
------------------------------ */

/* 共通設定
------------------------------ */
:where(.#{acms.$entry-class}) figure,
:where(.#{acms.$entry-class}) [role='figure']:not(:has(a[href*="media-download"], a[href*="storage"])) {
  margin-block: 0 global.$entry-el-margin-md;
  margin-inline: 0;
  line-height: 0; /* Descender space 対策 */
  text-align: center;

  a {
    display: inline-block;
    text-decoration: none;
    transition: opacity 0.2s ease;

    @media (any-hover: hover) {
      &:hover {
        opacity: 0.7;
      }
    }
  }

  img {
    display: inline-block;
    max-width: 100%;
    height: auto;
  }
}

/* キャプション
------------------------------ */
:where(.#{acms.$entry-class}) figcaption,
:where(.#{acms.$entry-class}) [role='figure']:not(:has(a[href*="media-download"], a[href*="storage"])) .caption {
  display: block;
  margin: 4px 0 0; /* 余白リセットのため全方向指定 */
  font-size: map.get(global.$font-scales, body-s);
  line-height: global.$line-height-sm;
  color: global.$color-text-side;
}
