/* =====================================================================
   Fandom State Book — gaudiy.com に倣ったデザイン
   - 配色: オフホワイト＋方眼グリッド背景／ニアブラック文字（白黒基調）
   - 連番ナビ・等幅テクニカル表記・ピルボタン・↗ リンク
   - 書体: 本文 = Inter + Noto Sans JP / 連番・ラベル = 等幅
   ===================================================================== */

:root {
  --max-width: 44rem;
  --page-bg: #f2f2f2;
  --surface: #ffffff;
  --bg-alt: #f5f5f5;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --ink: #111111;
  --grid: rgba(0, 0, 0, 0.045);
  --font-body: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-display: "Inter", var(--font-body);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Courier New", monospace;
}

* { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--fg);
  background-color: var(--page-bg);
  /* gaudiy.com の方眼グリッド背景 */
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  font-family: var(--font-body);
  line-height: 1.85;
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { border-color: var(--ink); }

/* --- draft banner ------------------------------------------------------ */
.draft-banner {
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
  flex-wrap: wrap;
}
.draft-banner__tag {
  font-family: var(--font-mono);
  border: 1px solid #fff;
  border-radius: 3px;
  padding: 0.05rem 0.45rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.draft-banner__text { color: #e0e0e0; }

/* --- header (方眼の上に透過で乗せる) ----------------------------------- */
.site-header { background: transparent; }
.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-header__brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: none;
}
.site-header__brand:hover { border-bottom: none; opacity: 0.7; }

/* --- language switcher (JP / EN) --------------------------------------- */
.lang-switcher {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.lang-switcher__item {
  color: var(--muted);
  border-bottom: none;
  text-transform: uppercase;
}
.lang-switcher__item:hover { color: var(--ink); border-bottom: none; }
.lang-switcher__item.is-active { color: var(--ink); font-weight: 700; }
.lang-switcher__sep { color: #c2c2c2; margin: 0 0.5rem; }

/* --- main content (方眼の上の白いシート) ------------------------------- */
.content {
  max-width: var(--max-width);
  margin: 2.5rem auto 0;
  padding: 3.5rem 3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}

h1, h2, h3, h4 {
  line-height: 1.45;
  font-weight: 700;
  letter-spacing: 0.01em;
}
h1 { font-size: 2rem; margin: 0 0 1.5rem; }
h2 {
  font-size: 1.4rem;
  margin: 3rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}
h3 { font-size: 1.1rem; margin: 2rem 0 0.75rem; }

p { margin: 1.2rem 0; }
strong { font-weight: 700; }
img { max-width: 100%; height: auto; }

hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }

blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--ink);
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 0.95rem;
}
blockquote p { margin: 0.5rem 0; }

code {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* --- home / page hero -------------------------------------------------- */
.page h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* トップページの英語併記ブロック。
   本文と同じ文字色のまま、細い罫線で日本語の段落と切り分ける。 */
.lede-en {
  margin: 2.25rem 0;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}
.lede-en p { margin: 0 0 1.1rem; }
.lede-en p:last-child { margin-bottom: 0; }

.lede-en__note { margin-top: 1.6rem; }

/* ピルボタン（gaudiy の「くわしく見る ↗」風） */
.pill-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}
.pill:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill--solid { background: var(--ink); color: #fff; }
.pill--solid:hover { opacity: 0.85; }

/* --- chapter ----------------------------------------------------------- */
.chapter__header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}
.chapter__kicker {
  font-family: var(--font-mono);
  color: var(--muted);
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.chapter__title { margin: 0; font-size: 1.9rem; }
.chapter__body h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* --- table of contents (連番テクニカル表記) --------------------------- */
.toc { list-style: none; padding: 0; margin: 2.5rem 0 0; }
.toc__item { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.toc__item:first-child { border-top: 1px solid var(--line); }
.toc__item a {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  border-bottom: none;
}
.toc__item a:hover .toc__title { border-bottom: 1px solid var(--ink); }
.toc__order {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.toc__title { font-weight: 600; color: var(--ink); }
.toc__desc {
  margin: 0.35rem 0 0 3.1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

/* --- chapter navigation ------------------------------------------------ */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}
.chapter-nav a { border-bottom: none; color: var(--muted); }
.chapter-nav a:hover { color: var(--ink); }
.chapter-nav__index a {
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chapter-nav__next { text-align: right; }

/* --- footer ------------------------------------------------------------ */
.site-footer { margin-top: 4rem; background: var(--ink); color: #cfcfcf; }
.site-footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  font-size: 0.85rem;
  line-height: 1.8;
}
.site-footer a { color: #fff; border-bottom-color: #555; }
.site-footer a:hover { border-bottom-color: #fff; }
.site-footer__note { color: #8a8a8a; margin-top: 0.5rem; }

/* --- responsive -------------------------------------------------------- */
@media (max-width: 600px) {
  html { font-size: 16px; }
  .content { margin: 1.5rem 1rem 0; padding: 2rem 1.4rem; border-radius: 4px; }
  .page h1 { font-size: 2rem; }
  .chapter__title { font-size: 1.5rem; }
}
