/*
Theme Name: 政治百科
Version: 0.4.1
Text Domain: seijihyakka
*/

:root {
  --paper: #fffaf1;
  --surface: #fffdf8;
  --ink: #282b25;
  --muted: #575d51;
  --line: #ddd5c5;
  --green: #214b3d;
  --sage: #eaf0e6;
  --ochre: #9b492a;
  --ochre-light: #f8e7d6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.8;
}

a { color: var(--green); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }
body > header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px max(20px, calc((100% - 1000px) / 2));
}
.logo { color: var(--green); font-size: 25px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.logo small { font-size: 16px; font-weight: 500; }
nav { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 6px; font-size: 14px; }
nav a { text-decoration: none; }
nav a:hover, .category:hover { text-decoration: underline; }
.hero { background: var(--sage); padding: clamp(36px, 8vw, 86px) 20px; text-align: center; }
.hero h1, article h1 {
  color: var(--green);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(32px, 7vw, 56px);
  line-height: 1.32;
  margin: 0 0 .45em;
  letter-spacing: .025em;
}
.hero .sub { font-size: clamp(14px, 3.6vw, 17px); }
.search { display: flex; max-width: 460px; margin: 22px auto 0; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border: 1px solid #989c8e;
  border-radius: 8px 0 0 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}
.search button { background: var(--green); color: white; border: 0; border-radius: 0 8px 8px 0; padding: 0 18px; cursor: pointer; }
main { max-width: 1000px; padding: 32px 20px 48px; margin: auto; }
main > section { margin-top: 36px; }
.categories { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; }
.category {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}
.category svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--green);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 6px;
}
.category small, .sh-related-list small { color: var(--muted); font-weight: 500; }
.category small { display: block; }
.topic { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }

article { max-width: 690px; margin: auto; overflow-wrap: anywhere; }
article img { max-width: 100%; height: auto; }
article > p, article > ul, article > ol { margin: 0 0 1.1em; font-size: clamp(16px, 4.2vw, 18px); }
article > p strong { color: var(--green); font-weight: 750; }
article > h2 {
  color: var(--green);
  margin: 2.15em 0 .85em;
  padding-inline-start: .65em;
  border-inline-start: 4px solid var(--ochre);
  font-size: clamp(23px, 5.9vw, 32px);
  line-height: 1.4;
  scroll-margin-top: 52px;
}
article > h2 + p { margin-top: 0; }
.eyebrow, .sub { font-size: 14px; color: var(--muted); }
.eyebrow { font-size: 12px; }
.sh-article .summary {
  margin: 20px 0;
  padding: 16px 18px;
  background: var(--ochre-light);
  border-inline-start: 4px solid var(--ochre);
  border-radius: 0 10px 10px 0;
}
.summary > strong { color: #7b361c; }
.summary p { margin: .25em 0 0; }
.sh-article .sh-lead { font-size: clamp(18px, 4.6vw, 21px); font-weight: 650; line-height: 1.7; }
.sh-toc, .sh-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 24px 0;
}
.sh-toc { margin-bottom: 0; }
.sh-toc summary { cursor: pointer; font-weight: 700; color: var(--green); }
.sh-toc ol { padding-inline-start: 24px; margin: 8px 0 0; }
.sh-toc a { display: inline-block; padding: 4px 0; }
.sh-panel h2, .sh-panel h3 { font-size: 20px; line-height: 1.45; color: var(--green); margin: 0 0 12px; }
.sh-panel > p:last-child { margin-bottom: 0; }
.sh-metric-grid, .sh-flow-group ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: 8px;
  margin: 0;
}
.sh-metric, .sh-flow-group li, .sh-related-list li {
  background: var(--sage);
  border: 1px solid #d7e0d4;
  border-radius: 8px;
  padding: 10px 12px;
}
.sh-metric dt { font-weight: 700; }
.sh-metric dd, .sh-bar-row dd { margin: 0; }
.sh-metric dd { font-size: 13px; }
.sh-metric dd.sh-metric-value {
  color: var(--green);
  font-size: clamp(21px, 5vw, 27px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.sh-chart { margin: 0; }
.sh-bar-row {
  display: grid;
  grid-template-columns: minmax(37px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
  font-size: 14px;
}
.sh-bar-track { position: relative; background: var(--sage); height: 13px; border-radius: 3px; }
.sh-bar-track i { position: absolute; top: 0; height: 100%; background: var(--green); border-radius: 3px; }
.sh-bar-row:last-child .sh-bar-track i { background: var(--ochre); }
.sh-bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; }
.sh-flow-group ul, .sh-panel .sh-related-list { list-style: none; padding: 0; }
.sh-flow-group li span { display: block; font-size: 14px; }
.sh-hub { background: var(--green); color: white; text-align: center; padding: 10px; border-radius: 8px; }
.sh-flow-arrow { text-align: center; font-weight: 700; color: var(--ochre); }
.sh-policy-table { overflow-x: auto; padding-bottom: 4px; }
.sh-policy-table table { border-collapse: collapse; width: 100%; font-size: 14px; }
.sh-policy-table th, .sh-policy-table td { padding: 9px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.sh-policy-table thead th { background: var(--green); color: white; }
.sh-policy-table tbody th { background: var(--sage); min-width: 80px; }
.sh-policy-table td { min-width: 150px; }
.sh-scroll-hint { display: none; }
.sh-related-list { display: grid; gap: 8px; }
.sh-related-list p { margin: 2px 0 0; font-size: 14px; }
.wp-block-table { overflow: auto; }
footer { background: var(--green); color: white; text-align: center; padding: 24px 16px; font-size: 13px; }

@media (max-width: 600px) {
  main { padding: 24px 16px 40px; }
  .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sh-scroll-hint { display: block; margin: 0 0 8px; }
  .sh-metric-grid { grid-template-columns: minmax(0, 1fr); }
}
