/* メッセージ一覧ページ専用CSS */

/* ギャラリー全体のレイアウト */
.message-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  justify-items: center;
  margin-top: 30px;
  padding: 0 10px;
}

/* 手紙画像の見た目 */
.letter-img {
  width: 100%;
  max-width: 350px;
  /*box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);*/
  background-color: transparent;
  transition: transform 0.25s ease/*, box-shadow 0.25s ease*/;
  cursor: pointer;
}

.letter-img:hover {
  transform: scale(1.1);
  /*box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25)*/;
}

/* 見出し */
.container h2 {
  text-align: center;
  margin-top: 20px;
  font-size: 1.5rem;
}

/* スマホ対応 */
@media (max-width: 600px) {
  .message-gallery {
    grid-template-columns: 1fr;
  }

  .letter-img {
    max-width: 90%;
  }
}

/* ==================================== */
/* 2. 画像拡大（モーダル）表示用スタイル */
/* ==================================== */

#imgModal {
    /* 1. 初期状態は非表示（JSで active クラスが付くまでは非表示） */
    display: none;

    /* 2. 画面全体を覆うように固定 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* 3. 背景を半透明の黒にする */
    background-color: rgba(0, 0, 0, 0.5);
    
    /* 4. 他の要素より手前に表示 */
    z-index: 9999;
    
    /* 5. 画像を画面の中央に配置するためのFlex設定 */
    display: flex;
    justify-content: center; /* 水平方向の中央寄せ */
    align-items: center;     /* 垂直方向の中央寄せ */
    
    /* 閉じる時のアニメーションを滑らかにする (任意) */
    transition: opacity 0.3s ease;
}

/* JSによって active クラスが付与されたら表示する */
#imgModal.active {
    /* JSによって display: flex に切り替わります */
    display: flex;
}

/* 拡大画像自体のサイズ制限と見た目 */
#modalLetter {
    /* 画面の90%を超えないように最大サイズを制限 */
    max-width: 90%;
    max-height: 90vh; /* Viewport Height の90% */
    
    /* マウスオーバー時のカーソルをデフォルトに戻す */
    cursor: default;
    
    /* 縁を少し丸く見せたい場合 (任意) */
    /* border-radius: 5px; */
    
    /* 影をつけて立体感を出す (任意) */
    /*box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);*/
}
