/* AXEL — ダークを基調にした一覧デザイン(大きな見出し、ピル型の絞り込み、角丸カードのグリッド) */
:root {
  --bg: #0b0b0b;
  --surface: #161616;
  --surface-hover: #1d1d1d;
  --surface-2: #222;
  --text: #f2eeeb;
  --text-2: #c9c4c0;
  --muted: #8e8984;
  --line: rgb(255 255 255 / .14);
  --line-strong: rgb(255 255 255 / .28);
  --accent: #9db7ff;
  --chip-fill: #ece7e3;
  --chip-fill-text: #121212;
  --radius-card: 20px;
  --radius-pill: 999px;
  --maxw: 1120px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); overflow-wrap: anywhere; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 上部バー ---------- */
.topbar {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
/* ワードマーク: 「A」の記号 + AXEL(字間を広げた太字。ダーク背景に白) */
.wordmark { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; }
.wordmark-mark { width: 20px; height: 20px; flex-shrink: 0; }
.wordmark-text { font-weight: 700; font-size: 1.05rem; letter-spacing: .2em; line-height: 1; margin-right: -.2em; }
.footer-brand { color: var(--text-2); margin-top: 0; }
.footer-brand-name { font-weight: 700; letter-spacing: .16em; color: var(--text); }
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.lang-switch button { border: 0; border-radius: var(--radius-pill); padding: 4px 12px; font-size: .82rem; background: transparent; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }

/* ---------- 見出し ---------- */
.hero { max-width: 900px; margin: 0 auto; padding: 56px 20px 28px; text-align: center; }
.hero h1 {
  margin: 0; font-weight: 500; letter-spacing: -.035em; line-height: 1.05;
  font-size: clamp(2.3rem, 7vw, 5.2rem); text-wrap: balance;
}
.hero h1:lang(ja) { letter-spacing: -.02em; font-size: clamp(1.9rem, 5vw, 3.6rem); line-height: 1.2; word-break: keep-all; overflow-wrap: anywhere; }
.lead { margin: 22px auto 0; max-width: 640px; color: var(--text-2); font-size: clamp(1rem, 2vw, 1.2rem); min-height: 3.1em; }
.stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px 44px; margin: 36px 0 0; min-height: calc(clamp(1.6rem, 3.5vw, 2.4rem) * 1.55 + 1.3rem); }
.stats div { display: flex; flex-direction: column-reverse; align-items: center; }
.stats dt { color: var(--muted); font-size: .85rem; }
.stats dd { margin: 0; font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- 絞り込み ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.controls {
  padding: 14px 0; margin-bottom: 4px; display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.search { position: relative; width: min(560px, 100%); }
.search-icon { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 18px 11px 44px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: transparent; font-size: 16px; /* iOS のズーム防止 */ color: var(--text);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { border-color: var(--text-2); outline: none; }
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pill-select { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.pill-select > span {
  position: absolute; left: 17px; top: 6px; font-size: .66rem; line-height: 1; color: var(--muted);
  pointer-events: none; white-space: nowrap; letter-spacing: .02em;
}
.pill-select select {
  appearance: none; -webkit-appearance: none; width: 100%; min-width: 0; max-width: 260px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background-color: transparent;
  padding: 19px 36px 6px 16px; font-size: 15px; line-height: 1.2; color: var(--text); text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238e8984' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 11px;
}
.pill-select select:hover { border-color: var(--text-2); }
.pill-select select option, .pill-select select optgroup { background: #1b1b1b; color: var(--text); }
.reset { border: 1px solid transparent; border-radius: var(--radius-pill); background: transparent; color: var(--muted); padding: 8px 14px; font-size: .9rem; }
.reset:hover { color: var(--text); border-color: var(--line); }
.toggle-filters {
  display: none; width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: transparent;
  padding: 10px 16px; color: var(--text-2);
}
.toggle-filters svg { width: 18px; height: 18px; flex-shrink: 0; }
.filter-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #0b0b0b; font-size: .78rem; font-weight: 700; line-height: 20px; text-align: center; }
/* 絞り込みのボトムシート用(スマホのみ表示) */
.sheet-head, .filters-close, .filters-backdrop { display: none; }

.result-count { color: var(--muted); font-size: .88rem; margin: 10px 2px 14px; }
.list-notes { font-size: .84rem; color: var(--muted); margin: -6px 2px 14px; padding: 8px 12px; border-left: 3px solid var(--line); background: color-mix(in srgb, var(--line) 25%, transparent); border-radius: 4px; }
.list-notes p { margin: 0; }
.list-notes p + p { margin-top: 4px; }
.detail-note { margin: 0; }

/* ---------- カード ---------- */
.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
/* 読み込み中は一覧の高さを確保し、表示時に下の要素(フッター)が大きく動かないようにする */
.cards:empty { min-height: 100vh; }
.card {
  position: relative; background: var(--surface); border-radius: var(--radius-card); padding: 20px 20px 18px;
  display: flex; flex-direction: column; gap: 6px; min-width: 0; min-height: 214px;
  transition: background .15s ease, transform .15s ease;
}
.card:hover { background: var(--surface-hover); transform: translateY(-2px); }
.card:has(h3 button:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card .logo { margin-bottom: 14px; }
.card h3 { margin: 0; font-size: 1.06rem; font-weight: 500; letter-spacing: -.01em; }
/* カード全体を押せるようにする(ボタンの当たり判定をカードいっぱいに広げる) */
.card h3 button { all: unset; cursor: pointer; color: var(--text); overflow-wrap: anywhere; }
.card h3 button::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-card); }
.card h3 button:focus-visible { outline: none; }
.card .oneliner {
  margin: 0; font-size: .92rem; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
/* 箇条書き(要約)。先頭に小さな点を付ける */
.bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bullets li { position: relative; padding-left: 14px; overflow-wrap: anywhere; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.card-bullets { font-size: .88rem; color: var(--text-2); line-height: 1.5; margin-top: 2px; }
.card-bullets li { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.detail-bullets { gap: 8px; font-size: 1rem; line-height: 1.65; color: var(--text); }
.detail-bullets li { padding-left: 18px; }
.detail-bullets li::before { width: 6px; height: 6px; top: .72em; background: var(--accent); }
.card .loc { margin: 2px 0 0; font-size: .78rem; color: var(--muted); }
.card-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: flex-end; gap: 8px; }
.card .meta { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; min-width: 0; }
.card .arrow { color: var(--muted); flex-shrink: 0; width: 16px; height: 16px; transition: transform .15s ease, color .15s ease; }
.card:hover .arrow { color: var(--text); transform: translateX(3px); }

.badge, .chip-btn {
  display: inline-flex; align-items: center; gap: 4px; border-radius: var(--radius-pill); font-size: .72rem; line-height: 1;
  padding: 4px 8px; white-space: nowrap;
}
.badge-batch { background: var(--chip-fill); color: var(--chip-fill-text); font-weight: 600; }
.badge-program { border: 1px solid var(--line-strong); color: var(--text-2); }
.status-acquired { background: #3a2f12; color: #f4d58b; }
.status-inactive { background: #2a2a2a; color: #a7a29e; }
.status-active { background: #16301f; color: #9fe0b2; }
.status-unknown { background: #262626; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.chip-btn { position: relative; z-index: 1; border: 1px solid var(--line); background: transparent; color: var(--text-2); }
.chip-btn:hover { border-color: var(--text-2); color: var(--text); }
.card .chips { margin-top: 2px; }

/* ロゴ(画像、または社名の頭文字) */
/* タイルの背景はロゴ自身の背景色(--tile)。透過ロゴは白(明るいロゴは暗色)のタイル。
   ロゴは余白を切り取ってあるので、タイル内に一定の余白を空けて中央に置く */
.logo {
  width: 52px; height: 52px; border-radius: 14px; overflow: hidden; flex-shrink: 0;
  display: grid; place-items: center; background: var(--tile, #fff);
  box-shadow: 0 0 0 1px rgb(255 255 255 / .07);
}
.logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.logo-pad { padding: 9px; }
.logo-pad img { max-width: 100%; max-height: 100%; }
.logo-cover img { object-fit: cover; }
.logo-lg.logo-pad { padding: 11px; }
.logo.is-placeholder { background: var(--ph, #2b2b2b); color: #fff; font-weight: 600; font-size: 1.3rem; letter-spacing: -.02em; }
.logo-lg { width: 64px; height: 64px; border-radius: 16px; }
.logo-lg.is-placeholder { font-size: 1.6rem; }

.more { text-align: center; margin: 28px 0 56px; }
.more button { border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: transparent; padding: 11px 26px; color: var(--text); }
.more button:hover { background: var(--surface); }
.empty { grid-column: 1 / -1; color: var(--muted); padding: 48px 0; text-align: center; }

/* ---------- 詳細 ---------- */
dialog {
  width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 48px); border: 1px solid var(--line);
  border-radius: 24px; padding: 0; background: var(--surface); color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / .7); backdrop-filter: blur(3px); }
dialog article { padding: 24px 26px 28px; }
.detail-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.detail-title { display: flex; gap: 16px; align-items: center; min-width: 0; }
.detail-header h2 { margin: 0; font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; overflow-wrap: anywhere; }
.detail-meta { margin: 0 0 2px; font-size: .8rem; color: var(--muted); }
.close { font-size: 1.3rem; line-height: 1; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: transparent; color: var(--text-2); }
.close:hover { color: var(--text); border-color: var(--line-strong); }
.detail-summary { margin: 20px 0 14px; font-size: 1rem; line-height: 1.75; color: var(--text); }
.detail-summary.loading { color: var(--muted); }
.detail-summary:empty { display: none; }
.detail-original { margin: 0 0 18px; font-size: .9rem; border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; }
.detail-original summary { cursor: pointer; color: var(--muted); }
.detail-oneliner { font-weight: 600; margin: 10px 0 6px; }
.detail-oneliner:empty { display: none; }
.detail-desc { white-space: pre-line; color: var(--text-2); }
.detail-fields { display: grid; grid-template-columns: 8em 1fr; gap: 10px 14px; margin: 0; font-size: .9rem; border-top: 1px solid var(--line); padding-top: 16px; }
.detail-fields dt { color: var(--muted); }
.detail-fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.detail-fields .chip-btn { z-index: auto; }

/* ---------- フッター ---------- */
.site-footer { max-width: var(--maxw); margin: 0 auto; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); padding: 20px 20px 48px; }
.site-footer ul { padding-left: 1.2em; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  /* ---- スマホ: 余白を詰めて一覧を早く見せる。タップ領域は 44px 以上、文字は 12px 以上 ---- */
  .topbar { padding: max(6px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left)); }
  .wordmark { min-height: 44px; padding: 0 4px; }
  .lang-switch { padding: 2px; }
  .lang-switch button { min-height: 44px; min-width: 64px; padding: 0 12px; font-size: .88rem; }
  .hero { padding: 14px 16px 6px; }
  .hero h1:lang(ja), .hero h1 { font-size: 1.75rem; }
  .lead { margin-top: 10px; font-size: .95rem; min-height: 4.6em; }
  .stats { gap: 6px 28px; margin-top: 12px; min-height: 3.6rem; }
  .stats dd { font-size: 1.45rem; }
  .stats dt { font-size: .8rem; }
  main { padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right)); }

  /* 検索と絞り込みボタンは画面上部に固定(スクロールしてもすぐ使える) */
  .controls {
    position: sticky; top: 0; z-index: 20; flex-direction: row; gap: 8px; margin: 0 -12px 4px; padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top));
    /* backdrop-filter は付けない(付けると子のボトムシート position: fixed の基準がこの要素になる) */
    background: rgb(11 11 11 / .97); border-bottom: 1px solid var(--line);
  }
  .search { flex: 1; min-width: 0; }
  .search input { min-height: 46px; padding-right: 12px; }
  .toggle-filters {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; flex-shrink: 0;
    min-height: 46px; min-width: 46px; padding: 0 14px; color: var(--text);
  }
  /* 狭い画面ではボタンはアイコン + 件数だけ(文言は aria-label に残す) */
  .toggle-filters > span[data-i18n] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  /* 絞り込みは下から出るシート */
  .filters {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; flex-direction: column; align-items: stretch; gap: 10px;
    max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 6px max(16px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line-strong);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s;
  }
  .filters.open { transform: none; visibility: visible; transition: transform .22s ease; }
  .filters-backdrop { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .6); }
  .filters-backdrop:not([hidden]) { display: block; }
  .sheet-head { display: flex; align-items: center; justify-content: center; padding: 10px 0 4px; position: relative; }
  .sheet-head::before { content: ""; position: absolute; top: 0; width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
  .sheet-title { font-weight: 600; font-size: 1rem; color: var(--text); }
  .pill-select { display: flex; }
  .pill-select > span { font-size: .75rem; top: 7px; }
  .pill-select select { max-width: none; min-height: 52px; font-size: 16px; padding-top: 21px; }
  .reset { align-self: stretch; min-height: 46px; border-color: var(--line); color: var(--text-2); }
  .filters-close {
    display: block; min-height: 50px; border: 0; border-radius: var(--radius-pill); background: var(--text); color: var(--bg);
    font-weight: 600; font-size: 1rem;
  }
  html.sheet-open, html.modal-open { overflow: hidden; }

  .result-count { margin: 8px 2px 10px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .card { min-height: 0; padding: 16px; }
  .card .logo { margin-bottom: 10px; }
  .card h3 { font-size: 1.08rem; }
  .card-bullets { font-size: .92rem; }
  /* カード内のタグはタップしやすく(44px) */
  .card-foot { padding-top: 10px; align-items: center; }
  .card .meta { align-items: center; }
  /* タグ: 当たり判定は 44px、見た目のピルは小さく(枠は ::before で内側に描く) */
  .chip-btn { min-height: 44px; padding: 0 12px; font-size: .82rem; border-color: transparent; background: none; }
  .chip-btn::before { content: ""; position: absolute; inset: 7px 0; border: 1px solid var(--line); border-radius: var(--radius-pill); pointer-events: none; }
  .chip-btn:hover::before { border-color: var(--text-2); }
  .card .meta { gap: 0 6px; }
  .badge { font-size: .78rem; padding: 5px 9px; }
  .more button { min-height: 48px; width: 100%; }
  .more { margin: 20px 0 32px; }

  /* 詳細は全画面。上部の閉じるボタンは常に見える */
  dialog {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0;
    overscroll-behavior: contain;
  }
  dialog article { padding: 0 max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .detail-header {
    position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    background: rgb(22 22 22 / .95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
    align-items: center;
  }
  .detail-header h2 { font-size: 1.3rem; }
  .logo-lg { width: 52px; height: 52px; border-radius: 14px; }
  .close { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; padding: 0; font-size: 1.4rem; }
  .detail-original summary { min-height: 44px; display: flex; align-items: center; gap: 8px; list-style: none; }
  .detail-original summary::-webkit-details-marker { display: none; }
  .detail-original summary::before { content: "▸"; font-size: .9em; transition: transform .15s ease; }
  .detail-original[open] summary::before { transform: rotate(90deg); }
  .detail-original { padding: 0 14px; }
  .detail-original[open] { padding-bottom: 12px; }
  .detail-fields { grid-template-columns: 1fr; gap: 0; font-size: .95rem; }
  .detail-fields dt { margin-top: 12px; }
  .detail-fields dd a { display: inline-flex; align-items: center; min-height: 44px; }
  .detail-fields .chips { gap: 6px; }

  .site-footer { padding: 20px max(16px, env(safe-area-inset-right)) calc(32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); font-size: .82rem; }
  .site-footer a { display: inline-block; padding: 12px 0; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .filters, .filters.open { transition: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card, .card .arrow { transition: none; }
  .card:hover { transform: none; }
}
