/* ===== 固定ページ・投稿ページ共通スタイル ===== */
.page-content,
.post-content {
    padding: 100px 0 80px;
    min-height: calc(100vh - 300px);
    background: #fff;
}

.page-container,
.post-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ヘッダー */
.page-header,
.post-header {
    text-align: center;
    margin-bottom: 60px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.page-title,
.post-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.3;
    color: #333;
    margin: 0;
}

/* アイキャッチ画像 */
.post-thumbnail {
    margin-bottom: 50px;
    text-align: center;
}

.post-thumbnail img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* 本文エリア */
.page-body,
.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    margin-bottom: 60px;
}

/* 本文内の要素スタイリング */
.page-body h2,
.post-body h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 40px 0 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #009944;
}

.page-body h3,
.post-body h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 30px 0 15px;
    color: #333;
}

.page-body p,
.post-body p {
    margin-bottom: 20px;
}

.page-body ul,
.post-body ul,
.page-body ol,
.post-body ol {
    margin: 20px 0 20px 20px;
    padding-left: 20px;
}

.page-body li,
.post-body li {
    margin-bottom: 10px;
}

.page-body blockquote,
.post-body blockquote {
    margin: 30px 0;
    padding: 20px 30px;
    background: #f8f8f8;
    border-left: 4px solid #009944;
    font-style: italic;
}

.page-body table,
.post-body table {
    width: 100%;
    margin: 30px 0;
    border-collapse: collapse;
}

.page-body th,
.post-body th,
.page-body td,
.post-body td {
    padding: 12px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.page-body th,
.post-body th {
    background: #f8f8f8;
    font-weight: 600;
}

.page-body img,
.post-body img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 4px;
}

/* 画像の配置クラス */
.page-body .alignleft,
.post-body .alignleft {
    float: left;
    margin-right: 20px;
}

.page-body .alignright,
.post-body .alignright {
    float: right;
    margin-left: 20px;
}

.page-body .aligncenter,
.post-body .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ボタンエリア */
.page-back-button,
.post-navigation {
    text-align: center;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e0e0e0;
}

.btn-back-home,
.btn-back {
    display: inline-block;
    padding: 15px 40px;
    background: #009944;
    color: #fff;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 211, 122, 0.3);
}

.btn-back-home:hover,
.btn-back:hover {
    background: #00B968;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 211, 122, 0.4);
    color: #fff;
}

/* ===== ページタイトル非表示時の調整 ===== */
.page-body.no-title {
    margin-top: 0;
}

.hide-page-title .page-header {
    display: none;
}

.hide-page-title .page-content {
    padding-top: 60px;
}

/* ===== 投稿ページ専用スタイル ===== */

/* 投稿ページのヘッダーを左揃えに変更 */
.post-header {
    text-align: left;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 30px;
}

/* 投稿タイトルの下マージンを増やす */
.post-title {
    margin-bottom: 30px;
}

/* SNSシェアボタン */
.sns-share {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #fff;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #fff;
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

/* 各SNSボタンの色 */
.share-x {
    background-color: #000;
}

.share-x:hover {
    background-color: #333;
}

.share-facebook {
    background-color: #1877f2;
}

.share-facebook:hover {
    background-color: #166fe5;
}

.share-instagram {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.share-instagram:hover {
    background: linear-gradient(45deg, #e6683c, #dc2743, #cc2366, #bc1888, #9c1478);
}

.share-note {
    background-color: #41c9b4;
}

.share-note:hover {
    background-color: #3ab5a3;
}

/* 投稿メタ情報 */
.post-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.meta-separator {
    margin: 0 10px;
}

/* H2スタイルを上書き - 薄緑背景に緑文字 */
.post-body h2 {
    background-color: #e8f5e9;
    color: #2e7d32;
    padding: 15px 20px;
    border-bottom: none;
    border-radius: 5px;
}

/* H3スタイルを上書き - 左端にアクセント */
.post-body h3 {
    padding-left: 20px;
    position: relative;
}

.post-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 80%;
    background-color: #4caf50;
    border-radius: 3px;
}

/* タグ */
.post-tags {
    padding: 20px 0;
    border-top: 1px solid #eee;
    margin-bottom: 30px;
}

.tag-label {
    font-weight: bold;
    margin-right: 10px;
}

.post-tags a {
    display: inline-block;
    padding: 5px 12px;
    background-color: #f0f0f0;
    color: #666;
    text-decoration: none;
    border-radius: 3px;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.post-tags a:hover {
    background-color: #4caf50;
    color: #fff;
}

/* ホームに戻るボタンエリアの調整 */
.page-back-button {
    margin-top: 30px;
}

/* WordPress標準のクラスサポート */
.wp-caption {
    max-width: 100%;
    margin: 20px 0;
}

.wp-caption-text {
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.gallery {
    margin: 30px 0;
}

.gallery-item {
    display: inline-block;
    text-align: center;
    vertical-align: top;
    margin: 10px;
}

/* カラム対応 */
.wp-block-columns {
    display: flex;
    gap: 30px;
    margin: 30px 0;
}

.wp-block-column {
    flex: 1;
}

/* ===== 目次（Table of Contents）スタイル ===== */
.nemielu-toc {
    background: linear-gradient(135deg, #f0fdf4 0%, #e8f5e9 100%);
    border: 2px solid #4caf50;
    border-radius: 12px;
    padding: 0;
    margin: 40px 0;
    max-width: 100%;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.1);
    overflow: hidden;
}

/* 目次ヘッダー */
.nemielu-toc-header {
    background: linear-gradient(135deg, #4caf50 0%, #43a047 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.nemielu-toc-title {
    font-size: 1.2em;
    font-weight: 700;
    display: flex;
    align-items: center;
}

.nemielu-toc-title::before {
    content: "📑";
    margin-right: 10px;
    font-size: 1.1em;
}

.nemielu-toc-toggle {
    font-size: 1em;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.nemielu-toc-toggle.collapsed {
    transform: rotate(-90deg);
}

/* 目次コンテンツ */
.nemielu-toc-content {
    padding: 20px;
    background: #fff;
    transition: all 0.3s ease;
}

.nemielu-toc-content.collapsed {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
}

/* 目次リスト */
.nemielu-toc-list,
.nemielu-toc-sublist {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.nemielu-toc-sublist {
    padding-left: 1.5em;
    margin-top: 5px;
}

.nemielu-toc-item {
    margin: 0;
    position: relative;
}

/* 目次リンク */
.nemielu-toc-link {
    color: #2e7d32;
    text-decoration: none;
    display: flex;
    align-items: baseline;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
}

.nemielu-toc-link:hover {
    background-color: #e8f5e9;
    color: #1b5e20;
    padding-left: 18px;
}

.nemielu-toc-link::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 2px;
    background-color: #4caf50;
    transition: width 0.3s ease;
}

.nemielu-toc-link:hover::before {
    width: 4px;
}

/* 番号スタイル */
.nemielu-toc-number {
    color: #66bb6a;
    font-weight: 600;
    margin-right: 8px;
    font-size: 0.9em;
}

.nemielu-toc-text {
    flex: 1;
    line-height: 1.5;
}

/* レベルごとのスタイル */
.nemielu-toc-level-2 .nemielu-toc-link {
    font-weight: 600;
    font-size: 1.05em;
}

.nemielu-toc-level-3 .nemielu-toc-link {
    font-size: 0.98em;
    padding-left: 16px;
}

.nemielu-toc-level-4 .nemielu-toc-link {
    font-size: 0.95em;
    padding-left: 24px;
    color: #388e3c;
}

.nemielu-toc-level-5 .nemielu-toc-link,
.nemielu-toc-level-6 .nemielu-toc-link {
    font-size: 0.9em;
    padding-left: 32px;
    color: #558b2f;
}

/* アクティブ状態 */
.nemielu-toc-link.active {
    background-color: #e8f5e9;
    font-weight: 600;
}

.nemielu-toc-link.active::before {
    width: 4px;
    background-color: #2e7d32;
}

/* スムーススクロール */
html {
    scroll-behavior: smooth;
}

/* アンカーリンクのオフセット調整 */
h2[id], h3[id], h4[id], h5[id], h6[id] {
    scroll-margin-top: 80px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .page-content,
    .post-content {
        padding: 80px 0 60px;
    }
    
    .page-header,
    .post-header {
        margin-bottom: 40px;
        padding-bottom: 20px;
    }
    
    .page-body,
    .post-body {
        font-size: 1rem;
        margin-bottom: 40px;
    }
    
    .page-body h2,
    .post-body h2 {
        font-size: 1.5rem;
        margin: 30px 0 15px;
    }
    
    .page-body h3,
    .post-body h3 {
        font-size: 1.3rem;
        margin: 25px 0 12px;
    }
    
    .page-back-button,
    .post-navigation {
        margin-top: 40px;
        padding-top: 30px;
    }
    
    .btn-back-home,
    .btn-back {
        padding: 12px 30px;
        font-size: 0.95rem;
    }
    
    .hide-page-title .page-content {
        padding-top: 40px;
    }
    
    .post-meta {
        margin-bottom: 20px;
        padding-bottom: 20px;
    }
    
    .sns-share {
        justify-content: flex-start;
    }
    
    .share-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .share-btn span {
        display: none;
    }
    
    .wp-block-columns {
        flex-direction: column;
    }
    
    /* 目次のモバイル対応 */
    .nemielu-toc {
        margin: 30px 0;
        border-radius: 10px;
    }
    
    .nemielu-toc-header {
        padding: 12px 15px;
    }
    
    .nemielu-toc-title {
        font-size: 1.1em;
    }
    
    .nemielu-toc-content {
        padding: 15px;
    }
    
    .nemielu-toc-link {
        padding: 6px 10px;
        font-size: 0.95em;
    }
    
    .nemielu-toc-level-3 .nemielu-toc-link {
        padding-left: 12px;
    }
    
    .nemielu-toc-level-4 .nemielu-toc-link {
        padding-left: 20px;
    }
    
    .nemielu-toc-level-5 .nemielu-toc-link,
    .nemielu-toc-level-6 .nemielu-toc-link {
        padding-left: 28px;
    }
}