/* いそいそさーち（ISO 42001 日本語ガイド）スタイル */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --text: #1c2230;
  --text-muted: #5b6475;
  --border: #dde1e8;
  --accent: #2f5bd3;
  --accent-soft: #e8eefc;
  --quote-bg: #f5f7fb;
  --ja-bg: #fbf8ef;
  --ja-border: #d9b44a;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .04);
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151c;
    --surface: #1a1f29;
    --surface-2: #222835;
    --text: #e6e9ef;
    --text-muted: #9aa3b5;
    --border: #2e3544;
    --accent: #8aa8ff;
    --accent-soft: #24304d;
    --quote-bg: #1f2533;
    --ja-bg: #2a261b;
    --ja-border: #b08f2e;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151c;
  --surface: #1a1f29;
  --surface-2: #222835;
  --text: #e6e9ef;
  --text-muted: #9aa3b5;
  --border: #2e3544;
  --accent: #8aa8ff;
  --accent-soft: #24304d;
  --quote-bg: #1f2533;
  --ja-bg: #2a261b;
  --ja-border: #b08f2e;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.4; }
h1 { font-size: 1.75rem; margin: .2em 0 .2em; }
h2 { font-size: 1.2rem; margin: 2rem 0 .8rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
[lang="en"], .en-title, .en-inline, .card-en, .eyebrow { font-family: Inter, system-ui, sans-serif; }
.muted { color: var(--text-muted); }
.note { color: var(--text-muted); font-size: .88rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 10; background: var(--surface); padding: 4px 8px; }

/* ---------- ヘッダー ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: #fff; font-family: Inter, sans-serif; font-size: .85rem;
}
/* サイト名の下にサブタイトルを置く2段組（ヘッダーを1行に収めるため） */
.brand-text { display: grid; line-height: 1.25; }
.brand-text small { font-weight: 500; color: var(--text-muted); font-size: .7rem; }
.global-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.global-nav a {
  color: var(--text-muted); padding: 6px 10px; border-radius: 6px; font-size: .92rem;
}
.global-nav a:hover { background: var(--surface-2); text-decoration: none; }
.global-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 500; }
.search { margin-left: auto; flex: 1 1 240px; max-width: 340px; }
.search input {
  width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem;
}
.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 1rem;
}

/* ---------- レイアウト ---------- */
.main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); font-size: .85rem; padding: 20px 16px;
}
.site-footer p { max-width: 1200px; margin: .3em auto; }

/* ---------- パンくず ---------- */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 16px; font-size: .85rem; }
.breadcrumb li { color: var(--text-muted); }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; color: var(--text-muted); }

/* ---------- ホーム ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent-soft), var(--surface));
  border: 1px solid var(--border); border-radius: 16px; padding: 36px 28px; margin-bottom: 8px;
}
.hero h1 { font-size: 2rem; }
.eyebrow { color: var(--accent); font-size: .82rem; font-weight: 600; letter-spacing: .02em; margin: 0; }
.lead { font-size: 1.02rem; color: var(--text); max-width: 60em; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 500;
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.structure { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.structure-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 5px 0; border-bottom: 1px dashed var(--border); }
.plain-list li:last-child { border-bottom: 0; }

/* ---------- カード ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; color: var(--text); box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.card-id { color: var(--accent); font-size: .8rem; font-weight: 700; }
.card-title { font-weight: 700; line-height: 1.5; }
.card-en { color: var(--text-muted); font-size: .8rem; line-height: 1.4; }
.card-count { margin-top: 6px; font-size: .8rem; color: var(--text-muted); }
.badge {
  display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); margin-right: 4px; width: fit-content;
}
.badge.muted { background: var(--surface-2); color: var(--text-muted); margin-top: 6px; }

/* ---------- 一覧 ---------- */
.index-group h2 a { color: var(--text); }
.en-inline { color: var(--text-muted); font-size: .8em; font-weight: 400; margin-left: 6px; }
.en-title { color: var(--text-muted); margin: 0 0 12px; }
.sub-heading { font-size: 1rem; color: var(--text-muted); border-left: 3px solid var(--accent); padding-left: 10px; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) 20px; gap: 12px; align-items: center;
  padding: 14px 16px; color: var(--text); border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); text-decoration: none; }
.row-id { font-family: Inter, sans-serif; font-weight: 600; color: var(--accent); }
.row-title { display: block; font-weight: 700; }
.row-desc {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--text-muted); font-size: .88rem; line-height: 1.6;
}
.chev { color: var(--text-muted); font-size: 1.4rem; }

/* ---------- サイドバー ---------- */
.sidebar {
  position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; max-height: calc(100vh - 96px); overflow: auto;
}
.sidebar h2 { font-size: .9rem; margin: 0 0 8px; }
.sidebar h2 a { color: var(--text); }
.sidebar ul { list-style: none; padding: 0; margin: 0; }
.sidebar li a {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 6px;
  color: var(--text); font-size: .86rem; line-height: 1.5;
}
.sidebar li a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar li.current a { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidebar .count { color: var(--text-muted); font-size: .8rem; }

/* ---------- 個別項目 ---------- */
.item-head { margin-bottom: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.official, .explain, .tabs {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; margin-top: 18px; box-shadow: var(--shadow);
}
.official h2, .explain h2 { margin: 0 0 10px; font-size: 1.05rem; }
.official-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.official-head h2 { margin: 0; }
.view-switch, .filter-bar { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.view-switch button, .filter-bar button {
  border: 0; background: var(--surface); color: var(--text-muted); padding: 5px 12px; cursor: pointer; font: inherit; font-size: .82rem;
}
.view-switch button + button, .filter-bar button + button { border-left: 1px solid var(--border); }
.view-switch button.on, .filter-bar button.on { background: var(--accent); color: #fff; }
.quote-pair { margin-top: 14px; }
.quote-ref { margin: 0 0 4px; font-size: .78rem; font-weight: 700; color: var(--text-muted); font-family: Inter, sans-serif; }
.quote-en {
  margin: 0; padding: 12px 16px; background: var(--quote-bg); border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0; font-size: .95rem; line-height: 1.7;
}
.quote-ja {
  margin-top: 6px; padding: 12px 16px; background: var(--ja-bg); border-left: 4px solid var(--ja-border);
  border-radius: 0 8px 8px 0;
}
.ja-label { display: block; font-size: .75rem; font-weight: 700; color: var(--text-muted); }
.official[data-view="en"] .quote-ja, .official[data-view="ja"] .quote-en { display: none; }
.no-original { background: var(--surface-2); padding: 12px 16px; border-radius: 8px; color: var(--text-muted); }
.source-note { margin: 14px 0 0; font-size: .78rem; color: var(--text-muted); }

.tab-list { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 12px; flex-wrap: wrap; }
.tab-list button {
  border: 0; background: none; padding: 8px 12px; cursor: pointer; font: inherit; font-size: .92rem;
  color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-list button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.tab-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }
.check-list, .doc-list { margin: 0; padding: 0; list-style: none; }
.check-list li, .doc-list li { position: relative; padding: 6px 0 6px 28px; border-bottom: 1px dashed var(--border); }
.check-list li:last-child, .doc-list li:last-child { border-bottom: 0; }
.check-list li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }
.doc-list li::before { content: "▤"; position: absolute; left: 4px; color: var(--ja-border); }

/* ---------- 前へ／次へ ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.pager a {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; color: var(--text); font-weight: 500; font-size: .92rem;
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; color: var(--text-muted); font-size: .75rem; }
.pager-prev small::before { content: "‹ "; }
.pager-next { text-align: right; }
.pager-next small::after { content: " ›"; }

/* ---------- 対訳一覧 ---------- */
.filter-bar { margin: 4px 0 16px; }
.parallel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.parallel-head, .parallel-row { display: grid; grid-template-columns: 140px 1fr 1fr; gap: 16px; padding: 12px 16px; }
.parallel-head { background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--text-muted); }
.parallel-row { border-top: 1px solid var(--border); }
.parallel-row[hidden] { display: none; }
.parallel-row p { margin: 0; font-size: .9rem; line-height: 1.7; }
.p-id { font-weight: 700; font-family: Inter, sans-serif; }
.p-id small { display: block; font-family: "Noto Sans JP", sans-serif; font-weight: 400; color: var(--text-muted); }

/* ---------- チップ（番号・用語へのリンク） ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  font-family: Inter, "Noto Sans JP", sans-serif; font-weight: 600; font-size: .82rem; line-height: 1.6;
}
.chip span { color: var(--text-muted); font-weight: 400; font-family: "Noto Sans JP", sans-serif; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.all { background: var(--accent-soft); }
.chip.term { color: var(--text); font-weight: 500; font-family: "Noto Sans JP", sans-serif; }
.h-link { font-size: .8rem; font-weight: 400; margin-left: 8px; }

/* ---------- 対応表 ---------- */
.map-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.map-head, .map-row { display: grid; grid-template-columns: 190px minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; padding: 12px 16px; align-items: start; }
.map-table.two .map-row { grid-template-columns: 240px minmax(0, 1fr); }
.map-head { background: var(--surface-2); font-weight: 700; font-size: .85rem; color: var(--text-muted); }
.map-row { border-top: 1px solid var(--border); }
.map-key { color: var(--text); }
.map-key b { color: var(--accent); font-family: Inter, sans-serif; margin-right: 6px; }
.map-key span { font-size: .9rem; }
.map-note { margin: 0; font-size: .86rem; color: var(--text-muted); line-height: 1.6; }
.map-group { margin: 0; padding: 10px 16px; background: var(--surface-2); font-size: .92rem; border-top: 1px solid var(--border); }
.map-group:first-child { border-top: 0; }
.map-group a { color: var(--text); }

/* ---------- 用語集 ---------- */
.glossary-tools {
  position: sticky; top: 58px; z-index: 2; background: var(--bg);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0;
}
.glossary-tools input {
  flex: 1 1 240px; max-width: 360px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem;
}
.kana-index { display: flex; flex-wrap: wrap; gap: 4px; }
.kana-index button {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 6px; width: 34px; height: 32px; cursor: pointer; font: inherit; font-size: .88rem;
}
.kana-index button:hover { border-color: var(--accent); color: var(--accent); }
.kana-group { scroll-margin-top: 130px; }
.kana-group[hidden], .term[hidden] { display: none; }
.kana-group h2 { border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.glossary { margin: 0; }
.term {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px; scroll-margin-top: 140px; transition: border-color .3s, box-shadow .3s;
}
.term.focused { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.term dt { font-weight: 700; font-size: 1.02rem; }
.term dd { margin: 4px 0 0; }
.term dd p { margin: 0 0 8px; }

/* ---------- 広告枠 ---------- */
.side-col { position: sticky; top: 76px; display: grid; gap: 16px; }
.side-col .sidebar { position: static; }
.side-col:has(.ad-slot:not([hidden])) .sidebar { max-height: calc(100vh - 380px); min-height: 200px; }
.ad-slot { text-align: center; margin: 24px 0; }
.side-col .ad-slot { margin: 0; }
/* 広告の固有幅で右列が広がらないよう、列幅に合わせて縮める */
.side-col { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.side-col .ad-body { display: block; }
.ad-label { display: block; margin-bottom: 4px; font-size: .72rem; color: var(--text-muted); letter-spacing: .08em; }
.ad-body { display: inline-block; max-width: 100%; overflow: hidden; }
.ad-body img { max-width: 100%; height: auto; }
.ad-footer { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.ad-footer .ad-slot { margin: 0 0 24px; }

/* ---------- 説明ページ ---------- */
.prose { max-width: 50em; }
.prose li { margin: 4px 0; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 960px) {
  .with-sidebar { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .side-col { position: static; }
  .side-col:has(.ad-slot:not([hidden])) .sidebar { max-height: none; }
}
@media (max-width: 720px) {
  .header-inner { gap: 8px; }
  .search { order: 4; max-width: none; flex-basis: 100%; }
  .global-nav {
    order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none;
    /* 右端をぼかして横にスクロールできることを示す */
    -webkit-mask-image: linear-gradient(to right, #000 85%, transparent);
    mask-image: linear-gradient(to right, #000 85%, transparent);
  }
  .global-nav::-webkit-scrollbar { display: none; }
  .global-nav a { white-space: nowrap; }
  .theme-toggle { margin-left: auto; }
  h1, .hero h1 { font-size: 1.45rem; }
  .hero { padding: 24px 18px; }
  .structure { grid-template-columns: 1fr; }
  .list-row { grid-template-columns: 64px minmax(0, 1fr) 16px; gap: 8px; }
  .pager { grid-template-columns: 1fr; }
  .parallel-head { display: none; }
  .parallel-row { grid-template-columns: 1fr; gap: 6px; }
  .map-head { display: none; }
  .map-row, .map-table.two .map-row { grid-template-columns: 1fr; gap: 6px; }
  .glossary-tools { position: static; }
  .official, .explain, .tabs { padding: 14px; }
}
