/* WPに干渉しにくいよう yo- プレフィックスを付けています */

/* ✅ 修正点（ここだけが本質）:
   - 作品トップ/各節ページのコンテンツ幅を、Kadence「一般 > コンテンツ最大幅」に合わせる
   - 1290px / 1.5rem などの値は WP が出している CSS変数を参照（=設定変更に追従）
*/

/* =========================================================
   Layout: Kadence content width follow + boxed inner padding
   ========================================================= */
.yo-wrap{
  /* Kadence の「コンテンツ最大幅」に追従（例: 1290px） */
  max-width: var(--global-content-width, 1290px);

  /* 中央寄せは維持 */
  margin: 0 auto;

  /* 作品トップ/各話の基本インデント（= edge padding） */
  padding-top: 26px;
  padding-bottom: 26px;
  padding-left:  var(--global-content-edge-padding, 1.5rem);
  padding-right: var(--global-content-edge-padding, 1.5rem);
}

/* ★トップページと同じ “もう一段内側” を再現
   Kadenceの boxed レイアウト時だけ、boxed padding を上乗せする */
body.content-style-boxed .yo-wrap{
  padding-left:  calc(var(--global-content-edge-padding, 1.5rem) + var(--global-content-boxed-padding, 2rem));
  padding-right: calc(var(--global-content-edge-padding, 1.5rem) + var(--global-content-boxed-padding, 2rem));
}

/* ✅ 要件：スマホでは boxed の上乗せを無効化（本文幅を確保） */
@media (max-width: 600px){
  body.content-style-boxed .yo-wrap{
    padding-left:  var(--global-content-edge-padding, 1.5rem);
    padding-right: var(--global-content-edge-padding, 1.5rem);
  }
}

/* =========================================================
   作品トップ: title/sub + continue/progress
   ========================================================= */

/* タイトル：アンティーク寄りの金（下品さ抑制） */
.yo-title{
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: .03em;

  color: rgba(198, 176, 112, 0.92); /* antique brass */
  text-shadow:
    0 1px 0 rgba(0,0,0,0.55),
    0 10px 26px rgba(0,0,0,0.55),
    0 0 18px rgba(198,176,112,0.08);
}

/* サブ文：温白に統一 */
.yo-sub{
  margin: 0 0 14px;
  line-height: 1.7;

  color: rgba(233,225,207,0.88);
  opacity: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
}

/* 続きを読む系（高さ統一込み） */
.yo-continue{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;  /* ← 高さ揃えの要 */
  margin: 18px 0 26px;
}

.yo-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 10px 14px;
  border-radius: 12px;
  text-decoration: none;

  background: rgba(233,225,207,0.10);
  border: 1px solid rgba(233,225,207,0.18);
  color: rgba(233,225,207,0.92);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);

  /* 高さ統一 */
  min-height: 44px;
  line-height: 1.2;
}

.yo-btn:hover{ transform: translateY(-1px); }

.yo-btn--ghost{
  background: transparent;
  border: 1px solid rgba(233,225,207,0.22);
}

.yo-pill{
  display: inline-flex;
  align-items: center;
  gap: 8px;

  padding: 10px 12px;
  border-radius: 999px;

  background: rgba(0,0,0,.25);
  border: 1px solid rgba(233,225,207,0.14);
  color: rgba(233,225,207,0.88);

  /* 高さ統一 */
  min-height: 44px;
  line-height: 1.2;
}

.yo-progress{ margin: 10px 0 18px; }

.yo-bar{
  height: 10px;
  border-radius: 999px;
  overflow: hidden;

  background: rgba(233,225,207,0.08);
  border: 1px solid rgba(233,225,207,0.14);
}

#barFill{
  display: block;
  height: 100%;
  width: 0%;
  background: rgba(233,225,207,0.62);
}

.yo-plabel{
  margin-top: 10px;
  opacity: 1;
  color: rgba(233,225,207,0.88);
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
}

/* =========================================================
   TOC: 「単一の表」風 + 黒ベース透過 + 未読/既読色
   ========================================================= */

.yo-toc{
  display: block;
  margin-top: 14px;

  background: rgba(0,0,0,0.52);
  border: 1px solid rgba(233,225,207,0.14);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);

  padding: 0;
}

.yo-toc-item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  text-decoration: none;

  padding: 18px 18px;

  background: transparent;
  border: none;
  box-shadow: none;

  border-bottom: 1px solid rgba(233,225,207,0.10);

  color: rgba(233,225,207,0.92);
}

.yo-toc-item:last-child{ border-bottom: none; }

.yo-left{
  display: flex;
  gap: 12px;
  min-width: 0;
  align-items: baseline;
}

.yo-num{
  font-weight: 700;
  white-space: nowrap;
  color: rgba(233,225,207,0.96); /* 未読：白寄り */
}

.yo-hook{
  opacity: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(233,225,207,0.86); /* 未読：白寄り */
}

.yo-status{
  white-space: nowrap;
  font-size: .92em;
  color: rgba(233,225,207,0.70); /* 未読：淡い白 */
  opacity: 1;
}

/* 既読 */
.yo-toc-item.is-read{ opacity: 1; }
.yo-toc-item.is-read .yo-num{ color: rgba(233,225,207,0.78); }
.yo-toc-item.is-read .yo-hook{ color: rgba(233,225,207,0.68); }
.yo-toc-item.is-read .yo-status{
  color: rgba(154, 188, 142, 0.88);
  text-shadow: 0 1px 6px rgba(0,0,0,0.55);
}

/* 最終読了 */
.yo-toc-item.is-last{
  outline: 1px solid rgba(233,225,207,0.22);
  outline-offset: -1px;
}

/* =========================================================
   Rule: border-radius 제거（yo-系のみ）
   ========================================================= */
.yo-btn,
.yo-btn--ghost,
.yo-pill,
.yo-bar,
#barFill,
.yo-toc,
.yo-toc-item{
  border-radius: 0 !important;
}

/* =========================================================
   Episode page polish: header (ep no + title) + bottom nav
   - no shadow, no radius
   - nowrap guarantee
   - 3 buttons always in one row
   NOTE:
   - Do NOT touch site background color
   - Do NOT frame the body text with gold border
   ========================================================= */

:root{
  --ink-text:  #E6E2D8;  /* paper white */
  --ink-muted: #9A9FA6;  /* helper */
  --ink-line:  rgba(201,180,106,0.22); /* antique line */
  --ink-line2: rgba(201,180,106,0.14);
  --ink-gold:  #B6AA8A;  /* muted antique gold */
}

/* Wrapper spacing only (NO background color control) */
body.single-episode .yo-wrap{
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 28px);
}

/* Header */
body.single-episode .yo-episode-head{
  margin: 0 0 clamp(14px, 2.2vw, 22px) 0;
  padding: clamp(12px, 2.4vw, 18px) 0;
  border-bottom: 1px solid var(--ink-line2);
}

body.single-episode .yo-episode-head-inner{
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: clamp(10px, 2.2vw, 18px);
  width: 100%;
  text-align: center;

  white-space: nowrap;
  overflow: hidden;
}

/* 第xx節 */
body.single-episode .yo-epno{
  color: var(--ink-gold);
  letter-spacing: 0.08em;
  font-weight: 600;
  line-height: 1.1;
  font-size: clamp(13px, 3.6vw, 18px);
}

/* 節タイトル */
body.single-episode .yo-ep-title{
  color: var(--ink-text);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.1;
  font-size: clamp(14px, 4.2vw, 20px);

  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px){
  body.single-episode .yo-episode-head-inner{ gap: 10px; }
}

/* Body readability (NO background / NO border / NO gold frame) */
body.single-episode .yo-episode-body{
  padding: clamp(16px, 3vw, 26px);
  margin: 0 0 clamp(18px, 3vw, 26px) 0;
}

body.single-episode .yo-episode-body p{
  margin: 0 0 1.0em 0;
  line-height: 1.85;
  letter-spacing: 0.02em;
  color: var(--ink-text);
}

/* Bottom nav: 3 blocks always in one row */
body.single-episode .yo-episode-bottomnav{
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  width: 100%;

  border: 1px solid var(--ink-line);
  border-radius: 0;
  background: rgba(12,18,24,0.65);
  overflow: hidden;
}

body.single-episode .yo-bottomnav__cell{
  flex: 1 1 0%;
  min-width: 0;
}

body.single-episode .yo-bottomnav__btn{
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: clamp(44px, 8vw, 54px);
  padding: 0 10px;

  border-radius: 0;
  text-decoration: none;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  font-size: clamp(12px, 3.4vw, 15px);
  letter-spacing: 0.04em;
  font-weight: 600;

  color: var(--ink-text);
}

body.single-episode .yo-bottomnav__cell + .yo-bottomnav__cell{
  border-left: 1px solid var(--ink-line2);
}

body.single-episode .yo-bottomnav__cell--toc .yo-bottomnav__btn{
  color: var(--ink-gold);
}

body.single-episode .yo-bottomnav__btn:hover,
body.single-episode .yo-bottomnav__btn:focus{
  background: rgba(201,180,106,0.07);
  outline: none;
}

body.single-episode .yo-bottomnav__btn--disabled{
  pointer-events: none;
  user-select: none;
  background: rgba(0,0,0,0.12);
}
body.single-episode .yo-bottomnav__btn--disabled::before{
  content: "";
}

/* =========================================================
   Mobile: コンテンツ幅が狭く感じる問題の修正
   - 左右paddingを下げて本文の有効幅を確保
   ========================================================= */
@media (max-width: 600px){
  .yo-wrap{
    padding-left: 12px;
    padding-right: 12px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .yo-toc-item{
    padding-left: 12px;
    padding-right: 12px;
  }

  .yo-continue{
    gap: 8px;
  }
}

/* =========================================================
   Extra (kept): episode nav helpers (non-conflicting)
   ========================================================= */
.yo-episode-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.yo-back{text-decoration:none;color:rgba(233,225,207,0.85)}
.yo-epno{opacity:.9}
.yo-episode-body{line-height:1.95}
.yo-episode-nav{display:flex;justify-content:space-between;gap:12px;margin:28px 0 12px}
@media (max-width:520px){
  .yo-episode-nav{flex-direction:column}
  .yo-hook{white-space:normal}
}

/* Remove all border radius inside episode page (hard rule) */
body.single-episode *{
  border-radius: 0 !important;
}

/* =========================================================
   Novel top cover (single-novel only)
   - 上部コンテンツをアイキャッチ背景のカバー化
   - 既存レイアウト・ロジックには一切干渉しない
   ========================================================= */

/* カバー外枠：全幅＋背景 */
body.single-novel .yo-cover{
  /* 全幅化（yo-wrap の max-width を無効化） */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);

  /* 背景（PHPから渡したCSS変数を使用） */
  background-image: var(--yo-cover);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  /* 最低高さ（中身＋背景が成立するため） */
  min-height: 320px;

  /* 下部コンテンツとの分離 */
  margin-bottom: 22px;

  /* 可読性のための下地 */
  position: relative;
}

/* 暗幕オーバーレイ（文字可読性確保） */
body.single-novel .yo-cover::before{
  content: "";
  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      to bottom,
      rgba(10,14,18,0.70),
      rgba(10,14,18,0.88)
    );
  pointer-events: none;
}

/* カバー内側：既存 yo-wrap と同じ幅・padding を再利用 */
body.single-novel .yo-cover__inner{
  position: relative;
  z-index: 1;

  max-width: var(--global-content-width, 1290px);
  margin: 0 auto;

  padding-top: 42px;
  padding-bottom: 36px;
  padding-left:  var(--global-content-edge-padding, 1.5rem);
  padding-right: var(--global-content-edge-padding, 1.5rem);
}

/* boxed レイアウト時の内側余白追従 */
body.single-novel.content-style-boxed .yo-cover__inner{
  padding-left:  calc(var(--global-content-edge-padding, 1.5rem) + var(--global-content-boxed-padding, 2rem));
  padding-right: calc(var(--global-content-edge-padding, 1.5rem) + var(--global-content-boxed-padding, 2rem));
}

/* スマホ：boxed 上乗せを解除 */
@media (max-width: 600px){
  body.single-novel.content-style-boxed .yo-cover__inner{
    padding-left:  var(--global-content-edge-padding, 1.5rem);
    padding-right: var(--global-content-edge-padding, 1.5rem);
  }

  body.single-novel .yo-cover{
    min-height: 240px;
  }

  body.single-novel .yo-cover__inner{
    padding-top: 28px;
    padding-bottom: 26px;
  }
}

/* =========================================================
   Fix: remove top padding before novel cover (single-novel)
   - 犯人は .yo-wrap の padding-top
   - single-novel のときだけ無効化
   ========================================================= */
body.single-novel .yo-wrap{
  padding-top: 0 !important;
}

/* 進捗バー（共通）：金に統一 */
:root{
  --yo-gold-bar: rgba(198,176,112,0.92); /* yo-title と同系の金 */
}

/* 小説トップ（いま表示されてる #barFill） */
#barFill{
  background: var(--yo-gold-bar) !important;
}

/* 一覧系（flat/status のバー） */
.yo-flat-progress__fill,
.yo-status-progress__fill{
  background: var(--yo-gold-bar) !important;
}

/* 旧/別実装（.novel-progress-fill を使ってる場合） */
.novel-progress-fill{
  background: var(--yo-gold-bar) !important;
}

/* =========================================================
   Buttons: 枠色・文字色を金に統一 ＋ hover挙動を既存トーンに合わせる
   対象：小説トップの .yo-btn / .yo-btn--ghost
   ========================================================= */

:root{
  --yo-gold: rgba(198,176,112,0.92);     /* 既存タイトルと同系の金 */
  --yo-gold-dim: rgba(198,176,112,0.55); /* 枠・弱め */
  --yo-gold-bg-hover: rgba(198,176,112,0.10);
}

/* 通常 */
.yo-btn,
.yo-btn--ghost{
  color: var(--yo-gold) !important;
  border-color: var(--yo-gold-dim) !important;
}

/* ゴースト含め背景は抑制 */
.yo-btn{
  background: rgba(0,0,0,0.35);
}
.yo-btn--ghost{
  background: transparent;
}

/* hover / focus（他ページのバーやUIと同じ“軽く浮く”挙動） */
.yo-btn:hover,
.yo-btn:focus,
.yo-btn--ghost:hover,
.yo-btn--ghost:focus{
  color: var(--yo-gold) !important;
  border-color: var(--yo-gold) !important;
  background: var(--yo-gold-bg-hover) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  outline: none;
}

/* active（押下時は沈む） */
.yo-btn:active,
.yo-btn--ghost:active{
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}

/* PCのみ：節ページの総幅を1290px（padding込み）に固定 */
@media (min-width: 1024px) {
  body.single-episode main.yo-main.yo-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 1290px;   /* padding込みの総幅 */
    margin-left: auto;
    margin-right: auto;
    padding-left: 28px;
    padding-right: 28px;
  }
}
