<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>小･中学生のためのプランクトン図鑑（図鑑）／ギャラリー？！</title>

<link rel="shortcut icon" href="../index/favicon.ico">
<link rel="apple-touch-icon-precomposed" href="../index/apple-touch-icon.png">
<link rel="stylesheet" href="../script/myelements.css" type="text/css">

<style>
/* ＝はみ出しを完全に防ぐためのリセット設定＝ */
* {
    box-sizing: border-box;
}

/* ＝全体の基本スタイル＝ */
body {
    background-color: #969696;
    color: #FFFFFF;
    font-family: "UD Digi Kyokasho NP-B", "Yu Gothic", "游ゴシック", YuGothic, "游ゴシック体", "Hiragino Kaku Gothic ProN", sans-serif;
    text-align: center;
    margin: 0;
    padding: 20px 10px;
    width: 100%;
    /* 画面の横揺れ・はみ出しを強制的にカットする */
    overflow-x: hidden; 
}

a {
    text-decoration: none;
    color: #66CCFF;
}

a:hover {
    color: #ff0000;
}

/* ＝ギャラリーの並び方（スマホ2列、PC3列のレスポンシブ）＝ */
.gallery-container {
    display: grid;
    /* スマホの時は横2列に指定 */
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; 
    width: 100%;
    max-width: 700px; /* PCでの最大幅 */
    margin: 30px auto;
    align-items: center; 
}

/* 画面幅が600px以上（タブレットやPC）の時は3列にする */
@media (min-width: 600px) {
    .gallery-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gallery-item {
    filter: drop-shadow(0 0 5px rgba(0,0,0,0.8));
    transition: transform 0.2s ease-in-out;
    /* Gridレイアウトが枠を突き破るのを防ぐ必須コード */
    min-width: 0; 
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    cursor: pointer;
    width: 100%; 
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

.gallery-item p {
    font-size: 13px;
    font-weight: bold;
    margin: 5px 0 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ＝「使い方」ボックス＝ */
.usage-box {
    background-color: #C0C0C0;
    border: 2px solid #99CCFF;
    border-radius: 10px;
    color: #000000;
    width: 100%;
    max-width: 600px;
    margin: 40px auto 20px auto;
    padding: 20px;
    text-align: left;
}

.usage-box-title {
    color: #FFFFFF;
    font-weight: bold;
    font-size: 20px;
    border-bottom: 1px solid #FFFFFF;
    padding-bottom: 5px;
    margin-top: 0;
    margin-bottom: 10px;
}

.usage-box ul {
    margin: 0;
    padding-left: 25px;
    line-height: 1.6;
}

.clickable-image {
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

/* ＝モーダル（拡大表示）のスタイル＝ */
#imageModal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 20, 30, 0.85);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.modal-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 95%;
    max-width: 800px;
    max-height: 95%;
}

/* ＝水のようなフレーム（ウォーターフレーム）＝ */
.modal-image-frame {
    position: relative;
    padding: 10px;
    background-color: rgba(135, 206, 250, 0.15);
    border: 2px solid rgba(180, 230, 255, 0.6);
    border-radius: 20px;
    box-shadow: 
        inset 6px 6px 12px rgba(255, 255, 255, 0.5), 
        inset -6px -6px 15px rgba(0, 80, 150, 0.3),  
        0 10px 30px rgba(0, 150, 255, 0.4);          
    backdrop-filter: blur(4px);
    animation: float-water 4s ease-in-out infinite;
    max-width: 100%;
}

@keyframes float-water {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.modal-content {
    display: block;
    width: 100%;
    max-height: calc(80vh - 100px);
    border-radius: 10px; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

.modal-footer {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    margin-top: 20px;
}

/* ＝閉じるボタン（アクアテイスト）＝ */
.close-btn-cool {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0; /* 縮むのを防ぐ */
}

.close-btn-cool svg {
    width: 100%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s;
}

.close-btn-cool:hover svg {
    transform: rotate(90deg) scale(1.15);
    filter: drop-shadow(0 0 8px #66CCFF);
}

.author-name {
    font-weight: bold;
    flex-grow: 1;
    text-align: center;
    font-size: 15px;
    padding: 0 5px;
    /* はみ出し防止 */
    min-width: 0;
}

.dummy-space {
    width: 44px;
    flex-shrink: 0;
}
</style>
</head>

<body>

    <div>
        <img border="0" src="image/gallerykara.png" class="clickable-image" width="640" onclick="location.href='./'" alt="もどる" title="もどる">
    </div>

    <div class="gallery-container">
        <div class="gallery-item">
            <img src="gallery/r01.png" onclick="openModal('gallery/r01.png', 'るかちゃん（小５）')" alt="プランクトン画像">
            <p>るかちゃん（小５）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r02.png" onclick="openModal('gallery/r02.png', 'るかちゃん（小５）')" alt="プランクトン画像">
            <p>るかちゃん（小５）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r03.png" onclick="openModal('gallery/r03.png', 'るかちゃん（小５）')" alt="プランクトン画像">
            <p>るかちゃん（小５）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r04.png" onclick="openModal('gallery/r04.png', 'るかちゃん（小５）')" alt="プランクトン画像">
            <p>るかちゃん（小５）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r05.png" onclick="openModal('gallery/r05.png', 'るかちゃん（小５）')" alt="プランクトン画像">
            <p>るかちゃん（小５）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r06.png" onclick="openModal('gallery/r06.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r07.png" onclick="openModal('gallery/r07.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r08.png" onclick="openModal('gallery/r08.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r09.png" onclick="openModal('gallery/r09.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r10.png" onclick="openModal('gallery/r10.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r11.png" onclick="openModal('gallery/r11.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r12.png" onclick="openModal('gallery/r12.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r13.png" onclick="openModal('gallery/r13.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r14.png" onclick="openModal('gallery/r14.png', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r15.jpg" onclick="openModal('gallery/r15.jpg', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r16.jpg" onclick="openModal('gallery/r16.jpg', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/r17.jpg" onclick="openModal('gallery/r17.jpg', 'るかちゃん（小６）')" alt="プランクトン画像">
            <p>るかちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/a01.png" onclick="openModal('gallery/a01.png', 'アメリちゃん（小６）')" alt="プランクトン画像">
            <p>アメリちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/a02.png" onclick="openModal('gallery/a02.png', 'アメリちゃん（小６）')" alt="プランクトン画像">
            <p>アメリちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/h01.jpg" onclick="openModal('gallery/h01.jpg', 'ひめちゃん（小６）')" alt="プランクトン画像">
            <p>ひめちゃん（小６）</p>
        </div>
        <div class="gallery-item">
            <img src="gallery/h02.jpg" onclick="openModal('gallery/h02.jpg', 'ひめちゃん（小６）')" alt="プランクトン画像">
            <p>ひめちゃん（小６）</p>
        </div>
    </div>

    <div style="margin-top: 40px;">
        <img border="0" src="image/back.gif" class="clickable-image" width="180" onclick="location.href='./'" alt="もどる" title="もどる">
    </div>

    <div class="usage-box">
        <div class="usage-box-title">使い方</div>
        <ul>
            <li>プランクトンギャラリーのコーナーです。</li>
            <li>ご自由にダウンロードや印刷を行ってください。</li>
            <li>ただし画像の加工・改変等は認めていません。</li>
            <li>著作権は画像提供者にあります。</li>
        </ul>
    </div>

    <div id="imageModal" onclick="closeModal()">
        <div class="modal-wrapper" onclick="event.stopPropagation();">
            <div class="modal-image-frame">
                <img class="modal-content" id="fullImage" alt="拡大画像">
            </div>
            
            <div class="modal-footer">
                <button class="close-btn-cool" onclick="closeModal()" title="閉じる">
                    <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
                        <circle cx="50" cy="50" r="45" fill="none" stroke="#66CCFF" stroke-width="4" stroke-dasharray="8 12" opacity="0.8" />
                        <path d="M30 30 L70 70 M70 30 L30 70" stroke="#FFFFFF" stroke-width="8" stroke-linecap="square" />
                    </svg>
                </button>
                
                <div class="author-name">
                    <div id="modalAuthor"></div>
                    <div style="font-size: 11px; font-weight: normal; color: #fff; margin-top: 8px; background: rgba(0,0,0,0.5); padding: 5px 10px; border-radius: 20px; display: inline-block;">
                        💡 画像長押し(PCは右クリック)で保存
                    </div>
                </div>
                
                <div class="dummy-space"></div>
            </div>
        </div>
    </div>

    <script>
    function openModal(src, author) {
        document.getElementById('imageModal').style.display = 'flex';
        document.getElementById('fullImage').src = src;
        document.getElementById('modalAuthor').innerText = author;
    }

    function closeModal() {
        document.getElementById('imageModal').style.display = 'none';
    }

    window.onkeydown = function(event) {
        if (event.key === "Escape") {
            closeModal();
        }
    };
    </script>

</body>
</html>