/* ==============================================
   エディタ内プレビュー用スタイル
   ============================================== */
.custom-posts-block-preview {
    border: 2px dashed #ddd;
    padding: 20px;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.custom-posts-block-preview h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.custom-posts-block-preview p {
    margin: 5px 0;
    color: #666;
}

/* ==============================================
   フロントエンド表示用スタイル（固定高さ対応）
   ============================================== */
.custom-posts-block {
    margin: 20px 0;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

.custom-posts-block .section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 3px solid #333;
    color: #333;
    position: relative;
}

.custom-posts-block .section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: #007cba;
}

.featured-post-section {
    margin-bottom: 50px;
}

.latest-post-section {
    margin-bottom: 40px;
}

/* ==============================================
   投稿カードの共通スタイル（固定高さ対応）
   ============================================== */
.post-card-block {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    height: 300px; /* 固定高さを設定 */
    display: flex;
    flex-direction: column;
}

.post-card-block:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.post-card-block img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.post-card-block:hover img {
    transform: scale(1.05);
}

.post-card-block h3,
.post-card-block h4 {
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.post-card-block h3 a,
.post-card-block h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-card-block h3 a:hover,
.post-card-block h4 a:hover {
    color: #007cba;
}

/* 抜粋テキストの自動調整 */
.post-card-block p {
    color: #666;
    line-height: 1.6;
    margin: 0 0 15px 0;
    flex-grow: 1; /* 余ったスペースを埋める */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

/* 日付を非表示にする */
.post-meta {
    display: none !important;
}

/* ==============================================
   フルレイアウト（デフォルト）- 固定高さ対応
   ============================================== */
.layout-full .post-card-block {
    height: 280px; /* フルレイアウト専用の高さ */
}

.layout-full .full-layout {
    display: flex;
    gap: 25px;
    padding: 25px;
    align-items: flex-start;
    height: 100%;
}

.layout-full .post-thumbnail-wrapper {
    flex: 0 0 200px;
    width: 200px;
    height: 150px;
    overflow: hidden;
    border-radius: 8px;
}

.layout-full .post-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-full .post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow: hidden;
}

.layout-full h3 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px 0;
}

.layout-full p {
    flex-grow: 1;
    -webkit-line-clamp: 4; /* 4行で切り取り */
    font-size: 15px;
    line-height: 1.5;
}

.layout-full .read-more-btn {
    margin-top: auto;
    align-self: flex-start;
    flex-shrink: 0;
}

/* ==============================================
   横並びレイアウト - 固定高さ対応
   ============================================== */
.layout-horizontal .post-card-block {
    height: 220px;
}

.layout-horizontal .horizontal-layout {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start;
    height: 100%;
}

.layout-horizontal .post-thumbnail-wrapper {
    flex: 0 0 160px;
    width: 160px;
    height: 120px;
    overflow: hidden;
    border-radius: 8px;
}

.layout-horizontal .post-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-horizontal .post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    overflow: hidden;
}

.layout-horizontal h4 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 6px 0;
}

.layout-horizontal p {
    flex-grow: 1;
    -webkit-line-clamp: 3; /* 3行で切り取り */
    font-size: 14px;
}

.layout-horizontal .read-more-btn {
    margin-top: auto;
    align-self: flex-start;
    flex-shrink: 0;
}

/* ==============================================
   縦並びレイアウト - 固定高さ対応
   ============================================== */
.layout-vertical .post-card-block {
    height: 350px;
}

.layout-vertical .vertical-layout {
    padding: 20px;
    text-align: left;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.layout-vertical .post-thumbnail-wrapper {
    margin-bottom: 15px;
    height: 160px;
    overflow: hidden;
    border-radius: 8px;
    flex-shrink: 0;
}

.layout-vertical .post-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-vertical .post-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.layout-vertical h3 {
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 8px 0;
    flex-shrink: 0;
}

.layout-vertical p {
    flex-grow: 1;
    -webkit-line-clamp: 3; /* 3行で切り取り */
    font-size: 14px;
}

.layout-vertical .read-more-btn {
    margin-top: auto;
    flex-shrink: 0;
}

/* ==============================================
   コンパクトレイアウト - 固定高さ対応
   ============================================== */
.layout-compact .post-card-block {
    height: 120px;
}

.layout-compact .compact-layout {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    height: 100%;
}

.layout-compact .post-thumbnail-wrapper {
    flex: 0 0 80px;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.layout-compact .post-thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.layout-compact .post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    justify-content: center;
}

.layout-compact h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
    flex-shrink: 0;
}

.layout-compact .compact-excerpt {
    font-size: 13px;
    color: #666;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 2行で切り取り */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.layout-compact .read-more-btn {
    display: none; /* コンパクトレイアウトではRead Moreボタンを非表示 */
}

/* ==============================================
   Read More ボタン
   ============================================== */
.read-more-btn {
    display: inline-block;
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: #fff !important;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

.read-more-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 124, 186, 0.4);
}

/* ==============================================
   投稿タイプ別のアクセント
   ============================================== */
.featured-post {
    border-left: 2px solid #007cba;
    position: relative;
}

.featured-post::before {
    content: '📌';
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    color: #007cba;
    font-size: 16px;
    z-index: 2;
}

.latest-post {
    border-left: 2px solid #007cba;
    position: relative;
}

.latest-post::before {
    content: '🆕';
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    color: #007cba;
    font-size: 16px;
    z-index: 2;
}

/* ==============================================
   レスポンシブデザイン
   ============================================== */

/* タブレット用 */
@media (max-width: 1024px) and (min-width: 769px) {
    .custom-posts-block {
        padding: 0 30px;
    }
    
    .layout-full .post-card-block {
        height: 260px;
    }
    
    .layout-full .post-thumbnail-wrapper {
        flex: 0 0 180px;
        width: 180px;
        height: 130px;
    }
    
    .layout-horizontal .post-card-block {
        height: 200px;
    }
    
    .layout-horizontal .post-thumbnail-wrapper {
        flex: 0 0 140px;
        width: 140px;
        height: 100px;
    }
    
    .layout-vertical .post-card-block {
        height: 320px;
    }
}

/* モバイル用 */
@media (max-width: 768px) {
    .custom-posts-block {
        padding: 0 15px;
        margin: 30px 0;
    }
    
    .custom-posts-block .section-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    /* すべてのレイアウトを縦並びに変更し、高さを調整 */
    .layout-full .post-card-block,
    .layout-horizontal .post-card-block {
        height: 280px;
    }
    
    .layout-vertical .post-card-block {
        height: 300px;
    }
    
    .layout-full .full-layout,
    .layout-horizontal .horizontal-layout {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
    }
    
    .layout-full .post-thumbnail-wrapper,
    .layout-horizontal .post-thumbnail-wrapper {
        flex: none;
        width: 100%;
        height: 140px;
    }
    
    .layout-full .post-thumbnail-wrapper img,
    .layout-horizontal .post-thumbnail-wrapper img {
        height: 100%;
    }
    
    .layout-full h3,
    .layout-horizontal h3,
    .layout-vertical h3 {
        font-size: 18px;
    }
    
    .layout-full p,
    .layout-horizontal p,
    .layout-vertical p {
        -webkit-line-clamp: 3;
    }
    
    .layout-compact .post-card-block {
        height: 110px;
    }
    
    .layout-compact .compact-layout {
        padding: 12px 15px;
    }
    
    .layout-compact .post-thumbnail-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .read-more-btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* 小画面用 */
@media (max-width: 480px) {
    .custom-posts-block {
        padding: 0 10px;
    }
    
    .custom-posts-block .section-title {
        font-size: 18px;
    }
    
    .layout-full .post-card-block,
    .layout-horizontal .post-card-block,
    .layout-vertical .post-card-block {
        height: 300px;
    }
    
    .layout-full .full-layout,
    .layout-horizontal .horizontal-layout,
    .layout-vertical .vertical-layout {
        padding: 15px;
    }
    
    /* 小画面でのタイトル文字サイズ調整 */
    .layout-full h3,
    .layout-horizontal h3,
    .layout-vertical h3 {
        font-size: 16px !important;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    
    .layout-full h4,
    .layout-horizontal h4,
    .layout-vertical h4 {
        font-size: 16px !important;
        line-height: 1.3;
        margin-bottom: 8px;
    }
    
    /* 小画面での画像サイズ調整 */
    .layout-full .post-thumbnail-wrapper,
    .layout-horizontal .post-thumbnail-wrapper {
        height: 120px;
    }
    
    .layout-vertical .post-thumbnail-wrapper {
        height: 140px;
    }
    
    /* 小画面での抜粋調整 */
    .layout-full p,
    .layout-horizontal p,
    .layout-vertical p {
        font-size: 13px;
        line-height: 1.5;
        -webkit-line-clamp: 4;
    }
    
    /* コンパクトレイアウトの調整 */
    .layout-compact .post-card-block {
        height: 90px;
    }
    
    .layout-compact .compact-layout {
        padding: 10px 12px;
        gap: 12px;
    }
    
    .layout-compact .post-thumbnail-wrapper {
        width: 55px;
        height: 55px;
    }
    
    .layout-compact h4 {
        font-size: 13px;
        line-height: 1.2;
        margin-bottom: 4px;
    }
    
    .layout-compact .compact-excerpt {
        font-size: 11px;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }
    
    /* Read Moreボタンの調整 */
    .read-more-btn {
        padding: 8px 14px;
        font-size: 11px;
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }
    
    /* アイコンの調整 */
    .featured-post::before,
    .latest-post::before {
        top: 8px;
        right: 8px;
        font-size: 12px;
    }
}