/* =========================================
   Outputページ用（ギャラリー配置）
   ========================================= */

.output{
    margin : 0 auto;
    max-width: 60%;
}

.gallery-container {
    display: flex;       /* 横並びにする */
    flex-wrap: wrap;     /* 端まで来たら折り返す */
    gap: 30px;           /* カード同士の隙間 */
    padding: 20px;       /* 全体の余白 */
    max-width: 1000px;   /* 広がりすぎないように */
    margin: 0 auto;      /* 画面中央に配置 */
}

/* outputページではカードの幅を固定しないと崩れることがあるので念押し */
.gallery-container .card {
    width: 300px; /* カードの幅を固定 */
    /* max-widthは解除しておくと綺麗に並びます */
    max-width: none; 
}

/* スマホの時はカードを少し小さく、あるいは1列にする */
@media screen and (max-width: 600px) {
    .gallery-container .card {
        width: 100%; /* スマホなら画面幅いっぱい */
        max-width: 350px;
    }
}

/* バッジの色をCSSで管理する */
.badge.music { background: linear-gradient(45deg, #4facfe, #00f2fe); }
.badge.novel { background: linear-gradient(45deg, #43e97b, #38f9d7); }
.badge.illust { background: linear-gradient(45deg, #e238ee, #d379e0); }

/* --- フィルタボタンのデザイン --- */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    background: #fff;
    border: 2px solid #d32f2f;
    color: #d32f2f;
    padding: 10px 20px;
    border-radius: 30px;
    font-family: 'Shippori Mincho', serif;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

/* 選ばれているボタンのデザイン */
.filter-btn.active, .filter-btn:hover {
    background: #d32f2f;
    color: white;
}

/* --- 小説カードの特別設定 --- */
.gallery-item[data-category="novel"] .card-text {
    text-align: left; /* 小説は左揃えの方が読みやすい */
}

.novel-preview {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
    /* 3行以上は「...」で省略する設定 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    display: inline-block;
    color: #d32f2f;
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px dashed #d32f2f;
}

/* --- アニメーション用クラス --- */
.hide {
    display: none; /* 消す */
}

.show {
    animation: fadeInGallery 0.5s ease; /* ふわっと出す */
}

@keyframes fadeInGallery {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* オーディオ・ビデオプレイヤーの共通設定 */
.media-player {
    width: 100%;       /* カードの幅いっぱいに広げる */
    margin-top: 10px;  /* 上の文字との隙間 */
    outline: none;     /* 選択時の枠線を消す */
    border-radius: 5px; /* 角を少し丸く */
}

/* 動画の場合は高さも自動調整 */
video.media-player {
    height: auto;
    background: #000; /* 読み込み中は黒背景 */
}

/* カード内の説明文（pタグ）に対する設定 */
.card-text p {
    /* \n を改行として表示 */
    white-space: pre-wrap;
    /* ついでに行間を少し広げると読みやすい */
    line-height: 1.6;
}


/*画像拡大のためのモダール設定*/

/* --- 画像拡大モダールの設定 --- */
.modal {
    display: none; /* 普段は隠す */
    position: fixed;
    z-index: 1000; /* 最前面に */
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9); /* 背景を黒く透けさせる */
}

/* 拡大画像のスタイル */
.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 800px; /* PCでもデカくなりすぎないように */
    max-height: 80vh; /* 画面からはみ出さないように */
    object-fit: contain;
    border: 2px solid #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    animation: zoom 0.3s; /* フワッと出すアニメーション */
}

/* 閉じるボタン（×） */
.close-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}
.close-btn:hover {
    color: #bbb;
}

/* アニメーション定義 */
@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}

/* スマホ用の調整 */
@media only screen and (max-width: 700px){
    .modal-content {
        width: 100%;
    }
}