/* リセットCSSの簡略化 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全体のスタイル設定 */
body {
    background-color: #242D45; 
    color: #D0D4E0; 
    font-family: "IMB Plex Mono","Courier","monospace","ヒラギノ明朝 Pro", "MS P明朝", serif;
    min-height: 100vh; 
    display: flex; 
    flex-direction: column;
    position: relative; 
    overflow-x: hidden; 
}

body::selection{
    color: #fff;
    background-color: #afa199;
}

/* font-family: 'Montserrat', sans-serif; */
 /* "IMB Plex Mono","Courier","monospace"; */


/* --- ヘッダー・ナビゲーション (デスクトップデフォルト) --- */


.header {
    width: 100%;
    padding: 26px 26px; 
    top: 0;
    left: 0;
    z-index: 10;
    display: flex; 
    position: fixed; 
}

/* チェックボックスを非表示にする */
.menu-toggle {
    position: absolute;
    opacity: 0;
    z-index: 99; 
    width: 40px;
    height: 40px;
    cursor: pointer;
    left: 20px; /* ヘッダーのpaddingに合わせる */
    display: block; /* PCでも表示 */
}

/* ハンバーガーアイコンのスタイル */
.menu-icon {
    display: flex; /* PCでも表示 */
    flex-direction: column;
    justify-content: space-between;
    width: 20px;
    height: 10px;
    cursor: pointer;
    z-index: 20; 
}

.bar {
    height: 2px;
    width: 100%;
    background-color: #D0D4E0;
    transition: all 0.3s ease;
}

/* ナビゲーションリストを全画面表示（モバイルと同じ）に切り替え */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(36, 45, 69, 0.85); /* 半透明の背景 */
    transform: translateX(-100%); /* 初期は画面外へ */
    transition: transform 0.4s ease-in-out;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.nav-list {
    list-style: none;
    flex-direction: column; /* 縦並び */
    align-items: center;
    gap: 30px;
    font-size: 2rem;
}

.nav-list a {
    color: #D0D4E0;
    text-decoration: none;
    font-size: 1.6rem; /* モバイルと統一 */
    font-weight: 400;
    letter-spacing: 1px;
    transition: color 0.3s;
    position: relative;
}

.nav-list .li_small {
    font-size: 1.4rem;
}

.nav-list .li_insta {
    font-size: 1.2rem;
}


/* ホバー時の下線エフェクトは残す */
.nav-list a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0; 
    height: 1px;
    background-color: white;
    transition: width 0.3s ease-out; 
}


.nav-list a:hover::after {
    width: 100%; 
}
.nav-list a:hover {
    color: white; 
}

/* チェックボックスがONになったらメニューを表示（モバイルと同じ設定を流用） */
#menu-toggle:checked ~ .nav {
    transform: translateX(0); 
}

/* チェックボックスがONになったらアイコンをX字に変換（モバイルと同じ設定を流用） */
#menu-toggle:checked ~ .menu-icon .bar:nth-child(2) {
        transform: translateY(-4px) rotate(-45deg); 
}
#menu-toggle:checked ~ .menu-icon .bar:nth-child(1) {
    transform: translateY(4px) rotate(45deg); 
}
/* #menu-toggle:checked ~ .menu-icon .bar:nth-child(2) {
    transform: translateY(-10.5px) rotate(-45deg); 
} */

.home {
    font-family: "IMB Plex Mono","Courier","monospace";
    font-size: 0.8rem;
    margin: 0 0 0 auto;
    color: #D0D4E0;
    text-decoration: none;
}

/* --- メインコンテンツ、アニメーション --- */

/* テキストのフェードインアニメーション */
@keyframes fadeInText {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 浮遊アニメーション */
@keyframes float {
    0% {
        transform: translate(var(--translateX), var(--translateY)) rotate(var(--rotation, 0deg));
    }
    50% {
        transform: translate(calc(var(--translateX) + var(--floatX)), calc(var(--translateY) + var(--floatY))) rotate(var(--rotation, 0deg));
    }
    100% {
        transform: translate(var(--translateX), var(--translateY)) rotate(var(--rotation, 0deg));
    }
}

/* PNG要素のフェードインアニメーション */
@keyframes fadeInElement {
    from { opacity: 0; transform: translate(var(--translateX), var(--translateY)) scale(0.8) rotate(var(--rotation, 0deg)); }
    to { opacity: 0.8; transform: translate(var(--translateX), var(--translateY)) scale(1) rotate(var(--rotation, 0deg)); }
}

.main-content {
    flex-grow: 1; 
    display: flex;
    justify-content: flex-end; 
    align-items: center;
    padding: 20px 40px;
    position: relative; 
}

.poem-container {
    font-family: "IMB Plex Mono","Courier","monospace";
    position: absolute;
    top: 81%; 
    left: 4%; 
    max-width: 400px;
    line-height: 1.5;
    font-size: 1.1rem;
    font-weight: 400;
    z-index: 5; 
    opacity: 0;
    animation: fadeInText 1s ease-out 3.2s forwards;
    
}

/* .poem-container::selection{
    color: #fff;
    background-color: #afa199;
} */

.visual-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.element {
    position: absolute;
    opacity: 0; /* 初期は非表示。imgタグに直接適用 */
    /* transform-originはimgタグに適用 */
    animation: fadeInElement 1s ease-out forwards, 
               float 8s ease-in-out infinite alternate; 
    /* div.element自体はコンテナとして使うため、ここではwidth/heightを指定しない */
}

/* imgタグに対してスタイルを適用 */
.element img {
    position: absolute; /* 親の.elementに対して絶対位置指定 */
    width: 100%; /* 親の.elementの幅に合わせる */
    height: 100%; /* 親の.elementの高さに合わせる */
    object-fit: contain; /* 画像が要素内に収まるように */
    transform-origin: center center; /* 回転の中心 */
    /* filter: invert(100%) brightness(120%); PNGが黒い場合は反転して明るくする */
}


/* 各要素の位置、サイズ、回転角度、浮遊量 */

/* 岩影 */
.element-brush-1 {
    width: 126px; height: 126px; /* 画像の表示サイズ */
    top: 25%; left: 29%;
    --rotation: 2deg;
    --translateX: -50%; /* 画像中央を基準にするため */
    --translateY: -50%;
    --floatX: 5px; 
    --floatY: -8px; 
    animation-delay: 1.2s;
}

/* 木の枝 */
.element-brush-2 {
    width: 130px; height: 130px;
    top: 17%; right: 37%;
    --rotation: 12deg;
    --translateX: 50%; 
    --translateY: -50%;
    --floatX: -7px;
    --floatY: 5px;
    animation-delay: 0.6s;
}


/* 紅葉*/
.element-star {
    width: 88px; height: 88px;
    top: 60%; left: 35%;
    --rotation: -10deg;
    --translateX: -50%;
    --translateY: -50%;
    --floatX: -2px;
    --floatY:  6px;
    animation-delay: 0.3s;
}

/* 草 */
.element-branch-1 {
    width: 110px; height: 110px;
    top: 47%; left: 20%;
    --rotation:-2deg;
    --translateX: -50%;
    --translateY: -50%;
    --floatX: 8px;
    --floatY: -2px;
    animation-delay: 1.8s;
}

/* 円形要素 */
.element-moon {
    width: 83px; height: 83px;
    top: 34%; right: 19%;
    --rotation: 0deg;
    --translateX: 50%;
    --translateY: -50%;
    --floatX: 10px;
    --floatY: -5px;
    animation-delay: 1.4s;
}

/* 九日舎要素 */
.element-ginkgo {
    width: 142px; height: 142px;
    top: 41%; right: 46%;
    --rotation: 6deg;
    --translateX: 50%;
    --translateY: -50%;
    --floatX: 4px;
    --floatY: 7px;
    animation-delay: 1.5s;
}

/* .element-ginkgo:hover img{
    opacity: 0.6;
} */

#hovcolor:hover{
filter: brightness(0) saturate(100%) invert(73%) sepia(6%) saturate(578%) hue-rotate(338deg) brightness(91%) contrast(82%);}


/* 「9」要素 */
.element-number-9 {
    width: 100px; height: 100px;
    top: 57%; right: 32%;
    --rotation: 3deg;
    --translateX: 50%;
    --translateY: -50%;
    --floatX: -3px;
    --floatY: -6px;
    animation-delay: 2.3s;
}


/* 根要素 */
.element-branch-2 {
    width: 110px; height: 110px;
    top: 73%; right: 22%;
    --rotation: 0deg;
    --translateX: 50%;
    --translateY: -50%;
    --floatX: -5px;
    --floatY: 4px;
    animation-delay: 1.0s;
}


/* 岩面 */
.element-brush-3 {
    width: 146px; height: 146px;
    top: 75%; left: 42%;
    --rotation: -2deg;
    --translateX: -50%;
    --translateY: -50%;
    --floatX: 8px;
    --floatY: 2px;
    animation-delay: 1.8s;
}




/* --- 別ページの基本的なレイアウト --- */

.page-title-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    text-align: center;
    max-width: 800px;
    padding: 20px;
    z-index: 5;
}

.page-title-container h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.page-title-container p {
    font-size: 1.1rem;
    line-height: 1.7;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.gallery-item {
    background-color: rgba(208, 212, 224, 0.1); 
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}


/* --- 768px以下のスタイル（タブレット横〜モバイル） --- */
@media (max-width: 768px) {
    
    /* ヘッダーのパディング調整 */
    .header {
        padding: 20px;
    }

    /* ホームリンクの位置調整 */
    .home {
        margin: 0 0 0 auto; /* 右端に寄せるのは維持 */
        font-size: 0.8rem;
    }

    /* メニューアイコンとトグルの位置調整（画面端に寄せる） */
    .menu-toggle {
        left: 20px;
    }
    
    /* メインコンテンツのパディング調整 */
    .main-content {
        padding: 20px;
    }

    /* 詩のコンテナの位置と幅の調整 */
    .poem-container {
        /* 中央付近に移動させ、幅を画面幅に応じて調整 */
        top: 88%;
        left: 3%;
        transform: translateX(-50%);
        width: 90%; 
        max-width: 380px; /* PC版より狭くする */
        line-height: 1.4;
        font-size: 1.2rem;
        animation: fadeInText 1s ease-out 3s forwards; /* アニメーション開始を少し早める */
    }

    /* --- ビジュアル要素のサイズと位置調整 --- */
    /* 全体を縮小し、重なりを軽減 */

    /* 岩影 */
    .element-brush-1 {
        width: 100px; height: 100px;
        top: 20%; left: 32%;
        --floatX: 4px; --floatY: -6px; 
    }

    /* 木の枝 */
    .element-brush-2 {
        width: 100px; height: 100px;
        top: 16%; right: 29%;
        --floatX: -5px; --floatY: 4px;
    }

    /* 紅葉 */
    .element-star {
        width: 70px; height: 70px;
        top: 50%; left: 30%;
        --floatX: -1px; --floatY: 5px;
    }

    /* 草 */
    .element-branch-1 {
        width: 80px; height: 80px;
        top: 34%; left: 20%;
        --floatX: 6px; --floatY: -1px;
    }

    /* 円形要素 */
    .element-moon {
        width: 70px; height: 70px;
        top: 32%; right: 22%;
        --floatX: 8px; --floatY: -4px;
    }

    /* 九日舎要素 */
    .element-ginkgo {
        width: 110px; height: 110px;
        top: 36%; right: 48%;
        --floatX: 3px; --floatY: 6px;
    }

    /* 「9」要素 */
    .element-number-9 {
        width: 80px; height: 80px;
        top: 49%; right: 37%;
        --floatX: -2px; --floatY: -5px;
    }

    /* 根要素 */
    .element-branch-2 {
        width: 80px; height: 80px;
        top: 59%; right: 19%;
        --floatX: -4px; --floatY: 3px;
    }

    /* 岩面 */
    .element-brush-3 {
        width: 110px; height: 110px;
        top: 66%; left: 35%;
        --floatX: 6px; --floatY: 1px;
    }
}


/* --- 480px以下のスタイル（スマートフォン） --- */
@media (max-width: 480px) {

    /* bodyのフォントサイズを微調整 */
    body {
        font-size: 14px;
    }

    /* ヘッダーのパディング調整 */
    .header {
        padding: 15px;
    }

    /* メニューアイコンとトグルの位置調整 */
    .menu-toggle {
        left: 15px;
        width: 30px;
        height: 30px;
    }

    /* ハンバーガーアイコンのサイズを調整 */
    .menu-icon {
        width: 18px;
        height: 10px;
    }

    /* ナビゲーションメニューのフォントサイズを調整 */
    .nav-list a {
        font-size: 1.8rem;
    }

    /* ホームリンクのフォントサイズを調整 */
    .home {
        font-size: 0.8rem;
    }

    /* 詩のコンテナの位置と幅の調整（さらに中央に寄せ、幅を確保） */
    .poem-container {
        top: 80%;
        width: 90%; 
        max-width: 300px;
        font-size: 0.9rem;
    }

    /* --- ビジュアル要素のさらなる調整（より小さく、画面上部に集中） --- */

    /* 岩影 */
    .element-brush-1 {
        width: 84px; height: 84px;
        top: 15%; left: 27%;
    }

    /* 木の枝 */
    .element-brush-2 {
        width: 90px; height: 90px;
        top: 14%; right: 31%;
    }

    /* 紅葉 */
    .element-star {
        width: 60px; height: 60px;
        top: 50%; left: 30%;
    }

    /* 草 */
    .element-branch-1 {
        width: 85px; height: 85px;
        top: 31%; left: 24%;
    }

    /* 円形要素 */
    .element-moon {
        width: 60px; height: 60px;
        top: 29%; right: 20%;
    }

    /* 九日舎要素 */
    .element-ginkgo {
        width: 102px; height: 102px;
        top: 33%; right: 49%;
    }

    /* 「9」要素 */
    .element-number-9 {
        width: 75px; height: 75px;
        top: 47%; right: 33%;
    }

    /* 根要素 */
    .element-branch-2 {
        width: 70px; height: 70px;
        top: 62%; right: 24%;
    }

    /* 岩面 */
    .element-brush-3 {
        width: 98px; height: 98px;
        top: 66%; left: 36%;
    }

    /* --- 別ページの基本的なレイアウトの調整 --- */
    .page-title-container {
        width: 90%;
        padding: 10px;
    }

    .page-title-container h1 {
        font-size: 2rem;
    }

    .page-title-container p {
        font-size: 1rem;
    }

    .image-grid {
        grid-template-columns: 1fr; /* 1列にする */
        gap: 15px;
    }

    .gallery-item {
        height: 100px;
    }
}