/* ======================================
   gallery.css（全置換・最終整理版）
   条件：
   - 3枚表示（.fm-gallery--outdoor）のみ 600×750 比率
   - svh 不使用
   - 上下余白を発生させない
   - 1枚表示は既存挙動のまま
   - JS / ボタン変更なし
   ====================================== */

.fm-gallery {
  margin: 170px auto 0;
  position: relative;
}
/* 左上にはみ出すタイトル画像 */
.fm-gallery-title {
  position: absolute;
  top: -130px;        /* 上にはみ出す量（調整可） */
  left: -130px;       /* 左にはみ出す量（調整可） */
  z-index: 1;        /* 写真より背面 */
  pointer-events: none;

  width: 225px;      /* サイズはデザインに合わせて調整 */
  height: auto;
  opacity: 0;        /* 初期状態は非表示 */
  visibility: hidden; /* Safari対策 */
}


/* ======================================
   ステージ（共通）
   ====================================== */
.fm-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #eee;
  border: 5px solid #fff;
  z-index: 2;
}

/* ======================================
   トラック
   ====================================== */
.fm-track {
  display: flex;
  align-items: flex-start; /* Safari対策：centerからflex-startに変更 */
  will-change: transform;
  transition: transform 380ms ease;
}

/* ======================================
   スライド（共通）
   ====================================== */
.fm-slide {
  flex: 0 0 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.fm-slide img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ======================================
   3枚表示（屋外ギャラリー）
   ====================================== */
.fm-gallery--outdoor {
  --fm-peek: 160px; /* 左右ちょい見せ量 */
  --fm-gap: 8px;    /* スライド間隔 */
  margin-bottom: 0; /* Safari対策：下の空白を削除 */
}

/* Safari対策：stageに高さを明示的に設定 */
.fm-gallery--outdoor .fm-stage {
  aspect-ratio: 4 / 5; /* 600×750の比率 */
  max-height: 750px;
}

/* スライド幅（中央＋左右ちょい見せ） */
.fm-gallery--outdoor .fm-slide {
  flex: 0 0 calc(100% - (var(--fm-peek) * 2));
}

/* スライド間隔 */
.fm-gallery--outdoor .fm-track {
  gap: var(--fm-gap);
}

/* ★ここが最重要
   ・比率は「画像」に持たせる
   ・stage には高さ・比率を持たせない
*/
.fm-gallery--outdoor .fm-slide img {
  aspect-ratio: 4 / 5; /* 600×750 */
  max-height: 100%;
  width: auto;
  object-fit: contain;
  /* Safari対策 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ======================================
   左右ちょい見せ：全面ぼかし
   ====================================== */
.fm-gallery--outdoor .fm-stage::before,
.fm-gallery--outdoor .fm-stage::after {
  content: "";
  position: absolute;
  top: 0;
  width: var(--fm-peek);
  height: 100%;
  z-index: 2;
  pointer-events: none;

  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);

  /* backdrop-filter 有効化 */
  background: rgba(255, 255, 255, 0.001);
}

.fm-gallery--outdoor .fm-stage::before {
  left: 0;
}

.fm-gallery--outdoor .fm-stage::after {
  right: 0;
}

/* ======================================
   コントロール
   ====================================== */
.fm-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0 6px;
  position: relative;
}

.fm-nav {
  display: flex;
  gap: 10px;
}

.fm-count {
  position: absolute;
  right: 0;
}

.fm-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--color-pink);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 8px;
  cursor: pointer;
}

.fm-btn:active {
  transform: translateY(1px);
}

/* 屋外ギャラリー専用ボタン色 */
.fm-gallery--outdoor .fm-btn {
  background: #cdf277;
  color: #333;
}

/* ======================================
   カウンター
   ====================================== */
.fm-count {
  font-weight: 600;
  user-select: none;
  position: absolute;
  right: 0;
}

.fm-count .fm-current {
  font-size: 2rem;
}

.fm-count .fm-total,
.fm-count .fm-slash {
  font-size: 1.2rem;
}

.gallery_info {
	margin: 10px 0 0;
	text-align: left;
}

.gallery_info .gallery_title {
	font-size: 1.2rem;
	line-height: 1.6;
	font-weight: 600;
	margin: 0;
}

.gallery_info .gallery_content p {
	font-size: 0.95rem;
	line-height: 1.7;
	margin: 5px 0 0;
}

/* ======================================
   レスポンシブ
   ====================================== */
 @media screen and (max-width: 1280px) {  
.fm-gallery-title {
left: -30px;
}
}

@media screen and (max-width: 912px) {
  /* Safari対策：912px以下でstageの高さを調整 */
  .fm-gallery--outdoor .fm-stage {
    aspect-ratio: 4 / 5;
    max-height: 650px;
  }
}

@media screen and (max-width: 820px) {
  /* SPでは画面を埋めたい場合のみ */
  .fm-gallery--outdoor .fm-slide img {
    object-fit: cover;
    width: 100%;
    height: auto;
  }

  /* Safari対策：820px以下でstageの高さをさらに調整 */
  .fm-gallery--outdoor .fm-stage {
    max-height: 550px;
  }
}

 @media screen and (max-width: 768px) {
.fm-gallery-title {
left: -20px;
}

  /* Safari対策：768px以下でstageの高さをさらに調整 */
  .fm-gallery--outdoor .fm-stage {
    max-height: 480px;
  }
}

@media screen and (max-width: 767px) {

  /* ① 3枚表示用の変数・前提を完全に無効化 */
  .fm-gallery--outdoor {
    --fm-peek: 0px;
  }

  /* ② スライドは常に1枚＝100% */
  .fm-gallery--outdoor .fm-slide {
    flex: 0 0 100%;
  }

  /* ③ track は余計なズレ要因をすべて消す */
  .fm-gallery--outdoor .fm-track {
    gap: 0;
    padding: 0;
    transform: translateX(0); /* 初期化 */
  }

  /* ④ 3枚表示用の演出はすべて無効 */
  .fm-gallery--outdoor .fm-stage::before,
  .fm-gallery--outdoor .fm-stage::after,
  .fm-gallery--outdoor .fm-slide::before,
  .fm-gallery--outdoor .fm-slide::after {
    display: none !important;
  }

  /* ⑤ 画像は素直に1枚表示 */
  .fm-gallery--outdoor .fm-slide img {
    width: 100%;
    height: auto;
    object-fit: cover;
  }
}

 @media screen and (max-width: 640px) {  
.fm-gallery-title {
left: -10px;
}


