/* === 全体背景設定 === */
body.gallery-page {
    /* CSSファイル基準の相対パスに修正（assets/css → assets/images） */
    background: url("../images/bamboo.jpg") no-repeat center center fixed;
    background-size: cover;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    margin: 0;
    padding: 0;
}

/* iOS/小画面は fixed をやめてカクつき回避 */
@media (max-width: 900px) {
    body.gallery-page {
        background-attachment: scroll;
        background-position: center top;
    }
}

/* === ギャラリータイトル === */
.gallery-title {
    text-align: center;
    margin: 2rem 0;
    font-size: 2rem;
    color: #333;
    /* 背景が明るい時の読みやすさ向上（任意） */
    text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

/* === ギャラリーのグリッドレイアウト === */
.gallery-container {
    display: grid;
    gap: 1.5rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    grid-template-columns: repeat(5, 1fr);
    /* デスクトップ既定 */
}

/* 画面幅に応じて列数を調整 */
@media (max-width: 1200px) {
    .gallery-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .gallery-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .gallery-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: .5rem;
    }
}

/* === 共通カードデザイン === */
.gallery-card {
    background-color: #faf6e8;
    border-radius: 15px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, .2);
    overflow: hidden;
    transition: transform .3s, box-shadow .3s;
    /* パフォーマンス微改善（対応ブラウザ） */
    content-visibility: auto;
    contain-intrinsic-size: 300px 400px;
    /* プレースホルダ寸法 */
}

/* マウス操作時のホバー */
.gallery-card:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .3);
}

/* 動きを減らす設定の尊重 */
@media (prefers-reduced-motion: reduce) {
    .gallery-card {
        transition: none;
    }

    .gallery-card:hover {
        transform: none;
        box-shadow: 0 8px 16px rgba(0, 0, 0, .2);
    }
}

/* === カードの比率設定 === */
.gallery-card.vertical {
    aspect-ratio: 3 / 4;
}

.gallery-card.horizontal {
    aspect-ratio: 4 / 3;
}

/* === 画像の表示設定 === */
.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 必要なら被写体の寄せ位置
  object-position: center 35%;
  */
}

/* （任意）カード内リンクのフォーカス可視化 */
.gallery-card a:focus-visible {
    outline: 3px solid #4d92d0;
    outline-offset: 3px;
    border-radius: 10px;
}