/* Arch 公式サイトの共通スタイル。
   左に章目次を常時置くドキュメント型のレイアウトを提供する。
   配色はトップページから引き継いだトークンをそのまま使う。 */

:root {
  --bg: #F8FAF8;
  --surface: #F2F4F2;
  --surface-2: #ECEEEC;
  --text: #191C1B;
  --text-muted: #3F4945;
  --primary: #006B5D;
  --on-primary: #FFFFFF;
  --primary-container: #9CF2E0;
  --on-primary-container: #00201B;
  --outline: #BEC9C4;
  --accent: #9C4332;
  --sidebar-w: 288px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191C1B;
    --surface: #1D201F;
    --surface-2: #232726;
    --text: #E1E3E1;
    --text-muted: #BEC9C4;
    --primary: #80D5C3;
    --on-primary: #003730;
    --primary-container: #005046;
    --on-primary-container: #9CF2E0;
    --outline: #3F4945;
    --accent: #FFB4A2;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.85;
  font-size: 16px;
}

a { color: var(--primary); }

/* ── 上部バー ─────────────────────────────────────────── */
header.site {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--outline);
  background: var(--surface);
}

header.site .bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
}

.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .04em;
  text-decoration: none;
  color: var(--text);
}

header.site nav { margin-left: auto; }
header.site nav a { margin-left: 18px; text-decoration: none; font-size: 15px; }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--outline);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  padding: 6px 12px;
  cursor: pointer;
}

/* ── 本体：左に目次、右に本文 ───────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}

aside.toc {
  position: sticky;
  top: 57px;
  max-height: calc(100vh - 57px);
  overflow-y: auto;
  border-right: 1px solid var(--outline);
  padding: 24px 16px 48px;
  background: var(--bg);
}

aside.toc h2 {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 8px;
  font-weight: 700;
}

aside.toc h2:first-child { margin-top: 0; }

aside.toc ul { list-style: none; margin: 0 0 8px; padding: 0; }

aside.toc li a {
  display: block;
  padding: 5px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.5;
  border-left: 2px solid transparent;
}

aside.toc li a:hover { background: var(--surface); color: var(--text); }

/* いま開いているページ。塗りつぶしは「選択中」の誤解を招くため使わず、
   「左の縦線＋太字」で示す。 */
aside.toc li a.current {
  color: var(--text);
  font-weight: 700;
  border-left-color: var(--accent);
  background: var(--surface);
}

aside.toc li.sub a { padding-left: 26px; font-size: 13.5px; }

main.doc {
  padding: 40px 40px 96px;
  min-width: 0;
  max-width: 860px;
}

main.doc > h1 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.35;
  margin: 0 0 12px;
}

main.doc .lead {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0 0 32px;
}

main.doc h2 {
  font-size: 22px;
  margin: 44px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--outline);
  scroll-margin-top: 72px;
}

main.doc h3 {
  font-size: 17.5px;
  margin: 28px 0 6px;
  scroll-margin-top: 72px;
}

main.doc p { margin: 0 0 14px; }
main.doc ul, main.doc ol { margin: 0 0 16px; padding-left: 24px; }
main.doc li { margin-bottom: 6px; }

main.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 15px;
}

main.doc th, main.doc td {
  border: 1px solid var(--outline);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

main.doc th { background: var(--surface); font-weight: 700; }

/* 1列目が短い項目名（「会員」「申請」など）の表で、その列が縦積みに潰れるのを防ぐ。
   説明の入る2列目に余った幅を回す。 */
main.doc table th:first-child,
main.doc table td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* ただし1列目にも長い文が入る表（2列目が短い等）では折り返してよい。 */
main.doc table.wrap-first th:first-child,
main.doc table.wrap-first td:first-child {
  white-space: normal;
  width: auto;
}

.note {
  background: var(--surface-2);
  border-left: 4px solid var(--primary);
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 20px;
}

.note.warn { border-left-color: var(--accent); }
.note strong { color: var(--text); }

.cards {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 18px 20px;
}

.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p { margin: 0; color: var(--text-muted); font-size: 15px; }

.muted { color: var(--text-muted); font-size: 15px; }

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  vertical-align: middle;
  margin-left: 8px;
}

/* ボタンは塗らない（枠線で示す）。塗ると現在地の表示と紛れるため。 */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid currentColor;
}

.btn[aria-disabled="true"] {
  color: var(--text-muted);
  border-color: var(--text-muted);
  pointer-events: none;
}

.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 24px; }

.steps { counter-reset: step; list-style: none; padding-left: 0; }

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 20px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps > li > strong { display: block; font-size: 17px; margin-bottom: 2px; }

.pagenav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--outline);
  font-size: 15px;
}

footer.site {
  border-top: 1px solid var(--outline);
  background: var(--surface);
  padding: 28px 20px 48px;
  font-size: 14px;
  color: var(--text-muted);
}

footer.site .inner { max-width: 1280px; margin: 0 auto; }
footer.site ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; gap: 18px; flex-wrap: wrap; }

/* ── 画面が狭いとき ────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-toggle { display: inline-block; }

  aside.toc {
    display: none;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--outline);
  }

  aside.toc.open { display: block; }
  main.doc { padding: 28px 20px 72px; }
}
