/* ==========================================
   全体設定
   ========================================== */
body {
    margin: 0;
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    background-color: #f1f1f1;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    color: #333;
}


/* ==========================================
   ヘッダー (PC)
   ========================================== */
/* ヘッダー全体の設定 */
.header {
    margin-left: 220px; /* サイドバーの幅と同じ */
    background-color: #24336A;
    color: white;
    padding: 6px 20px;
    box-sizing: border-box;
    position: relative;
    z-index: 5000;

    /* ★中央配置のための設定 */
    display: flex;
    justify-content: center; /* 横方向の中央 */
    align-items: center;     /* 縦方向の中央 */
}

/* サイトタイトル（画像が入るリンク）のスタイル */
.site-title-link {
    /* ★固定のmargin-leftを削除 */
    text-decoration: none;
    display: flex;
    align-items: center;
}

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 24px;
    position: relative;
    z-index: 1001;
}

.hamburger-menu span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.hamburger-menu span:last-child { margin-bottom: 0; }

/* ==========================================
   サイドバー (固定設定)
   ========================================== */
.sidebar, .sidebar-other {
    width: 220px;
    background-color: #E8E6E3;
    padding: 15px;
    padding-top: 68px;
    padding-bottom: 0px;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow-y: auto;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 5000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.08);
}

.sidebar nav ul, .sidebar-other nav ul {
    list-style: none;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

.sidebar nav li, .sidebar-other nav li {
    margin-bottom: 10px;
}

.sidebar nav a, .sidebar-other nav a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 8px 6px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    text-align: center;    /* まずは中央にする */
    padding-right: 20px;    /* 左側に余白を入れて、全体を右へ少しずらす */
}

.sidebar nav a:hover, .sidebar-other nav a:hover {
    background-color: #fff;
    text-decoration: none !important;
}

/* ==========================================
   メインコンテンツ
   ========================================== */
.container {
    display: flex;
    flex: 1;
}

.content {
    flex-grow: 1;
    margin-left: 220px; /* サイドバー幅と同じ */
    padding: 20px;
    box-sizing: border-box;
}

/* ==========================================
   フッター (サイドバーを考慮)
   ========================================== */
.p-site-footer {
    background-color: #24336A; /* ヘッダーと同じ色 */
    color: #fff;
    padding: 40px 0 30px;
    margin-top: auto; /* コンテンツが少なくても下に配置 */
    width: 100%;
    padding-left: 220px; /* PCではサイドバー分を空ける */
    box-sizing: border-box;
}

.p-footer-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.p-footer-links {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    gap: 40px;
}

.p-footer-links a {
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.3s;
}

.p-footer-links a:hover { opacity: 0.7; }

.p-footer-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto 20px;
    width: 80%;
}

.p-footer-bottom {
    font-size: 0.85rem;
    opacity: 0.8;
}



.p-sidebar-random {
    margin: 20px 0;
    padding: 0 10px;
    /* ボタンを中央に寄せる設定 */
    text-align: center;
}

.p-random-btn {
    /* 幅を100%から、中身に合わせた幅に変更 */
    display: inline-flex; 
    align-items: center;
    padding: 7px 3px;
    
    background-color: #E8E6E3;
    border: 0px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    transition: background-color 0.2s;

    /* 中央から左へ10pxずらす設定 */
    position: relative;
    right: 3px; /* 右方向に10px移動＝左へずれる */
}

.p-random-btn:hover {
    background-color: #e0e0e0;
}


/* ページで下にスクロールしたときに出る上へ誘導ボタン。もはやサイドバーではない */



/* 右下に固定表示 */
.p-pagetop-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 45px;
    height: 45px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    
    /* 最初は隠す設定 */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: translateY(10px);
}

/* 表示された時 */
.p-pagetop-btn.is-show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ホバーで少し浮く */
.p-pagetop-btn:hover {
    background-color: #555;
    transform: scale(1.1);
}
/* ==========================================
   スマホ表示 (767px以下)
   ========================================== */
@media (max-width: 767px) {
      .header {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        width: 100%;
        margin-left: 0;
margin-left: 0;      
        padding: 3px 15px;   
    }

    /* 2. HTML直書きの height="75" を完全に無効化して上書きする */
    .header a img {
        height: 60px !important; /* スマホ時のロゴの高さを 50px に強制固定 */
        width: auto !important;  /* 画像の横伸び・潰れを絶対に防ぐ */
    }




    .hamburger-menu { display: block; }
    .site-title-link { margin-left: 10px; }

    .sidebar, .sidebar-other {
        left: -100%; /* 完全に隠す */
        width: 70%;
        z-index: 1001;
        transition: left 0.3s ease;
    }

    .sidebar.is-active, .sidebar-other.is-active {
        left: 0;
    }

    .content {
        margin-left: 0;
        margin-top: 70px; /* ヘッダーの高さ分 */
        padding: 10px;
    }

    .p-site-footer {
        padding-left: 0; /* スマホでは左余白を解除 */
    }

    .p-footer-links {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
}

/* オーバーレイ */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.overlay.is-active {
    display: block;
    opacity: 1;
    visibility: visible;
}









/* --- フッターリンク全体の表示制御 --- */

/* デフォルト（PC時）は非表示にする */
.p-footer-links-list {
    display: none !important;
}

/* --- スマホ表示（画面幅768px以下）の時だけ表示して横並びにする --- */
@media (max-width: 768px) {
    .p-footer-links-list {
        display: flex !important;       /* スマホの時だけフレックスボックスとして表示 */
        flex-direction: row !important; /* 横方向に並べる */
        justify-content: center;        /* 中央寄せ */
        align-items: center;
        flex-wrap: nowrap !important;   /* 絶対に折り返さない */
        list-style: none !important;
        padding: 0 !important;
        margin: 0 0 15px 0 !important;
        width: 100%;
    }

    /* リストの各項目（li） */
    .p-footer-links-list li {
        display: inline-flex;
        align-items: center;
        white-space: nowrap;            /* 自動改行を防ぐ */
    }

    /* リンク文字単体のスタイル */
    .p-footer-link-item {
        font-size: 11.5px;              /* スマホ用に少しシャープなサイズ */
        color: #cbd5e1;                 /* コピーライトと同じ薄いグレー */
        text-decoration: none;
        transition: color 0.2s;
    }

    /* リンクにマウスを乗せたとき（タップ時など） */
    .p-footer-link-item:hover {
        color: #ffffff;                 /* 白く光る */
        text-decoration: underline;
    }

    /* リンクとリンクの間の縦線（|） */
    .p-footer-links-list li:not(:last-child)::after {
        content: "|";
        margin-left: 8px;               /* 間隔をスマホ用にタイトに */
        margin-right: 8px;
        color: #8da2bb;                 /* 縦線の色 */
        font-size: 11.5px;
        cursor: default;
    }
}