@charset "utf-8";

/* ==========================================================================
   Image Modal
   ========================================================================== */

/* モーダル背景コンテナ
   touch-action: none によりブラウザのネイティブスクロール・ピンチズーム（Viewport Zoom）を抑止
   rgba(15, 23, 42, 0.70) と blur(8px) により重苦しさを解消し、背景を自然にボカして画像に集中させる */
.c-image-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background-color: rgba(15, 23, 42, 0.70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-out;
}

.c-image-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.c-image-modal__content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  touch-action: none;
  cursor: zoom-out;
}

.c-image-modal__img {
  max-width: 92vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background-color: #ffffff;
  border-radius: 6px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35);
  cursor: zoom-in;
  will-change: transform;
  transform-origin: center center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media screen and (min-width: 768px) {
  .c-image-modal__img {
    max-width: min(85vw, 1100px);
    max-height: 88vh;
  }
}

/* ズーム中のカーソル制御 */
.c-image-modal.is-zoomed .c-image-modal__img {
  cursor: grab;
}

.c-image-modal.is-zoomed .c-image-modal__img:active {
  cursor: grabbing;
}

/* 閉じるボタン */
.c-image-modal__close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  background-color: rgba(20, 20, 20, 0.65);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100001;
  transition: background-color 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

@media screen and (min-width: 768px) {
  .c-image-modal__close {
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
  }
}

.c-image-modal__close:hover {
  background-color: rgba(20, 20, 20, 0.9);
  transform: scale(1.05);
}

.c-image-modal__close::before,
.c-image-modal__close::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 1px;
}

.c-image-modal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.c-image-modal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* モーダル初回オープン時のみフェードインアニメーションを適用（ズーム解除時の再発火・フラッシュを防止） */
.c-image-modal.is-opening .c-image-modal__img {
  animation: modalFadeInUp 0.32s cubic-bezier(0.2, 0, 0.2, 1) forwards;
}

@keyframes modalFadeInUp {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 操作ガイドヒント（スマホ・PC共通チップ） */
.c-image-modal__hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: rgba(15, 23, 42, 0.82);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 18px;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  z-index: 100000;
  white-space: nowrap;
}

.c-image-modal__hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* 操作ガイドアイコン（PC用マウス & スマホ用タップ） */
.c-image-modal__hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.c-image-modal__hint-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

