/* style_title_headers.css - 本の見開きデザイン */

/* 本の見開きコンテナ - 画面上部に配置 */
.book-spread-container {
  position: absolute;
  top: clamp(5vh, 8vh, 10vh); /* 上部に固定配置 */
  left: clamp(2vw, 5vw, 8vw);
  right: clamp(2vw, 5vw, 8vw);
  transform: none; /* 垂直中央配置を削除 */
  width: auto;
  min-width: 800px;
  max-width: 1500px;
  height: clamp(600px, 80vh, 750px); /* 高さを調整 */
  z-index: var(--z-content); /* CSS変数を使用してz-indexを統一 */
  box-sizing: border-box;
  
  /* 本の見開きページデザイン */
  background: #ffffff;
  border: 2px solid #ccc;
  border-radius: 12px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 4px 16px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 0;
  
  display: grid;
  grid-template-columns: 1fr 240px; /* 左ページ可変、右ページ240px固定 */
  grid-template-rows: auto 1fr;
  grid-template-areas: 
    "header header"
    "left-page right-page";
  gap: 0;
}

/* タイトルヘッダー（見開き全幅） */
.manual-title-header {
  grid-area: header;
  background: #2c3e50;
  color: white;
  padding: 20px 50px;
  z-index: 5;
  box-sizing: border-box;
  text-align: center;
  border-bottom: 3px solid #34495e;
  margin: 0;
  border-radius: 12px 12px 0 0; /* 上部のみ角丸 */
  
  /* 本のタイトルページ風 */
  background-image: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #2c3e50 100%);
}

.manual-title-line {
  margin: 0;
}

.manual-title-text {
  font-size: 22px; /* 18px→22px */
  font-weight: bold;
  color: white;
  margin: 0;
  padding: 0;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 左ページ */
.left-page {
  grid-area: left-page;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* 上詰め強制 */
  align-items: stretch; /* 横幅いっぱいに */
  padding: 10px 80px 20px 30px; /* 上部パディングさらに削減 */
  background: linear-gradient(135deg, #ffffff 0%, #fefefe 50%, #fcfcfc 100%);
  /*border-right: 3px solid rgba(0,0,0,0.15);  本の中央線 */
  min-height: 100%;
  max-height: 100%; /* はみ出し防止 */
  max-width: 60vw; /* 右ページ(240px) + 余裕(40px) を引いた幅 */
  box-sizing: border-box;
  overflow: hidden; /* 左ページ外へのはみ出しを防止 */
  position: relative; /* 絶対位置指定の基準として設定 */
  transform-style: preserve-3d;
  transform-origin: right center; /* 右端を軸としたページめくり */
  /* transition: all 1.0s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 
    0 2px 15px rgba(0,0,0,0.1),
    inset -3px 0 8px rgba(0,0,0,0.05),
    inset 0 -2px 4px rgba(0,0,0,0.02); */
}

/* シンプルなフェード切り替えエフェクト */
.left-page.page-fade-out {
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.left-page.page-fade-in {
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
}

/* 右ページ */
.right-page {
  grid-area: right-page;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 30px 30px 30px 20px;
  background: rgba(248, 248, 248, 0.3);
  border-left: 3px solid rgba(0,0,0,0.15); /* 本の中央線 */
  box-sizing: border-box;
}

/* サブタイトルエリア */
.current-subtitle-header {
  background: transparent;
  color: #2c3e50;
  padding: 0;
  margin-bottom: 15px; /* マージン削減 */
  z-index: 4;
  box-sizing: border-box;
  text-align: left;
  border: none;
  flex-shrink: 0; /* サブタイトルエリアの高さを固定 */
}

/* タイトル（章レベル） */
.current-entry-title {
  margin: 0 0 8px 0;
  font-size: 20px; /* 16px→20px */
  color: #2c3e50;
  font-weight: bold;
  line-height: 1.3;
  padding-bottom: 4px;
  border-bottom: 2px solid #e74c3c;
  display: block;
}

/* サブタイトル（節レベル） */
.current-sub-title {
  margin: 0 0 0 0;
  font-size: 16px; /* 14px→16px */
  color: #34495e;
  font-weight: normal;
  line-height: 1.4;
  padding-left: 16px;
  position: relative;
}

/* サブタイトルの前に番号風のマーカーを追加 */
.current-sub-title::before {
  content: "● ";
  color: #e74c3c;
  font-size: 12px;
  position: absolute;
  left: 4px;
  top: 2px;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .book-spread-container {
    display: none; /* モバイルでは本デザインを無効化 */
  }
  
  .manual-title-header {
    
    top: 0; 
    left: 0; 
    right: 0; 
    width: 100%; 
    max-width: none;
    padding: 12px 15px;
    border-left: 4px solid #e60033;
    border-radius: 0 6px 6px 0;
    background: #2c3e50;
    color: white; /* テキスト色を明示的に設定 */
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: var(--z-overlay); 
    margin: 0; 
  }
  
  .current-subtitle-header {
    display: none; /* 白い帯の重なりを削除 */
  }
  
  .manual-title-text {
    font-size: 20px; /* カテゴリタイトルを一番大きく */
    line-height: 1.3;
    font-weight: bold;
  }
  
  .current-entry-title {
    font-size: 14px;
    margin: 0 0 6px 0;
    padding-bottom: 3px;
  }
  
  .current-sub-title {
    font-size: 12px;
    padding-left: 14px;
  }
  
  .current-sub-title::before {
    font-size: 10px;
    left: 3px;
  }
}

/* タブレット対応 */
@media (max-width: 1024px) and (min-width: 769px) {
  .manual-title-header {
    top: 10vh; /* 位置を上に調整 */
    left: 6vw;
    right: 6vw;
    padding: 7px 14px;
    z-index: var(--z-overlay); /* CSS変数を使用 */
  }
  
  .current-subtitle-header {
    top: 17vh; /* 位置を調整してマニュアルタイトルとの間隔を確保 */
    left: 6vw;
    right: 6vw;
    padding: 11px 14px;
    z-index: calc(var(--z-overlay) - 1); /* メインタイトルより少し下 */
  }
  
  .manual-title-text {
    font-size: 17px;
    line-height: 1.3;
  }
  
  .current-entry-title {
    font-size: 15px;
    margin: 0 0 7px 0;
    padding-bottom: 3px;
  }
  
  .current-sub-title {
    font-size: 13px;
    padding-left: 15px;
  }
}

/* 高さが非常に狭いブラウザ向け */
@media (max-height: 600px) {
  .manual-title-header {
    top: 5vh; /* より上に配置 */
    padding: 4px 12px;
    z-index: var(--z-overlay); /* CSS変数を使用 */
  }
  
  .current-subtitle-header {
    top: 11vh; /* 間隔を詰める */
    padding: 8px 12px;
    z-index: calc(var(--z-overlay) - 1); /* メインタイトルより少し下 */
  }
  
  .manual-title-text {
    font-size: 15px;
    line-height: 1.2;
  }
  
  .current-entry-title {
    font-size: 13px;
    margin: 0 0 4px 0;
    padding-bottom: 2px;
  }
  
  .current-sub-title {
    font-size: 11px;
    padding-left: 12px;
  }
  
  .current-sub-title::before {
    font-size: 9px;
    left: 2px;
  }
}

/* 画面サイズ別に左ページの右側paddingを段階的に調整 */
@media (max-width: 1460px) {
  .left-page {
    padding-right: 150px; /* 1460px以下で大幅増加 */
  }
}

@media (max-width: 1350px) {
  .left-page {
    padding-right: 170px; /* さらに増加 */
  }
}

@media (max-width: 1200px) {
  .left-page {
    padding-right: 190px; /* さらに大幅増加 */
  }
}

@media (max-width: 1000px) {
  .left-page {
    padding-right: 140px; /* さらに増加 */
  }
}

@media (max-width: 900px) {
  .left-page {
    padding-right: 160px; /* 最大に増加 */
  }
}

@media (max-width: 800px) {
  .left-page {
    padding-right: 180px; /* 極端に増加 */
  }
}

/* 極端に高さが狭い場合（400px以下） */
@media (max-height: 400px) {
  .manual-title-header {
    top: 5vh; /* 極端に狭い画面で見える位置 */
    padding: 3px 8px;
  }
  
  .current-subtitle-header {
    top: 8vh; /* 極端に狭い画面で見える位置 */
    padding: 6px 8px;
  }
  
  .manual-title-text {
    font-size: 13px;
  }
  
  .current-entry-title {
    font-size: 11px;
    margin: 0 0 3px 0;
    padding-bottom: 1px;
  }
  
  .current-sub-title {
    font-size: 10px;
    padding-left: 10px;
  }
}