/* =========================================================
   SINGLE POST & PERFORMANCE (詳細ページ専用)
   ========================================================= */

/* アイキャッチ画像専用のサイズ制限 */
.p-single__thumb {
    max-width: 800px; /* お好みの最大幅に調整してください */
    margin: 0 auto 40px;
    text-align: center;
}

.p-single__thumb img {
    width: auto;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* 記事本文内の一般画像（1枚ずつの時） */
.p-entry-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 30px auto;
}

/* WordPressが自動生成する画像用のクラスにも適用 */
.p-single .aligncenter,
.p-single .alignnone {
    max-width: 640px; /* 720pxから640pxに変更 */
    width: 100%;
    margin: 40px auto;
}

/* --- 自動タイルレイアウト（ギャラリー） --- */
.p-entry-content .wp-block-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 幅に合わせて自動タイル化 */
    gap: 15px;
    padding: 0;
    margin: 40px 0;
}

.p-entry-content .wp-block-gallery .wp-block-image {
    margin: 0 !important;
    width: 100% !important;
}

.p-entry-content .wp-block-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* タイル内で画像を均一に切り抜き */
    aspect-ratio: 1 / 1; /* 正方形のタイルにする場合。長方形なら 3/2 などに */
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
}

/* ホバー時の演出：クリックできることが直感的にわかるように */
.p-entry-content .wp-block-image:hover img {
    transform: scale(1.03);
    opacity: 0.9;
}

/* キャプションをタイルの上に薄く表示 */
.p-entry-content .wp-block-image figcaption {
    font-size: 0.8rem;
    margin-top: 5px;
    color: #666;
    text-align: center;
}

/* --- 自動タイルレイアウト（ギャラリー） --- */
.p-entry-content .wp-block-gallery {
    display: grid;
    /* 画像の最小幅を200pxとして、画面幅に合わせて自動で列数を増減させる */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 10px;
    margin: 40px 0;
    padding: 0;
}

/* ギャラリー内の各画像枠 */
.p-entry-content .wp-block-gallery .wp-block-image {
    margin: 0 !important;
    width: 100% !important;
}

/* ギャラリー内の画像本体：高さを揃えてタイル状にする */
.p-entry-content .wp-block-gallery img {
    width: 100%;
    aspect-ratio: 1 / 1; /* 正方形に統一。3/2などにすると長方形になります */
    object-fit: cover;   /* 枠に合わせて画像を切り抜き、隙間を埋める */
    margin: 0;
    transition: transform 0.3s ease;
}

/* マウスを乗せた時の動き */
.p-entry-content .wp-block-gallery img:hover {
    transform: scale(1.05);
    z-index: 10;
}

/* --- 記事詳細のフッター（ボタンエリア） --- */
.p-single__footer {
    text-align: center;
    margin-top: 60px;     /* ボタンの上の余白 */
    margin-bottom: 120px; /* ボタンの下の余白（ここでフッターとの距離を調整） */
}

/* ボタン自体のスタイル（single.phpから移設） */
.c-btn-back {
    display: inline-block;
    padding: 15px 50px;
    border: 1px solid var(--color-text-main);
    color: var(--color-text-main);
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.c-btn-back:hover {
    background-color: var(--color-text-main);
    color: #fff;
}

/* スマホでは余白を少し詰める */
@media (max-width: 768px) {
    .p-single__footer {
        margin-bottom: 80px;
    }
}