/* ギャラリー */
.gallery {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, 110px);
    justify-content: center;
    grid-gap: 0.4em 0.2em; /* 要素間の余白を設定*/
    margin: 40px auto;
}

/* ギャラリーアイテムのサイズ調整 */
.gallery-item {
    display: flex;
    flex-direction: column;  /* 子要素を縦に並べる */
    justify-content: space-between;  /* 子要素の間にスペースを均等に配置 */
    background-color: var(--colorwhite);
    border: 1px solid var(--colortransparent1);
    padding: 0.2em; /*内側の余白*/
    text-align: center;
    cursor: pointer;
    min-width: 110px;
    width: calc(10%);
    align-items: center;
    overflow: hidden;  /* 画像が飛び出さないようにする */
}
    .gallery-item:hover{
        opacity: 0.7;
    }

/* サムネイル画像のサイズ調整 */
.gallery-item img {
    width: 100%;
    aspect-ratio: 1;  /* 正方形のサムネイル */
    object-fit: cover;  /* 画像が枠内に収まるようにトリミング */
    object-position: center; /* 画像の中心を表示 */
}

/*画像とタイトルのレイアウト用*/
.info-container {
    display: flex;
    flex-direction: column;  /* 画像とタイトルを縦に並べる */
    justify-content: flex-start;  /* 上に詰める */
}

/* タイトルのスタイル調整 */
.info-container div {
    margin: 5px 0;
    font-size: 0.8em;  /* タイトルのフォントサイズ */
    color: var(--fontcolor2);
    display: -webkit-box;
    -webkit-line-clamp: 2;  /* 2行に制限 ※Webkitベースのブラウザ用 */
    line-clamp: 2; /* 標準プロパティ */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    text-align: left;
    padding: 0 2px;
}
    /*タイトルの前の分類アイコン*/
    .info-container div::before {
    font-family: "Material Symbols Rounded";
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 48;
    font-size: 1.3em;
    display: inline-block;
    vertical-align: middle;/*縦の表示位置*/
    width: 1.3em;
    height: 1.3em;
    margin-right: 0.2em;
    margin-bottom: 0.15em;
    border-radius: 3px;
    color: var(--colorwhite);
    text-align: center;
    }
        /*１枚絵*/
        .format-single::before {
            background-color: var(--tagmaincolor1);
            content: "\e3f4";
        }
        /*矢印切り替え*/
        .format-multiple::before {
            background-color: var(--tagmaincolor3);
            content: var(--icon_e1);
        }
        /*ポップアップコミック*/
        .format-comic::before {
            background-color: var(--tagmaincolor2);
            content: var(--icon_ematome);
        }
        /*外部コミック*/
        .format-full-comic::before {
            background-color: var(--tagmaincolor2);
            content: "\e89e" ;
        }

/* 日付部分のスタイル調整 */
.gallery-item p {
    margin: 0;
    font-size: 85%;
    opacity: 0.5;
}

    /*スマホでのデザイン*/
    @media screen and (max-width: 650px) {
        .gallery {
            grid-template-columns: repeat(auto-fit, 92px);
            grid-gap: 0.3em 0.1em; /* 要素間の余白を設定*/
        }
            .gallery-item {
                min-width: 92px;
                width: calc(10%);
                padding: 0.1em; /*内側の余白*/
                
            }
    }

/* ポップアップ -----------------------------------------------------------------------*/
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100% !important;
    height: 100%;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

/* ポップアップ内のコンテンツ */
.popup-content {
    background-color: var(--tagsubcolor0);
    padding: 20px;
   /* margin-top: 8vh; （今はmultipleを使っていないのでコメントアウト）*/
    border-radius: 10px;
    width: 90vw;  /* 幅を画面幅の90%に固定 */
    height: 95vh; /* 高さを画面高さの%に固定 */ /*（multipleを使うなら86vhにする）*/
    max-width: 90%; /* 最大幅90% */
    max-height: 95%; /* 最大高さ% */ /*（multipleを使うなら86%にする）*/
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center; /* 中央寄せ */
}

/* 初期状態で画像が適切なサイズで表示されるように修正 */
.popup-images img {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 画像が枠内に収まるように調整 */
}
    /*comic100のときは最大横幅を狭く*/
    img.comic100_width {
        max-width: 500px;
    }

/* ポップアップ内の矢印ボタンの位置を変更 */
.arrow-buttons {
    display: flex;
    justify-content: center;
    gap: 50px;
    position: absolute;
    top: 8px;
    width: 100%;
    left: 0;
    z-index: 10001;
}

/* スマホでのポップアップの調整 */
@media screen and (max-width: 650px) {
    .popup-content {
        width: 95vw;  /* 幅を画面幅の95%に変更 */
        max-width: 95%; /* 最大幅95% */
        padding: 10px;  /* 左右の余白を狭く */
    }
}

.arrow-buttons button {
    background-color: var(--colorwhite);
    cursor: pointer;
}

.popup-info {
    margin-top: 50px;
    padding: 0.8em 1em;
    text-align: center;
    background-color: var(--colorwhite);
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
}
    /*タイトル*/
    #popup-title {
        font-size: 1.2em;
        text-align: left;
    }
    /*日付*/
    #popup-date {
        font-size: 0.8em;
        color: var(--fontcolor2);
        text-align: left;
    }
    /*説明*/
    #popup-description {
        position: relative;
        margin-top: 5px;
        text-align: left;
        padding: 1em 0.5em;
    }
        #popup-description::after {
            content: '';
            position: absolute;
            top: -4px; /* 要素の上に配置 */
            left: 0;
            width: 100%; /* 要素の幅に合わせて上線を引く */
            border-bottom: 2px dashed var(--tagsubcolor4); /* 点線の下線 */
          }
          
          #popup-description:empty::after {
            content: none;  /* 要素が空の場合、疑似要素を表示しない */
          }

/*コミックタイプ（ポップアップ）の文字のデザイン*/
.comic-images div {
    opacity: 0.6;
}
.comic-images p {
    font-size: 0.8em;
    opacity: 0.4;
    margin-bottom: 50px;
}
.comic-images p:last-child {
    margin-bottom: 0;
}

.share-link {
    cursor: pointer;
    color: var(--fontcolor2);
    background-color: var(--tagsubcolor2);
    border-radius:10px; /*角丸く*/
    text-align:center; /*左右中央寄せ*/
    margin: 1em; /*外側の余白*/
    padding: 0.5em;
    margin-top: 30px;
    width: 170px;
}
    .share-link:hover {
        background-color: var(--colortransparent3);
        color: var(--fontcolorlink1);
        transition:.3s;
    }


/* 漫画ビューのスタイル ------------------------------------------------------------------------------------*/
.bg_gallery {
    background-color: var(--tagsubcolor0);
}

.comic-info {
    margin: 0 auto;
    padding: 0.8em 1em;
    text-align: center;
    background-color: var(--colorwhite);
    border-radius: 10px;
    width: 100%;
}
    /*タイトル*/
    #comic-title {
        margin: 0.5em;
        font-size: 1.2em;
    }
    /*日付*/
    #comic-date {
        margin: 0.5em;
        font-size: 0.8em;
        color: var(--fontcolor2);
    }
    /*説明*/
    #comic-description {
        position: relative;
        margin-top: 5px;
        text-align: left;
        padding: 1em 0.5em;
    }
        #comic-description::after {
            content: '';
            position: absolute;
            top: -4px; /* 要素の上に配置 */
            left: 0;
            width: 100%; /* 要素の幅に合わせて上線を引く */
            border-bottom: 2px dashed var(--tagsubcolor4); /* 点線の下線 */
        }
        
        #comic-description:empty::after {
            content: none;  /* 要素が空の場合、疑似要素を表示しない */
        }

.comic-view-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.comic-view {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.comic-view img {
    width: 100%;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

/*文字のデザイン*/
.comic-view div {
    opacity: 0.6;
}
.comic-view p {
    font-size: 0.9em;
    opacity: 0.4;
    margin-bottom: 50px;
}
.comic-view p:last-child {
    margin-bottom: 0;
}

/* スマホでの調整 */
@media screen and (max-width: 650px) {
    .comic-view-container {
        padding: 0;
    }
}