/* /report/ トップの「実装状況マップ」専用。セレクタは .report-status-map で前置スコープする。
 * 配色は autais/assets/css/enterprise-readiness.css の --er-verified / --er-partial / --er-planned と
 * 揃える（同じ3状態を別ページで別の色にしないため）。実体は tokens.css のブランド系トークンを使う。
 */

.report-status-map {
  --rsm-verified: var(--accent-fg, #15803d);
  --rsm-partial: var(--warm, #f59e0b);
  --rsm-planned: var(--muted-3, #cbd5e1);
  --rsm-verified-bg: var(--accent-bg, #dcfce7);
  --rsm-partial-bg: var(--warm-soft, #fef3c7);
  --rsm-planned-bg: #eef1f6;
  --rsm-e2e-ok: #0ea5e9;
  --rsm-e2e-fail: #dc2626;

  margin: 22px 0 30px;
  padding: 24px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.report-status-map__head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -.01em;
}

.report-status-map__head p {
  margin: 0;
  max-width: 68ch;
  color: var(--fg-2);
  font-size: 13.5px;
  line-height: 1.85;
}

.report-status-map__view-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
}

.report-status-map__view-switch-label {
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 700;
}

.report-status-map__view-btn {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--fg-2);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.report-status-map__view-btn:hover { color: var(--fg); }

.report-status-map__view-btn.is-active {
  border-color: var(--p);
  background: var(--p);
  color: #fff;
}

.report-status-map__view-btn:focus-visible {
  outline: 2px solid var(--p);
  outline-offset: 2px;
}

.report-status-map__headline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 4px;
}

.report-status-map__stat {
  flex: 1 1 160px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
}

.report-status-map__stat-label {
  display: block;
  color: var(--fg-2);
  font-size: 12px;
  font-weight: 700;
}

.report-status-map__stat-value {
  display: block;
  margin-top: 2px;
  color: var(--fg);
  font: 700 22px/1.2 Inter, sans-serif;
  font-variant-numeric: tabular-nums;
}

.report-status-map__stat-sub {
  display: block;
  color: var(--fg-2);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.report-status-map__grid {
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.report-status-map__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
}

.report-status-map__row + .report-status-map__row {
  border-top: 1px dashed var(--line);
}

.report-status-map__row-label {
  flex: none;
  width: 8.4em;
  padding-top: 2px;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.5;
}

.report-status-map__row-label small {
  display: block;
  color: var(--fg-2);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.report-status-map__cells {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.report-status-map__group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
}

.report-status-map__cell {
  position: relative;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--rsm-planned);
  outline-offset: 2px;
  cursor: pointer;
}

/* 実装ビュー（既定 data-view="status"）: 従来どおり3色 + 他次元は隅の点/斜線/破線枠で重ね表示。 */
.report-status-map[data-view="status"] .report-status-map__cell[data-status="code-verified"] { background: var(--rsm-verified); }
.report-status-map[data-view="status"] .report-status-map__cell[data-status="partial"] { background: var(--rsm-partial); }
.report-status-map[data-view="status"] .report-status-map__cell[data-status="planned"] { background: var(--rsm-planned); }

.report-status-map[data-view="status"] .report-status-map__cell[data-e2e="covered"]::after,
.report-status-map[data-view="status"] .report-status-map__cell[data-e2e="passing"]::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rsm-e2e-ok, #0ea5e9);
  box-shadow: 0 0 0 1px #fff;
}

.report-status-map[data-view="status"] .report-status-map__cell[data-e2e="failing"]::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rsm-e2e-fail, #dc2626);
  box-shadow: 0 0 0 1px #fff;
}

.report-status-map[data-view="status"] .report-status-map__cell[data-debug="open"],
.report-status-map[data-view="status"] .report-status-map__cell[data-debug="in_progress"] {
  background-image: repeating-linear-gradient(45deg, rgba(15, 23, 42, .38) 0, rgba(15, 23, 42, .38) 1px, transparent 1px, transparent 4px);
}

.report-status-map[data-view="status"] .report-status-map__cell[data-plan="drafted"],
.report-status-map[data-view="status"] .report-status-map__cell[data-plan="in_progress"] {
  outline: 1px dashed rgba(15, 23, 42, .5);
  outline-offset: 1px;
}

/* E2E / デバッグ / 企画ビュー: そのマスは、そのビューの次元だけで色分けする。 */
.report-status-map[data-view="e2e"] .report-status-map__cell,
.report-status-map[data-view="debug"] .report-status-map__cell,
.report-status-map[data-view="plan"] .report-status-map__cell {
  background: var(--rsm-planned-bg);
}

.report-status-map[data-view="e2e"] .report-status-map__cell[data-e2e="covered"],
.report-status-map[data-view="e2e"] .report-status-map__cell[data-e2e="passing"] { background: var(--rsm-verified); }
.report-status-map[data-view="e2e"] .report-status-map__cell[data-e2e="failing"] { background: var(--rsm-e2e-fail, #dc2626); }

.report-status-map[data-view="debug"] .report-status-map__cell[data-debug="in_progress"] { background: var(--rsm-partial); }
.report-status-map[data-view="debug"] .report-status-map__cell[data-debug="open"] { background: var(--rsm-e2e-fail, #dc2626); }

.report-status-map[data-view="plan"] .report-status-map__cell[data-plan="drafted"] { background: var(--rsm-partial); }
.report-status-map[data-view="plan"] .report-status-map__cell[data-plan="in_progress"] { background: var(--rsm-verified); }

.report-status-map__cell:hover,
.report-status-map__cell:focus-visible {
  outline: 2px solid var(--p);
  transform: scale(1.35);
}

.report-status-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.report-status-map__legend li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--fg-2);
  font-size: 12.5px;
}

.report-status-map__swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.report-status-map__swatch[data-status="code-verified"] { background: var(--rsm-verified); }
.report-status-map__swatch[data-status="partial"] { background: var(--rsm-partial); }
.report-status-map__swatch[data-status="planned"] { background: var(--rsm-planned); }

.report-status-map__swatch[data-e2e="none"],
.report-status-map__swatch[data-debug="none"],
.report-status-map__swatch[data-plan="none"] { background: var(--rsm-planned-bg); border: 1px solid var(--line); }
.report-status-map__swatch[data-e2e="covered"] { background: var(--rsm-verified); }
.report-status-map__swatch[data-debug="in_progress"] { background: var(--rsm-partial); }
.report-status-map__swatch[data-debug="open"] { background: var(--rsm-e2e-fail, #dc2626); }
.report-status-map__swatch[data-plan="drafted"] { background: var(--rsm-partial); }
.report-status-map__swatch[data-plan="in_progress"] { background: var(--rsm-verified); }

/* 実装ビューの凡例に出す、他次元マーカーの縮小サンプル。 */
.report-status-map__marker {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--rsm-planned);
}

.report-status-map__marker--e2e::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rsm-e2e-ok, #0ea5e9);
  box-shadow: 0 0 0 1px #fff;
}

.report-status-map__marker--debug {
  background-image: repeating-linear-gradient(45deg, rgba(15, 23, 42, .38) 0, rgba(15, 23, 42, .38) 1px, transparent 1px, transparent 4px);
}

.report-status-map__marker--plan {
  background: transparent;
  outline: 1px dashed rgba(15, 23, 42, .5);
  outline-offset: 1px;
}

.report-status-map__legend + .report-status-map__legend { margin-top: 6px; }

.report-status-map__json {
  margin: 10px 0 0;
  font-size: 12.5px;
}

.report-status-map__json a {
  color: var(--p);
  font-weight: 700;
  text-decoration: none;
}

.report-status-map__json a:hover { text-decoration: underline; }

/* カスタムツールチップ（report-status-map.js が中身を差し込み、position: fixed で配置する） */
.report-status-map__tooltip {
  position: fixed;
  z-index: 3000;
  max-width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 12.5px;
  line-height: 1.7;
  box-shadow: var(--shadow-lg, 0 12px 32px rgba(15,23,42,.10));
  pointer-events: none;
}

.report-status-map__tooltip[hidden] { display: none; }

@media (max-width: 640px) {
  .report-status-map { padding: 20px; }
  .report-status-map__row { flex-direction: column; gap: 4px; }
  .report-status-map__row-label { width: auto; }
}
