/* project1/css/mokuji.css */

/* =========================================
   1. ボタン（ビューア側用）
   ========================================= */
.btn-green {
    background-color: #009a44 !important;
    color: white !important;
}

.btn-green:hover {
    background-color: #0081cd !important; 
}

/* =========================================
   2. 目次パネル（モーダル）全体のレイアウト
   ========================================= */
#modal-mokuji {
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6); 
    z-index: 9999;
    justify-content: center; 
    align-items: center;
}

#modal-mokuji.panel-open { 
    display: flex; 
}

#modal-mokuji .modal-dialog {
    background: #fff; 
    width: 95%; 
    max-width: 1200px; 
    height: 95%;
    border-radius: 8px; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#modal-mokuji .modal-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 15px 20px; 
    border-bottom: 1px solid #dee2e6; 
    background-color: #f8f9fa; 
}

#modal-mokuji .modal-title { 
    margin: 0; 
    font-size: 20px; 
    color: #333; 
}

#modal-mokuji .close {
    background: none; 
    border: none; 
    font-size: 28px; 
    cursor: pointer; 
    color: #aaa;
}

#modal-mokuji .close:hover { 
    color: #333; 
}

#modal-mokuji .modal-body {
    padding: 20px; 
    overflow-y: auto; 
    flex: 1;
}

#modal-mokuji .modal-body p {
    border-bottom: 1px solid #eee;
    margin: 0; 
    padding: 10px 0;
}

#modal-mokuji .modal-body a { 
    color: #0056b3; 
    text-decoration: none; 
}

#modal-mokuji .modal-body a:hover { 
    text-decoration: underline; 
}

.ml-1rem { margin-left: 1rem; font-weight: bold; font-size: 1.1em; color: #333 !important;}
.ml-2rem { margin-left: 2rem; }
.ml-3rem { margin-left: 3rem; }


/* =========================================
   3. 丸いボタン（レスポンシブ対応完全版）
   ========================================= */
.mokuji-content {
    width: 100%;
    display: block;
    margin: 1em 0;
    padding: 0;
}

.mokuji-content ul {
    width: 100%;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-wrap: wrap; /* 画面幅が足りない時は自動で段落ちさせる */
    justify-content: center;
    gap: 20px; /* ボタン同士の隙間を一定に保つ */
    list-style: none;
}

/* --- デフォルト（タブレット〜小さめのPC画面） --- */
.mokuji-content ul li {
    width: calc(25% - 25px); /* 基本は4つ並び */
    aspect-ratio: 1 / 1; /* 【重要】縦横比を1:1に固定し、絶対に楕円にさせない */
    flex-shrink: 0; /* 【重要】ブラウザによる無理な縮小（押し潰し）を禁止 */
    margin: 0;
    background: #fff;
    border-radius: 50%;
    display: flex;
}

.mokuji-content ul li a {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex; /* 【重要】文字を確実にど真ん中に配置する */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 1em;
    box-sizing: border-box;
    color: #fff !important;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 1px #222, -1px 1px 1px #222, 1px -1px 1px #222, -1px -1px 1px #222, 1px 1px 1px #222, -1px 1px 1px #222, 1px -1px 1px #222, -1px -1px 1px #222;
    transition: transform 0.3s ease;
    line-height: 1.4em;
    text-decoration: none;
}

/* 各ボタンの背景色 */
.mokuji-content ul li:nth-child(1) a { background: #f19805; }
.mokuji-content ul li:nth-child(2) a { background: #ed87b4; }
.mokuji-content ul li:nth-child(3) a { background: #0081cd; }
.mokuji-content ul li:nth-child(4) a { background: #bb8cbe; }
.mokuji-content ul li:nth-child(5) a { background: #70b72c; }
.mokuji-content ul li:nth-child(6) a { background: #009da4; }
.mokuji-content ul li:nth-child(7) a { background: #e20112; }
.mokuji-content ul li:nth-child(8) a { background: #009a44; }
.mokuji-content ul li:nth-child(9) a { background: #ed6c01; }
.mokuji-content ul li:nth-child(10) a { background: #a7841f; }
.mokuji-content ul li:nth-child(11) a { background: #e2efc4; }
.mokuji-content ul li:nth-child(12) a { background: #e2efc4; }

.mokuji-content ul li a:hover {
    text-decoration: none;
    transform: scale(1.05); /* ホバーで少しだけフワッと拡大 */
}


/* --- レスポンシブ対応（画面サイズによる変化） --- */

/* 大画面（PCなど）: 横一列に5個並びにする */
@media screen and (min-width: 1098px) {
    .mokuji-content ul li {
        width: calc(20% - 25px); /* 5等分 */
        max-width: 220px; /* 大きくなりすぎないように上限を設定 */
    }
    .mokuji-content ul li a {
        font-size: 140%;
    }
}

/* 中画面（ノートPCなど）: フォントサイズのみ調整 */
@media screen and (min-width: 768px) and (max-width: 1097px) {
    .mokuji-content ul li a {
        font-size: 120%;
    }
}

/* 小画面（スマホなど）: 角丸の横長ボタンとして縦に積み重ねる */
@media screen and (max-width: 767.98px) {
    .mokuji-content ul {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .mokuji-content ul li {
        width: 90%; /* 横幅いっぱいに広げる */
        aspect-ratio: auto; /* 正円の縛りを解除 */
        height: auto;
        min-height: 60px;
        border-radius: 10px; /* 少し丸みのある長方形に */
    }

    .mokuji-content ul li a {
        border-radius: 10px; /* リンクの当たり判定も長方形に合わせる */
        padding: 15px 20px;
        font-size: 120%;
    }
}