@charset "utf-8";
/* ==========================================================================
   レビュー本文の画像グリッド（grid_img）
   medicaldoc の common/css/app.css の仕様に準拠
   ※ このファイルを読み込まなければ従来（縦並び）の表示に戻ります
   ========================================================================== */

/* --------------------------------------------------------------------------
   グリッド本体
   -------------------------------------------------------------------------- */
/* PHP側で整形済み（grid_img--layoutN が付いた）ブロックのみをグリッド化する。
   入稿HTMLの不備で未整形のまま残ったブロックは、従来どおりの表示にしておく。 */
.animal-hospital-single__details .grid_img[class*="grid_img--layout"] {
  display: grid;
  grid-gap: 5px;
  margin-bottom: 20px;
}

/* 入稿HTMLに紛れ込む改行タグを無効化（medicaldoc の入稿HTMLには <br> が挟まる）。
   未整形ブロックは後続の本文を巻き込んでいる可能性があるため、ここも整形済み限定にする
   （本文中の <br> まで消してしまわないように）。 */
.animal-hospital-single__details .grid_img[class*="grid_img--layout"] > br {
  display: none;
}

.animal-hospital-single__details .grid_img__item {
  width: 100%;
  height: auto;
  overflow: hidden;
}

/* 7枚目以降は非表示（モーダル内では全枚数を閲覧可能） */
.animal-hospital-single__details .grid_img__item:nth-of-type(n + 7) {
  display: none;
}

.animal-hospital-single__details .grid_img__item .grid_img__open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
  -webkit-appearance: none;
          appearance: none;
}

.animal-hospital-single__details .grid_img__item .grid_img__open img {
  width: 100% !important;
  height: 100%;
  max-width: 100%;
  max-height: initial;
  margin: 0;
  object-fit: cover;
  vertical-align: top;
}

/* --------------------------------------------------------------------------
   枚数別レイアウト
   -------------------------------------------------------------------------- */

/* 1枚 … 原寸・中央寄せ */
.animal-hospital-single__details .grid_img--layout1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
.animal-hospital-single__details .grid_img--layout1 .grid_img__item {
  text-align: center;
}
.animal-hospital-single__details .grid_img--layout1 .grid_img__item .grid_img__open {
  display: inline-block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
}
.animal-hospital-single__details .grid_img--layout1 .grid_img__item .grid_img__open img {
  width: auto !important;
  height: auto;
  max-width: 100%;
  object-fit: initial;
}

/* 2枚・4枚 … 2列（3:2） */
.animal-hospital-single__details .grid_img--layout2,
.animal-hospital-single__details .grid_img--layout4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.animal-hospital-single__details .grid_img--layout2 .grid_img__item,
.animal-hospital-single__details .grid_img--layout4 .grid_img__item {
  aspect-ratio: 3/2;
}

/* 3枚・6枚以上 … 3列（1:1） */
.animal-hospital-single__details .grid_img--layout3,
.animal-hospital-single__details .grid_img--layout6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.animal-hospital-single__details .grid_img--layout3 .grid_img__item,
.animal-hospital-single__details .grid_img--layout6 .grid_img__item {
  aspect-ratio: 1/1;
}

/* 5枚 … 上段2枚（3:2）＋下段3枚（1:1） */
.animal-hospital-single__details .grid_img--layout5 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(2, 1fr);
}
.animal-hospital-single__details .grid_img--layout5 .grid_img__item:nth-of-type(1) {
  grid-row: 1/2;
  grid-column: 1/4;
  aspect-ratio: 3/2;
}
.animal-hospital-single__details .grid_img--layout5 .grid_img__item:nth-of-type(2) {
  grid-row: 1/2;
  grid-column: 4/7;
  aspect-ratio: 3/2;
}
.animal-hospital-single__details .grid_img--layout5 .grid_img__item:nth-of-type(3) {
  grid-row: 2/3;
  grid-column: 1/3;
  aspect-ratio: 1/1;
}
.animal-hospital-single__details .grid_img--layout5 .grid_img__item:nth-of-type(4) {
  grid-row: 2/3;
  grid-column: 3/5;
  aspect-ratio: 1/1;
}
.animal-hospital-single__details .grid_img--layout5 .grid_img__item:nth-of-type(5) {
  grid-row: 2/3;
  grid-column: 5/7;
  aspect-ratio: 1/1;
}

/* 7枚以上のとき、6枚目に「+N」オーバーレイ */
.animal-hospital-single__details .grid_img--layout6 .grid_img__item[data-more] {
  position: relative;
}
.animal-hospital-single__details .grid_img--layout6 .grid_img__item[data-more]::after {
  content: "+ " attr(data-more);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M9 3L7.17 5H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-3.17L15 3H9zm3 15a5 5 0 1 1 0-10 5 5 0 0 1 0 10zm0-2a3 3 0 1 0 0-6 3 3 0 0 0 0 6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: top calc(50% - 30px) center;
  background-size: 40px auto;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
}

/* ==========================================================================
   画像拡大モーダル
   ※ body 直下に生成されるため、記事本文側のCSSの影響を受けません
   ========================================================================== */
.gridImgModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
  z-index: -1;
}
.gridImgModal.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 100000;
}

.gridImgModal__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gridImgModal__content {
  position: relative;
  width: 100%;
  max-width: 1080px;
  padding: 0 45px;
}

.gridImgModal__counter {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  color: #fff;
  font-size: 0.8rem;
  line-height: 2;
  text-align: center;
}
.gridImgModal__counter span {
  font-size: 20px;
}

.gridImgModal__figure {
  margin: 0;
}

.gridImgModal__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 60vh;
  margin: 0 auto;
  object-fit: contain;
}

.gridImgModal__caption {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  text-align: center;
  word-wrap: break-word;
}
.gridImgModal__caption:empty {
  display: none;
}

.gridImgModal__prev,
.gridImgModal__next {
  position: absolute;
  top: 50%;
  width: 45px;
  height: 45px;
  padding: 0;
  border: 0;
  background: none;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 2;
  -webkit-appearance: none;
          appearance: none;
}
.gridImgModal__prev::before,
.gridImgModal__next::before {
  content: "";
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
}
.gridImgModal__prev {
  left: 0;
}
.gridImgModal__prev::before {
  transform: rotate(-135deg);
}
.gridImgModal__next {
  right: 0;
}
.gridImgModal__next::before {
  transform: rotate(45deg);
}
.gridImgModal__prev[disabled],
.gridImgModal__next[disabled] {
  opacity: 0;
  cursor: auto;
}

.gridImgModal__close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 3;
  -webkit-appearance: none;
          appearance: none;
}
.gridImgModal__close::before,
.gridImgModal__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 3px;
  background-color: #fff;
}
.gridImgModal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}
.gridImgModal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

@media screen and (max-width: 767px) {
  .gridImgModal__content {
    padding: 0 40px;
  }
  .gridImgModal__prev,
  .gridImgModal__next {
    width: 36px;
    height: 36px;
  }
}
