/* 読み物・補助ツールページで共通して使うレイアウト */

html {
  scroll-behavior: smooth;
}

.tool-header {
  padding-top: 30px;
}

.breadcrumb {
  margin: 16px 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.breadcrumb li + li::before {
  content: ">";
  opacity: 0.65;
}

/* パンくずの各リンクも独立した操作対象なので、
   WCAG 2.2 達成基準 2.5.8 の24pxを満たす高さを確保する。 */
.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--color-muted);
}

/* グリッドのgapで等間隔に並べると、見出しの前後で余白の強弱がつけられない。
   ブロックレイアウトにして、縦のリズムは見出しのマージンに任せる。 */
/* トップページのナビ・モード切替と同じ max-width + 左右20px に揃える。 */
.subpage-layout {
  max-width: var(--subpage-max-width, var(--measure));
  margin: 0 auto 96px;
  padding: 0 20px;
  display: block;
}

.section-heading {
  margin-bottom: 0;
}

/* 各ページの先頭に置く見出しはそのページの表題にあたるため、
   セクション見出し（H2相当）より一段大きくして階層を明示する。 */
.subpage-layout > .section-heading:first-of-type > h2 {
  margin-top: 40px;
  font-size: var(--font-size-h1);
  line-height: 1.4;
}

@media (min-width: 48rem) {
  .subpage-layout > .section-heading:first-of-type > h2 {
    margin-top: 64px;
  }
}

.section-heading p,
.section-heading ul {
  margin: var(--space-block) 0 0;
}

.compact-footer {
  padding-top: 0;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
}

.back-to-top a {
  display: block;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--color-hero-bg);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: opacity var(--transition-fast);
}

.back-to-top a:hover {
  opacity: 0.85;
}

@media (max-width: 680px) {
  .subpage-layout {
    margin-top: 20px;
  }
}

@media (max-width: 480px) {
  .subpage-layout {
    padding: 0 16px;
  }
}

@media (max-width: 560px) {
  .back-to-top {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .back-to-top a {
    padding: 9px 14px;
    font-size: 0.875rem;
  }
}
