/* サイト共通のスタイル。外部フォント・外部画像は使わない（CSPで禁止） */
/* 配色は favicon（紺 #12344d と緑 #4fd1a5）に合わせる。
   - 紺（--brand）：ヘッダーの地、リンク・ボタン（明るい背景のとき）
   - 緑（--mint）：線・点などの飾りと、暗い背景でのリンク・ボタン。白地の文字には使わない（読みにくいため） */
:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #57606a;
  --line: #d0d7de;
  --surface: #f6f8fa;
  --brand: #12344d;
  --brand-fg: #ffffff;
  --mint: #4fd1a5;
  --accent: #12344d;
  --accent-fg: #ffffff;
  --accent-soft: #e1f5ee;
  --focus: #e36209;
  --draft-bg: #fff3b0;
  --draft-line: #b08800;
  --ok: #1a7f37;
  --wait: #7d4e00;
  --radius: 8px;
  --max: 960px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --fg: #e6edf3;
    --muted: #9da7b3;
    --line: #3a434d;
    --surface: #161b22;
    --accent: #4fd1a5;
    --accent-fg: #0b2233;
    --accent-soft: #12344d;
    --focus: #ffa657;
    --draft-bg: #4d3b00;
    --draft-line: #d4a72c;
    --ok: #56d364;
    --wait: #e3b341;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.4; }
h1 { font-size: 1.75rem; margin: 0.5em 0; }
h2 { font-size: 1.35rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }
h4 { font-size: 0.95rem; margin: 0.8em 0 0.2em; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em;
  background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 0.25em; }
pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; line-height: 1.6; }
pre code { border: 0; padding: 0; background: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 10;
  background: var(--accent); color: var(--accent-fg); padding: 8px 12px; border-radius: var(--radius);
}
.skip-link:focus { top: 8px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ヘッダー：狭い画面ではメニューを折り返す（スクリプトなし） */
.site-header { border-bottom: 3px solid var(--mint); background: var(--brand); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 16px; padding-top: 10px; padding-bottom: 10px; }
.site-name { font-weight: 700; color: var(--brand-fg); text-decoration: none; }
.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 4px; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: inline-block; padding: 6px 10px; border-radius: var(--radius); text-decoration: none;
  color: var(--brand-fg); }
.site-nav a:hover { background: rgba(255, 255, 255, 0.14); }
.site-nav a[aria-current] { background: rgba(255, 255, 255, 0.14); font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--mint); }

.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0 0.5em; list-style: none; padding: 0;
  margin: 12px auto 0; max-width: var(--max); padding: 0 16px; font-size: 0.875rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.5em; }

main { display: block; padding-bottom: 48px; }
.section { margin-top: 32px; }
.prose { max-width: 780px; }
.prose table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.95rem; }
.table-wrap { overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface); }
.lead { font-size: 1.05rem; color: var(--muted); }
.meta { color: var(--muted); font-size: 0.875rem; margin: 0; }
.page-header { margin-top: 8px; }
.hero { padding: 24px 0 8px; }
.hero h1 { font-size: 1.9rem; }
.tagline { margin: 0; color: var(--accent); font-weight: 700; }

.button { display: inline-block; padding: 10px 18px; border-radius: var(--radius); border: 2px solid var(--accent);
  background: var(--accent); color: var(--accent-fg); font-weight: 700; text-decoration: none; }
.button:hover { filter: brightness(1.08); }
.button-secondary { background: transparent; color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--bg); height: 100%; }
.card > :first-child { margin-top: 0; }
.card-title { margin: 0 0 4px; font-size: 1.1rem; }
.plain-list { margin: 0.2em 0 0.6em; padding-left: 1.3em; }
.card .actions { margin-bottom: 0; }
.empty { color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 8px 0; }
.tags li { font-size: 0.8rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; color: var(--muted); }
.badge { display: inline-block; vertical-align: middle; font-size: 0.75rem; font-weight: 700; padding: 1px 8px;
  border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge-available, .badge-sample { color: var(--ok); }
.badge-preparing { color: var(--wait); }

.tool-facts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  margin: 16px 0 8px; }
.tool-facts h2 { margin-top: 0; font-size: 1.1rem; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--mint); border-radius: var(--radius);
  padding: 4px 16px; background: var(--surface); }
.callout h2 { margin-top: 12px; }
.notice { border: 1px solid var(--line); border-left: 4px solid var(--wait); border-radius: var(--radius);
  padding: 8px 16px; background: var(--surface); }
.back-link { margin-top: 32px; }

/* デモの成果物の一覧 */
.demo-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 16px; }
.demo-item h3 { margin-top: 0; }
.demo-item dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 8px 0; }
.demo-item dt { color: var(--muted); }
.demo-item dd { margin: 0; }
.demo-source { margin-top: 8px; }
.demo-source summary { cursor: pointer; }
.demo-source .columns { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.demo-source pre { white-space: pre-wrap; font-size: 0.85rem; }

/* 端末内比較（デモページの「自分のPDFで比較する」。compare.js が状態を切り替える） */
button.button { font: inherit; font-weight: 700; line-height: inherit; cursor: pointer; }
button.button:disabled { cursor: not-allowed; opacity: 0.55; filter: none; }
.compare { border: 1px solid var(--line); border-left: 4px solid var(--mint); border-radius: var(--radius);
  padding: 4px 16px 16px; margin: 16px 0 32px; }
.compare h2 { margin-top: 12px; }
.compare-facts { padding-left: 1.3em; }
.compare-privacy { margin: 8px 0; }
.compare-files { display: grid; gap: 8px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
/* 欄ごとに、ファイルをドラッグ＆ドロップで選べる（compare.js が、ドラッグ中に is-dragover を付ける） */
.compare-field { margin: 8px 0; padding: 10px 12px; border: 2px dashed var(--line); border-radius: var(--radius); }
.compare-field.is-dragover { border-color: var(--accent); border-style: solid; background: var(--surface); }
.compare-drop-hint { display: block; color: var(--muted); font-size: 0.85rem; }
/* 旧版と新版の入れ替え（欄のすぐ下。「比較する」より控えめな大きさにする） */
.compare-swap { margin: 4px 0 8px; }
.compare-swap .button { padding: 6px 14px; font-size: 0.9rem; }
.compare-field label { display: block; font-weight: 700; }
.compare-field input[type="file"] { max-width: 100%; padding: 6px 0; font: inherit; }
/* 「ファイルを選択」のボタン（ブラウザの部品）を、サイトの副のボタン（.button-secondary）と同じ見た目にする */
.compare-field input[type="file"]::file-selector-button { font: inherit; font-weight: 700; padding: 6px 14px; margin-right: 10px;
  border-radius: var(--radius); border: 2px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; }
.compare-field input[type="file"]::file-selector-button:hover { background: var(--surface); }
.compare-field input[type="file"]:disabled::file-selector-button { cursor: not-allowed; opacity: 0.55; }
.compare-limits { color: var(--muted); font-size: 0.9rem; margin: 4px 0; }
.compare-status { font-weight: 700; margin: 8px 0; }
.compare-status:empty { display: none; }
.compare-note { border-left: 4px solid var(--wait); padding-left: 12px; }
.compare-steps { margin: 8px 0; padding-left: 1.6em; color: var(--muted); font-size: 0.95rem; }
.compare-steps li[data-state="active"] { color: var(--fg); font-weight: 700; }
.compare-steps li[data-state="done"] { color: var(--ok); }
.compare-steps li[data-state="failed"] { color: var(--fg); text-decoration: underline wavy var(--focus); }
.compare-steps .step-state { font-weight: normal; }
.compare-error { margin: 12px 0; }
.compare-error-title { font-weight: 700; }
.compare-error-detail { font-size: 0.85rem; color: var(--muted); }
.compare-result h3:focus { outline: none; }
.compare-result h3:focus-visible { outline: 3px solid var(--focus); }
/* レポートは固定の高さの枠に表示する（中身に合わせて伸ばすと、レポート内のリンクで移動しない） */
.compare-report { display: block; width: 100%; height: 80vh; min-height: 420px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #ffffff; }

/* 仮の文言（公開用ビルドでは残せない） */
/* ツールのライセンスのページ（sitegen/licenses.py が生成する表）と、紹介ページ・デモのページからのリンク */
.license-docs { margin: 0; padding: 0; list-style: none; }
.license-docs li { margin: 0; overflow-wrap: anywhere; }
.tool-privacy { margin-top: 24px; }
.tool-licenses { margin-top: 24px; }
.tool-privacy + .tool-licenses { margin-top: 8px; }

mark.draft, .draft-banner { background: var(--draft-bg); color: var(--fg); }
mark.draft { border-bottom: 2px dashed var(--draft-line); padding: 0 2px; }
.draft-banner { border: 2px dashed var(--draft-line); border-radius: var(--radius);
  width: calc(100% - 32px); max-width: calc(var(--max) - 32px); margin: 12px auto 0; padding: 4px 16px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); font-size: 0.9rem; }
.footer-inner { display: grid; gap: 8px 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  padding-top: 16px; padding-bottom: 24px; }
.footer-nav h2 { font-size: 0.95rem; margin: 8px 0 4px; }
.footer-nav ul { list-style: none; padding: 0; margin: 0; }
.footer-nav li { margin: 2px 0; }
.footer-note, .footer-name { grid-column: 1 / -1; margin: 4px 0; color: var(--muted); }

@media (max-width: 600px) {
  h1, .hero h1 { font-size: 1.5rem; }
  .button { width: 100%; text-align: center; }
}
@media print {
  .site-header, .site-footer, .skip-link, .breadcrumbs, .actions { display: none; }
}
