/*
  静的サイト移行診断の見た目。
  CSP（style-src 'self'）に合わせ、見た目はこのファイルにだけ書く（インラインの style・style 属性を使わない）。
  JS は見た目を class と hidden 属性で切り替える。
*/

:root {
  --text: #1f2328;
  --muted: #59636e;
  --line: #d1d9e0;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --accent: #0b5cad;
  --accent-dark: #084887;
  --good: #1a7f37;
  --good-bg: #dafbe1;
  --caution: #8a5a00;
  --caution-bg: #fff3c4;
  --problem: #b42318;
  --problem-bg: #ffe1dc;
  --none: #4a5560;
  --none-bg: #eef1f4;
  --unknown: #5b3e96;
  --unknown-bg: #ece6fa;
  --radius: 6px;
}

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

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

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

a:hover {
  color: var(--accent-dark);
}

h1,
h2,
h3,
h4 {
  line-height: 1.4;
}

.small {
  font-size: 0.875rem;
  color: var(--muted);
}

/* 本文へ移るリンク（キーボードで操作するときだけ見える） */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 2px solid var(--accent);
}

/* ---- 枠組み ---- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.site-header-in,
.site-main,
.site-footer {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header-in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a[aria-current="page"] {
  font-weight: 700;
  color: var(--text);
}

.site-main {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.site-footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0.25rem 0;
}

.page-title {
  font-size: 1.75rem;
  margin: 0.5rem 0 1rem;
}

/* ---- 説明 ---- */

.intro-lead {
  font-size: 1.125rem;
  font-weight: 700;
}

.flow-list,
.after-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}

.flow-card,
.after-card {
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.flow-card h3,
.after-card h3 {
  margin-top: 0.25rem;
}

.steps-list li {
  margin-bottom: 0.5rem;
}

/* ---- 入力 ---- */

.app {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.app > h2:first-child {
  margin-top: 0;
}

.field {
  margin: 1rem 0;
}

.field label,
.field legend {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

fieldset.field {
  border: 0;
  padding: 0;
  margin-left: 0;
  margin-right: 0;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="tel"],
.field textarea {
  width: 100%;
  max-width: 40rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  border: 1px solid #8c959f;
  border-radius: var(--radius);
  background: #fff;
}

.field input:focus,
.field textarea:focus,
.button:focus-visible,
.choice input:focus-visible {
  outline: 3px solid #7ab3ef;
  outline-offset: 1px;
}

.field input[readonly] {
  background: var(--bg-soft);
}

.help {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.choice {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 400;
  margin: 0.25rem 0;
}

.field .choice {
  font-weight: 400;
}

.mark {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.6;
  border-radius: 3px;
  vertical-align: middle;
}

.mark-required {
  color: #fff;
  background: var(--problem);
}

.mark-optional {
  color: var(--none);
  background: var(--none-bg);
}

.form-section {
  margin: 1.5rem 0;
}

.form-section h2 {
  font-size: 1.125rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}

/* おとりの欄。人には見えない位置に置く（ボットよけ） */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  color: #fff;
  background: var(--accent-dark);
}

.button-secondary {
  color: var(--accent);
  background: #fff;
}

.button-secondary:hover {
  color: var(--accent-dark);
  background: var(--bg-soft);
}

.button:disabled {
  color: #fff;
  background: #8c959f;
  border-color: #8c959f;
  cursor: not-allowed;
}

.turnstile-box {
  margin: 1rem 0;
}

.turnstile-lead {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.turnstile {
  min-height: 65px;
}

/* ---- 知らせ ---- */

.status:empty {
  display: none;
}

.status {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
}

.status-busy::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.5em;
  border: 2px solid var(--accent);
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1em;
  animation: turn 0.9s linear infinite;
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-busy::before {
    animation: none;
  }
}

/* 診断中・・・（ステップごとの診断）。・を1つ→2つ→3つと見せる。
   ・は全角で幅が 1em のため、幅を 1em ずつ広げて隠れた分を出す（content の動きに頼らない） */
.working {
  font-weight: bold;
  white-space: nowrap;
}

.working-dots {
  display: inline-block;
  width: 3em;
  overflow: hidden;
  vertical-align: bottom;
  animation: working-dots 1.5s step-end infinite;
}

@keyframes working-dots {
  0% {
    width: 1em;
  }
  33% {
    width: 2em;
  }
  66% {
    width: 3em;
  }
}

/* 動きを減らす設定では、・を3つのまま止めて出す */
@media (prefers-reduced-motion: reduce) {
  .working-dots {
    animation: none;
  }
}

p.working {
  margin: 0.5rem 0 0;
}

/* 「予定より診断に時間がかかっています」は長いため、狭い画面では折り返す */
.working-label {
  white-space: normal;
}

/* 診断中の棒（要求を送ってからの秒数 ÷ 目安の秒数） */
.working-bar {
  display: block;
  width: 100%;
  max-width: 24rem;
  height: 0.75rem;
  margin-top: 0.5rem;
  accent-color: var(--accent);
}

.status-error {
  border-left-color: var(--problem);
  background: var(--problem-bg);
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.notice-error {
  background: var(--problem-bg);
  border-color: #f1aea4;
}

.notice-done {
  background: var(--good-bg);
  border-color: #9ed7ab;
}

.notice p:first-child {
  margin-top: 0;
}

.notice p:last-child {
  margin-bottom: 0;
}

/* ---- 判定 ---- */

.judgment {
  display: inline-block;
  min-width: 3.5em;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.8;
  text-align: center;
  border-radius: 3px;
  white-space: nowrap;
}

.judgment-good {
  color: var(--good);
  background: var(--good-bg);
}

.judgment-caution {
  color: var(--caution);
  background: var(--caution-bg);
}

.judgment-problem {
  color: var(--problem);
  background: var(--problem-bg);
}

.judgment-none {
  color: var(--none);
  background: var(--none-bg);
}

.judgment-unknown {
  color: var(--unknown);
  background: var(--unknown-bg);
}

.legend {
  margin: 1rem 0;
}

.legend summary {
  cursor: pointer;
  color: var(--accent);
}

.legend-list div {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin: 0.5rem 0;
}

.legend-list dt {
  flex: 0 0 7rem;
}

.legend-list dd {
  margin: 0;
}

/* ---- ステップの結果 ---- */

.step-results {
  margin-top: 1.5rem;
}

.step-result {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step-result > h3 {
  margin-top: 0;
}

.step-note {
  font-size: 0.875rem;
  color: var(--muted);
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  padding: 0;
  list-style: none;
}

.counts li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.counts .count {
  font-weight: 700;
}

.items {
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.item-name {
  font-weight: 700;
}

.item-message {
  margin: 0.25rem 0 0;
}

.item-notes {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ステップの見出しの下の説明文 */
.step-about {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

/* 項目の「静的化との関わり」。判定の札（色で塗る）と見分けられるよう、枠だけの札にする */
.item-relation {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
}

.relation {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-right: 0.5rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.8;
  color: var(--accent-dark);
  background: var(--bg);
  border: 1px solid var(--accent);
  border-radius: 3px;
}

.relation-class {
  font-weight: 700;
}

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

/* ステップの中の分類ごとの小見出し（分類の札は、ここに1回だけ出す） */
.items-group {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem;
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.items-group .relation {
  font-size: 0.875rem;
}

.items-group-count {
  font-weight: 400;
  color: var(--muted);
}

/* まとめの行から移ってきた項目 */
.item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 分類 D（静的化に直接関係しない）の項目はたたむ */
.items-folded {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0 0;
}

.items-folded > summary {
  cursor: pointer;
  color: var(--accent);
}

.items-folded[open] > summary {
  margin-bottom: 0.75rem;
}

/* ステップ8の静的化の見込みと規模 */
.outlook {
  margin: 0.5rem 0 1rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: #f1f7fe;
}

.outlook-label {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.outlook-message {
  margin: 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.scale-size {
  display: inline-block;
  min-width: 2em;
  margin-left: 0.25rem;
  padding: 0 0.5rem;
  font-size: 1.5rem;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
}

/* AI による所見 */
.ai {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-soft);
}

.ai h4 {
  margin: 1.25rem 0 0.5rem;
}

.ai h5 {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.ai-findings {
  padding-left: 0;
  list-style: none;
}

.ai-findings li {
  margin: 0.75rem 0;
}

.importance {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 3px;
  background: var(--none-bg);
}

.importance-high {
  color: var(--problem);
  background: var(--problem-bg);
}

.importance-middle {
  color: var(--caution);
  background: var(--caution-bg);
}

/* ---- 表 ---- */

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

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

.table th {
  background: var(--bg-soft);
}

.result-meta div {
  display: flex;
  gap: 1rem;
  margin: 0.25rem 0;
}

.result-meta dt {
  flex: 0 0 7rem;
  font-weight: 700;
}

.result-meta dd {
  margin: 0;
}

/* 結果の画面の全体のまとめ */
.summary-list {
  margin: 0.25rem 0 1rem;
  padding: 0;
  list-style: none;
}

/* 1項目1行。押すとステップごとの結果の項目へ移る */
.summary-list .summary-item {
  margin: 0;
  border-top: 1px solid var(--line);
}

.summary-link {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0;
  color: var(--text);
  text-decoration: none;
}

.summary-link:hover .summary-name,
.summary-link:focus .summary-name {
  color: var(--accent);
  text-decoration: underline;
}

.summary-name {
  font-weight: 700;
}

.summary-step {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--muted);
}

.next {
  margin-top: 1rem;
}

.next-label {
  margin-bottom: 0;
  font-weight: 700;
}

.after {
  margin-top: 2rem;
}

.policy h2 {
  margin-top: 2rem;
  font-size: 1.25rem;
}

@media (max-width: 40rem) {
  .result-meta div,
  .legend-list div {
    display: block;
  }

  .page-title {
    font-size: 1.5rem;
  }
}
