/*
Theme Name: ヤカンヒコウ
Theme URI: https://blog.chachay.org/
Author: Chachay
Description: 左ナビ・中央タイトル一覧・右本文の3ペインレイアウト（ヤカンヒコウ配色）
Version: 4.0
License: MIT
*/

/* =====================
   カラー変数（ヤカンヒコウ配色）
   白背景・黒テキスト・青リンク・薄グレーサイドバー
   ===================== */
:root {
    --color-bg:               #ffffff;
    --color-sidebar-bg:       #f7f7f7;
    --color-text:             #212121;
    --color-text-light:       #757575;
    --color-text-meta:        #9e9e9e;
    --color-link:             #0066cc;
    --color-link-hover:       #004499;
    --color-border:           #e0e0e0;
    --color-border-dark:      #333333;
    --color-active-bg:        #e8f0fe;
    --color-active-text:      #0066cc;
    --color-active-bar:       #0066cc;
    --color-code-bg:          #f5f5f5;
    --color-code-border:      #bdbdbd;
    --color-header-line:      #333333;
    --color-nav-hover:        #eeeeee;
    --color-nav-current-bg:   #333333;
    --color-nav-current-text: #ffffff;
    --color-title-hover:      #f0f4ff;
    --color-footer-bg:        #f7f7f7;
    --color-footer-text:      #9e9e9e;

    /* =====================
       レイアウト幅変数
       ★ここだけ変更すれば各ペインの幅が変わります★

       目安：
         中央を少し広く → --width-center: 240px
         中央を広く     → --width-center: 280px  ← おすすめ
         中央をかなり広く→ --width-center: 320px
       ===================== */
    --width-left:   180px;   /* 左ペイン（カテゴリナビ） */
    --width-center: 280px;   /* 中央ペイン（タイトル一覧）★ここを変更 */

    /* =====================
       ★ここだけ変更すれば全体に反映されます★

       目安：
         小さめ → base: 13px
         標準   → base: 14px  ← 現在
         大きめ → base: 16px
         特大   → base: 18px
       ===================== */
    --font-base:        18px;   /* 本文・基準サイズ */
    --font-sm:          16px;   /* ナビ・メタ情報など小さめ文字 */
    --font-xs:          14px;   /* 日付・カテゴリタグなど最小 */
    --font-post-title:  26px;   /* 右ペイン：記事タイトル */
    --font-h1-site:     22px;   /* サイトタイトル（ヘッダー） */
    --font-h2:          20px;   /* 記事内 h2 */
    --font-h3:          17px;   /* 記事内 h3 */
    --font-code:        14px;   /* コード・等幅フォント */
    --font-footer:      13px;   /* フッター */
}

/* =====================
   リセット & 基本
   ===================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    font-size: var(--font-base);
    line-height: 1.8;
    color: var(--color-text);
    background: var(--color-bg);
    overflow: hidden;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* =====================
   ページ全体：縦並び
   ===================== */
#page-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* =====================
   ヘッダー（固定）
   ===================== */
#header {
    flex-shrink: 0;
    padding: 14px 24px;
    border-bottom: 2px solid var(--color-header-line);
    background: var(--color-bg);
    z-index: 10;
}

#header h1 {
    font-size: var(--font-h1-site);
    font-weight: bold;
    letter-spacing: 2px;
    color: var(--color-text);
}

#header h1 a {
    color: var(--color-text);
    text-decoration: none;
}

#header h1 a:hover {
    color: var(--color-link);
    text-decoration: none;
}

/* =====================
   3ペインエリア
   ===================== */
#three-pane {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* =====================
   左ペイン（180px固定）
   カテゴリナビ + SNS・リンク
   ===================== */
#left-pane {
    width: var(--width-left);
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: 18px 12px;
    background: var(--color-sidebar-bg);
}

.pane-section {
    margin-bottom: 26px;
}

.pane-section-title {
    font-size: 10px;
    font-weight: bold;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border);
}

/* カテゴリナビ */
#category-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#category-nav a {
    display: block;
    padding: 5px 8px;
    font-size: var(--font-sm);
    color: var(--color-text);
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.1s;
    text-decoration: none;
}

#category-nav a:hover {
    background: var(--color-nav-hover);
    color: var(--color-text);
    text-decoration: none;
}

#category-nav a.current {
    background: var(--color-nav-current-bg);
    color: var(--color-nav-current-text);
    font-weight: bold;
}

/* SNS・リンク */
#left-pane ul {
    list-style: none;
    padding: 0;
}

#left-pane ul li {
    margin-bottom: 6px;
}

#left-pane ul li a {
    font-size: var(--font-sm);
    color: var(--color-link);
}

#left-pane ul li a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

.link-desc {
    display: block;
    font-size: 10px;
    color: var(--color-text-meta);
    margin-top: 1px;
    margin-left: 2px;
}

/* =====================
   中央ペイン（200px固定）
   記事タイトル一覧
   ===================== */
#center-pane {
    width: var(--width-center);
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    background: var(--color-bg);
}

.title-item {
    padding: 11px 12px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.1s;
}

.title-item:hover {
    background: var(--color-title-hover);
}

.title-item.active {
    background: var(--color-active-bg);
    border-left: 3px solid var(--color-active-bar);
    padding-left: 9px;
}

.title-item .item-title {
    font-size: var(--font-sm);
    font-weight: bold;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 4px;
}

.title-item.active .item-title {
    color: var(--color-active-text);
}

.title-item .item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.title-item .item-date {
    font-size: var(--font-xs);
    color: var(--color-text-meta);
}

.title-item .item-views {
    font-size: var(--font-xs);
    color: var(--color-text-meta);
    white-space: nowrap;
}

.title-item .item-cat {
    font-size: var(--font-xs);
    color: var(--color-text-light);
    margin-top: 2px;
}

/* ソートバー */
#sort-bar {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.sort-btn {
    flex: 1;
    padding: 7px 4px;
    font-size: var(--font-xs);
    font-family: inherit;
    background: none;
    border: none;
    border-right: 1px solid var(--color-border);
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.sort-btn:last-child {
    border-right: none;
}

.sort-btn:hover {
    background: var(--color-nav-hover);
    color: var(--color-text);
}

.sort-btn.active {
    background: var(--color-nav-current-bg);
    color: var(--color-nav-current-text);
    font-weight: bold;
}

/* 中央ページネーション */
#center-pagination {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    border-top: 1px solid var(--color-border);
    background: var(--color-sidebar-bg);
}

#center-pagination a {
    color: var(--color-text-light);
    padding: 2px 7px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    text-decoration: none;
}

#center-pagination a:hover {
    background: var(--color-nav-hover);
    text-decoration: none;
}

/* ローディング */
.loading-msg {
    padding: 20px 12px;
    font-size: 12px;
    color: var(--color-text-meta);
    text-align: center;
}

/* =====================
   右ペイン（残り全幅）
   記事本文
   ===================== */
#right-pane {
    flex: 1;
    overflow-y: auto;
    padding: 26px 36px;
    min-width: 0;
    background: var(--color-bg);
}

#right-pane .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-meta);
    font-size: 14px;
}

/* 記事タイトル */
#right-pane .post-title {
    font-size: var(--font-post-title);
    font-weight: bold;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--color-text);
}

/* 記事メタ情報（日付・カテゴリ） */
#right-pane .post-meta {
    font-size: 12px;
    color: var(--color-text-light);
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

#right-pane .post-meta .post-categories a {
    color: var(--color-text-light);
    border: 1px solid var(--color-border);
    padding: 1px 7px;
    border-radius: 2px;
    font-size: 11px;
    text-decoration: none;
}

#right-pane .post-meta .post-categories a:hover {
    background: var(--color-nav-hover);
    text-decoration: none;
}

/* 記事本文 */
#right-pane .post-content {
    font-size: var(--font-base);
    line-height: 1.9;
    color: var(--color-text);
}

#right-pane .post-content p {
    margin-bottom: 1.1em;
}

#right-pane .post-content h2 {
    font-size: var(--font-h2);
    font-weight: bold;
    margin: 2em 0 0.7em;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

#right-pane .post-content h3 {
    font-size: var(--font-h3);
    font-weight: bold;
    margin: 1.5em 0 0.5em;
    color: var(--color-text);
}

#right-pane .post-content ul,
#right-pane .post-content ol {
    padding-left: 1.8em;
    margin-bottom: 1em;
}

#right-pane .post-content li {
    margin-bottom: 0.3em;
}

#right-pane .post-content img {
    display: block;
    margin: 1.4em auto;
    max-width: 100%;
}

/* コードブロック */
#right-pane .post-content pre {
    background: var(--color-code-bg);
    border: 1px solid var(--color-code-border);
    border-left: 3px solid var(--color-text-light);
    padding: 14px 16px;
    overflow-x: auto;
    font-size: var(--font-code);
    line-height: 1.65;
    margin: 1.2em 0;
    border-radius: 2px;
}

#right-pane .post-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: var(--font-code);
    background: var(--color-code-bg);
    color: var(--color-text);
    padding: 1px 5px;
    border-radius: 2px;
}

#right-pane .post-content pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
}

/* テーブル */
#right-pane .post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 13px;
}

#right-pane .post-content th,
#right-pane .post-content td {
    border: 1px solid var(--color-border);
    padding: 7px 12px;
    text-align: left;
}

#right-pane .post-content th {
    background: var(--color-sidebar-bg);
    font-weight: bold;
    color: var(--color-text);
}

/* 引用 */
#right-pane .post-content blockquote {
    border-left: 3px solid var(--color-border-dark);
    margin: 1.2em 0;
    padding: 4px 16px;
    color: var(--color-text-light);
    font-style: italic;
}

/* =====================
   フッター（固定）
   ===================== */
#footer {
    flex-shrink: 0;
    padding: 9px 24px;
    border-top: 1px solid var(--color-border);
    font-size: var(--font-footer);
    color: var(--color-footer-text);
    text-align: center;
    background: var(--color-footer-bg);
}

#footer a {
    color: var(--color-text-light);
}

/* ============================================
   レスポンシブ：900px以下 → 1カラム縦積み
   ============================================ */
@media (max-width: 900px) {

    /* 通常スクロールに戻す */
    body {
        overflow: auto;
    }

    #page-wrapper {
        height: auto;
        min-height: 100vh;
        display: block;
    }

    /* ヘッダー：固定解除 */
    #header {
        padding: 12px 16px;
    }

    /* 3ペインを縦積みに */
    #three-pane {
        display: block;
        overflow: visible;
    }

    /* ===== 左ペイン：横幅100%、高さ自動 ===== */
    #left-pane {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        overflow: visible;
        padding: 12px 16px;
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        align-items: flex-start;
    }

    .pane-section {
        margin-bottom: 0;
        min-width: 120px;
    }

    /* カテゴリナビを横並びのタグに */
    #category-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    #category-nav a {
        display: inline-block;
        padding: 3px 10px;
        border: 1px solid var(--color-border);
        border-radius: 12px;
        font-size: 12px;
    }

    #category-nav a.current {
        border-color: var(--color-nav-current-bg);
    }

    /* ===== 中央ペイン：縦リストに切り替え ===== */
    #center-pane {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        overflow: visible;
        display: block;
    }

    /* ソートバーは幅いっぱいに固定表示 */
    #sort-bar {
        position: static;
        width: 100%;
        display: flex;
    }

    /* タイトルカードは縦並び（見切れ解消） */
    .title-item {
        min-width: unset;
        max-width: unset;
        width: 100%;
        flex-shrink: unset;
        border-bottom: 1px solid var(--color-border);
        border-right: none;
        padding: 12px 16px;
        scroll-snap-align: unset;
    }

    .title-item.active {
        border-left: 3px solid var(--color-active-bar);
        border-top: none;
        padding-left: 13px;
        padding-top: 12px;
    }

    /* ページネーションも表示 */
    #center-pagination {
        display: flex;
        padding: 10px 16px;
    }

    /* ===== 右ペイン：通常フロー ===== */
    #right-pane {
        overflow: visible;
        padding: 20px 16px;
        flex: none;
        width: 100%;
    }

    #right-pane .placeholder {
        height: auto;
        padding: 30px 0;
    }

    /* フッター */
    #footer {
        padding: 10px 16px;
    }
}

/* =====================
   超小型（480px以下）
   ===================== */
@media (max-width: 480px) {
    #header h1 {
        font-size: 17px;
        letter-spacing: 1px;
    }

    #right-pane .post-title {
        font-size: 18px;
    }

    #right-pane {
        padding: 16px 12px;
    }

    .title-item {
        min-width: 140px;
    }
}