/* =========================================================
   中小企業診断士 2次試験 解説サイト  共通スタイル
   ========================================================= */

:root {
  --c-bg:        #f5f6f8;
  --c-surface:   #ffffff;
  --c-text:      #1f2933;
  --c-text-sub:  #52606d;
  --c-border:    #e1e5ea;
  --c-accent:    #1f6feb;
  --c-accent-d:  #14479e;

  /* 事例別カラー */
  --c-jirei1: #c0392b; /* 事例Ⅰ 組織・人事 */
  --c-jirei2: #d68910; /* 事例Ⅱ マーケ・流通 */
  --c-jirei3: #1e8449; /* 事例Ⅲ 生産・技術 */
  --c-jirei4: #2471a3; /* 事例Ⅳ 財務・会計 */

  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --maxw: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans",
               "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- ヘッダー ---------- */
.site-header {
  background: linear-gradient(120deg, #14479e, #1f6feb);
  color: #fff;
  padding: 28px 20px;
}
.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
}
.site-header h1 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: .02em;
}
.site-header p {
  margin: 6px 0 0;
  font-size: .9rem;
  opacity: .9;
}

/* ---------- 本文コンテナ ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ---------- パンくず ---------- */
.breadcrumb {
  font-size: .82rem;
  color: var(--c-text-sub);
  margin: 0 0 18px;
}
.breadcrumb a { color: var(--c-text-sub); }

/* ---------- 目次マトリクス ---------- */
.intro {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.intro h2 { margin-top: 0; font-size: 1.1rem; }
.intro p { margin: .4em 0; color: var(--c-text-sub); font-size: .92rem; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: .85rem;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.j1 { background: var(--c-jirei1); }
.dot.j2 { background: var(--c-jirei2); }
.dot.j3 { background: var(--c-jirei3); }
.dot.j4 { background: var(--c-jirei4); }

.matrix-wrap { overflow-x: auto; }
table.matrix {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-width: 560px;
}
table.matrix th, table.matrix td {
  border: 1px solid var(--c-border);
  padding: 10px 8px;
  text-align: center;
  font-size: .92rem;
}
table.matrix thead th {
  background: #eef2f7;
  font-weight: 700;
  color: var(--c-text);
}
table.matrix thead th.j1 { border-top: 3px solid var(--c-jirei1); }
table.matrix thead th.j2 { border-top: 3px solid var(--c-jirei2); }
table.matrix thead th.j3 { border-top: 3px solid var(--c-jirei3); }
table.matrix thead th.j4 { border-top: 3px solid var(--c-jirei4); }
table.matrix th.year {
  background: #eef2f7;
  white-space: nowrap;
  font-weight: 700;
}
table.matrix td a {
  display: block;
  padding: 4px 2px;
  border-radius: 6px;
  font-weight: 600;
}
table.matrix td a:hover { background: #eaf1ff; text-decoration: none; }
table.matrix td.na { color: #b3bcc6; }
table.matrix td.soon { color: #aab2bc; font-size: .8rem; }

/* ---------- 問題ページ ---------- */
.paper-head {
  border-left: 6px solid var(--c-accent);
  padding: 4px 0 4px 16px;
  margin-bottom: 8px;
}
.paper-head.j1 { border-color: var(--c-jirei1); }
.paper-head.j2 { border-color: var(--c-jirei2); }
.paper-head.j3 { border-color: var(--c-jirei3); }
.paper-head.j4 { border-color: var(--c-jirei4); }
.paper-head .badge {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}
.paper-head.j1 .badge { background: var(--c-jirei1); }
.paper-head.j2 .badge { background: var(--c-jirei2); }
.paper-head.j3 .badge { background: var(--c-jirei3); }
.paper-head.j4 .badge { background: var(--c-jirei4); }
.paper-head h2 { margin: 0; font-size: 1.4rem; }
.paper-meta {
  font-size: .85rem;
  color: var(--c-text-sub);
  margin: 6px 0 24px 16px;
}

/* セクション見出し */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 34px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--c-border);
}

/* 与件文 */
.yoken {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 8px 26px 18px;
  box-shadow: var(--shadow);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
}
.yoken h4 {
  font-family: "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: .95rem;
  margin: 22px 0 4px;
  color: var(--c-accent-d);
}
.yoken p {
  margin: 1em 0;
  text-align: justify;
}
.yoken .para {
  position: relative;
  padding-left: 30px;
}
.yoken .para .pn {
  position: absolute;
  left: 0; top: .35em;
  font-family: sans-serif;
  font-size: .7rem;
  color: #9aa5b1;
  background: #eef2f7;
  border-radius: 4px;
  padding: 0 5px;
  line-height: 1.5;
}

/* 設問 */
.q {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.q-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.q-no { font-weight: 700; font-size: 1.05rem; }
.q-tag {
  font-size: .76rem;
  background: #eef2f7;
  color: var(--c-text-sub);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}
.q-tag.point { background: #fdecea; color: var(--c-jirei1); }
.q-tag.limit { background: #eaf1ff; color: var(--c-accent-d); }
.q-body { margin: 0; }
.q-sub {
  margin: 12px 0 0;
  padding: 10px 14px;
  border-left: 3px solid var(--c-border);
  background: #fafbfc;
  border-radius: 0 6px 6px 0;
}
.q-sub .label { font-weight: 700; font-size: .9rem; display: block; margin-bottom: 2px; }

/* 財務諸表テーブル（事例Ⅳ） */
.fin-table-wrap { overflow-x: auto; margin: 14px 0; }
table.fin {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: .86rem;
  background: var(--c-surface);
}
table.fin caption {
  font-weight: 700;
  padding: 8px;
  font-size: .92rem;
}
table.fin th, table.fin td {
  border: 1px solid var(--c-border);
  padding: 5px 9px;
}
table.fin th { background: #eef2f7; }
table.fin td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.fin td.lbl-indent { padding-left: 22px; }
table.fin tr.subtotal td { background: #f7f9fb; font-weight: 700; }

/* 解説プレースホルダ（未作成時） */
.kaisetsu {
  margin-top: 14px;
  border: 1px dashed #c7ced6;
  border-radius: 8px;
  padding: 12px 16px;
  background: #fbfcfd;
  color: var(--c-text-sub);
  font-size: .88rem;
}
.kaisetsu .ttl { font-weight: 700; color: var(--c-text); }

/* 解答例・解説（開閉式 details） */
details.kaisetsu {
  margin-top: 14px;
  border: 1px solid var(--c-border);
  border-style: solid;
  border-radius: 8px;
  padding: 0;
  background: #fff;
  color: var(--c-text);
  overflow: hidden;
}
details.kaisetsu > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 16px;
  font-size: .9rem;
  font-weight: 700;
  color: var(--c-accent-d);
  background: #eef4ff;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.kaisetsu > summary::-webkit-details-marker { display: none; }
details.kaisetsu > summary::before {
  content: "▶";
  font-size: .7rem;
  transition: transform .15s;
}
details.kaisetsu[open] > summary::before { transform: rotate(90deg); }
details.kaisetsu > summary:hover { background: #e2ecff; }

.ans, .exp { padding: 14px 18px; }
.ans { border-bottom: 1px solid var(--c-border); background: #fcfdff; }
.ans-ttl, .exp-ttl {
  display: inline-block;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  border-radius: 4px;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.ans-ttl { background: var(--c-accent); }
.exp-ttl { background: #5a6b7b; }
.ans .cnt {
  font-size: .76rem;
  color: var(--c-text-sub);
  margin-left: 8px;
  font-weight: 600;
}
.ans p, .exp p { margin: .5em 0; }
.ans .model {
  background: #f3f7ff;
  border-left: 3px solid var(--c-accent);
  border-radius: 0 6px 6px 0;
  padding: 10px 14px;
  margin: 4px 0;
  line-height: 1.9;
}
.ans .model.sub { margin-top: 10px; }
.ans .model .sublabel { font-weight: 700; color: var(--c-accent-d); margin-right: 6px; }
.exp { font-size: .9rem; color: var(--c-text-sub); }
.exp p strong, .exp strong { color: var(--c-text); }
.exp ul { margin: .4em 0; padding-left: 1.3em; }
.exp ul li { margin: .25em 0; }
.exp .step {
  font-weight: 700;
  color: var(--c-accent-d);
  display: block;
  margin: .8em 0 .2em;
}
.exp .calc {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  background: #f5f6f8;
  border-radius: 6px;
  padding: 8px 12px;
  margin: .4em 0;
  font-size: .85rem;
  white-space: pre-wrap;
  line-height: 1.7;
}

/* 目次に戻るボタン（各ページ下部） */
.backtop {
  margin-top: 36px;
  text-align: center;
}
.backtop a {
  display: inline-block;
  background: var(--c-accent);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
  padding: 13px 34px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.backtop a:hover { background: var(--c-accent-d); text-decoration: none; }

/* ナビ（前後） */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 40px;
}
.pager a {
  flex: 1;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: .9rem;
}
.pager a:hover { background: #eaf1ff; text-decoration: none; }
.pager a.next { text-align: right; }
.pager a span { display: block; font-size: .72rem; color: var(--c-text-sub); }

/* フッター */
.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-sub);
  font-size: .82rem;
  text-align: center;
  padding: 22px 20px;
}

@media (max-width: 600px) {
  .site-header h1 { font-size: 1.2rem; }
  .yoken { padding: 8px 16px 14px; }
  .q { padding: 14px 16px; }
  .pager { flex-direction: column; }
}

/* 総合トップ（ポータル）へのリンクボタン */
.to-portal { margin: 0 0 10px; }
.to-portal a {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 999px;
  text-decoration: none;
}
.to-portal a:hover { background: #1d4ed8; }
