/* ============================================= */
/* (0) 基本設定・リセット */
/* ============================================= */
html {
  font-size: 16px;
}

body {
    margin: 0;
    font-size: 1.1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.7;
    color: #333;
    background-color: #f9f9f9;
}

/* メニュー表示中は背景をスクロールさせない */
body.is-nav-active {
    overflow: hidden;
}

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

ul, ol {
    padding-left: 20px;
}

a {
    color: #0033cc;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* サイト全体のラッパー (中央揃え用) */
.container {
    display: flex;
    flex-direction: column; /* スマホでは縦積み */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0; /* スマホ用の左右余白 */
}

/* ============================================= */
/* (1) ヘッダー & ナビゲーション                                              */
/* ============================================= */
.site-header {
    width: 100%;
    padding: 15px 0;
    background-color: #fff;
    border-bottom: 1px solid #eee;
    /* ハンバーガーボタンより手前、オーバーレイメニューより奥 */
    position: relative; 
    z-index: 50; 
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.site-logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

/* (A) PC用ナビ (デフォルトは非表示) */
.global-nav {
    display: none; 
}
.global-nav ul {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
}
.global-nav li {
    margin-left: 20px;
}

/* (B) スマホ用ハンバーガーボタン */
.hamburger-btn {
    display: flex; /* スマホで表示 */
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 30px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 150; /* メニュー開閉時も最前面に */
}
.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: #333;
    transition: all 0.3s;
}

/* ハンバーガーメニューが開いた時のボタン（×印） */
.hamburger-btn.is-active {
    position: fixed; /* ヘッダーがスクロールしても位置固定 */
    top: 25px;       /* ヘッダーのpadding + α */
    right: 15px;      /* ヘッダーのpadding */
}
.hamburger-btn.is-active .hamburger-line:nth-child(1) {
    transform: translateY(13.5px) rotate(45deg);
}
.hamburger-btn.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-13.5px) rotate(-45deg);
}

/* (C) スマホ用ナビゲーション (全画面オーバーレイ) */
.mobile-nav {
    display: none; /* JSで 'flex' に変更 */
    position: fixed; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* 画面の高さ100% */
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 100;
    
    /* 内部の ul を中央寄せ */
    align-items: center;
    justify-content: center;
}
.mobile-nav ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
.mobile-nav li {
    margin: 20px 0;
}
.mobile-nav a {
    font-size: 1.3rem;
    font-weight: bold;
    color: #333;
    padding: 10px;
}

/* (D) 閉じるボタン */
.close-btn {
    position: fixed; 
    top: 20px;
    right: 20px;
    z-index: 110; 

    background: #555;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 26px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.3s;
}
.close-btn:hover {
    background-color: #888;
}

/* ============================================= */
/* (2) メインコンテンツ (スマホ: 1カラム)                                */
/* ============================================= */
.main-content {
    flex: 1;
    order: 1; /* スマホではメインが先 */
    /* PC表示時に右側に余白を持たせる */
    padding: 1rem;
    margin: 1rem 0;
    background-color: #fff;
}

.sidebar {
    width: 100%;
    padding: 20px 15px; /* スマホ用の左右余白を考慮 */
    background-color: #f4f4f4;
    order: 2; /* スマホではサイドバーが後 */
    box-sizing: border-box; /* paddingを含めて幅100% */
    margin: 1rem 0;
    background-color: white;
}

/* パンくずリスト */
.breadcrumb-nav ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    font-size: 0.9rem;
}
.breadcrumb-nav li:not(:last-child)::after {
    content: ">";
    margin: 0 0.5em;
    color: #888;
}
.breadcrumb-nav span {
    color: #777;
}

/* 記事タイトル */
.post-title {
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 10px;
    line-height: 1.3;
}

/* 記事メタ情報 (日付) */
.post-meta {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 25px;
}
.post-meta time {
    margin-right: 15px;
}

/* 目次 */
.post-body .table-of-contents {
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 15px 20px;
    margin-bottom: 30px;
    border-radius: 5px;
    font-weight: bold;
}
.post-body .table-of-contents h2 {
    font-size: 1.2rem;
    margin-top: 0;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
}
.post-body .table-of-contents ul {
    padding-left: 20px;
    margin-bottom: 0;
}
.post-body .table-of-contents ul li {
    margin: 5px 0;
}
/* 目次の階層ごとのインデント */
.post-body .toc-item.level-h2 {
  list-style-type: disc;        /* ● 黒丸 */
}
.post-body .toc-item.level-h3 {
  list-style-type: circle;      /* ○ 白丸 */
  margin-left: 1em;
  font-size: 0.95em;
}
.post-body .toc-item.level-h4 {
  list-style-type: square;      /* ■ 四角 */
  margin-left: 1.5em;
  font-size: 0.9em;
}

/* --- 記事本文 --- */
/* 見出し */
.post-body h2 {
    font-size: 1.3rem;
    margin: 3rem 0 2rem 0;
    padding: 1rem;
    background-color: #f5f6f7;
    text-align: center;
}
.post-body h3 {
    font-size: 1.2rem;
    margin: 2rem 0 0 0;
    border-bottom: 2px solid;
    text-align: center;
}
.post-body h4 {
    font-size: 1.1rem;
    margin: 2rem 0 0 0;
    padding: 0.5rem 1rem;
    border-left: 5px solid darkgray;
    text-align: left;
}

/* テーブル（データ表） */
.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.9rem;
    overflow-x: auto; /* スマホで表がはみ出たらスクロール */
    display: block;
}
.post-body th, 
.post-body td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: left;
    min-width: 100px; /* 横スクロール時の最小幅 */
}
.post-body th {
    background-color: #f0f0f0;
    font-weight: bold;
}

/* リスト */
.post-body ul {
    margin: 2rem 0;
}
.post-body ul li {
    margin: .2rem;
}

/* 関連記事 */
.related-posts {
    margin-top: 40px;
}

/* サイドバーウィジェット */
.sidebar-widget {
    margin-bottom: 30px;
}
.sidebar-widget h2 {
    font-size: 1.1rem;
    border-bottom: 2px solid #ccc;
    padding-bottom: 5px;
}
.sidebar-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-widget li {
    border-bottom: 1px dashed #ddd;
}
.sidebar-widget a {
    display: block;
    padding: 8px 5px;
    color: #333;
}
.sidebar-widget a:hover {
    background-color: #e9e9e9;
    text-decoration: none;
}


/* ============================================= */
/* (4) フッター */
/* ============================================= */
.site-footer {
    text-align: center;
    padding: 0.5rem 0;
    background-color: #333;
    color: #fff;
    margin-top: 1.5rem;
    font-size: 1rem;
}
.footer-nav ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-nav li {
    margin: 5px 15px;
}
.footer-nav a {
    color: #fff;
}
.copyright {
    margin: 0;
    font-size: 0.9rem;
}


/* ============================================= */
/* (5) PC用スタイル (ブレークポイント: 769px以上) */
/* ============================================= */
@media (min-width: 769px) {

    /* コンテナ (2カラム配置) */
    .container {
        flex-direction: row; /* 横並びにする */
        padding: 0; /* PCでは .header-inner などが余白を持つ */
    }

    /* ヘッダー */
    .hamburger-btn {
        display: none; /* PCではハンバーガーボタン非表示 */
    }
    .mobile-nav {
        display: none !important; /* スマホ用ナビは強制非表示 */
    }
    .close-btn {
        display: none !important; /* 閉じるボタンも強制非表示 */
    }
    .global-nav {
        display: block; /* PC用ナビを表示 */
    }

    /* 2カラムレイアウト */
    .main-content {
        width: 75%;
        order: 1;
        padding: 30px; /* PC用の余白 */
    }
    .sidebar {
        width: 25%;
        order: 2;
        padding: 30px;
        margin-left:1rem;
    }

    /* テーブルの横スクロール解除 */
    .post-body table {
        display: table;
        width: 100%;
    }
}

/* ============================================= */
/* (6) その他                                                                               */
/* ============================================= */
/* ボタン */
.back-btn {
  position: fixed;
  right: 15px;
  bottom: 15px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 1000;
  text-align: center;
}
.back-btn.show {
  opacity: 0.85;
  pointer-events: auto;
}
.back-btn:hover {
  opacity: 1;
  transform: scale(1.05);
}
#toTocBtn {
  bottom: 70px; /* トップボタンの上に配置 */
}

/* 関連記事 */
#rss-article-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
#rss-article-list li {
  margin: 0.4em 0;
}
#rss-article-list a {
  text-decoration: none;
  color: #333;
  display: grid;
  justify-content: space-between;
  align-items: baseline;
}
#rss-article-list a:hover {
  text-decoration: underline;
}
.rss-title {
  font-size: medium;
}
.rss-date {
  font-size: small;
  color: #333;
}