/* ============================================================
   共有スタイル — タグ・ファセット検索DB (jsfdb型)
   各サイトは data.js の meta.accent でアクセントカラーを差し替える
   ============================================================ */

:root {
  --accent: #7048e8;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 30%, #fff);
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --faint: #9aa1ad;
  --border: #e6e8ec;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
          "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- ヘッダー ---------- */
.site-header {
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 18%, #fff) 0%, transparent 55%),
    var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 26px;
}
.site-header__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 14px;
}
.site-header__back:hover { color: var(--accent); }
.site-header__title {
  margin: 0;
  font-size: clamp(26px, 4.5vw, 38px);
  letter-spacing: .02em;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.site-header__title .accent-bar {
  display: inline-block;
  width: 34px; height: 6px; border-radius: 3px;
  background: var(--accent);
  transform: translateY(-6px);
}
.site-header__tagline {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--accent);
  font-weight: 600;
}
.site-header__desc {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 760px;
  font-size: 14.5px;
}
.site-header__count {
  margin-top: 14px;
  font-size: 13px;
  color: var(--faint);
}
.site-header__count b { color: var(--accent); font-size: 15px; }

/* ---------- レイアウト ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 80px;
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 28px;
  align-items: start;
}

/* ---------- サイドバー(ファセット) ---------- */
.sidebar {
  position: sticky;
  top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 4px 14px;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 36px);
  overflow: auto;
}
.facet { padding: 12px 16px 4px; border-bottom: 1px solid var(--border); }
.facet:last-child { border-bottom: none; }
.facet__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: none;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.facet__label::before {
  content: "";
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--accent);
}
.chips { display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 8px; }

.chip {
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 7px 11px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .12s ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.chip[aria-pressed="true"] .chip__count { color: color-mix(in srgb, var(--accent-ink) 80%, var(--accent)); }
.chip__count { font-size: 11px; color: var(--faint); }
.chip.is-empty { opacity: .38; cursor: default; }
.chip.is-empty:hover { background: #fff; border-color: var(--border); }

/* ---------- メイン ---------- */
.main { min-width: 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.search {
  flex: 1 1 260px;
  position: relative;
}
.search input {
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  outline: none;
  transition: border-color .12s;
}
.search input:focus { border-color: var(--accent); }
.search::before {
  content: "🔍";
  position: absolute;
  left: 13px; top: 50%; transform: translateY(-50%);
  font-size: 13px; opacity: .55;
}
.tool-btn {
  font: inherit;
  font-size: 13px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  transition: all .12s;
  white-space: nowrap;
}
.tool-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.tool-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filters-toggle { display: none; }

.active-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 4px;
}
.active-row:empty { display: none; }
.result-count { font-size: 14px; color: var(--muted); }
.result-count b { color: var(--text); font-size: 17px; }
.pill {
  font-size: 12.5px;
  padding: 5px 9px 5px 11px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: color-mix(in srgb, var(--accent) 70%, #000);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.pill button {
  border: none; background: none; cursor: pointer;
  color: inherit; font-size: 14px; line-height: 1; padding: 0;
  opacity: .6;
}
.pill button:hover { opacity: 1; }
.clear-all {
  font-size: 12.5px; color: var(--muted);
  background: none; border: none; cursor: pointer; text-decoration: underline;
}
.clear-all:hover { color: var(--accent); }

/* ---------- カードグリッド ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card__cover {
  display: block;
  max-width: 100%;
  max-height: 190px;
  width: auto;
  margin: 0 auto 14px;
  object-fit: contain;
  border-radius: 6px;
  background: #f0f1f3;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .12);
}
.card__placeholder {
  display: flex; align-items: center; justify-content: center; text-align: center;
  width: 134px; min-height: 188px; box-sizing: border-box;
  margin: 0 auto 14px; padding: 14px 12px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, #fff), color-mix(in srgb, var(--accent) 4%, #fff));
  border: 1px solid var(--accent-line);
  border-left: 5px solid var(--accent);           /* 背表紙風 */
  border-radius: 4px 6px 6px 4px;
  color: color-mix(in srgb, var(--accent) 72%, #1f2430);
  font-size: 12.5px; font-weight: 700; line-height: 1.6;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .1);
}
.card__title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .01em; }
.card__subtitle { margin: 3px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }
.card__meta { margin: 2px 0 0; font-size: 12px; color: var(--faint); }
.card__body {
  margin: 12px 0 14px;
  font-size: 14px;
  color: #333a47;
  white-space: pre-line;
}
.card--verse .card__body {
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.9;
  letter-spacing: .03em;
  color: #20242e;
}
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag {
  font: inherit;
  font-size: 11.5px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fbfbfc;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
}
.tag:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.tag[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.card__link {
  margin-top: 13px;
  align-self: flex-start;
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
}
.card__link:hover { text-decoration: underline; }
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:5px; vertical-align: middle; }

.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin: 0 0 6px; }

.more-note {
  grid-column: 1 / -1;
  text-align: center;
  padding: 16px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- フッター ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 26px 24px;
  text-align: center;
  color: var(--faint);
  font-size: 12.5px;
}
.site-footer a { color: var(--muted); }
.site-footer .disclosure { margin-top: 8px; font-size: 11.5px; color: var(--faint); }

/* サイドバーの固定ヘッダ/適用ボタン/背景は既定(PC)では非表示 */
.sidebar__head, .sidebar__apply, .sidebar-backdrop { display: none; }
.sidebar__body { display: block; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  body.no-scroll { overflow: hidden; }

  /* ツールバーとメディアバーを上部に固定し、常にフィルタへ手が届く */
  .toolbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--bg, #f7f8fa); padding: 10px 0; margin: -4px 0 6px;
    flex-wrap: wrap; gap: 8px;
  }
  .toolbar .search { flex: 1 1 100%; }
  .primary-bar { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .pbar-btn { flex: 0 0 auto; }

  /* フィルタは下から出るシート(オーバーレイ) */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    max-height: 86vh; max-width: none; width: 100%;
    transform: translateY(100%); transition: transform .22s ease;
    display: flex; flex-direction: column;
    background: var(--surface); border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,.28); z-index: 60; padding: 0;
  }
  .sidebar.is-open { transform: translateY(0); }
  .sidebar__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border); flex: 0 0 auto;
  }
  .sidebar__head-t { font-weight: 800; font-size: 15px; }
  .sidebar__close {
    border: none; background: #eef0f3; color: #555; width: 32px; height: 32px;
    border-radius: 50%; font-size: 15px; cursor: pointer;
  }
  .sidebar__body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px 8px; }
  .sidebar__apply {
    display: block; flex: 0 0 auto; padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--surface);
  }
  .sidebar__apply-btn {
    width: 100%; border: none; background: var(--accent); color: var(--accent-ink);
    font-size: 15px; font-weight: 800; padding: 14px; border-radius: 12px; cursor: pointer;
  }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(15,17,21,.45);
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 55;
  }
  .sidebar-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .filters-toggle { display: inline-flex; }
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
}

/* ---------- 並び替えセレクト ---------- */
.tool-select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink, #1f2430);
  border-radius: 9px;
  padding: 8px 28px 8px 12px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---------- 主要ファセット 横バー(メディア種別など) ---------- */
.primary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.pbar-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
}
.pbar-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.pbar-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.pbar-count {
  font-size: 11px;
  opacity: .7;
  font-weight: 600;
  margin-left: 3px;
}
.pbar-btn.is-active .pbar-count { opacity: .85; }

/* ---------- カードのメディアバッジ ---------- */
.card { position: relative; }
.card__badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: color-mix(in srgb, var(--accent) 90%, #000 0%);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}

/* ---------- Phase C: ファセット検索・ランディング・ページング ---------- */
.facet__sel {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; border-radius: 99px; padding: 0 7px; margin-left: 6px;
}
.facet__search {
  width: 100%; box-sizing: border-box; margin: 2px 0 9px;
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px;
  background: #fbfbfc;
}
.facet__search:focus { outline: none; border-color: var(--accent-line); }

/* ランディング(空状態の入口) */
.landing { margin: 2px 0 8px; }
.landing__lead { font-size: 15px; color: #374151; margin: 0 0 14px; }
.landing__h { font-size: 14px; color: var(--muted); margin: 0 0 10px; font-weight: 700; }
.landing__tiles { display: flex; flex-wrap: wrap; gap: 9px; margin: 0 0 22px; }
.ltile {
  border: 1px solid var(--border); background: var(--surface); color: #1f2430;
  border-radius: 11px; padding: 11px 15px; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: all .12s; display: inline-flex; align-items: center; gap: 7px;
}
.ltile:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.06); }
.ltile__n { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.landing__feed-h { font-size: 13px; color: var(--muted); margin: 6px 0 0; font-weight: 700; }

/* もっと見る */
.more-wrap { grid-column: 1 / -1; text-align: center; padding: 22px 0 6px; }
.more-btn {
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 11px; padding: 12px 28px; font-size: 14px; font-weight: 700; cursor: pointer;
}
.more-btn:hover { filter: brightness(1.06); }
.more-note { color: var(--faint); font-size: 12.5px; margin: 10px 0 0; }
