/*
Theme Name: Kankitsu
Description: 柑橘叢書 オリジナルテーマ
Version: 1.1
Text Domain: kankitsu
*/

/* =========================================================
   ■ 色・フォントの設定（ここだけ変更すればサイト全体に反映）
   ========================================================= */
:root {
  --kk-bg: #FFFDF2;          /* 背景色 */
  --kk-text: #4A3B1F;        /* 文字色 */
  --kk-accent: #F5B323;      /* アクセント色（ヘッダー・ボタン・リンク） */
  --kk-accent-text: #3A2200; /* アクセント色の上の文字色 */
  --kk-sub-bg: #ffffff;      /* ブロック・枠の背景色 */
  --kk-border: #dddddd;      /* 枠線の色 */
  --kk-counter-bg: #111111;  /* カウンターの背景色 */
  --kk-counter-text: #ff3b3b;/* カウンターの数字色 */
  --kk-font: "Hiragino Mincho ProN", "Yu Mincho", serif; /* 本文フォント */
  --kk-font-size: 16px;      /* 本文の文字サイズ */
  --kk-line-height: 1.9;     /* 行間 */
  --kk-header-h: 56px;       /* ヘッダーの高さ（登場人物タブの位置にも使用） */
}

/* デジタル数字フォント（fonts/DSEG7Classic-Bold.woff2 を置いた場合に使用） */
@font-face {
  font-family: "DSEG7";
  src: url("fonts/DSEG7Classic-Bold.woff2") format("woff2");
  font-display: swap;
}

/* ===== 基本 ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--kk-bg);
  color: var(--kk-text);
  font-family: var(--kk-font);
  font-size: var(--kk-font-size);
  line-height: var(--kk-line-height);
}
a { color: var(--kk-accent); }
.kk-main { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
.kk-h1 { text-align: center; font-size: 1.6em; margin: 0.5em 0 1em; }
.kk-h2 { font-size: 1.2em; border-bottom: 1px solid var(--kk-border); margin: 2em 0 0.8em; }

/* ===== ヘッダー ===== */
.kk-header {
  height: var(--kk-header-h);
  background: var(--kk-accent);
  display: flex; align-items: center; justify-content: center;
}
.kk-nav { display: flex; gap: 8px; margin: 0; padding: 0; list-style: none; }
.kk-nav a {
  display: block; padding: 8px 12px;
  color: var(--kk-accent-text); text-decoration: none; font-weight: bold; letter-spacing: 0.05em;
}
.kk-nav a:hover { opacity: 0.75; }

/* ===== トップページ ===== */
.kk-site-title { text-align: center; font-size: 2.4em; letter-spacing: 0.3em; margin: 0.8em 0 0.6em; }
.kk-counter { text-align: center; margin-bottom: 2em; }
.kk-counter-digits { display: inline-flex; gap: 2px; vertical-align: middle; margin: 0 6px; }
.kk-counter-digits span {
  display: inline-block; width: 1.3em; padding: 4px 0; text-align: center;
  background: var(--kk-counter-bg); color: var(--kk-counter-text);
  font-family: "DSEG7", "Courier New", monospace; font-size: 1.2em; line-height: 1.2;
}
.kk-history-box {
  height: 240px; overflow-y: auto;
  background: var(--kk-sub-bg); border: 1px solid var(--kk-border); padding: 8px 16px;
}
.kk-history-box p, .kk-history-box ul { margin: 0.3em 0; }

/* ===== 作品トップページ ===== */
.kk-work-list { display: flex; flex-direction: column; gap: 24px; align-items: center; }
.kk-work-block {
  display: flex; align-items: center; justify-content: center;
  width: 100%; max-width: 480px; min-height: 120px; padding: 16px;
  background: var(--kk-sub-bg); border: 1px solid var(--kk-border);
  color: var(--kk-text); text-decoration: none; font-size: 1.4em;
}
.kk-work-block:hover { border-color: var(--kk-accent); }

/* ===== 作品ページ ===== */
.kk-episodes { margin: 0; padding: 0; list-style: none; }
.kk-episodes li { margin: 0.4em 0; }
.kk-ep-title { font-weight: bold; margin-right: 12px; }
.kk-ep-pages a { margin-right: 8px; }
.kk-text-block { white-space: pre-wrap; }

/* ===== 本文ページ ===== */
.kk-pager { display: flex; justify-content: center; align-items: center; gap: 24px; margin: 16px 0; }
.kk-pager a, .kk-pager .kk-pager-blank { display: inline-block; width: 2em; text-align: center; text-decoration: none; font-size: 1.2em; }
.kk-novel-body { margin: 24px 0; word-break: break-word; white-space: pre-wrap; }
.kk-back { text-align: center; }

/* ===== 登場人物タブ・パネル ===== */
.kk-chara {
  position: fixed; top: var(--kk-header-h); bottom: 0; right: 0;
  width: 33vw; z-index: 900;
  transform: translateX(100%); transition: transform 0.35s ease;
}
.kk-chara.is-open { transform: translateX(0); }
.kk-chara-tab {
  position: absolute; top: 0; right: 100%;
  writing-mode: vertical-rl; padding: 12px 6px;
  background: var(--kk-accent); color: var(--kk-accent-text);
  border: none; cursor: pointer; font-family: inherit; font-size: 0.95em; letter-spacing: 0.2em;
}
.kk-chara-panel {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--kk-sub-bg); border-left: 2px solid var(--kk-accent);
  padding: 16px 20px;
}
.kk-chara-name { font-weight: bold; margin: 1em 0 0.2em; }
.kk-chara-name:first-child { margin-top: 0; }
.kk-chara-desc { margin: 0 0 0 1em; white-space: pre-wrap; }
body.kk-noscroll { overflow: hidden; }

/* ===== メールフォーム（Contact Form 7） ===== */
.wpcf7 input[type="text"], .wpcf7 input[type="email"], .wpcf7 textarea {
  width: 100%; padding: 8px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--kk-border); background: var(--kk-sub-bg); color: var(--kk-text);
}
.wpcf7 input[type="submit"] {
  padding: 10px 40px; border: none; cursor: pointer;
  background: var(--kk-accent); color: var(--kk-accent-text); font-size: 1em; font-family: inherit;
}
.wpcf7 .wpcf7-response-output { display: none !important; } /* 結果はモーダルで表示 */
.kk-error, .wpcf7-not-valid-tip { display: block; color: #d00; font-size: 0.9em; }

/* ===== モーダル共通（入口・メールフォーム） ===== */
.kk-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); padding: 16px;
}
.kk-modal.is-open { display: flex; }
.kk-modal-box {
  width: 100%; max-width: 420px; padding: 32px 24px; text-align: center;
  background: var(--kk-sub-bg); color: var(--kk-text); border-radius: 8px;
}
.kk-modal-buttons { display: flex; justify-content: center; gap: 24px; margin-top: 24px; }
.kk-btn {
  min-width: 100px; padding: 10px 16px; border: 1px solid var(--kk-accent); border-radius: 6px; cursor: pointer;
  background: var(--kk-accent); color: var(--kk-accent-text); font-family: inherit; font-size: 1em;
}
.kk-btn-sub { background: var(--kk-sub-bg); color: var(--kk-accent); }

/* 入口：外部から来たときは不透明な背景で中身を隠す */
.kk-gate-on .kk-gate { display: flex; background: var(--kk-bg); }
.kk-gate-on body { overflow: hidden; }
.kk-gate-on body > *:not(.kk-gate) { visibility: hidden; }

/* ===== スマホ ===== */
@media (max-width: 600px) {
  :root { --kk-font-size: 15px; }
  .kk-nav { gap: 0; }
  .kk-nav a { padding: 8px 8px; font-size: 0.9em; }
  .kk-site-title { font-size: 1.8em; letter-spacing: 0.15em; }
  .kk-chara { width: 85vw; }
}
