/* GitHub Pages 用サイトのスタイル。tools/build-site.rb が assets/style.css として配置する。
   tj3 が生成するレポート側の CSS には影響しない (別ページとして開く)。 */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --border: #d8dce2;
  --text: #1f2328;
  --text-muted: #5b6270;
  --link: #0b62c4;
  --accent: #0b62c4;
  --code-bg: #f2f4f7;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --bg-soft: #1b1f26;
    --border: #2f353e;
    --text: #dfe3e8;
    --text-muted: #98a0ad;
    --link: #6cb0ff;
    --accent: #6cb0ff;
    --code-bg: #1b1f26;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.8;
  font-size: 16px;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

/* ヘッダ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.site-header .home {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.site-header a.home:hover {
  color: var(--link);
}

.site-header .stage-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* 本文 */

h1,
h2,
h3 {
  line-height: 1.4;
  margin: 2.5rem 0 1rem;
}

h1 {
  margin-top: 0;
  font-size: 1.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--border);
}

h2 {
  font-size: 1.35rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
}

a {
  color: var(--link);
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

ul,
ol {
  padding-left: 1.4rem;
}

li {
  margin: 0.35rem 0;
}

blockquote {
  margin: 1rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--text-muted);
}

/* コード */

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.15em 0.4em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
}

pre {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  line-height: 1.6;
}

pre code {
  white-space: pre;
}

/* 表は横幅を超えたらその中だけスクロールさせる */

.readme table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.readme th,
.readme td {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.readme th {
  background: var(--bg-soft);
  white-space: nowrap;
}

/* 生成物一覧 */

.artifact-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.5rem;
}

.artifact-list li {
  margin: 0;
}

.artifact-list a {
  display: block;
  padding: 0.6rem 0.85rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  text-decoration: none;
}

.artifact-list a:hover {
  border-color: var(--accent);
}

.artifact-list a::before {
  margin-right: 0.5rem;
  color: var(--text-muted);
}

.artifact-list a.report::before {
  content: "▤";
}

.artifact-list a.file::before {
  content: "▢";
}

.empty {
  color: var(--text-muted);
}

/* 前後の段階へのナビゲーション */

.stage-nav {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
}

.stage-nav p {
  margin: 0;
}

/* ソース表示 */

details {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
}

summary {
  padding: 0.6rem 0.85rem;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  font-weight: 600;
}

details > *:not(summary) {
  margin: 0 0.85rem 0.85rem;
}

.source pre {
  max-height: 34rem;
  margin-top: 0;
}
