/* 基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: dnp-shuei-nmincho-std, sans-serif;
    font-style: normal;
    font-weight: 400;
    background-color: #e0e0d9; /* 全体の薄いグレー背景 */
    color: #333;
    line-height: 1.8;
}

/* ヘッダー */
header {
    width: 100%;
    height: 100px;
}

.logo-placeholder{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: transparent;
}

.logo-placeholder img{
    width: 200px;
    height: auto;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 30px;
}

nav ul li a {
    text-decoration: none;
    color: #333;
    font-size: 0.9rem;
    padding-bottom: 5px;
  position: relative;
}

nav ul li a:hover::before {
  transform-origin: left top;
  transform: scale(1, 1);
}


nav ul li a::before {
  background: #333;
  content: '';
  width: 100%;
  height: 1px;
  position: absolute;
  left: 0;
  bottom: 0;
  transform-origin: right top;
  transform: scale(0, 1);
  transition: transform .3s;
}


/* メインタイトル (縦書き) */
/* ヒーロー全体の背景 */
.hero {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 背景の雲文様の配置 */
/* --- 雲のアニメーション設定 --- */

/* 1. 各セクションの基点を設定（雲がはみ出さないようにし、階層を管理） */
#TOP, #intro, #dictionaries {
    position: relative;
    overflow: hidden; /* 雲が画面外へはみ出るのを防ぐ */
    z-index: 0;
}

/* 2. アニメーションレイヤーの基本スタイル */
.cloud-animation-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%; /* ループ用に幅を2倍にする */
    height: 100%;
    z-index: -1; /* 一番下の階層に配置 */
    background-image: url('../img/cloud.png'); /* 提供された雲の画像 */
    background-repeat: repeat-x;
    background-size: contain; /* 画像の比率を維持 */
    opacity: 0.5; /* 背景に馴染ませるために透明度を調整（デザインに合わせて変更可） */
    pointer-events: none; /* マウス操作を邪魔しない */
    animation: cloudMove 60s linear infinite; /* 60秒かけてゆっくり動く */
}

/* 3. 雲を横に動かすアニメーション */
@keyframes cloudMove {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* 幅の半分まで進むと、継ぎ目なくループする */
    }
}

/* 4. 既存コンテンツを雲より上に確実に表示させる */
.intro-container, 
.dict-container, 
.bg-decoration {
    position: relative;
    z-index: 1;
}


#TOP{
    height: 900px;
}

/* スライドショーの外枠（縦長のデザイン） */
.slideshow-container {
    position: relative;
    width: 350px;  /* 画像に合わせたサイズ */
    height: 600px;
    background-color: #0f0f0fb1;
    z-index: 2;
    overflow: hidden;
    /* 外側の微細な境界線 */
}

/* インナーシャドウ：ここが奥行きのポイント */
.shadow-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 350px;;
    height: 700px;
    /* 内側に向かって濃くなるグラデーション */
    box-shadow: inset 0 0 40px 15px rgba(0, 0, 0, 0.559);
    z-index: 5; /* 画像より上に配置 */
    pointer-events: none; /* 下のリンクなどを邪魔しない */
    border: 4px solid #404040;
}

/*台形*/
.opening-shadow {
    position: absolute;
    top: 84%;
    width: 585px;  /* 扉の幅に合わせる */
    height: 100px; /* 影の奥行き */
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent); /* 根元を濃く */
    
    /* 台形の形を作る (左上, 右上, 右下, 左下の順) */
    /* 上辺を少し狭くすることで遠近感を出しています */
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
    
    /* ぼかしを加える */
    filter: blur(8px);
    margin: -6px auto 0; /* 扉のすぐ下に配置 */
    position: absolute;
    z-index: 1;
    overflow: visible;
}

/* スライド画像の設定 */
.slides {
    position: relative;
    width: 100%;
    height: 100%;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    animation: fadeAnimation 40s infinite; /* 10枚×4秒 = 40s */
}

.slide1 { background-image: url('../img/img29.png'); animation-delay: 0s; }
.slide2 { background-image: url('../img/img28.png'); animation-delay: 4s; }
.slide3 { background-image: url('../img/img17-5.png'); animation-delay: 8s; }
.slide4 { background-image: url('../img/img75.png'); animation-delay: 12s; }
.slide5 { background-image: url('../img/img78.png'); animation-delay: 16s; }
.slide6 { background-image: url('../img/img70.png'); animation-delay: 20s; }
.slide7 { background-image: url('../img/img52.png'); animation-delay: 24s; }
.slide8 { background-image: url('../img/img54.png'); animation-delay: 28s; }
.slide9 { background-image: url('../img/img10.png'); animation-delay: 32s; }
.slide10 { background-image: url('../img/img17.png'); animation-delay: 36s; }

/* フェードアニメーション */
@keyframes fadeAnimation {
    0% { opacity: 0; transform: scale(1.05); } /* 少し大きくして寄る演出 */
    5% { opacity: 1; }
    15% { opacity: 1; }
    20% { opacity: 0; transform: scale(1); }
    100% { opacity: 0; }
}

/* 中央のロゴ */
.hero-logo {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    width: 80%;
    text-align: center;
    pointer-events: none;
    overflow: visible;
}
.hero-logo img {
    width: 20%;
    height: auto;
    margin: 170px 0 0 0;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.5));
    overflow: visible;
}


/* 縦書きタイトル共通 */
.vertical-title {
    writing-mode: vertical-rl;
    color: #AE1F1F;
    font-size: 1.5rem;
    margin:0 50px;
    font-size: 36px;
}

/* コンテンツエリア */
.container {
    margin: 0 auto;
    padding: 200px 50px 100px 50px;
}
.intro-container{
    display: flex;
}
.intro {
    display: flex;
    justify-content: center;
    padding: 100px 0;
    font-size: 20px;
    line-height: 4;
}

.intro-text {
    text-align: justify;
    writing-mode: vertical-rl;
}

.readmore a{
    writing-mode: vertical-rl;
    padding: 60px 0px;
    border: solid 1px #000;
    color: inherit;
    margin: 200px 80px 0 0;
    text-decoration: none;
    font-size: 16px;
}
.readmore a:hover {
  color: #AE1F1F;
  border: solid 1px #AE1F1F;
}

/* --- 既存のCSSの下に追加、または書き換え --- */


/* タイトルとボタンのエリア全体を右端に寄せる */
.read-title {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 50px 70px 0 0; 
    z-index: 10;
}

/* 「線＋タイトル」のグループも右側に寄せる */
.ReadTitle {
    display: flex;
    justify-content: flex-end; /* 中の要素を右側に寄せる */
    margin-bottom: 5px;
}

/* タイトルの文字の左側に少し余白をあける（線との間隔） */
.story-selection h2 {
    font-size: 24px;
    color: #EEE;
    margin: 0 0 0 20px; 
}

/* 絞り込みボタンのリストも右揃えにする */
.story-selection ul.filter-list {
    padding: 0;
    margin-top: 10px;
    justify-content: flex-end; /* リストの中身を右に寄せる */
}

#story-selection {
    position: relative;
    background-color: #3d3d3f;
    overflow: hidden;
}

.horizontal-wrapper {
    display: flex;
    width: 100%;
    /* 扉を右側に寄せて配置 */
    justify-content: flex-end; 
    overflow: hidden;
}

.grid-container {
    /* gridは絶対に使わず、flexに統一します */
    display: flex !important;
    /* 右から「一話、二話...」と並べる */
    flex-direction: row-reverse; 
    gap: 150px;
    padding: 0 10vw 0 15vw;
    width: max-content; /* 中身の合計幅を確保 */
    height: 75vh;
    /* ブラウザ標準のスクロールを完全に無効化（GSAP専用にする） */
    overflow: visible !important; 
}

/* 扉の上下デザイン（元のデザインのまま） */
.doors-ue {
    align-self: flex-start;
    margin-top: 50px;
}
.doors:not(.doors-ue) {
    align-self: flex-end;
    margin-bottom: 50px;
}

/* ... doors, card-title 等のその他のCSSは変更不要です ... */
/* ドアの配置調整（上下交互のデザインを維持） */
.doors {
    flex-shrink: 0; /* 横幅が潰れないように固定 */
}

/* --- story-bg の修正 --- */
.story-bg {
    position: absolute;
    top: 0;
    left: 0;
    /* 幅を「可変」ではなく「画面いっぱい」に固定する */
    width: 100%; 
    height: 100%;
    background-image: url(../img/nami.png);
    /* 画像を横方向にリピートさせる（これで途切れなくなります） */
    background-repeat: repeat-x; 
    background-size: auto 100%;
    background-position: bottom center;
    z-index: 0;
    opacity: 0.8;
    pointer-events: none;
    /* transform(x) は使わないので、もし残っていたら削除 */
}

/* コンテンツ枠：CSSでのstickyを解除し、GSAPで制御しやすくします */
.sticky-wrapper {
    position: relative; /* position: sticky から変更 */
    width: 100%;
    height: 100vh;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.custom-line {
    border: none;
    border-top: 1px solid #ffffff; /* 線の太さと色 */
    width: 150px;
    margin: 20px 0; /* 上下の余白 */
}

.filter-list li {
    cursor: pointer;
    transition: color 0.3s;
    opacity: 0.6;
}

.filter-list li.active {
    opacity: 1;
    color: #AE1F1F; /* 選択中を赤くする */
    font-weight: bold;
}

/* 非表示にするためのクラス */
.doors.hide {
    display: none !important;
}

.story-selection h2{
    font-size: 24px;
    color: #EEE;
    margin: 0 30px;
}

.story-selection ul{
    color: #fff;
    text-decoration: none;
    list-style: none;
    display: flex;
    padding: 0 40px;
}

.story-selection ul li{
    text-decoration: none;
    padding: 20px;
}

/* 非表示にするためのクラス（JSで切り替え） */
.doors.hide {
    display: none !important;
}

/* アニメーションの初期状態として透明度を設定しておく（任意） */
.doors {
    opacity: 1;
    visibility: visible;
    transition: visibility 0.3s; /* display:noneとの兼ね合いをスムーズに */
  width: 200px;  /* ドア2枚分の横幅 */
  height: 300px; /* ドアの高さ */
  overflow: hidden;       /* 空いたとき、ドアを消す為のもの。 */
  border: solid 2px #000; /* ドア全体の枠線 */
  display: flex;          /* 2枚のドアを横並びにする */
  position: relative;
  cursor: pointer;
  margin: 90px 0;
}
.doors img{
    position: absolute;
    z-index: 20;
}

.door {
  background-color: #ffffff; 
  width: 200px;  /* ドア1枚分の横幅 */
  height: 300px; /* ドアの高さ */
  border: 1px solid #ddd;
  border: solid 1px #EEE; /* ドアの枠線 */
  box-sizing: border-box; /* 余白の計算を簡単にするため */
  transition: all .5s;    /* ドアがゆっくり開く */
  position: absolute;
  z-index: 30;
}

.doors:hover .right {
  transform: translateX(97%); /* マウスホバー時に、右に動く */
}

.doors a{
    color: inherit; /* 親要素の色を継承する */
}

.doors-ue{
    bottom: 30px;
}

.card-title {
    width: 170px;
    height: 270px;
    border: 1px solid #ddd;
    writing-mode: vertical-rl;
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    margin: 7% 0 0 7%;
    text-align: center;
    text-decoration: none;
}

.card-title p{
    margin-right: 24%;
}

/* --- 辞典セクション --- */
.dictionaries {
    margin: 100px 0 0 0;
    position: relative;
    padding: 150px 0 250px; /* 下側に装飾用の余白を広く取る */
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.dict-container {
    display: flex;
    gap: 10px; /* ボックス間の隙間 */
    z-index: 2;
}

.dict-box {
    text-decoration: none;
    width: 600px;  /* 正方形に近いサイズ */
    height: 500px;
    /* 中央が少し明るい放射状グラデーション */
    background: radial-gradient(circle, #444446 0%, #2a2a2c 70%, #222224 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.dict-box:hover {
    transform: translateY(-5px);
}

.dict-content {
    text-align: center;
    color: #ffffff;
}

.dict-content h3 {
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
}

.dict-content p {
    font-size: 0.9rem;
    opacity: 0.8;
    letter-spacing: 0.05em;
}

/* 背景装飾（波・雲の文様） */
.bg-decoration .pattern-1,
.bg-decoration .pattern-2,
.bg-decoration .pattern-3 {
    position: absolute;
    z-index: 1;
    opacity: 0.6;
    width: 350px; /* 文様画像のサイズ */
}

.pattern-1 { bottom: 100px; left: -50px; }
.pattern-2 { bottom: 150px; right: 10%; }
.pattern-3 { bottom: 20px; right: -30px; }

/* --- フッターエリア --- */
.site-footer {
    background-color: #e0e0d9;
    padding: 0;
    position: relative;
    bottom: -20px;
}

.footer-inner {
    max-width: 1200px;
    margin: 0;
    text-align: left; /* 左寄せ */
}
.footer-inner img{
    width: 200px;
}
.footer-logo {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 20px;
    color: #333;
    letter-spacing: 0.1em;
}

.footer-nav ul {
    list-style: none;
    display: flex;
    gap: 10px;
    padding: 0;
    margin-bottom: 30px;
}

.footer-nav ul li a {
    text-decoration: none;
    color: #333;
    font-size: 0.85rem;
}

.footer-line {
    border: none;
    border-top: 1px solid #999;
    width: 100%;
}

.copyright {
    font-size: 0.75rem;
    color: #666;
    letter-spacing: 0.02em;
    margin: 20px 0;
}


/* --- フェードインアニメーションの初期状態 --- */
.intro-container .vertical-title, 
.intro-container .intro-text, 
.intro-container .readmore, 
#story-selection, 
.dictionaries {
    opacity: 0;
    transform: translateY(60px); /* 60px下に下げておく */
    will-change: opacity, transform;
}

/* --- スマホ・タブレット対応 (768px以下) --- */
@media (max-width: 768px) {
    /* ヘッダー・ハンバーガーメニュー */

    
    .logo-placeholder {
        padding: 15px 20px;
    }

    .hamburger {
        display: block;
        width: 30px;
        height: 25px;
        position: relative;
        z-index: 100;
        cursor: pointer;
    }

    .hamburger span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: #333;
        position: absolute;
        transition: 0.3s;
    }

    .hamburger span:nth-child(1) { top: 0; }
    .hamburger span:nth-child(2) { top: 10px; }
    .hamburger span:nth-child(3) { top: 20px; }

    /* メニューが開いた時のアニメーション */
    .hamburger.open span:nth-child(1) { transform: translateY(10px) rotate(45deg); }
    .hamburger.open span:nth-child(2) { opacity: 0; }
    .hamburger.open span:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }

    nav {
        position: fixed;
        top: 0;
        right: -100%; /* 初期状態は画面外 */
        width: 80%;
        height: 100vh;
        background-color: rgba(224, 224, 217, 0.95);
        z-index: 90;
        transition: 0.5s;
        padding-top: 100px;
    }

    nav.open {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        align-items: center;
    }

    nav ul li {
        margin: 20px 0;
    }

    .hero-logo img {
        width: 50%; /* ロゴを少し大きく */
    }

    /* 古事記とは（縦書きを維持しつつ調整） */
    .intro-container {
        flex-direction: column-reverse; /* 要素を縦に積む */
        align-items: center;
        padding: 50px 20px;
    }

    .intro-text {
        height: auto;
        font-size: 14px;
        max-height: 400px; /* 縦書きが長くなりすぎないように制限 */
        margin-bottom: 30px;
        line-height: 2.2;
    }

    .vertical-title {
        writing-mode: horizontal-tb;
        margin: 0 0 30px 0;
        font-size: 24px;
    }

    .readmore a {
        margin: 30px 0 0 0;
        writing-mode: horizontal-tb;
        padding: 16px 70px;
    }

    /* 物語セクション */
    .read-title {
        align-items: center; /* 中央寄せ */
        padding: 20px 0 0 0;
    }

    .ReadTitle {
        justify-content: left;
        padding-top: 30px;
        margin-left: 100px;
    }
    .ReadTitle h2{
        margin: 0 12px;
    }

    .custom-line {
        width: 90px;
    }

    .filter-list{
        font-size: 14px;
    }

    .story-selection ul.filter-list {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* 辞典セクション */
    .dict-container {
        flex-direction: column; /* 縦に並べる */
        align-items: center;
        width: 100%;
    }

    .dict-box {
        width: 90%; /* 横幅いっぱい */
        height: 250px; /* 高さを抑える */
    }

    /* フッター */
    .footer-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
}