/* Octavo のウェブページ（site/）の見た目。外部のフォント・スクリプトは読まない
   （訪問者の情報を外に出さないため）。色は :root のトークンだけで決める。 */

:root {
  --accent: #0e2f92;
  --accent-soft: #eef2fb;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --text: #1f2328;
  --muted: #57606a;
  --line: #d0d7de;
  --code-bg: #f6f8fa;
  --on-accent: #ffffff;
  --sans: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans CJK JP",
          "Yu Gothic UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #8fa8ff;
    --accent-soft: #161d33;
    --bg: #0d1117;
    --bg-alt: #151b23;
    --text: #e6edf3;
    --muted: #9198a1;
    --line: #30363d;
    --code-bg: #151b23;
    --on-accent: #0d1117;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --accent: #8fa8ff;
  --accent-soft: #161d33;
  --bg: #0d1117;
  --bg-alt: #151b23;
  --text: #e6edf3;
  --muted: #9198a1;
  --line: #30363d;
  --code-bg: #151b23;
  --on-accent: #0d1117;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
}

a { color: var(--accent); text-underline-offset: 2px; }

img { max-width: 100%; height: auto; display: block; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* 上の帯 */
.top {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; font-size: 15px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--text); }

/* 冒頭 */
.hero { padding: 64px 0 40px; }
.hero h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 60px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.hero .tagline {
  margin: 10px 0 0;
  color: var(--accent);
  font-weight: 700;
  font-size: clamp(18px, 2.6vw, 22px);
}
.hero .lead { margin: 20px 0 0; max-width: 46em; color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.secondary { color: var(--accent); background: transparent; }

/* 節 */
section { padding: 40px 0; }
section.alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 16px; font-size: 26px; line-height: 1.3; }
h3 { margin: 0 0 6px; font-size: 17px; }
p { margin: 0 0 14px; }

.figure { margin: 8px 0 0; }
.figure img {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}
.figure figcaption { margin-top: 10px; color: var(--muted); font-size: 15px; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.feature {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  background: var(--bg);
}
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}
pre {
  margin: 0 0 16px;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.comment { color: var(--muted); }

.chapters { margin: 0; padding-left: 1.4em; columns: 2 300px; column-gap: 32px; }
.chapters li { margin: 0 0 6px; break-inside: avoid; }
.chapters span { color: var(--muted); font-size: 15px; }

footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 14px;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer a { color: var(--muted); }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 40px 0 28px; }
  section { padding: 32px 0; }
  .top nav { gap: 12px; }
}

/* ---- 手引きのページ（site/guide.html） ---------------------------------- */
.guide .doc {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 40px;
  padding-top: 24px;
  padding-bottom: 48px;
}
.guide .toc { font-size: 14px; line-height: 1.5; }
.guide .toc-side {
  position: sticky;
  top: 16px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.guide .toc-label, .guide .toc-fold summary {
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 8px;
}
.guide .toc-fold { display: none; }
.guide .toc-fold summary { cursor: pointer; margin: 0; }
.guide .toc-fold[open] summary { margin-bottom: 8px; }
.guide .toc ul { list-style: none; margin: 0; padding: 0; }
.guide .toc ul ul { padding-left: 14px; }
.guide .toc a { color: var(--muted); text-decoration: none; display: block; padding: 2px 0; }
.guide .toc a:hover { color: var(--text); }
.guide .content { min-width: 0; }
.guide .content h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.2; margin: 8px 0 12px; }
.guide .content h2 {
  margin: 48px 0 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 16px;
}
.guide .content h3 { margin: 32px 0 10px; font-size: 20px; scroll-margin-top: 16px; }
.guide .content h4 { margin: 24px 0 8px; font-size: 17px; scroll-margin-top: 16px; }
/* 折りたたんだ節（見出しが summary の中にある） */
.guide .content details.fold { margin: 24px 0 14px; }
.guide .content details.fold > summary { cursor: pointer; }
.guide .content details.fold > summary h4 { display: inline; margin: 0; }
.guide .content details.fold[open] > summary { margin-bottom: 8px; }
.guide .content hr { display: none; }                /* 章の区切りは h2 の罫で足りる */
.guide .content ul, .guide .content ol { padding-left: 1.4em; margin: 0 0 14px; }
.guide .content li { margin: 0 0 4px; }
.guide .content li > p { margin: 0 0 6px; }
.guide .content table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 15px;
}
.guide .content th, .guide .content td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
.guide .content th { background: var(--bg-alt); }

@media (max-width: 860px) {
  .guide .doc { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .guide .toc-side { display: none; }
  .guide .toc-fold {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
  }
}
