/* くじアプリのヘルプ（kuji-help*.html）だけで使うスタイル。kuji-base.css の後に読む。
   **インラインの <style> と style= 属性は書かない**（CSP が style-src 'self'）。
   色は kuji-base.css の変数を使う。ここで足すのは、検索の強調色・リンクの下線・表の見出しの地の色だけ。 */

:root {
  --help-mark: rgba(154, 52, 18, 0.16);
  --help-target: rgba(154, 52, 18, 0.07);
  --help-link-line: rgba(154, 52, 18, 0.35);
  --help-th: rgba(28, 26, 23, 0.045);
}

@media (prefers-color-scheme: dark) {
  :root {
    --help-mark: rgba(251, 146, 60, 0.28);
    --help-target: rgba(251, 146, 60, 0.10);
    --help-link-line: rgba(251, 146, 60, 0.4);
    --help-th: rgba(255, 255, 255, 0.05);
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 現在地（章ページの先頭） */
.crumbs {
  font-size: 0.88rem;
  color: var(--muted);
  margin: -20px 0 16px;
}

.crumbs a { color: var(--muted); }

/* 検索 */
.help-search { margin: 0 0 32px; }

.help-search input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  -webkit-appearance: none;
  appearance: none;
}

.help-search input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.help-results { margin-top: 8px; }

.help-results:empty { display: none; }

.help-results ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.help-results li {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.help-results li:first-child { border-top: 0; }

.help-results a {
  font-weight: 600;
  text-decoration: none;
}

.help-results a:hover { text-decoration: underline; }

.help-results .where {
  color: var(--muted);
  font-size: 0.82rem;
}

.help-results p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.help-results mark {
  background: var(--help-mark);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}

.help-results .none {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

/* 入口: 困っていることから探す */
.help-troubles {
  columns: 2;
  column-gap: 28px;
  padding-left: 1.2em;
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.help-troubles li {
  break-inside: avoid;
  margin: 4px 0;
}

@media (max-width: 34rem) {
  .help-troubles { columns: 1; }
}

/* 入口: 章から探す */
.help-chapters {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-chapters li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

.help-chapters li:first-child { border-top: 0; }

.help-chapters .num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  padding-top: 2px;
}

.help-chapters a {
  font-weight: 600;
  text-decoration: none;
}

.help-chapters a:hover { text-decoration: underline; }

.help-chapters .staff {
  display: inline-block;
  margin-left: 8px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  vertical-align: 2px;
}

.help-chapters .blurb {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.9rem;
}

/* 章ページ: ページ内の目次 */
.help-toc {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 14px 18px;
  margin: 0 0 8px;
  font-size: 0.92rem;
}

.help-toc ol, .help-toc ul {
  margin: 0;
  padding-left: 1.3em;
}

.help-toc ol ol { margin-top: 2px; }

.help-toc li { margin: 3px 0; }

.help-toc a { text-decoration: none; }

.help-toc a:hover { text-decoration: underline; }

/* 用語集の索引。語が短いので段組みにする */
.help-terms ul {
  columns: 3;
  column-gap: 20px;
  list-style: none;
  padding-left: 0;
}

.help-terms li { break-inside: avoid; }

@media (max-width: 34rem) {
  .help-terms ul { columns: 2; }
}

/* §12 困ったとき・§13 用語集（表を定義リストにしたもの） */
dl.qa {
  margin: 20px 0;
  padding: 0;
}

dl.qa > div {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  scroll-margin-top: 16px;
}

dl.qa > div:first-child { border-top: 0; }

/* 用語・困っていることは本文より大きくし、説明を字下げして、太字の強調と見分けられるようにする */
dl.qa dt {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.6;
  margin: 0 0 6px;
}

dl.qa dd {
  margin: 0;
  padding-left: 1em;
}

dl.qa > div:target {
  background: var(--help-target);
  margin: 0 -12px;
  padding: 14px 12px;
  border-radius: 8px;
}

/* 本文中のリンク。色は残してリンクと分かるようにし、下線を薄く細くして見出しより目立たないようにする */
.doc a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--help-link-line);
}

.doc a:hover { text-decoration-color: currentColor; }

/* 表の見出しの行。site.css の白（--card）はページの地とほぼ同じなので、薄い地の色を付ける。
   site.css は見出しを折り返さないので、長い見出しの列だけが広がり、ほかの列が数文字で折り返す。ヘルプでは折り返す */
.doc th {
  background: var(--help-th);
  white-space: normal;
}

/* 見出しの段差。本文の太字と大きさだけでは見分けにくいので、h2 は上の罫線、h3 は左の線でも区別する */
h2 {
  font-size: 1.35rem;
  margin-top: 56px;
  padding-top: 20px;
}

h3 {
  font-size: 1.1rem;
  line-height: 1.5;
  margin: 36px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
}

/* 章が2つ以上のページの小見出し（1章だけのページでは build が h3 に上げる）。太字の本文と見分けるため、頭に印を付ける */
h4 {
  font-size: 1rem;
  line-height: 1.6;
  margin: 28px 0 8px;
}

h4::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.5em;
  background: var(--accent);
  vertical-align: 0.12em;
}

@media (max-width: 30rem) {
  h2 { font-size: 1.2rem; }
}

/* リンクで飛んできた見出しを示す */
h1, h2, h3 { scroll-margin-top: 16px; }

h2:target {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  margin-left: -13px;
}

/* h3 はもともと左の線があるので、地の色で示す */
h3:target {
  background: var(--help-target);
  border-radius: 0 6px 6px 0;
}

/* 前後のページ */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 48px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.pager a {
  text-decoration: none;
  max-width: 48%;
}

.pager a:hover { text-decoration: underline; }

.pager .next {
  margin-left: auto;
  text-align: right;
}

.pager small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

/* 券面の図など、等幅の図はそのままの幅で横スクロール */
.doc pre { font-size: 0.85rem; }
