/* 本文を36字前後で折り返す。見開ける幅に限り、見出し・書誌情報を左の欄へ送る。 */
:root {
  color-scheme: light;
  --paper: #fcfbf9;
  --ink: #493c31;
  --heading: #3d2a1a;
  --secondary: #756c61;
  --rule: #e0d7cb;
  --mustard: #ffc24d;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --measure: 36em;
  font-family: "Zen Maru Gothic", "Hiragino Sans", "Yu Gothic Medium", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-break: strict;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; }
body > header, main, footer {
  width: min(calc(100% - 2 * var(--gutter)), 56rem);
  margin-inline: auto;
}
body > header { padding-top: 2rem; font-weight: 700; }
main { padding-block: clamp(2rem, 6vw, 5rem) 0; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
h1, h2, h3 { color: var(--heading); line-break: strict; overflow-wrap: anywhere; text-wrap: balance; }
h1 {
  padding-bottom: clamp(1.25rem, 3.5vw, 2.25rem);
  border-bottom: 1px solid var(--ink);
  font-size: clamp(1.65rem, 4.6vw, 2.85rem);
  line-height: 1.35;
  letter-spacing: .015em;
}
.imprint {
  display: flex; align-items: center; gap: .75em;
  margin-bottom: clamp(.75rem, 2vw, 1.2rem);
  font-size: .875rem; line-height: 1.5; letter-spacing: .12em;
}
.imprint::before { content: ""; width: 1.65rem; height: .22rem; background: var(--mustard); }
.front-matter, .chapter { padding-block: clamp(1.5rem, 3.4vw, 2.75rem); }
.chapter { border-top: 1px solid var(--rule); }
.opening, .copy { max-width: var(--measure); min-width: 0; }
p, li {
  font-size: 1rem; line-height: 1.9; letter-spacing: .018em;
  overflow-wrap: anywhere; text-wrap: pretty;
}
/* 対応ブラウザは日本語の文節で改行する。狭い画面の長い固有名詞には折り返す余地を残す。 */
@supports (word-break: auto-phrase) {
  article :is(h1, h2, h3, p, li) { word-break: auto-phrase; }
}
.opening > p:first-child { font-weight: 600; }
p + p, p + :is(ul, ol), :is(ul, ol) + p { margin-top: 1em; }
h2 { font-size: clamp(1.15rem, 2vw, 1.38rem); line-height: 1.55; }
h3 { margin-bottom: .4em; font-size: 1.0625rem; line-height: 1.6; }
p + h3 { margin-top: 1.75em; }
:is(h2, h3)[id] { scroll-margin-block-start: 1rem; }
.chapter > h2 { margin-bottom: .7rem; }
.section-number {
  color: var(--secondary); font-size: .76em; font-variant-numeric: tabular-nums;
  margin-inline-end: .22em;
}
ul, ol { padding-inline-start: 1.25em; }
li { padding-inline-start: .25em; }
li + li { margin-top: .6em; }
li::marker { color: var(--secondary); font-size: .7em; }
ol > li::marker { font-size: 1em; font-variant-numeric: tabular-nums; }
strong { font-weight: 700; color: var(--heading); }
a { color: var(--heading); text-decoration-thickness: .075em; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: .12em; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
dl {
  display: flex; flex-wrap: wrap; align-content: start; gap: .25rem 1.25rem;
  margin-bottom: 1rem;
  font-size: .8125rem; line-height: 1.65; font-variant-numeric: tabular-nums;
}
dl div { display: flex; flex-wrap: wrap; column-gap: .55em; }
dt { color: var(--secondary); }
dd { overflow-wrap: anywhere; }
footer { padding-block: 1.1rem 2rem; border-top: 1px solid var(--ink); }
nav { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
nav a { padding-block: .7rem; font-size: .9rem; }
main > section { margin-block: 2rem; }
@media (min-width: 54rem) {
  .front-matter, .chapter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 36rem);
    column-gap: 2.75rem;
  }
  dl { display: grid; gap: .55rem; margin: .2rem 0 0; }
  .chapter > h2 { margin: 0; }
  .section-number { display: block; margin-bottom: .35em; font-size: .75rem; }
}
/* 中間幅でも本文が中央から片方に寄りすぎないよう、単段時は題と本文の左端を揃える。 */
@media (max-width: 53.999rem) {
  body > header, main, footer { max-width: var(--measure); }
}
@media print {
  body { background: white; }
  main { padding-top: 0; }
  .front-matter, .chapter { display: block; padding-block: 1rem; }
  h1, h2, h3 { break-after: avoid; }
  p, li { orphans: 2; widows: 2; }
  footer { display: none; }
}
