@charset "UTF-8";

/* ----------------------------------------------
   全体レイアウト・基本スタイル
---------------------------------------------- */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #f6f7f8;
}

/* コンテナ: ヘッダー、ナビ、コンテンツ、右サイドバーをグリッドで配置 */
.container {
    flex: 1;
    display: grid;
    grid-template-columns: 10% 15% 50% 15% 10%;
    grid-template-rows: auto 1fr;
    grid-template-areas:
        ". header contents rsbar ."
        ". nav contents rsbar .";
    position: relative;
}

/* レスポンシブ: 画面幅に応じてグリッド列幅を調整 */
@media screen and (max-width: 1550px) {
    .container {
        grid-template-columns: 5% 17.5% 67.5% 8% 2%;
    }
}

@media screen and (max-width: 1200px) {
    .container {
        grid-template-columns: 5% 20% 70% 8% 2%;
    }
}

/* 横幅960px以下: ヘッダーを中央寄せ、ナビ幅縮小等 */
@media screen and (max-width: 960px) {
    .container {
        grid-template-columns: 10% 0% 80% 8% 2%;
        grid-template-areas:
            ". header header rsbar ."
            ". nav contents rsbar .";
    }
    header {
        justify-content: center;
    }
    .EISA {
        margin: 20px 0 10px;
    }
}

/* 横幅850px以下 */
@media screen and (max-width: 850px) {
    .container {
        grid-template-columns: 5% 0% 90% 3% 2%;
    }
}

/* 横幅500px以下 */
@media screen and (max-width: 500px) {
    .container {
        grid-template-columns: 2% 0% 96% 2% 0%;
    }
}

/* ----------------------------------------------
   ヘッダー
---------------------------------------------- */
header {
    grid-area: header;
    position: sticky;
    top: 0;
    z-index: 10;
    height: 90px;
    padding: 0;
    display: flex;
    align-items: center;
    background-color: #f6f7f8;
}

.EISA {
    font-family: good-times, sans-serif;
    font-weight: 400;
    font-size: 4.2em;
    margin: 10px 0 0;
}

.EISA a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
}

/* 横幅1100px以下でフォントサイズ調整 */
@media screen and (max-width: 1100px) {
    .EISA {
        font-size: 3.5em;
    }
}

/* ----------------------------------------------
   ナビゲーション（デスクトップ）
---------------------------------------------- */
nav {
    grid-area: nav;
    position: sticky;
    top: 90px; /* ヘッダー高さと合わせる */
    align-self: start;
    font-size: 1.2em;
    color: #212121;
    background-color: #f6f7f8;
    overflow-y: auto;
    max-height: calc(100vh - 90px); /* ヘッダー分差し引く */
}

/* アクセスカウンター（960px以上のみ表示） */
@media screen and (min-width: 960px) {
    #count {
        background-color: #f6f7f8;
        border: 4px double #212121;
        text-align: center;
        margin-right: 15%;
        margin-bottom: 10px;
    }
    #count p:first-child,
    #count p:last-child {
        margin: 1px auto;
    }
    #count p:last-child {
        font-size: 1.5em;
    }
}

/* 横幅1250px～960pxで文字サイズ微調整 */
@media screen and (max-width: 1250px) and (min-width: 960px) {
    #count p:first-child {
        font-size: 0.9em;
    }
    #count .counter-value {
        font-size: 0.75em;
    }
}

/* 横幅1050px～960pxで文字サイズ微調整 */
@media screen and (max-width: 1050px) and (min-width: 960px) {
    #count p:first-child {
        font-size: 0.8em;
    }
    #count .counter-value {
        font-size: 0.65em;
    }
}

/* ナビゲーションリスト（960px以上用） */
@media screen and (min-width: 960px) {
    nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
        position: relative;
    }

    nav ul ul {
        padding-left: 1em;
        position: relative;
    }

    /* 下層リストの縦ライン表示 */
    nav ul ul::before {
        content: "";
        border-left: 2px solid #212121;
        position: absolute;
        height: 100%;
        left: 0.5em;
        top: 0;
    }

    /* 最下層のライン調整 */
    nav ul ul::after {
        content: "";
        border-left: 2px solid #f6f7f8;
        position: absolute;
        height: 0.8em;
        left: 0.5em;
        bottom: 0;
    }

    nav ul ul li {
        position: relative;
        padding-left: 1em;
    }

    nav ul ul li::before {
        content: "";
        border-top: 2px solid #212121;
        position: absolute;
        width: 1em;
        left: -0.5em;
        top: 50%;
        transform: translateY(-50%);
    }

    nav > ul > li {
        margin-bottom: 15px;
    }

    nav > ul > li > a {
        font-size: 1.2em;
    }

    nav a {
        text-decoration: none;
        color: inherit;
        padding: 2px;
        display: block;
    }

    nav a:hover {
        background-color: #4d4c61;
        color: #f6f7f8;
        margin-right: 10px;
    }
}

/* ----------------------------------------------
   ハンバーガーメニュー（960px以下）
   ナビゲーションをスライドインする仕組み
---------------------------------------------- */
@media screen and (max-width: 960px) {
    /* ハンバーガーボタン */
    .menu {
        position: fixed;
        top: 20px;
        left: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        width: 50px;
        height: 50px;
        background-color: #393e4f;
        border-radius: 50%;
        transition: transform 250ms ease, background-color 250ms ease;
        cursor: pointer;
        z-index: 200;
        will-change: transform;
    }

    .menu::after {
        content: "";
        position: absolute;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2px solid transparent;
        pointer-events: none;
    }

    /* メニュー展開後にボタン枠を回転して表示 */
    #menu:checked ~ .menu::after {
        animation: borderAnimation 1s linear forwards 0.75s;
    }

    @keyframes borderAnimation {
        0% {
            border-color: transparent;
            transform: rotate(0deg);
        }
        100% {
            border-color: #f6f7f8;
            transform: rotate(360deg);
        }
    }

    .menu span {
        display: block;
        width: 50%;
        height: 2px;
        background-color: #f6f7f8;
        transition: transform 250ms ease;
    }

    .menu span:nth-of-type(1) {
        transform: translateY(-5px);
    }

    .menu span:nth-of-type(3) {
        transform: translateY(5px);
    }

    /* メニュー開閉アニメーション */
    #menu:checked ~ .menu {
        transform: rotate(360deg);
    }

    #menu:checked ~ .menu span:nth-of-type(1) {
        transform: translateY(1px) rotate(45deg);
    }

    #menu:checked ~ .menu span:nth-of-type(2) {
        display: none;
    }

    #menu:checked ~ .menu span:nth-of-type(3) {
        transform: translateY(-1px) rotate(-45deg);
    }

    /* チェックボックス非表示（トグル用） */
    #menu {
        display: none;
    }

    /* スライドインナビゲーション */
    nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 300px;
        height: 100vh;
        background-color: #f6f7f8;
        color: #212121;
        transform: translateX(-100%);
        transition: transform 500ms ease, background-color 500ms ease 500ms, color 500ms ease 500ms;
        z-index: 100;
        padding-top: 100px;
        will-change: transform;
    }

    /* メニューON時にナビゲーション表示 */
    #menu:checked ~ nav {
        transform: translateX(0);
        background-color: #393e4f;
        color: #f6f7f8;
    }

    #menu:checked ~ nav ul ul {
        background-color: #393e4f;
        color: #f6f7f8;
    }

    nav ul {
        padding: 0;
        margin: 0;
        list-style: none;
    }

    nav ul li {
        margin: 0;
        padding: 10px 20px;
        border-bottom: 1px solid #212121;
    }

    nav ul li a {
        color: inherit;
        text-decoration: none;
        font-size: 16px;
        display: block;
        text-transform: uppercase;
    }

    /* サブメニュー */
    nav ul ul {
        padding-left: 30px;
        background-color: #f6f7f8;
        color: #212121;
        transition: background-color 500ms ease 500ms, color 500ms ease 500ms;
    }

    nav ul ul li {
        padding-left: 2px;
        border-bottom: none;
        position: relative;
    }

    nav ul ul li::before {
        content: ">";
        position: absolute;
        left: -20px;
        top: 50%;
        transform: translateY(-50%);
        color: inherit;
        padding-right: 10px;
    }

    /* ホバー時のカラー変更 */
    nav ul li a:hover {
        color: #2ca9e1;
    }

    /* アクセスカウンター（縮小時） */
    #count {
        text-align: center;
        margin-bottom: 0;
    }
    #count p:first-of-type {
        font-size: 20px;
        font-weight: bold;
        margin: 0;
    }
    #count p:last-of-type {
        font-size: 16px;
        margin: 0;
    }
}

/* 大きい画面でハンバーガーメニュー非表示 */
@media screen and (min-width: 961px) {
    #menu,
    .menu {
        display: none;
    }
}

/* ----------------------------------------------
   メインコンテンツ
---------------------------------------------- */
.contents {
    grid-area: contents;
    box-sizing: border-box;
    word-wrap: break-word;
    word-break: break-all;
    display: flex;
    flex-direction: column;
    position: relative;
}

.contents main {
    flex-grow: 1;
}

.contents main a {
    color: #000000; /* リンクの文字色 (例: 青色) */
}

@media screen and (max-width: 500px) {
    .contents {
        padding-right: 2%;
    }
}

/* ----------------------------------------------
   右サイドバー
---------------------------------------------- */
.rsbar {
    grid-area: rsbar;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 10px;
}

.darkmode-toggle-section {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 10px;
}

.darkmode-label {
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 0.8em;
}

/* ダークモードトグルスイッチ */
.darkmode-toggle-section .switchArea {
    position: fixed;
    line-height: 30px;
    text-align: center;
    font-size: 14px;
    position: relative;
    margin: auto;
    width: 80px;
}

/* チェックボックス非表示（見た目はラベルで代替） */
.darkmode-toggle-section .switchArea input[type="checkbox"] {
    display: none;
}

.darkmode-toggle-section .switchArea label {
    display: block;
    box-sizing: border-box;
    height: 30px;
    border: 2px solid #ffa64d;
    border-radius: 15px;
}

.darkmode-toggle-section .switchArea input[type="checkbox"]:checked + label {
    border-color: #999999;
}

/* OFF時とON時の文字表示 */
.darkmode-toggle-section .switchArea label span:after {
    content: "OFF";
    padding: 0 0 0 16px;
    color: #ffa64d;
}
.darkmode-toggle-section .switchArea input[type="checkbox"]:checked + label span:after {
    content: "ON";
    padding: 16px 0 0 0;
    color: #999999;
}

/* スイッチ部分の丸 */
.darkmode-toggle-section .switchArea #swImg {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #ffa64d;
    top: 3px;
    left: 3px;
    border-radius: 12px;
    transition: .2s;
}

.darkmode-toggle-section .switchArea input[type="checkbox"]:checked ~ #swImg {
    transform: translateX(48px);
    background: #999999;
}

/* トップへ戻るボタン */
.rsbar a.back-to-top {
    color: #333;
    position: fixed;
    bottom: 15px;
    right: 200px;
    text-decoration: none;
    display: block;
    width: 100px;
    padding: 2px 10px;
    text-align: right;
    transform: rotate(90deg);
    transform-origin: bottom right;
}

.rsbar a.back-to-top .arrow1 {
    width: 50px;
    height: 1.5px;
    background: #333;
    position: absolute;
    top: 50%;
    right: 50px;
}

.rsbar a.back-to-top .arrow2 {
    width: 1.5px;
    height: 12px;
    background: #333;
    position: absolute;
    top: calc(50% + 1.5px);
    right: 99px;
    transform: rotate(-130deg);
    transform-origin: top left;
}

.rsbar a.back-to-top:hover {
    background-color: #393e4f;
    color: #f6f7f8;
}
.rsbar a.back-to-top:hover .arrow1,
.rsbar a.back-to-top:hover .arrow2 {
    background: #f6f7f8;
}

/* スムーズスクロール */
html {
    scroll-behavior: smooth;
}

/* 960px以下で右サイドバー非表示 */
@media screen and (max-width: 960px) {
    .rsbar {
        display: none;
    }
}

/* ----------------------------------------------
   フッター
---------------------------------------------- */
footer {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: #f6f7f8;
    width: 100%;
    font-size: 0.8em;
    margin-top: auto;
}
