/*
Theme Name: 月と羅針盤 (Moon & Compass)
Theme URI: https://example.com/moon-compass
Author: Kanata Kirihara
Description: ファンタジー小説と創作日記のための、文学的・クラシックなWordPressテーマ。カスタム投稿タイプ「小説(novel)」「各話(chapter)」に対応。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: moon-compass
*/

/* ============ base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #eef1f7;
  color: #1c2436;
  font-family: 'Noto Serif JP', serif;
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: #b7c4e0; color: #1c2436; }
img { max-width: 100%; height: auto; }
.mc-serif { font-family: 'Shippori Mincho B1', serif; }
.mc-roman { font-family: 'Cormorant Garamond', serif; }
.mc-wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.mc-narrow { max-width: 820px; margin: 0 auto; padding: 0 32px; }
.mc-reader { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ============ header ============ */
.mc-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(238,241,247,0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid #ccd6e8;
}
.mc-header-inner { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.mc-brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.mc-logo { width: 40px; height: 40px; border: 1.5px solid #35478f; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; flex: none; }
.mc-logo::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #4a5fb8; }
.mc-logo::after { content: ""; position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #35478f; top: 6px; right: 8px; }
.mc-brand-name { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 22px; letter-spacing: 0.14em; line-height: 1; }
.mc-brand-sub { font-family: 'Cormorant Garamond', serif; font-size: 11px; letter-spacing: 0.32em; color: #7683a0; text-transform: uppercase; margin-top: 4px; }
.mc-nav { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.mc-nav a { padding: 9px 16px; font-size: 15px; letter-spacing: 0.06em; text-decoration: none; color: #5b6478; border-radius: 2px; white-space: nowrap; }
.mc-header-inner { flex-wrap: nowrap; }
.mc-nav .current-menu-item a, .mc-nav a:hover { color: #1c2436; background: #dbe3f2; }

/* ============ mobile nav toggle (hamburger) ============ */
.mc-nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 5px; width: 40px; height: 40px; border: none; background: transparent; cursor: pointer; padding: 0; flex: none; }
.mc-nav-toggle span { display: block; width: 24px; height: 2px; background: #1c2436; border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
.mc-nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mc-nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.mc-nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ buttons / badges ============ */
.mc-btn { display: inline-block; background: #1c2436; color: #eef1f7; padding: 14px 30px; font-size: 15px; letter-spacing: 0.1em; border-radius: 2px; text-decoration: none; border: none; cursor: pointer; font-family: 'Noto Serif JP', serif; }
.mc-btn-ghost { display: inline-block; border: 1px solid #96a4c4; color: #333f5c; padding: 13px 28px; font-size: 15px; letter-spacing: 0.1em; border-radius: 2px; text-decoration: none; }
.mc-badge { display: inline-block; font-size: 11px; letter-spacing: 0.12em; padding: 3px 10px; border-radius: 2px; }
.mc-badge.on { background: #dbe3f2; color: #35478f; }
.mc-badge.done { background: #dde1ea; color: #5e6780; }
.mc-cat { display: inline-block; font-size: 11px; letter-spacing: 0.14em; color: #35478f; border: 1px solid #c3cee3; padding: 3px 10px; border-radius: 2px; }
.mc-muted { color: #7683a0; font-size: 13px; }
.mc-dot { color: #96a4c4; }

/* ============ hero ============ */
.mc-hero { text-align: center; padding: 88px 32px 64px; max-width: 1120px; margin: 0 auto; }
.mc-hero-eyebrow { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 20px; color: #4a5fb8; letter-spacing: 0.06em; margin-bottom: 22px; }
.mc-hero h1 { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 56px; line-height: 1.5; letter-spacing: 0.06em; margin: 0 auto; max-width: 760px; }
.mc-hero p { max-width: 560px; margin: 28px auto 0; color: #5b6478; font-size: 17px; }
.mc-hero-actions { display: flex; gap: 16px; justify-content: center; margin-top: 40px; }

/* ============ section head ============ */
.mc-sec-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid #ccd6e8; padding-bottom: 16px; margin-bottom: 40px; }
.mc-sec-head h2 { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 26px; letter-spacing: 0.1em; margin: 0; }
.mc-sec-head .label { font-family: 'Cormorant Garamond', serif; letter-spacing: 0.24em; color: #7683a0; font-size: 13px; text-transform: uppercase; }

/* ============ works grid ============ */
.mc-works { display: grid; grid-template-columns: repeat(3,1fr); gap: 36px 32px; }
.mc-work-card { text-decoration: none; color: inherit; display: block; }
.mc-cover { border-radius: 3px; padding: 24px 20px 28px; text-align: center; aspect-ratio: 3/4; display: flex; flex-direction: column; align-items: center; box-shadow: 0 14px 30px -18px rgba(20,26,40,0.55); color: #e7ecf7; overflow: hidden; }
.mc-cover .roman { font-family: 'Cormorant Garamond', serif; font-size: 12px; letter-spacing: 0.3em; opacity: 0.7; text-transform: uppercase; flex: none; }
.mc-cover .vtitle {
	font-family: 'Shippori Mincho B1', serif;
	font-weight: 700;
	font-size: 27px;
	line-height: 1.6;
	letter-spacing: 0.08em;
	writing-mode: vertical-rl;
	text-orientation: mixed;
	white-space: nowrap;
	word-break: keep-all;
	overflow-wrap: normal;
	margin: 16px auto 0;
	flex: 1;
	min-height: 0;
	max-height: 100%;
	display: flex;
	align-items: center;
}
/* 長いタイトルはやや小さめのフォントに自動調整 */
.mc-cover .vtitle[data-len="long"] { font-size: 21px; }
.mc-cover .vtitle[data-len="verylong"] { font-size: 16px; }
.mc-cover-1 { background: linear-gradient(160deg,#2c3a5a,#1c2438); }
.mc-cover-2 { background: linear-gradient(160deg,#2a3f66,#1a2842); }
.mc-cover-3 { background: linear-gradient(160deg,#22345c,#141d34); }
.mc-cover-4 { background: linear-gradient(160deg,#33456e,#1e2a46); }
.mc-cover-5 { background: linear-gradient(160deg,#1f3350,#132238); }
.mc-cover-0 { background: linear-gradient(160deg,#2b3a63,#19233c); }
.mc-work-meta { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.mc-work-card h3 { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 20px; letter-spacing: 0.06em; margin: 8px 0 6px; }
.mc-work-card p { color: #5b6478; font-size: 14.5px; line-height: 1.85; margin: 0; }

/* ============ single novel ============ */
.mc-work-hero { background: linear-gradient(180deg,#eef1f8,#eef1f7); border-bottom: 1px solid #d2dbec; }
.mc-work-hero-inner { padding: 56px 32px 60px; display: grid; grid-template-columns: 220px 1fr; gap: 48px; align-items: start; max-width: 1120px; margin: 0 auto; }
.mc-back { color: #7683a0; font-size: 13px; letter-spacing: 0.08em; text-decoration: none; }
.mc-work-hero h1 { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 42px; letter-spacing: 0.06em; margin: 0 0 8px; }
.mc-work-hero .roman { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 19px; color: #4a5fb8; margin-bottom: 24px; }
.mc-work-hero .synopsis { color: #333f5c; font-size: 16px; line-height: 2; max-width: 600px; margin: 0 0 28px; }
.mc-toc a { display: flex; align-items: center; gap: 22px; padding: 20px 8px; border-bottom: 1px solid #d7dfee; text-decoration: none; color: inherit; }
.mc-toc .num { font-family: 'Cormorant Garamond', serif; font-size: 26px; color: #7e8fc0; width: 44px; flex: none; }
.mc-toc .ct { font-family: 'Shippori Mincho B1', serif; font-weight: 600; font-size: 18px; letter-spacing: 0.04em; }
.mc-toc .arrow { color: #96a4c4; font-size: 18px; }

/* ============ reader ============ */
.mc-reader-body { background: #f2f4f9; }
.mc-reader-bar { position: sticky; top: 78px; z-index: 40; background: rgba(242,244,249,0.9); backdrop-filter: blur(8px); border-bottom: 1px solid #d2dbec; }
.mc-reader-bar-inner { max-width: 760px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.mc-reader-bar .wt { font-family: 'Shippori Mincho B1', serif; font-size: 14px; color: #333f5c; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-reader-bar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.mc-fbtn { width: 32px; height: 32px; border: 1px solid #b6c2dc; background: #f8fafd; border-radius: 4px; cursor: pointer; color: #333f5c; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; line-height: 1; }
.mc-fbtn-nav { font-size: 18px; }
.mc-fbtn.is-disabled { opacity: 0.35; pointer-events: none; }

/* ============ mobile fixed bottom nav (reader) ============ */
.mc-mobile-navbar { display: none; }
.mc-article { max-width: 760px; margin: 0 auto; padding: 64px 24px 40px; }
.mc-article-head { text-align: center; margin-bottom: 56px; }
.mc-article-head .cnum { font-family: 'Cormorant Garamond', serif; font-size: 15px; color: #4a5fb8; letter-spacing: 0.18em; }
.mc-article-head h1 { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 32px; letter-spacing: 0.08em; margin: 14px 0 0; }
.mc-rule { width: 44px; height: 1px; background: #7e8fc0; margin: 28px auto 0; }
.mc-prose { font-size: 18px; line-height: 2.15; color: #202a3d; letter-spacing: 0.02em; }
.mc-prose p { margin: 0 0 1.6em; text-indent: 1em; }
.mc-chapter-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 72px; padding-top: 32px; border-top: 1px solid #d2dbec; }

/* ============ blog ============ */
.mc-blog-head { text-align: center; margin-bottom: 56px; }
.mc-blog-head .it { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 19px; color: #4a5fb8; }
.mc-blog-head h1 { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 40px; letter-spacing: 0.08em; margin: 14px 0 0; }
.mc-post { display: grid; grid-template-columns: 120px 1fr; gap: 32px; padding: 36px 0; border-bottom: 1px solid #ccd6e8; }
.mc-post-date { text-align: right; }
.mc-post-date .d { font-family: 'Cormorant Garamond', serif; font-size: 40px; line-height: 1; color: #1c2436; }
.mc-post-date .m { font-family: 'Cormorant Garamond', serif; letter-spacing: 0.2em; color: #7683a0; font-size: 13px; text-transform: uppercase; margin-top: 4px; }
.mc-post h2 { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 23px; letter-spacing: 0.04em; margin: 12px 0 10px; }
.mc-post h2 a { text-decoration: none; }
.mc-post p { color: #5b6478; font-size: 15px; line-height: 1.95; margin: 0 0 14px; }
.mc-readmore { color: #35478f; font-size: 14px; letter-spacing: 0.06em; text-decoration: none; }

/* ============ profile ============ */
.mc-prof-head { display: grid; grid-template-columns: 180px 1fr; gap: 48px; align-items: center; margin-bottom: 56px; }
.mc-avatar { width: 180px; height: 180px; border-radius: 50%; background: repeating-linear-gradient(45deg,#dbe3f2,#dbe3f2 8px,#eef1f8 8px,#eef1f8 16px); border: 1px solid #c3cee3; display: flex; align-items: center; justify-content: center; font-family: 'Cormorant Garamond', monospace; font-size: 12px; color: #7683a0; letter-spacing: 0.1em; overflow: hidden; }
.mc-prof-head h1 { font-family: 'Shippori Mincho B1', serif; font-weight: 800; font-size: 38px; letter-spacing: 0.1em; margin: 8px 0 6px; }
.mc-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; margin: 48px 0; }
.mc-stat { text-align: center; padding: 28px 16px; background: #f8fafd; border: 1px solid #d7dfee; border-radius: 3px; }
.mc-stat .n { font-family: 'Cormorant Garamond', serif; font-size: 38px; color: #35478f; }
.mc-stat .l { color: #7683a0; font-size: 13px; letter-spacing: 0.08em; margin-top: 4px; }
.mc-timeline-row { display: flex; gap: 20px; padding: 10px 0; }
.mc-timeline-row .y { font-family: 'Cormorant Garamond', serif; color: #4a5fb8; font-size: 16px; width: 56px; flex: none; }

/* ============ contact / forms ============ */
.mc-form { background: #f8fafd; border: 1px solid #d7dfee; border-radius: 4px; padding: 40px; }
.mc-field { margin-bottom: 24px; }
.mc-field label { display: block; font-size: 13px; letter-spacing: 0.08em; color: #5b6478; margin-bottom: 8px; }
.mc-field input, .mc-field textarea { width: 100%; padding: 12px 14px; border: 1px solid #c3cee3; background: #eef1f8; border-radius: 3px; font-family: 'Noto Serif JP', serif; font-size: 15px; color: #1c2436; }
.mc-field textarea { resize: vertical; }
.mc-form .mc-btn { width: 100%; padding: 15px; letter-spacing: 0.14em; }

/* ============ footer ============ */
.mc-footer { background: #1c2436; color: #c7cfe2; margin-top: 40px; }
.mc-footer-inner { padding: 56px 32px 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 32px; max-width: 1120px; margin: 0 auto; }
.mc-footer-name { font-family: 'Shippori Mincho B1', serif; font-weight: 700; font-size: 20px; letter-spacing: 0.14em; color: #eef1f7; }
.mc-footer-sub { font-family: 'Cormorant Garamond', serif; font-size: 12px; letter-spacing: 0.3em; color: #4a5fb8; margin-top: 6px; text-transform: uppercase; }
.mc-footer p { font-size: 13px; color: #8e97b0; margin-top: 16px; max-width: 280px; line-height: 1.8; }
.mc-footer-col-title { font-size: 12px; letter-spacing: 0.16em; color: #8e97b0; text-transform: uppercase; margin-bottom: 14px; }
.mc-footer-menu { list-style: none; margin: 0; padding: 0; }
.mc-footer-menu a { display: block; color: #c7cfe2; font-size: 14px; padding: 5px 0; text-decoration: none; }
.mc-footer-bottom { border-top: 1px solid #232d42; }
.mc-footer-bottom div { max-width: 1120px; margin: 0 auto; padding: 20px 32px; font-family: 'Cormorant Garamond', serif; font-size: 12px; letter-spacing: 0.16em; color: #8e97b0; }

/* ============ responsive ============ */
@media (max-width: 900px) {
  .mc-wrap, .mc-narrow { padding: 0 22px; }
  .mc-works { grid-template-columns: repeat(2,1fr); gap: 28px 20px; }
  .mc-work-hero-inner { grid-template-columns: 1fr; gap: 28px; padding: 40px 22px 44px; text-align: center; justify-items: center; }
  .mc-prof-head { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .mc-hero { padding: 64px 22px 48px; }
  .mc-hero h1 { font-size: 34px; }
  .mc-hero-actions { flex-wrap: wrap; }
  .mc-footer-inner { padding: 44px 22px 32px; gap: 28px; }
}

@media (max-width: 900px) {
  /* ハンバーガーメニューに切り替え（タブレットもここから対象） */
  .mc-nav-toggle { display: flex; }
  .mc-header-inner { height: 64px; }
  #mc-nav-main {
    position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: #eef1f7; transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    overflow-y: auto; padding: 12px 22px 40px; z-index: 49;
  }
  #mc-nav-main.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .mc-nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .mc-nav a { padding: 15px 6px; font-size: 16px; border-bottom: 1px solid #ccd6e8; border-radius: 0; white-space: normal; }
  .mc-nav .current-menu-item a, .mc-nav a:hover { background: transparent; color: #35478f; }
  body.mc-nav-lock { overflow: hidden; }

  /* リーダーの上部バーもヘッダー高さ変更(64px)に合わせる */
  .mc-reader-bar { top: 64px; }
}

@media (max-width: 600px) {
  .mc-works { grid-template-columns: 1fr; }
  .mc-post { grid-template-columns: 1fr; }
  .mc-post-date { text-align: left; }
  .mc-post-date .d { font-size: 30px; }
  .mc-stats { grid-template-columns: 1fr; }
  .mc-hero h1 { font-size: 28px; }
  .mc-hero-eyebrow { font-size: 16px; }
  .mc-sec-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mc-sec-head h2 { font-size: 22px; }
  .mc-work-hero h1 { font-size: 30px; }
  .mc-toc a { padding: 16px 4px; gap: 14px; }
  .mc-toc .num { font-size: 20px; width: 34px; }
  .mc-toc .ct { font-size: 16px; }
  .mc-form { padding: 26px 20px; }
  .mc-avatar { width: 130px; height: 130px; }
  .mc-prof-head h1 { font-size: 28px; }
  .mc-footer-inner { flex-direction: column; }

  /* リーダー画面 */
  .mc-reader-bar-inner { padding: 10px 16px; gap: 10px; }
  .mc-reader-bar .wt { display: none; }
  .mc-fbtn { width: 34px; height: 34px; }
  .mc-article { padding: 40px 18px 24px; }
  .mc-article-head { margin-bottom: 36px; }
  .mc-article-head h1 { font-size: 24px; }
  .mc-prose { font-size: 17px; line-height: 2; }

  /* 本文下ナビはスマホでは縦積みに */
  .mc-chapter-nav { flex-direction: column; align-items: stretch; gap: 16px; text-align: center; }
  .mc-chapter-nav .mc-btn { text-align: center; }

  /* 画面下固定の前後ナビ（スマホのみ表示） */
  .mc-mobile-navbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(238,241,247,0.96); backdrop-filter: blur(8px);
    border-top: 1px solid #ccd6e8; padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
  }
  .mc-mobile-navbtn {
    flex: 1; text-align: center; padding: 12px 6px; font-size: 13px; letter-spacing: 0.04em;
    text-decoration: none; color: #333f5c; border: 1px solid #ccd6e8; border-radius: 4px;
    background: #f8fafd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mc-mobile-navbtn.is-toc { flex: 0 0 auto; padding: 12px 16px; color: #5b6478; }
  .mc-mobile-navbtn.is-primary { background: #1c2436; color: #eef1f7; border-color: #1c2436; }
  .mc-mobile-navbtn.is-disabled { opacity: 0.4; pointer-events: none; }

  /* 固定バーの分だけ本文末尾に余白 */
  .mc-reader-body { padding-bottom: 74px; }
}
