/* GoDD Matrix Web アプリのスタイル (issue #28)。
   de-brand: 商標書体・ブランド名を使わずシステムフォントで構成する。
   light / dark 両対応。 */

:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f0f2f6;
  --text: #1b1f27;
  --muted: #5c6473;
  --border: #d9dee7;
  --accent: #2f6df6;
  --accent-weak: #e7effd;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --error: #c0392b;
  --mark-bg: #ffe08a;
  --mark-fg: #3a2c00;
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --panel: #161b22;
    --panel-2: #1c222b;
    --text: #e6e9ef;
    --muted: #9aa4b2;
    --border: #2a313b;
    --accent: #5b8dff;
    --accent-weak: #172236;
    --ok: #4cc47c;
    --warn: #e0a34a;
    --error: #ff6b5e;
    --mark-bg: #6b5412;
    --mark-fg: #ffe9a8;
  }
}

* {
  box-sizing: border-box;
}

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

.site-header {
  padding: 1.6rem 1.4rem 0.6rem;
  max-width: 1100px;
  margin: 0 auto;
}

.site-header h1 {
  font-size: 1.5rem;
  margin: 0 0 0.4rem;
}

.lede {
  color: var(--muted);
  margin: 0;
  max-width: 70ch;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.4rem;
  max-width: 1100px;
  margin: 1rem auto;
  padding: 0 1.4rem;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.search {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  align-self: start;
  position: sticky;
  top: 1rem;
}

.section-title {
  font-size: 1.05rem;
  margin: 0 0 0.8rem;
}

.field {
  margin-bottom: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field label {
  font-size: 0.8rem;
  color: var(--muted);
}

.field input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  background: var(--panel-2);
  color: var(--text);
}

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

button.ghost {
  background: transparent;
}

button:hover {
  filter: brightness(1.05);
}

.status {
  margin: 0.7rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.error {
  color: var(--error);
}

.content {
  min-width: 0;
}

.axes {
  margin-bottom: 1rem;
}

.axes-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
}

.axis-row {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
}

.axis-label {
  min-width: 8.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.axis-val.resolved {
  color: var(--ok);
  font-weight: 600;
}

.axis-val.unresolved {
  color: var(--muted);
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-title {
  margin: 0;
  font-size: 1rem;
}

.card-industry {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.card-meta,
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge {
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-weak);
  color: var(--accent);
  white-space: nowrap;
}

.badge-color {
  background: var(--panel-2);
  color: var(--text);
}

.badge-mood {
  background: var(--panel-2);
  color: var(--text);
}

.badge-ok {
  background: transparent;
  color: var(--ok);
  border: 1px solid var(--ok);
}

.badge-warn {
  background: transparent;
  color: var(--warn);
  border: 1px solid var(--warn);
}

.tag {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
}

.select-btn {
  margin-top: auto;
  background: var(--accent-weak);
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}

/* 検索マッチのハイライト (issue #39, light/dark 両対応でコントラスト確保)。 */
mark.hl {
  background: var(--mark-bg);
  color: var(--mark-fg);
  border-radius: 3px;
  padding: 0 0.12em;
}

/* ---- カラースウォッチ (issue #37) ---- */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.swatch {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  /* 背景色に依らず縁を視認できるよう内側に薄い明色リングを重ねる (淡色/濃色どちらも)。 */
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
  flex: 0 0 auto;
}

.swatch-block .swatches {
  gap: 0.4rem;
}

.swatch-block .swatch {
  width: 2rem;
  height: 2rem;
}

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

.detail {
  margin-top: 1.4rem;
}

.detail:empty {
  display: none;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.6rem 0 0.4rem;
}

.detail-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.sub-title {
  font-size: 0.92rem;
  margin: 1rem 0 0.4rem;
}

.notices {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  color: var(--warn);
  font-size: 0.85rem;
}

.block {
  margin-top: 0.8rem;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.copy-btn {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
}

pre.code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem;
  overflow-x: auto;
  max-height: 460px;
  overflow-y: auto;
  margin: 0.3rem 0 0;
}

pre.code code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- ファセット絞り込み (issue #31) ---- */
.facets {
  margin-bottom: 1.2rem;
}

.facets:empty {
  display: none;
}

.facets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.facets-head .section-title {
  margin: 0;
}

.facet-clear {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
}

.facet-group {
  margin-bottom: 0.7rem;
}

.facet-title {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
}

.chip.selected {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* カラー系統チップの代表色スウォッチ (issue #39, 装飾 = aria-hidden)。 */
.chip-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  /* 淡色/濃色どちらの見本でも縁を視認できるよう内側に薄い明色リングを重ねる。 */
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25);
  flex: 0 0 auto;
}

.chip-count {
  font-size: 0.72rem;
  padding: 0.02rem 0.4rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
}

.chip.selected .chip-count {
  background: var(--accent);
  color: #fff;
}

.facet-more {
  font-size: 0.78rem;
  padding: 0.28rem 0.6rem;
  border-style: dashed;
  background: transparent;
  color: var(--muted);
}

/* ---- ページャ (issue #31) ---- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1.2rem;
}

.pager:empty {
  display: none;
}

.page-btn {
  min-width: 5.5rem;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.85rem;
  color: var(--muted);
}

/* キーボード操作の可視化 (a11y) */
button:focus-visible,
.chip:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-footer {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.4rem;
  color: var(--muted);
  font-size: 0.8rem;
}
