/*
	ボディ部の基本設定
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	border: 0;
	font: inherit;
	margin: 0;
	padding: 0;
	vertical-align: baseline;
	scroll-behavior: smooth;

}

h1, h2 h3, h4, h5, h6 {
	padding: 0;
	margin: 0;
	border: 0;
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: auto; /* 画面全体のスクロールを禁止して、各パーツに任せる */
	box-sizing: border-box;
	font-family: serif;
}

/*	ヘッダー部	*/
header {
	flex-direction: row;
	display: flex;
    box-sizing: border-box;			/* paddingを含めて75pxと計算させる */
	justify-content: space-between; /* 左右中央に振り分ける */
	align-items: center;			/* 縦方向を中央に揃える */
	padding: 0;
	background-color: whitesmoke;
	border-bottom: none;
	height: 75px;
	overflow-y: auto;
}
/* 左：ロゴのスペース */
.header-left {
    box-sizing: border-box;
	width: 80px;
	height: 100%;			/* 親の75pxをフルに使う */
	display: flex;			/* Flexboxを有効化 */
	align-items: flex-start; /* 縦方向（上下）を「上端」に寄せる */
	justify-content: flex-start; /* 横方向（左右）を「左端」に寄せる */
	padding-top: 5px;		/* 上からの距離を5pxに指定 */
	padding-left: 5px;		/* 左からの距離を5pxに指定 */
}
/* 左：ロゴのサイズ */
.header-left img {
    box-sizing: border-box;
	height: 28px;			/* 12ptの文字に対して、これくらいだとスッキリします */
	display: block;			/* 余計な下隙間を消す */
	margin: 0 !important;
	padding: 0 !important;
	opacity: 0.8;			/* 少しだけ透明度を下げると、さらに背景に馴染みます */
}

/* 中央：タイトルの配置 */
.header-center {
	box-sizing: border-box;
	flex-grow: 1;			/* 残りのスペースを全部使って中央を維持 */
	height: 100%;			/* 親の75pxをフルに使う */
	text-align: center;		/* 中身のテキストを中央寄せ */
	display: flex;
	flex-direction: column; /* 縦に並べる */
	justify-content: space-around; /* 縦方向も中央に */
	line-height: 1.2;        /* 行間を詰める（重要！） */
	overflow-y: auto;
	padding: 0;
	padding-top: 5px;
	padding-bottom: 5px;
}

/* 右：これがあるとお手軽に中央が維持できます */
.header-right {
	box-sizing: border-box;
	width: 80px; /* 左のロゴと同じ幅にしておくと、タイトルが真ん中に来ます */
	padding: 0;
}

.book-title,
.chapter-title,
.author {
	font-size: 10pt;
	font-weight: bold;
	line-height: 1em;
	color: dimgray;
	margin: 0.5;
	padding: 0;
}

/* ヘッダーや履歴の中の small タグを狙い撃ち */
.book-title small,
.side-box small {
	font-size: 0.8em;		/* 0.8よりもう少し小さく（75%） */
	color: dimgray;			/* 少しグレーにして存在感を抑える */
	font-weight: normal;	/* タイトルが太字なら、ここは細くして強弱をつける */
	margin-left: 0.3em;		/* ほんの少しだけ隙間を空ける */
}
/* 本文エリアの底に余計な余白がないか強制リセット */
main, #focusElement {
    margin-bottom: 0;
    padding-bottom: 0;
}

footer {
	height: 75px;
	background-color: #eeeeee;
	display: flex; /* これで横に並べる */
	width: 100%;
	overflow: auto;
	background-color: whitesmoke;	/* 色を付けて場所を確定させる */
}
/*
	ボディー部内のコンテンツ部分
*/
/* 親要素：3つを横に並べる（並び順は左から右へ） */
.content {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	width: 100%;
	height: calc(100vh - 150px);/* 画面の高さに合わせる（ヘッダー/フッター分を引く調整は必要に応じて） */
	box-sizing: border-box;		/* パディングで横にはみ出すのを防ぐ */
	background-color: whitesmoke;
	overflow: auto;
}

/* 両脇の箱（履歴と目次） */
.side-box {
	box-sizing: border-box;
	width: 150px;
	flex-shrink: 0;
	height: 100%;
	overflow-y: auto;
	background-color: whitesmoke;
	padding: 10px;
	position: sticky;
	top: 0px;
	border: 0;
}

/* 中央の本文（主役） */
.explanation {
	flex-grow: 1;
	min-width: 0;
	padding: 0px;
	height: 100%;
	box-sizing: border-box;
	background-color: white;
	/* 縦書きの魔法 */
	writing-mode: vertical-rl; 
	overflow-x: auto;				/* 縦書きなので、はみ出したら「横」にスクロール */
}

#focusElement {
	scroll-margin-top: 0px;
	margin-bottom: 50px;
	outline: none;		/* これで水色の枠が消えます */
	outline: none;
	box-shadow: none; /* 青い光（シャドウ）も消す */
}
/* 念のためフォーカス時も */
#focusElement:focus {
	outline: none;
	box-shadow: none;
}

/* 本文エリア */
div.explanation {
	flex: 1;			/* 残りの幅を全部使う（これでcalc計算が不要に！） */
	height: 100%;
	background-color: white;
	writing-mode: vertical-rl;
	text-orientation: mixed;   /* 句読点や英数字をいい感じにする */
	overflow-x: auto;
	overflow-y: auto;
	padding: 10px;
}

/* 左右のナビ（navi, blank） */
navi, blank {
	width: 200px;
	height: 100%;
	flex-shrink: 0;		/* 幅が勝手に縮まないように固定 */
	overflow-y: auto;
}
/* --- subtitle部分 --- */
p.subtitle {
	text-decoration: none;
	margin-top: 2em;
	margin-bottom: 2em;
	margin-right: 1em;
	margin-left: 2em;
	font-size: 1.3em;
	font-weight: bold;
}
/* --- リンク設定（縦書き用） --- */
.explanation a {
	text-decoration: none;
	border-right: 1px solid #6060F0; /* 縦書きの下線 */
	padding-right: 2em;
	color: #0000FF;
	font-weight: bold;
	transition: all 0.3s; /* ふわっと色を変える */
}
.explanation a:hover {
	color: mediumblue;
	border-right-color: mediumblue;
}

/* --- ページナビ（次へ・前へ）の装飾 --- */
#pageNavi {
	display: block; /* 縦書きの中で塊にする */
	margin: 2em 1em;
	padding: 1em;
	border: 0;
	text-align: center;
	background: whitesmoke;
}

/* --- 本文内のセクション別サイズ指定 --- */

/* --- 前書き・後書きの装飾（90%サイズ & 薄い色） --- */
.foreword,
.afterword {
	font-size: 0.9em;
	color: dimgray;
}

/* --- 特殊な段落（ぶら下げ・仕切り） --- */
.stickOut {
	margin-top: 2em;
	text-indent: -2em;
}

.separater {
	text-align: center;
	text-indent: 0;
}

/*	見出しの設定	*/
h1.center {		/* タイトルに使用 */
	font-size: 100%;
	text-align: center;
	margin-top: 5px;
	margin-bottom: 4px;
	padding: 0;
}
div.explanation p.separater {
	margin-top: 5px;
	margin-bottom: 5px;
	margin-left: 0;
	margin-right: 0;
	text-indent: 0;
	text-align: center;
}

text-combine,
.tateyoko {			/* 縦書き中、縦中横の指定 */
	text-combine-upright: all;
	-webkit-text-combine: horizontal;
	-ms-text-combine-horizontal: all;
	text-combine-upright: all;
}

/* --- ルビと縦中横 --- */
ruby > rt { font-size: 40%; }

a {	/* 縦書き中のa link 共通 */ 
	text-decoration: none;
}
div.explanation a.Japanese {	/* 縦書き中のa link 日本語時（標準） */
	border-right: 1px solid;
	padding-right: 3px;
}
div.explanation a.western {	/* 縦書き中のa link 欧文時 */
	text-decoration: underline;
}
div.explanation a:hover {	/* 縦書き中のa link（カーソルが乗っている時） */
	font-size: 1em;		/* 文字サイズx倍 */
	color: mediumblue;
	font-weight: bold;
}
div.explanation a:link {	/* 縦書き中のa link（基本） */
	font-size: 1em;		/* 文字サイズx倍 */
	color: 0000FF;
	font-weight: bold;
}
/*	縦書き中のページナビ専用	*/
div.explanation a#pageNavi {
	font-size: 120%;
	line-height: 180%;
	font-family: serif;
	text-align: left;
	padding-top: 2em;
	padding-bottom: 2em;
	padding-left: 1.0em;
	padding-right: 1.0em;
	margin: 1em;
	margin-left: 2.5em;
	margin-right: 0.5em;
	text-indent: 0em;
	transition: color 0.3s ease, font-family 0.3s ease; /* 0.3秒かけて変化 */
}
div.explanation a#pageNavi:link {
	font-style: sans-serif;
	color:#303030;
}
div.explanation a#pageNavi:visited {
	font-style: sans-serif;
	color:#8888FF;
}
div.explanation a#pageNavi:hover {
	font-style: serif;
	color: mediumblue;
	background-color:#EEEEEE;
}
div.explanation a#pageNavi:active {
	font-style: serif;
	color:#33CC00;
}


section#title {
	font-size: 110%;
	padding: 0.5em;
}
section#text {
	font-size: 100%;
}
section#foreword {
	font-size: 90%;
}
section#afterword {
	font-size: 90%;
}
section#nextpage {
	font-size: 110%;
	padding-top: 3em;
	padding-bottom: 2em;
	padding-left: 1.5em;
	padding-right: 2em;
	background-color: #fafafa;
}

div. a#pageNavi:hover {		/* 縦書き中のページナビ専用 */
	color: red;
	font-weight: bold;
}
div.explanation a#pageNavi:active {		/* 縦書き中のページナビ専用 */
	color: red;
	font-weight: bold;
}

div.explanation {
	font-family: serif;
}

本文周りの書式指定
div.explanation p {		/* 縦書き中のパラグラフ */
	margin-top: 5px;
	margin-bottom: 5px;
	margin-left: 0;
	margin-right: 0;
	text-indent: 0;
	text-align: justify;
}
div.explanation p.honbun {
	text-indent: 1em;
}
div.explanation p.bracket-start {	/* 括弧類の時は半角さげ */
	margin-top: 5px;
	margin-bottom: 5px;
	text-indent: 0.5em;
}
div.explanation p.stickOut {	/* 突き出し（数字が先頭の時に使えそう） */
	margin-top: 2em;
	text-indent: -2em;
}
div.explanation p.indentation {		/* 二字下げ（先頭の空白が複数ある場合） */
	margin-top	: 2em;
	text-indent: 0em;
}
div.explanation p.noDrop {			/* 字下げ無し（字下げ有無混在の文章の場合考える） */
	margin-top: 0em;
	text-indent: 0.5em;
}
div.explanation p.separater {		/* セパレータ（記号類のみで1行が埋まっている場合はこの扱い） */
	margin-top: 5px;
	margin-bottom: 5px;
	margin-left: 0;
	margin-right: 0;
	text-indent: 0;
	text-align: center;
}
div.explanation p.blank {			/* <br />のみの時はこちら */
	text-align: center;
	line-height: 1.0em;
}
div.explanation p.pagenavi {		/* 次の章を示すブロック内 */
	line-height: 1.0em;
}
div.explanation p.foreword {		/* まえがき */
	color: #666666;
}
div.explanation p.afterword {		/* あとがき */
	color: #666666;
}

medium {
	text-size: 90%;
}

small {
	text-size: 80%;
}

.child {
	background-color: #eeeeee;
}


.index {
	width: 80px;
	height: 100%;
	flex-shrink: 0; /* ボタンの幅は死守 */
	display: flex;
	align-items: center;
	justify-content: center;
}

.context {
	flex-grow: 1; /* 残りの幅を全部使う */
	height: 100%;
	overflow-y: auto; /* 縦スクロールだけ許可 */
	padding: 5px 10px;
	box-sizing: border-box;
	font-size: 12pt;
	text-align: left;
}

p.text {
	margin-left: 20px;
}
/* 履歴(side-box)とヘッダー(header-center)のリンクを共通でお洒落にする */
/* 共通：リンクの青色を消して、文字色になじませる */
.header-center a,
.side-box a {
	text-decoration: none;	/* 下線を消す */
	color: #666666;			/* 基本の文字色 */
	transition: color 0.3s;	/* 色が変わる時に「じわっ」とさせると高級感が出ます */
}
/* マウスを乗せた時（ホバー） */
.header-center a:hover,
.side-box a:hover {
	color: #4682B4;
	border-right-color: mediumblue;
}

h2.chapter-title {
	margin-top: 2em;
	text-indent: 0;
	margin-bottom: 0;  /* 詰まりすぎず、空きすぎず */
	line-height: 1.1;
	font-size: 80%;
	color: dimgray; 
}
p.menuItems {
	margin-top: .5em;
	text-indent: 0;
	margin-bottom: 0;  /* 詰まりすぎず、空きすぎず */
	line-height: 1.1;
	font-size: 80%;
}
p.page {
	margin-top: 0;
	text-indent: 0;
	margin-bottom: 1em;  /* 詰まりすぎず、空きすぎず */
	line-height: 1.1;
	font-size: 80%;
	text-align: end;
	color: dimgray; 
}

/* 読んでいるところ（アクティブ）だけ色を変える */
.current-reading {
	color: #444444;		/* 読んでいるところはハッキリ黒く */
	font-weight: bold;
	scroll-margin-top: 45px;  /* 45px分、上に余裕を残して止まる */
}

h1 .explanation {
	margin-top: 2em;
	text-indent: 0em;
	line-height: 1;
	font-size: 160rem;
	margin-top: 2em;
	color: dimgray; 
	text-combine-upright: all;
	display: inline-block; /* 効かない時はこれを足すと起きることがあります */
	display: block; /* 縦書きの中で塊にする */
	margin: 2em 2em;
	padding: 1em;
	border: 1px solid #ddd;
	text-align: center;
}

/*
	コピペ実装！CSSだけで作れるお洒落で使いやすいボタン◉サンプルコード12選
	https://grow-group.jp/archives/2674/
	ここから下がボタンのCSS
*/
.btn-border {
	display: inline-block;
	max-width: 30px;
	text-align: center;
	border: 1px solid #ffffff;
	font-size: 20pt;
	color: #ffffff;
	text-decoration: none;
	font-weight: bold;
	padding: 4px 8px;
	border-radius: 4px;
	transition: .4s;
    /* 1. input特有のグレーの背景や立体感を消す */
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent; 
    /* 2. 縦横のサイズを固定して真四角にする */
    width: 30px;		/* お好みのサイズに */
    height: 30px;
    /* 3. 中の文字（▶︎）を上下左右の真ん中に置く */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0; 

    cursor: pointer;	/* マウスを乗せたら指の形にする */
}

.btn-border:hover {
	background-color: #9ec34b;
	border-color: #cbe585;
	color: #FFF;
}

/* 入力欄（テキストと数値）の共通設定 */
input[type="text"], 
input[type="number"] {
	font-family: serif;		/* bodyと同じ明朝体に揃える */
    font-size: 11pt;		/* 周りの文字より一回り大きく */
	padding: 2px 5px;		/* 枠の中に少しだけ余白を作る */
	border: 1px solid #ccc;	/* 枠線を少し柔らかい色に */
	border-radius: 4px;		/* 角をほんのり丸くすると「今風」に */
}

/* ncodeを入れるテキストボックスだけ、もう少し幅を広げるなら */
input[type="text"] {
	width: 8em;				/* 文字数に合わせて少し広めに */
}
input[type="submit"], button {
	font-size: 10pt;
	padding: 2px 8px;		/* 少し横幅を持たせると「ボタン」らしくなります */
}
