/*
 * Build-C Theme - Post / Blog Styles
 * ブログ・投稿関連 + YouTube Feed 修正
 */

/* ============================================================
   共通レイアウト（ブログ・単記事・アーカイブ共通）
   ============================================================ */

.blog-main,
.single-main,
.archive-main,
.page-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8rem 3rem 6rem;
    position: relative;
    z-index: 1;
}

/* ページ上部ヘッダー */
.blog-header {
    margin-bottom: 3rem;
}

/* ============================================================
   投稿カード（post-card）
   ============================================================ */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
}

.post-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-8px);
    border-color: var(--neon-cyan);
    box-shadow: 0 20px 60px rgba(0, 217, 255, 0.2);
}

/* サムネイル */
.post-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.post-thumbnail a {
    display: block;
    width: 100%;
    height: 100%;
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

/* カード本文 */
.post-body {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* メタ情報 */
.post-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.post-meta time {
    color: var(--neon-cyan);
}

.post-cat {
    padding: 0.2rem 0.6rem;
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 4px;
    color: var(--neon-cyan);
    font-size: 0.75rem;
}

/* 投稿タイトル */
.post-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.post-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-title a:hover {
    color: var(--neon-cyan);
}

/* 抜粋 */
.post-excerpt {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 1.2rem;
    flex: 1;
}

.post-excerpt p {
    margin: 0;
}

/* Read More */
.post-read-more {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--neon-cyan);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.3s ease;
    align-self: flex-start;
}

.post-read-more:hover {
    color: var(--neon-purple);
    transform: translateX(4px);
}

/* 投稿なし */
.no-posts {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.no-posts .section-command {
    margin-bottom: 1rem;
}

/* ============================================================
   ページネーション
   ============================================================ */

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.pagination .nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination .page-numbers {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 0.8rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.pagination .page-numbers:hover,
.pagination .page-numbers.current {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.3);
}

.pagination .page-numbers.dots {
    background: transparent;
    border-color: transparent;
}

/* ============================================================
   Homepage: Blog Section（front-page.php の最新記事セクション）
   ============================================================ */

.blog-section {
    padding: 6rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.blog-section-footer {
    text-align: center;
    margin-top: 2.5rem;
}

.view-all-posts {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    background: transparent;
    border: 2px solid var(--neon-cyan);
    border-radius: 50px;
    color: var(--neon-cyan);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.view-all-posts:hover {
    background: rgba(0, 217, 255, 0.1);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

/* ============================================================
   Archive: ヘッダー
   ============================================================ */

.archive-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    line-height: 1.8;
}

/* ============================================================
   Single / Page: 記事レイアウト
   ============================================================ */

.article {
    max-width: 800px;
    margin: 0 auto;
}

/* アイキャッチ */
.article-thumbnail {
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.article-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

/* 記事メタ */
.article-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.article-meta-command {
    color: var(--neon-cyan);
}

.article-meta time {
    color: var(--text-secondary);
}

.article-meta-sep {
    color: rgba(255, 255, 255, 0.2);
}

.article-meta-cat a {
    color: var(--neon-cyan);
    text-decoration: none;
}

.article-meta-cat a:hover {
    text-decoration: underline;
}

/* 記事タイトル */
.article-title {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 2.5rem;
    font-family: "Cormorant Garamond", serif;
}

/* ============================================================
   記事本文スタイル（Gutenberg ブロック対応含む）
   ============================================================ */

.article-content {
    font-size: 1.05rem;
    line-height: 2;
    color: var(--text-primary);
}

/* 見出し */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: "Cormorant Garamond", "Times New Roman", serif;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    line-height: 1.4;
}

.article-content h2 {
    font-size: 2rem;
    border-left: 4px solid var(--neon-cyan);
    padding-left: 1rem;
}

.article-content h3 {
    font-size: 1.6rem;
    color: var(--neon-cyan);
}

.article-content h4 {
    font-size: 1.3rem;
}

/* 段落 */
.article-content p {
    margin-bottom: 1.8rem;
}

/* リスト */
.article-content ul,
.article-content ol {
    padding-left: 2rem;
    margin-bottom: 1.8rem;
}

.article-content li {
    margin-bottom: 0.6rem;
    line-height: 1.9;
}

.article-content ul li::marker {
    color: var(--neon-cyan);
}

.article-content ol li::marker {
    color: var(--neon-cyan);
    font-family: 'JetBrains Mono', monospace;
}

/* 引用 */
.article-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(0, 217, 255, 0.05);
    border-left: 4px solid var(--neon-cyan);
    border-radius: 0 12px 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-content blockquote cite {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: var(--neon-cyan);
    font-style: normal;
    font-family: 'JetBrains Mono', monospace;
}

/* 画像 */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: block;
    margin: 1.5rem auto;
}

/* リンク */
.article-content a {
    color: var(--neon-cyan);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.3s ease;
}

.article-content a:hover {
    color: var(--neon-purple);
}

/* コード */
.article-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    background: rgba(0, 217, 255, 0.08);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    color: var(--neon-cyan);
}

.article-content pre {
    background: rgba(20, 20, 30, 0.9);
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.8rem;
}

.article-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-primary);
}

/* テーブル */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.8rem;
    font-size: 0.95rem;
}

.article-content th {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.2);
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--neon-cyan);
}

.article-content td {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
}

.article-content tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* hr */
.article-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 2.5rem 0;
}

/* ============================================================
   Gutenberg ブロック対応
   ============================================================ */

/* ワイドアライン */
.article-content .alignwide {
    margin-left: -3rem;
    margin-right: -3rem;
    max-width: calc(100% + 6rem);
}

.article-content .alignfull {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: 100vw;
    width: 100vw;
}

/* 画像ブロック */
.article-content .wp-block-image figure {
    margin: 1.5rem 0;
}

.article-content .wp-block-image figcaption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

/* 見出しブロック */
.article-content .wp-block-heading {
    margin: 2.5rem 0 1rem;
}

/* 引用ブロック */
.article-content .wp-block-quote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(0, 217, 255, 0.05);
    border-left: 4px solid var(--neon-cyan);
    border-radius: 0 12px 12px 0;
}

.article-content .wp-block-quote cite,
.article-content .wp-block-quote footer {
    font-size: 0.9rem;
    color: var(--neon-cyan);
    font-style: normal;
    font-family: 'JetBrains Mono', monospace;
}

/* カバーブロック */
.article-content .wp-block-cover {
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.8rem;
}

/* ボタンブロック */
.article-content .wp-block-button__link {
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    border-radius: 50px;
    padding: 0.8rem 2rem;
    color: white;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

.article-content .wp-block-button__link:hover {
    box-shadow: 0 0 30px rgba(0, 217, 255, 0.5);
    color: white;
}

/* ============================================================
   タグ
   ============================================================ */

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 2.5rem 0;
}

.tag-badge {
    padding: 0.3rem 0.9rem;
    background: rgba(199, 125, 255, 0.1);
    border: 1px solid rgba(199, 125, 255, 0.3);
    border-radius: 50px;
    color: var(--neon-purple);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.tag-badge:hover {
    background: rgba(199, 125, 255, 0.2);
    border-color: var(--neon-purple);
}

/* ============================================================
   前後の記事ナビゲーション
   ============================================================ */

.post-navigation {
    margin: 3rem 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.5rem 0;
}

.post-navigation .nav-links {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}

.post-navigation .nav-previous,
.post-navigation .nav-next {
    flex: 1;
}

.post-navigation .nav-next {
    text-align: right;
}

.post-navigation a {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
    transition: color 0.3s ease;
}

.post-navigation .nav-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--neon-cyan);
}

.post-navigation .nav-title {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.post-navigation a:hover .nav-title {
    color: var(--text-primary);
}

/* 一覧へ戻る */
.back-to-list-wrap {
    margin: 1.5rem 0 3rem;
}

.back-to-list {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.back-to-list:hover {
    color: var(--neon-cyan);
}

/* ============================================================
   YouTube Feed 修正（Smash Balloon 専用）
   ============================================================ */

/* ラッパー */
.yt-feed-wrapper {
    position: relative;
    overflow: hidden;
}

/* プラグイン全体のコンテナ */
.yt-feed-wrapper .sby_container,
.yt-feed-wrapper #sb_youtube {
    width: 100% !important;
    max-width: 100% !important;
}

/* チャンネルヘッダー（プラグイン生成）を非表示
   → .yt-header で独自ヘッダーを表示しているため */
.yt-feed-wrapper .sb_youtube_header {
    display: none !important;
}

/* 動画グリッド */
.yt-feed-wrapper .sby_items {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 各動画アイテム */
.yt-feed-wrapper .sby_item {
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* サムネイル比率を固定 */
.yt-feed-wrapper .sby_video_image,
.yt-feed-wrapper .sby_video_thumbnail {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    display: block !important;
    position: relative !important;
    height: auto !important;
}

.yt-feed-wrapper .sby_video_thumbnail img,
.yt-feed-wrapper .sby_video_image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* 巨大アイコンの抑制（プラグインのプレイボタン & YouTube ロゴ）*/
.yt-feed-wrapper .sby_play_btn_wrap {
    pointer-events: none !important;
}

.yt-feed-wrapper .sby_play_btn_wrap svg,
.yt-feed-wrapper .sby_play_btn_wrap img {
    width: 40px !important;
    height: 40px !important;
}

/* プラグインが挿入するロゴアイコンを制御 */
.yt-feed-wrapper .sby_logo_link {
    display: none !important;
}

/* 動画タイトルテキスト */
.yt-feed-wrapper .sby_video_title {
    font-family: "Noto Sans JP", sans-serif !important;
    font-size: 0.9rem !important;
    color: var(--text-primary) !important;
    margin-top: 0.6rem !important;
    line-height: 1.5 !important;
}

/* フィード全体の背景・ボーダーリセット */
.yt-feed-wrapper #sb_youtube,
.yt-feed-wrapper .sbyoutube {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* "Load More" ボタンのスタイル調整 */
.yt-feed-wrapper .sby_load_btn {
    display: inline-block !important;
    margin-top: 1.5rem !important;
    padding: 0.7rem 1.8rem !important;
    background: transparent !important;
    border: 1px solid rgba(0, 217, 255, 0.4) !important;
    border-radius: 50px !important;
    color: var(--neon-cyan) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.yt-feed-wrapper .sby_load_btn:hover {
    background: rgba(0, 217, 255, 0.1) !important;
    box-shadow: 0 0 16px rgba(0, 217, 255, 0.3) !important;
}

/* ============================================================
   レスポンシブ対応
   ============================================================ */

/* 〜1200px */
@media (max-width: 1200px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 〜1024px */
@media (max-width: 1024px) {
    .blog-main,
    .single-main,
    .archive-main,
    .page-main {
        padding: 7rem 2.5rem 5rem;
    }

    .blog-section {
        padding: 5rem 2.5rem;
    }
}

/* 〜768px */
@media (max-width: 768px) {
    .blog-main,
    .single-main,
    .archive-main,
    .page-main {
        padding: 6rem 1.5rem 4rem;
    }

    .blog-section {
        padding: 4rem 1.5rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .article-title {
        font-size: 2rem;
    }

    .article-content h2 {
        font-size: 1.6rem;
    }

    .post-navigation .nav-links {
        flex-direction: column;
        gap: 1rem;
    }

    .post-navigation .nav-next {
        text-align: left;
    }

    .yt-feed-wrapper .sby_items {
        grid-template-columns: 1fr !important;
    }
}

/* 〜480px */
@media (max-width: 480px) {
    .blog-main,
    .single-main,
    .archive-main,
    .page-main {
        padding: 5rem 1rem 3rem;
    }

    .blog-section {
        padding: 3rem 1rem;
    }

    .article-title {
        font-size: 1.6rem;
    }

    .article-content h2 {
        font-size: 1.4rem;
    }

    .article-content .alignwide {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
}
