/* ==========================================================================
   Doc — 文書系ページの共通スタイル
   対象: ニュース一覧 / ニュース記事 / プライバシー / 特定商取引法 / 送信完了(2種)
   本文の文字サイズ・行間・色は style.css の .article-body をそのまま使う
   （コラム記事と同じ値）。ここでは「左端の揃え方」「見出しの飾り」「補助要素」だけを足す。
   色は style.css の変数のみ。書体は足さない。
   ========================================================================== */

:root {
  --doc-measure: 680px;
}

/* ---------- 左端: ヒーローのタイトルと同じ .container の左端に揃える ---------- */
.doc > .article-body,
.doc > .doc-thanks,
.doc > .doc-table {
  max-width: var(--doc-measure);
}

.doc > .doc-table {
  max-width: 880px;
}

/* ---------- h2: コラム記事と同じ「章の切れ目」 ---------- */
.doc .article-body h2 {
  position: relative;
  margin-top: 2.9em;
  padding-top: 22px;
  scroll-margin-top: calc(var(--header-h) + 24px);
  word-break: auto-phrase;
  text-wrap: balance;
  /* 章の頭の線(40×2px)。疑似要素は章番号に使うので、背景で描く */
  background: var(--g-brand) no-repeat 0 0 / 40px 2px;
}

.doc .article-body > h2:first-child {
  margin-top: 0;
}

.doc .article-body ul li + li {
  margin-top: 0.5em;
}

.page-hero .page-title {
  word-break: auto-phrase;
  text-wrap: balance;
}

/* ---------- 末尾の補助行(制定日・戻るリンク) ---------- */
.doc-meta,
.doc-back {
  margin-top: 3em;
  padding-top: 20px;
  border-top: 1px solid var(--c-line);
}

.doc-meta {
  font-size: 0.9rem;
  color: var(--c-text-sub);
}

.doc-back {
  margin-top: 2.6em;
}

/* ---------- プライバシー: 目次 + 章番号 ---------- */
body.doc-page--policy { overflow-x: clip; }

.doc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: clamp(28px, 4vw, 40px);
}

.doc-layout > .article-body {
  min-width: 0;
  max-width: var(--doc-measure);
}

.doc-toc {
  max-width: var(--doc-measure);
  padding-top: 18px;
  border-top: 1px solid var(--c-line);
}

.doc-toc-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-text-sub);
}

.doc-toc ol {
  counter-reset: doctoc;
}

.doc-toc li {
  counter-increment: doctoc;
}

.doc-toc a {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 7px 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--c-text);
  transition: color 0.25s ease;
}

.doc-toc a::before {
  content: counter(doctoc, decimal-leading-zero);
  flex: none;
  font-family: "Inter", var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--c-brand);
}

.doc-toc a:hover {
  color: var(--c-brand);
}

/* 章番号 01, 02 ... */
.doc-layout > .article-body {
  counter-reset: docsec;
}

.doc-layout .article-body h2 {
  counter-increment: docsec;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 14px;
}

.doc-layout .article-body h2::before {
  content: counter(docsec, decimal-leading-zero);
  font-family: "Inter", var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--c-brand);
}

@media (min-width: 1100px) {
  .doc-layout {
    grid-template-columns: minmax(0, var(--doc-measure)) 260px;
    column-gap: 40px;
    justify-content: space-between;
    align-items: start;
    row-gap: 0;
  }

  .doc-layout > .article-body {
    grid-column: 1;
    grid-row: 1;
  }

  /* 目次は本文と同じ1行の中で追従する。行が終われば一緒に流れ、末尾に重ならない */
  .doc-layout > .doc-toc {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    max-width: none;
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
  }

  /* 右側の目次は行間を詰めてよい(タップ領域は32px以上を保つ) */
  .doc-toc a {
    min-height: 32px;
    padding-block: 4px;
  }
}

/* ---------- 特定商取引法: 表 ---------- */
.doc-table th {
  width: 200px;
  padding-left: 0;
  font-size: 1rem;
}

.doc-table td {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--c-text-sub);
}

@media (max-width: 620px) {
  .doc-table th {
    width: 100%;
    white-space: normal;
  }
  .doc-table td {
    padding-left: 0;
  }
}

/* ---------- 送信完了ページ: 左揃え・平らな組み ---------- */
.doc-thanks {
  display: grid;
  gap: 24px;
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--c-line);
}

.doc-thanks-title {
  font-size: var(--fs-h3);
  font-weight: 900;
  color: var(--c-ink);
  word-break: auto-phrase;
  text-wrap: balance;
}

.doc-thanks-lead {
  margin-top: -12px;
  color: var(--c-text-sub);
}

.doc-thanks-list {
  display: grid;
  gap: 12px;
  padding-left: 1.4em;
  list-style: disc;
  color: var(--c-text-sub);
  line-height: 1.9;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
}

/* ガイド完了: 資料カバーを平らに。guide.css は触らずここで上書き */
.doc-thanks .media-visual {
  border-radius: 0;
}

.doc-thanks .guide-cover {
  margin-inline: 0;
  max-width: 240px;
  border-radius: 4px 20px 4px 20px;
  box-shadow: none;
}

.doc-thanks .guide-form-note {
  margin-top: 12px;
  text-align: left;
}

/* ガイド完了: 820px以上は2列(左=カバー、右=ボタン・注記・箇条書き・リンク)。
   DOM順(カバー→ボタン→注記→箇条書き→リンク)は変えず、グリッドだけで配置する */
@media (min-width: 820px) {
  .doc > .doc-thanks--guide {
    max-width: 880px;
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: clamp(48px, 6vw, 64px);
    align-items: start;
  }

  .doc-thanks--guide > * {
    grid-column: 2;
    min-width: 0;
  }

  .doc-thanks--guide > .media-visual {
    grid-column: 1;
    grid-row: 1 / span 3;
  }
}

/* お問い合わせ完了ページ: 下部の電話案内(.cta-banner 自体は変えない) */
.doc-flush {
  padding-block: 0;
}

.doc-tel-note {
  font-size: 0.75em;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .doc-toc a { transition: none; }
}
