/* css/style.css */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #fff0f5; /* フェミニンピンク */
    color: #333;
}
header {
    background: linear-gradient(90deg, #ff6200, #000); /* 巨人オレンジ→黒 */
    color: #fff;
    text-align: center;
    padding: 20px;
}
nav {
    background: #ffb6c1; /* ライトピンク */
    padding: 10px;
    text-align: center;
}
nav a {
    color: #000;
    margin: 0 15px;
    text-decoration: none;
    font-weight: bold;
}
nav a:hover {
    color: #ff6200; /* 巨人オレンジ */
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff; /* 白で清潔感 */
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}
.gallery img {
    /* --- CHANGES START HERE --- */
    width: 100%; /* グリッドセルの幅いっぱいに広がる */
    /* height: 250px; /* FIXED HEIGHT を削除し、aspect-ratio で縦長にする */
    aspect-ratio: 3 / 4; /* 画像の縦横比を3:4に設定し、縦長の形状を強制する */
    object-fit: cover; /* 画像を縦長の枠に収め、はみ出る部分はトリミングする */
    /* --- CHANGES END HERE --- */
    border-radius: 5px;
    border: 2px solid #ffb6c1; /* ピンク枠 */
    transition: transform 0.3s;
    display: block; /* 余白防止 */
}
.gallery img:hover {
    transform: scale(1.05);
}
footer {
    background: #000;
    color: #fff;
    text-align: center;
    padding: 10px;
    position: relative;
    width: 100%;
}
footer p {
    font-size: 16px;
    margin: 5px 0;
}
footer #visitor-count {
    color: #ff6200; /* 巨人オレンジ */
    font-weight: bold;
}
@media (max-width: 600px) {
    nav a { display: block; margin: 10px 0; }
    .gallery { grid-template-columns: 1fr; }
    .container { padding: 10px; }
}
@media (min-width: 768px) {
    .gallery img {
        /*
         * PCビューでの max-width や margin の設定は、
         * グリッドと aspect-ratio による均一なサイズ設定と競合するため、
         * ここでは特に指定せず、aspect-ratio の動作を優先します。
         * 必要に応じて、grid-template-columns の調整を検討してください。
         */
        max-width: none; /* 以前の max-width を上書き */
        margin: 0; /* 以前の margin を上書き */
    }
}

/* カート表示用モーダル */
.cart-overlay {
    display: none; /* 初期状態では非表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 半透明の黒背景 */
    z-index: 1000; /* 最前面に表示 */
    justify-content: center; /* 中央寄せ */
    align-items: center; /* 中央寄せ */
}

.cart-modal {
    background-color: #fff; /* 白いモーダル背景 */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); /* 影 */
    max-width: 500px; /* 最大幅 */
    width: 90%; /* レスポンシブ対応 */
    max-height: 80vh; /* 高さ制限 */
    overflow-y: auto; /* 内容が多ければスクロール可能に */
    position: relative;
}

.cart-modal h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.cart-modal ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cart-modal li {
    border-bottom: 1px dashed #eee;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* アイテム情報が長い場合に折り返す */
}
.cart-modal li:last-child {
    border-bottom: none;
}

.cart-modal .item-info {
    flex-grow: 1;
    margin-right: 10px;
}

.cart-modal .item-quantity input {
    width: 50px;
    text-align: center;
    margin-right: 5px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}

.cart-modal .item-subtotal {
    min-width: 80px; /* 小計の幅を確保 */
    text-align: right;
    font-weight: bold;
}

.cart-modal .item-actions button {
    background-color: #dc3545; /* 赤色の削除ボタン */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
}
.cart-modal .item-actions button:hover {
    background-color: #c82333;
}

.cart-modal .total-price {
    text-align: right;
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 20px;
    border-top: 2px solid #eee;
    padding-top: 10px;
}

.cart-modal .modal-buttons {
    text-align: center;
    margin-top: 30px;
}

.cart-modal .modal-buttons button {
    background-color: #007bff; /* 青色の主要ボタン */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
    transition: background-color 0.3s ease;
}
.cart-modal .modal-buttons button:hover {
    background-color: #0056b3;
}

.cart-modal .modal-buttons .close-button {
    background-color: #6c757d; /* 灰色系の閉じる/キャンセルボタン */
}
.cart-modal .modal-buttons .close-button:hover {
    background-color: #5a6268;
}

/* 商品アイテム内のフォームとボタンのスタイル調整 */
.shop-items form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap; /* 小さい画面で折り返す */
}
.shop-items form input[type="number"] {
    width: 60px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.shop-items form input[type="submit"] {
    background-color: #28a745; /* 緑色の「カートに入れる」ボタン */
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}
.shop-items form input[type="submit"]:hover {
    background-color: #218838;
}

.product-item p.price {
    font-size: 1.2em;
    font-weight: bold;
    color: #e44d26; /* 目立つ価格の色 */
    margin-bottom: 10px;
}

/* カートを見るボタンのスタイル */
.cta-button {
    background-color: #007bff; /* 青色の「カートを見る」ボタン */
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 1.1em;
    display: inline-block;
    transition: background-color 0.3s ease;
}
.cta-button:hover {
    background-color: #0056b3;
}