@charset "utf-8";

/*
 * 小説ページ専用テーマ
 * 他ページは黄昏グラデーション+白文字のダーク基調だが、
 * 長文を読むページなので目に優しい「紙」基調に切り替える。
 * body.novel-page というクラスの中だけに効果を絞ってあるので、
 * 他のページの見た目には影響しない。
 */

body.novel-page {
	background-image:
		radial-gradient(circle at 18% 24%, rgba(139, 111, 71, 0.10), transparent 42%),
		radial-gradient(circle at 82% 12%, rgba(139, 111, 71, 0.08), transparent 40%),
		radial-gradient(circle at 70% 85%, rgba(139, 111, 71, 0.09), transparent 45%),
		radial-gradient(circle at 10% 90%, rgba(139, 111, 71, 0.07), transparent 40%),
		linear-gradient(180deg, #f7efdd 0%, #f2e7cf 100%);
	background-attachment: fixed;
	color: #3a2b19;
}

/* 見出しやロゴが白文字前提なので、ヘッダー部分だけ濃色の帯を敷いて視認性を確保する */
body.novel-page header {
	background: rgba(32, 22, 12, 0.88);
	backdrop-filter: blur(6px);
}

body.novel-page main {
	box-sizing: border-box;
	padding: 2.5rem 1.5rem 4rem;
	max-width: 1100px;
	margin: 0 auto;
	width: 100%;
}

.novel-reader {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 2rem;
	align-items: start;
}

/* ==== 作品一覧(目次) ==== */
.novel-toc {
	background: rgba(255, 255, 255, 0.35);
	border: 1px solid rgba(139, 111, 71, 0.25);
	border-radius: 10px;
	padding: 1.2rem;
	position: sticky;
	top: 1.5rem;
}

.novel-toc h2 {
	font-size: 0.6em;
	margin: 0 0 1rem;
	letter-spacing: 0.1em;
	color: #7a4a1f;
}

.novel-toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.novel-toc a {
	display: block;
	color: #3a2b19;
	text-decoration: none;
	padding: 0.6rem 0.8rem;
	border-radius: 8px;
	font-size: 0.55em;
	line-height: 1.5;
	transition: background-color 0.15s;
}

.novel-toc a:hover {
	background: rgba(139, 111, 71, 0.12);
}

.novel-toc li.is-current a {
	background: rgba(183, 33, 33, 0.12);
	font-weight: bold;
}

.novel-toc .novel-toc-subtitle {
	display: block;
	font-size: 0.75em;
	opacity: 0.8;
	margin: 0.15rem 0 0 0.8em;
	font-weight: normal;
	font-style: italic;
}

.novel-toc .novel-toc-summary {
	display: block;
	font-size: 0.85em;
	opacity: 0.75;
	margin-top: 0.2rem;
	font-weight: normal;
}

.novel-toc .novel-toc-bookmark {
	display: none;
	font-size: 0.8em;
	color: #B72121;
	margin-top: 0.3rem;
}

.novel-toc li.has-bookmark .novel-toc-bookmark {
	display: block;
}

/* ==== 本文 ==== */
.novel-body {
	background: rgba(255, 255, 255, 0.45);
	border: 1px solid rgba(139, 111, 71, 0.2);
	border-radius: 10px;
	padding: 2rem 2.5rem 2.5rem;
	box-shadow: inset 0 0 90px rgba(90, 62, 27, 0.08);
}

.novel-title {
	font-size: 0.85em;
	color: #7a2020;
	margin: 0 0 0.3rem;
}

.novel-title a {
	color: inherit;
	text-decoration: none;
}

.novel-title a:hover {
	text-decoration: underline;
}

.novel-subtitle {
	font-size: 0.55em;
	opacity: 0.8;
	margin: 0 0 0.6rem;
	font-style: italic;
}

.novel-meta-row {
	display: flex;
	align-items: center;
	gap: 0.7em;
	font-size: 0.5em;
	margin: 0 0 1rem;
	flex-wrap: wrap;
}

.novel-status-tag {
	display: inline-block;
	padding: 0.15em 0.7em;
	border-radius: 999px;
	background: rgba(122, 20, 20, 0.12);
	color: #7a1414;
	font-weight: bold;
}

.novel-status-tag.is-completed {
	background: rgba(58, 58, 58, 0.15);
	color: #333;
}

.novel-updated {
	opacity: 0.7;
}

.novel-new-tag {
	display: inline-block;
	font-size: 0.7em;
	font-weight: bold;
	padding: 0.1em 0.5em;
	margin-left: 0.4em;
	border-radius: 4px;
	background: #d98c00;
	color: #fff;
	vertical-align: middle;
}

.novel-summary {
	font-size: 0.5em;
	opacity: 0.75;
	margin: 0 0 1.5rem;
}

.novel-toolbar {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-bottom: 1rem;
	font-size: 0.45em;
}

.novel-font-btn {
	border: 1px solid rgba(139, 111, 71, 0.4);
	background: rgba(255, 255, 255, 0.5);
	color: #3a2b19;
	border-radius: 6px;
	padding: 0.3em 0.7em;
	cursor: pointer;
	font-family: inherit;
}

.novel-font-btn:hover {
	background: rgba(139, 111, 71, 0.15);
}

.novel-text {
	font-size: 0.6em;
	line-height: 2;
	letter-spacing: 0.03em;
}

/* 文字サイズ変更ボタン用(インラインstyleを使わずclassの切り替えで対応。
   CSPのstyle-srcを絞っているため、JSからstyle属性を書き換えない設計にしている) */
.novel-reader.font-scale-0 .novel-text { font-size: 0.48em; }
.novel-reader.font-scale-1 .novel-text { font-size: 0.54em; }
.novel-reader.font-scale-2 .novel-text { font-size: 0.6em; }
.novel-reader.font-scale-3 .novel-text { font-size: 0.68em; }
.novel-reader.font-scale-4 .novel-text { font-size: 0.76em; }
.novel-reader.font-scale-5 .novel-text { font-size: 0.86em; }

.novel-text p {
	margin: 0 0 1.4em;
	text-indent: 1em;
}

/* 各ページ最初の段落だけ、字下げの代わりに先頭1文字を大きくする(ドロップキャップ) */
/* 各ページ最初の段落だけ、字下げの代わりに先頭1文字を大きくする(レイズドキャップ:
   回り込み無しで1行目の中だけで完結させ、2行目以降のレイアウトに影響させない) */
.novel-text p:first-child {
	text-indent: 0;
}

.novel-text p:first-child::first-letter {
	font-size: 1.8em;
	line-height: 1;
	font-weight: bold;
	color: #7a2020;
}

/* 傍点(強調): <em> はブラウザ既定だと斜体になるので、日本語らしい「文字の上に点」に差し替える */
.novel-text em {
	font-style: normal;
	font-weight: inherit;
	-webkit-text-emphasis: dot;
	text-emphasis: dot;
	-webkit-text-emphasis-position: over right;
	text-emphasis-position: over right;
}

/* ルビ(ふりがな) */
.novel-text ruby rt {
	font-size: 0.55em;
	opacity: 0.85;
	user-select: none;
}

.novel-pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	margin-top: 2.5rem;
	font-size: 0.5em;
}

.novel-pagination a,
.novel-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.2em;
	height: 2.2em;
	padding: 0 0.4em;
	border-radius: 6px;
	text-decoration: none;
	color: #3a2b19;
}

.novel-pagination a {
	border: 1px solid rgba(139, 111, 71, 0.35);
	background: rgba(255, 255, 255, 0.4);
}

.novel-pagination a:hover {
	background: rgba(139, 111, 71, 0.15);
}

.novel-pagination .is-current {
	background: #B72121;
	color: #fff;
	font-weight: bold;
}

.novel-pagination .is-disabled {
	opacity: 0.3;
}

/* ==== 成人向け(グロテスク表現など)作品の注意表示・雰囲気変更 ==== */
.novel-toc-tag {
	display: inline-block;
	font-size: 0.75em;
	font-weight: bold;
	padding: 0.1em 0.5em;
	margin-left: 0.4em;
	border-radius: 4px;
	background: #7a1414;
	color: #fff;
	vertical-align: middle;
}

/* サイドバー(TOC)内では周りの文字が小さいので、ステータスタグもそれに合わせて縮小する */
.novel-toc .novel-status-tag {
	font-size: 0.75em;
	vertical-align: middle;
}

.novel-content-warning {
	margin: 0 0 1.5rem;
	padding: 1rem 1.2rem;
	border: 1px solid rgba(122, 20, 20, 0.5);
	background: rgba(122, 20, 20, 0.08);
	border-radius: 8px;
	font-size: 0.5em;
	line-height: 1.6;
	color: #6e1414;
}

.novel-content-warning-tag {
	display: inline-block;
	font-weight: bold;
	margin-right: 0.6em;
	padding: 0.15em 0.7em;
	border-radius: 4px;
	background: #7a1414;
	color: #fff;
}

/* ==== 章一覧・現在の章表示 ==== */
.novel-current-chapter {
	font-size: 0.5em;
	font-weight: bold;
	color: #7a2020;
	margin: 0 0 0.4rem;
	opacity: 0.85;
}

/* 本文ページ内、章名の下に出すchapter-summary(そのチャプターの最初のページだけ) */
.novel-chapter-summary-inline {
	font-size: 0.5em;
	opacity: 0.75;
	line-height: 1.7;
	margin: 0 0 1.2rem;
}

.novel-chapter-list {
	list-style: none;
	margin: 1.5rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
}

.novel-chapter-item a {
	display: inline-block;
	font-size: 0.65em;
	font-weight: bold;
	color: #7a2020;
	text-decoration: none;
	border-bottom: 1px solid rgba(122, 32, 32, 0.35);
}

.novel-chapter-item a:hover {
	border-bottom-color: currentColor;
}

.novel-chapter-item.has-part {
	margin-left: 1.4em;
}

/* [part:...] のグループ見出し。クリックできないただのラベル */
.novel-chapter-part-label {
	font-size: 0.6em;
	font-weight: bold;
	opacity: 0.85;
	margin-top: 0.6rem;
}

.novel-chapter-list li:first-child.novel-chapter-part-label {
	margin-top: 0;
}

.novel-chapter-summary {
	font-size: 0.5em;
	opacity: 0.8;
	margin: 0.3em 0 0;
	line-height: 1.7;
}

/* 一覧ページのカード内、章一覧の展開ボタン(<details>のネイティブ機能を利用) */
.novel-chapter-toggle {
	margin-top: 0.6rem;
}

.novel-chapter-toggle summary {
	cursor: pointer;
	font-size: 0.5em;
	font-weight: bold;
	color: #7a2020;
	list-style: none;
}

.novel-chapter-toggle summary::-webkit-details-marker {
	display: none;
}

.novel-chapter-toggle summary::before {
	content: "▸";
	display: inline-block;
	margin-right: 0.4em;
	transition: transform 0.25s ease;
}

.novel-chapter-toggle[open] summary::before {
	transform: rotate(90deg);
}

/* 開閉の高さアニメーション自体はJS(main.js)がWeb Animations APIで行う。
   CSSはレイアウトだけ担当し、開いている間の余白を用意しておく。 */
.novel-chapter-toggle .novel-chapter-list {
	margin-top: 0.8rem;
}

.novel-chapter-toggle .novel-chapter-item a {
	font-size: 1em;
}

.novel-chapter-toggle .novel-chapter-summary {
	font-size: 0.95em;
}

/* 読んでいる間、ページ全体の雰囲気を暗く不穏なトーンに切り替える */
body.novel-page.is-mature-page {
	background-image:
		radial-gradient(circle at 15% 20%, rgba(122, 20, 20, 0.35), transparent 45%),
		radial-gradient(circle at 85% 15%, rgba(80, 0, 0, 0.3), transparent 45%),
		radial-gradient(circle at 50% 90%, rgba(40, 0, 0, 0.35), transparent 50%),
		linear-gradient(180deg, #241212 0%, #120808 100%);
	color: #e7d9c8;
}

body.novel-page.is-mature-page .novel-toc,
body.novel-page.is-mature-page .novel-body {
	background: rgba(20, 8, 8, 0.55);
	border-color: rgba(122, 20, 20, 0.4);
	box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.55);
}

body.novel-page.is-mature-page .novel-toc h2 {
	color: #ff9b9b;
}

@media (max-width: 767px) {
	body.novel-page.is-mature-page .novel-toc ul {
		border-bottom-color: rgba(255, 107, 107, 0.3);
	}
}

body.novel-page.is-mature-page .novel-toc a,
body.novel-page.is-mature-page .novel-title,
body.novel-page.is-mature-page .novel-subtitle,
body.novel-page.is-mature-page .novel-summary,
body.novel-page.is-mature-page .novel-chapter-summary-inline,
body.novel-page.is-mature-page .novel-text {
	color: #e7d9c8;
}

body.novel-page.is-mature-page .novel-status-tag {
	background: rgba(255, 255, 255, 0.1);
	color: #e7d9c8;
}

body.novel-page.is-mature-page .novel-status-tag.is-completed {
	background: rgba(255, 255, 255, 0.1);
	color: #d8d8d8;
}

body.novel-page.is-mature-page .novel-updated {
	color: #c9b8a8;
}

body.novel-page.is-mature-page .novel-title {
	color: #ff6b6b;
}

body.novel-page.is-mature-page .novel-current-chapter,
body.novel-page.is-mature-page .novel-chapter-item a,
body.novel-page.is-mature-page .novel-chapter-part-label,
body.novel-page.is-mature-page .novel-chapter-toggle summary {
	color: #ff9b9b;
}

body.novel-page.is-mature-page .novel-text p:first-child::first-letter {
	color: #ff6b6b;
}

body.novel-page.is-mature-page .novel-toc a:hover {
	background: rgba(255, 107, 107, 0.12);
}

body.novel-page.is-mature-page .novel-toc li.is-current a {
	background: rgba(255, 107, 107, 0.18);
}

body.novel-page.is-mature-page .novel-font-btn,
body.novel-page.is-mature-page .novel-pagination a,
body.novel-page.is-mature-page .novel-pagination span {
	color: #e7d9c8;
	border-color: rgba(231, 217, 200, 0.3);
	background: rgba(255, 255, 255, 0.06);
}

body.novel-page.is-mature-page .novel-pagination .is-current {
	background: #7a1414;
}

body.novel-page.is-mature-page .novel-content-warning {
	border-color: rgba(255, 107, 107, 0.5);
	background: rgba(80, 10, 10, 0.4);
	color: #ffc2c2;
}

body.novel-page .footer-back {
	display: flex;
	justify-content: center;
	padding: 1.5rem;
	background: rgba(32, 22, 12, 0.88);
}

body.novel-page .footer-back a {
	color: #f2e7cf;
	text-decoration: none;
	font-size: 0.55em;
}

body.novel-page .footer-back a:hover {
	text-decoration: underline;
}

/* スマホでは目次を本文の上に積む */
@media (max-width: 767px) {
	.novel-reader {
		grid-template-columns: 1fr;
	}

	.novel-toc {
		position: static;
	}

	/* 作品数が多いと本文にたどり着くまでが長くなるので、
	   サイドバーの一覧は約4件分の高さに抑えて、それ以上はその場でスクロールさせる */
	.novel-toc ul {
		max-height: 18rem;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		border-bottom: 1px solid rgba(139, 111, 71, 0.25);
		padding-bottom: 0.5rem;
	}

	.novel-body {
		padding: 1.5rem 1.2rem 2rem;
	}
}