/* C:\temp\mktg-tool\mktg-ax\mktg-ax-map\public\style.css */
/* サイト構造マップ（地図の一覧と閲覧）の見た目。色は、地図の画面（sitemap-viz の viewer）と同じ変数 */

:root {
  color-scheme: light;
  --font: "IBM Plex Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;

  /* mktg.ax の色：藍＝主な操作、若竹＝うまくいった・フォーカス、煉瓦＝エラー・削除 */
  --ai: #274C77;
  --ai-deep: #1D3A5C;
  --wakatake: #2E8B74;
  --renga: #B85C38;

  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --ink: #1B2430;
  --muted: #5B6573;
  --line: #D9DFE7;
  --line-strong: #BCC5D1;
  --on-ai: #FFFFFF;
  --renga-bg: #F7E2D8;
  --top-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0F141B;
    --surface: #161D26;
    --surface-2: #1A222D;
    --ink: #E4E9EF;
    --muted: #99A4B3;
    --line: #2A3442;
    --line-strong: #3A4656;
    --ai: #7FAAE0;
    --ai-deep: #A5C4EC;
    --wakatake: #5CC6A8;
    --renga: #E0896A;
    --on-ai: #0F141B;
    --renga-bg: #3A231A;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

/* ログインの画面（会員SDK。/shared/mktg-auth.css）は、明るい配色だけで作ってある。
   暗い配色の端末でも、中のチェックボックスや入力欄は明るいままにする */
[data-mktg-auth] { color-scheme: light; }

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .92em;
  overflow-wrap: anywhere;
}

:focus-visible {
  outline: 2px solid var(--wakatake);
  outline-offset: 2px;
}

/* ── 上の帯 ─────────────────────────────── */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--top-h);
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.brand__mark {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--ai);
  stroke-width: 1.6;
}

.top__viewer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.top__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.top__right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.who {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

/* 地図を開いている間は、サービス名をしまって、地図の名前を出す */
.is-viewing .brand__name,
.is-viewing .who { display: none; }

/* ── ボタン ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.btn:hover { border-color: var(--ai); }
.btn:disabled { opacity: .55; cursor: default; }

.btn--primary {
  border-color: var(--ai);
  background: var(--ai);
  color: var(--on-ai);
}

.btn--primary:hover { background: var(--ai-deep); border-color: var(--ai-deep); }
.btn--quiet { border-color: transparent; background: transparent; color: var(--ai); }
.btn--quiet:hover { border-color: var(--line-strong); }
.btn--danger { border-color: var(--renga); color: var(--renga); }
.btn--danger:hover { background: var(--renga-bg); border-color: var(--renga); }

/* ── 知らせ（ログイン前・確認中・使えないとき） ─────────── */
.notice {
  max-width: 560px;
  margin: 12vh auto 0;
  padding: 0 20px;
  text-align: center;
}

.notice__title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
}

.notice__text {
  margin: 0;
  color: var(--muted);
}

.notice__extra {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 18px;
}

.notice__id {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.notice__id code {
  border: 0;
  background: none;
  font-size: 14px;
}

/* ── 一覧 ─────────────────────────────── */
.library {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.library__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.library__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}

.library__count { margin: 0; color: var(--muted); font-size: 13px; }

.library__empty,
.library__error {
  margin: 20px 0 0;
  color: var(--muted);
}

.library__error { color: var(--renga); }

.drop {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
}

.drop.is-over {
  border-color: var(--wakatake);
  background: var(--surface-2);
}

.drop__lead { margin: 0; font-weight: 600; }
.drop__hint { margin: 0; max-width: 64ch; color: var(--muted); font-size: 13px; }
.drop__hint code { white-space: nowrap; }
.drop__pick { margin-top: 8px; }
.drop__pick input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop__pick:focus-within { outline: 2px solid var(--wakatake); outline-offset: 2px; }

.uploads,
.maps {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
}

.upload__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload__status { margin-left: auto; color: var(--muted); white-space: nowrap; }
.upload.is-error { border-color: var(--renga); background: var(--renga-bg); }
.upload.is-error .upload__status { color: var(--renga); white-space: normal; text-align: right; }
.upload.is-done .upload__status { color: var(--wakatake); }

.map {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.map__name {
  min-width: 0;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.map__name a { color: var(--ink); text-decoration: none; }
.map__name a:hover { color: var(--ai); text-decoration: underline; }

.map__meta {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.map__tags { display: inline-flex; flex-wrap: wrap; gap: 6px; }

.tag {
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.7;
}

.map__actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.map__form {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.map__form input {
  flex: 1 1 240px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.map__confirm { color: var(--renga); font-weight: 500; }
.map__error { grid-column: 1 / -1; margin: 4px 0 0; color: var(--renga); font-size: 13px; }

/* ── 地図 ─────────────────────────────── */
.viewer {
  position: fixed;
  inset: var(--top-h) 0 0 0;
  display: grid;
  background: var(--bg);
}

.viewer__status {
  place-self: center;
  margin: 0;
  padding: 0 20px;
  color: var(--muted);
  text-align: center;
}

.viewer__status.is-error { color: var(--renga); }

.viewer__frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
}

/* 狭い画面では1列にして、名前 → 情報 → ボタンの順に並べる */
@media (max-width: 640px) {
  .map { grid-template-columns: minmax(0, 1fr); }
  .map__meta { order: 1; }
  .map__actions { order: 2; grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 8px; }
  .map__form, .map__error { order: 3; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .drop { transition: border-color .12s ease, background-color .12s ease; }
}
