/* style.css (レスポンシブ対応強化版) */
body {
    font-family: 'Arial', 'Helvetica Neue', 'Helvetica', sans-serif; /* より一般的なフォントファミリーに */
    line-height: 1.7; /* 行間を少し調整 */
    margin: 0;
    padding: 10px; /* モバイルでの左右の余白を確保 */
    background-color: #f0f8ff;
    color: #333;
    font-size: 16px; /* ベースフォントサイズ (モバイル基準) */
    -webkit-text-size-adjust: 100%; /* iOSでのフォントサイズ自動調整を抑制 */
    text-rendering: optimizeLegibility; /* 文字の表示を最適化 */
}

/* メインコンテンツエリアのベーススタイル */
header, main, footer, section {
    background-color: white;
    padding: 15px; /* モバイル向けのパディング */
    margin-bottom: 20px; /* 要素間のマージンを少し調整 */
    border-radius: 8px; /* 角丸を少し控えめに */
    box-shadow: 0 2px 5px rgba(0,0,0,0.08); /* 影を少し柔らかく */
    width: auto;
    max-width: 900px; /* コンテンツの最大幅を少し調整 */
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box; /* paddingとborderをwidth/heightに含める */
}

h1, h2, h3, h4, h5, h6 {
    color: #00509e;
    margin-top: 0;
    margin-bottom: 0.8em; /* 見出し下のマージン調整 */
    line-height: 1.3; /* 見出しの行間 */
    word-wrap: break-word;
    overflow-wrap: break-word; /* 長い単語やURLがはみ出るのを防ぐ */
}

h1 {
    border-bottom: 2px solid #00509e; /* ボーダーを少し細く */
    padding-bottom: 0.5em;
    font-size: 1.8em; /* モバイル向けのH1サイズ */
}
h2 {
    font-size: 1.5em; /* モバイル向けのH2サイズ */
}
h3 {
    font-size: 1.25em; /* モバイル向けのH3サイズ */
}

p {
    margin-bottom: 1em;
}

a {
    color: #0066cc; /* リンク色を少し変更 */
    text-decoration: none;
}

a:hover, a:focus { /* フォーカス時もスタイルを適用 */
    color: #004080;
    text-decoration: underline;
}

/* ナビゲーションのスタイル (モバイルファースト) */
nav.page-navigation {
    margin: 25px 0;
    padding: 10px;
    text-align: center;
    background-color: #e6f3ff;
    border-radius: 8px;
    display: flex;
    flex-direction: column; /* モバイルでは縦積み */
    align-items: stretch; /* 各リンクを幅いっぱいに */
    gap: 8px;
}

nav.page-navigation a {
    font-weight: bold;
    display: block;
    padding: 10px 15px;
    border-radius: 5px;
    background-color: #fff;
    border: 1px solid #007bff;
    transition: background-color 0.2s ease, color 0.2s ease; /* スムーズな変化 */
}
nav.page-navigation a:hover, nav.page-navigation a:focus {
    background-color: #007bff;
    color: #fff;
    text-decoration: none; /* ホバー時は下線不要に */
}

/* 画像のレスポンシブ対応クラス */
.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
}

/* コードブロックのスタイル (変更なし) */
pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    position: relative;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace; /* よりモダンな等幅フォント */
    font-size: 0.9em; /* 少し小さくして情報量を増やす */
    line-height: 1.6;
}
code { /* インラインコード */
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    background-color: #e9ecef; /* 背景色を少し変更 */
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.85em; /* インラインコードも少し小さめに */
    color: #333;
}
pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 1em; /* pre内のフォントサイズを基準に */
    color: inherit; /* 親要素の色を継承 */
}

/* コードコピーボタンのスタイル (変更なし) */
.copy-button {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    opacity: 0.7; /* 通常時は少し控えめに */
    transition: opacity 0.3s ease, background-color 0.3s ease;
}
pre:hover .copy-button {
    opacity: 1;
}
.copy-button:hover, .copy-button:focus {
    background-color: #0056b3;
}

/* サイトマップリストのスタイル (変更なし) */
#sitemap-list {
    list-style-type: none;
    padding-left: 0;
}
#sitemap-list li {
    margin-bottom: 10px;
    padding: 12px 15px; /* 少しパディング調整 */
    background-color: #e9ecef;
    border-radius: 5px;
}
#sitemap-list li a {
    font-weight: bold;
    display: block; /* リンクエリアを広げる */
}

/* Canvasデモ用のスタイル (変更なし) */
.canvas-container {
    border: 1px solid #ccc;
    margin: 20px auto; /* マージン調整 */
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 15px;
    box-sizing: border-box;
}
.demo-box {
    width: 80%;
    max-width: 200px;
    min-height: 100px;
    background-color: lightcoral;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    margin: 10px;
    transition: all 0.5s ease;
}
#window-size-info {
    margin-top: 10px;
    font-weight: bold;
    color: #333;
}

/* ----- メディアクエリを使ったレスポンシブ対応 ----- */

/* タブレットサイズ以上 (例: 600px以上) */
@media (min-width: 600px) {
    body {
        padding: 20px; /* 少し広めのパディング */
        font-size: 17px; /* 少しフォントを大きく */
    }
    header, main, footer, section {
        padding: 25px; /* パディングも少し大きく */
    }
    h1 { font-size: 2.2em; }
    h2 { font-size: 1.7em; }
    h3 { font-size: 1.4em; }

    nav.page-navigation {
        flex-direction: row; /* 横並びに変更 */
        justify-content: center; /* 中央寄せ */
        flex-wrap: wrap; /* リンクが多い場合に折り返す */
        gap: 10px; /* 横並び時の隙間 */
    }
    nav.page-navigation a {
        display: inline-block; /* インラインブロックに戻す */
        width: auto; /* 幅を自動に */
    }
    pre {
        font-size: 0.95em; /* 少しフォントサイズを戻す */
    }
}

/* デスクトップサイズ以上 (例: 992px以上) */
@media (min-width: 992px) {
    body {
        font-size: 18px; /* さらにフォントを大きく */
    }
    header, main, footer, section {
        padding: 30px;
    }
    h1 { font-size: 2.5em; }
    h2 { font-size: 1.9em; }
    h3 { font-size: 1.5em; }

    pre {
        font-size: 1em; /* デスクトップでは標準サイズに */
    }
}
