/* 基本スタイル */ body { font-family: sans-serif; margin: 0; background-color: #f0f2f5; } header { background-color: #fff; padding: 1rem 2rem; box-shadow: 0 2px 4px rgba(0,0,0,0.1); text-align: center; } /* ギャラリーコンテナ */ .gallery-container { display: grid; /* 画面幅に応じて列数を自動調整 */ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; padding: 1.5rem; max-width: 1200px; margin: 0 auto; } /* 各画像アイテム */ .image-item { background-color: #fff; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); overflow: hidden; /* 角丸を有効にするため */ transition: transform 0.3s ease; display: flex; flex-direction: column; } .image-item:hover { transform: translateY(-5px); } /* ▼▼▼ この部分を更新 ▼▼▼ */ .image-item img { width: 100%; aspect-ratio: 1 / 1; /* 比率を1:1に設定 */ object-fit: cover; /* 比率を保ったまま領域を埋める */ display: block; } /* ▲▲▲ ここまで ▲▲▲ */ /* タイトルとボタンのコンテナ */ .image-info { padding: 1rem; display: flex; flex-direction: column; flex-grow: 1; /* コンテナの高さを揃える */ } /* タイトル */ .image-title { font-size: 1.1rem; margin: 0 0 1rem 0; /* 下に余白 */ color: #333; flex-grow: 1; /* ボタンを一番下に配置するため */ } /* ボタンエリア */ .image-info .buttons { display: flex; justify-content: space-around; gap: 1rem; } .btn { flex: 1; padding: 0.75rem; border: none; border-radius: 4px; background-color: #007bff; color: white; font-size: 1rem; cursor: pointer; text-align: center; text-decoration: none; transition: background-color 0.3s ease; } .btn:hover { background-color: #0056b3; } .download-btn { background-color: #28a745; } .download-btn:hover { background-color: #218838; } /* モーダルウィンドウ */ .modal { display: none; /* 初期状態では非表示 */ position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.85); flex-direction: column; /* 画像とキャプションを縦に並べる */ justify-content: center; align-items: center; } .modal-content { max-width: 90%; max-height: 80vh; /* キャプションの高さを考慮 */ animation: zoomIn 0.3s ease; } /* モーダルキャプション */ #modal-caption { margin-top: 15px; color: #ccc; font-size: 1.2rem; text-align: center; } @keyframes zoomIn { from { transform: scale(0.8); } to { transform: scale(1); } } .close-btn { position: absolute; top: 20px; right: 35px; color: #fff; font-size: 40px; font-weight: bold; cursor: pointer; }