/* ============================================================
   PropDesk – ブログ／お知らせ 2カラムレイアウト
   使用テンプレート: single.php（記事詳細）/ page-news.php（一覧）
   左＝本文（広い）／右＝サイドバー（狭い・関連記事＆CTA）
   ============================================================ */

.pd-2col {
  max-width: 1180px;
  margin: 48px auto 72px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 44px;
  align-items: start;
}

.pd-2col__main { min-width: 0; }

/* ---- サイドバー本体 ---- */
.pd-sidebar { min-width: 0; }
.pd-sidebar__sticky {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.pd-side-block {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 18px 18px 8px;
}
.pd-side-block__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--gray-800);
  letter-spacing: -0.2px;
  padding-bottom: 12px;
  margin-bottom: 6px;
  border-bottom: 2px solid var(--green-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pd-side-block__title::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
  flex: none;
}

/* ---- 関連記事／人気記事リスト ---- */
.pd-side-posts { list-style: none; margin: 0; padding: 0; }
.pd-side-post + .pd-side-post { border-top: 1px solid var(--gray-100); }
.pd-side-post__link {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 2px;
  text-decoration: none;
  border-radius: 8px;
  transition: background .15s;
}
.pd-side-post__link:hover { background: var(--gray-50); text-decoration: none; }
.pd-side-post__link:hover .pd-side-post__title { color: var(--green); }

.pd-side-post__thumb {
  flex: none;
  width: 88px;
  height: 66px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--green-bg);
  border: 1px solid var(--gray-200);
}
.pd-side-post__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pd-side-post__body { display: block; min-width: 0; }
.pd-side-post__cat {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}
.pd-side-post__title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.55;
  color: var(--gray-800);
  transition: color .15s;
  /* 3行までで省略 */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pd-side-post__date {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--gray-400);
}

/* ---- カテゴリー一覧 ---- */
.pd-side-cats { list-style: none; margin: 0; padding: 0 0 10px; }
.pd-side-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-600);
  text-decoration: none;
  border-bottom: 1px solid var(--gray-100);
  transition: color .15s;
}
.pd-side-cats li:last-child .pd-side-cat { border-bottom: 0; }
.pd-side-cat:hover { color: var(--green); text-decoration: none; }
.pd-side-cat.is-active { color: var(--green); font-weight: 800; }
.pd-side-cat__count {
  flex: none;
  min-width: 26px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  background: var(--gray-100);
  border-radius: 999px;
  padding: 2px 8px;
}
.pd-side-cat.is-active .pd-side-cat__count { color: var(--green); background: var(--green-bg); }

/* ---- サイドバーCTA ---- */
.pd-side-cta {
  background: linear-gradient(160deg, #1a7a3c 0%, #22a050 100%);
  border-radius: 14px;
  padding: 22px 20px;
  color: #fff;
  box-shadow: 0 6px 18px rgba(26,122,60,.18);
}
.pd-side-cta__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  opacity: .85;
  margin-bottom: 8px;
}
.pd-side-cta__title { font-size: 16px; font-weight: 800; line-height: 1.55; margin-bottom: 10px; }
.pd-side-cta__desc { font-size: 12.5px; line-height: 1.75; opacity: .92; margin-bottom: 16px; }
.pd-side-cta__btn {
  display: block;
  text-align: center;
  background: #fff;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  padding: 11px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform .1s, box-shadow .15s;
}
.pd-side-cta__btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.14); text-decoration: none; }
.pd-side-cta__sub {
  display: block;
  text-align: center;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  text-decoration: none;
}
.pd-side-cta__sub:hover { text-decoration: underline; }

/* ---- レスポンシブ ----
   1024px以下は1カラムに落とし、サイドバーは本文の下へ回す */
@media (max-width: 1024px) {
  .pd-2col {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    max-width: 860px;
  }
  .pd-sidebar__sticky { position: static; }
}

@media (max-width: 640px) {
  .pd-2col { margin: 32px auto 56px; padding: 0 20px; gap: 32px; }
  .pd-side-post__thumb { width: 78px; height: 58px; }
}

/* ============================================================
   記事の目次（TOC）とスムーススクロール
   生成は includes/post-toc.php（the_contentフィルター）
   ============================================================ */

/* 目次リンクのページ内移動をスムーススクロールにする。
   「動きを減らす」設定のユーザーには即時ジャンプにフォールバックする */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* 追従ヘッダー（64px）に見出しが隠れないよう、着地位置をずらす */
.article-body h2,
.article-body h3 { scroll-margin-top: 88px; }

.pd-toc {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  padding: 20px 24px;
  margin: 32px 0 36px;
}
.pd-toc__details { margin: 0; }
.pd-toc__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--gray-800);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.pd-toc__summary::-webkit-details-marker { display: none; }
.pd-toc__summary::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--green);
  flex: none;
}
/* 開閉インジケーター（右端の三角） */
.pd-toc__summary::after {
  content: "";
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--gray-400);
  border-bottom: 2px solid var(--gray-400);
  transform: rotate(45deg);
  transition: transform .15s;
}
.pd-toc__details[open] .pd-toc__summary::after { transform: rotate(-135deg); }
.pd-toc__summary:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.pd-toc__list {
  counter-reset: pd-toc;
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--gray-200);
}
.pd-toc__item { margin: 0; }
.pd-toc__item--h2 { counter-increment: pd-toc; }
/* 本文リンクの色（.article-body a）に負けないよう、目次側の詳細度を上げる */
.pd-toc .pd-toc__link {
  display: block;
  padding: 7px 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--gray-700, #4b5563);
  text-decoration: none;
  transition: color .15s;
}
.pd-toc .pd-toc__link:hover { color: var(--green); text-decoration: underline; }
.pd-toc .pd-toc__item--h2 > .pd-toc__link { font-weight: 700; color: var(--gray-800); }
.pd-toc__item--h2 > .pd-toc__link::before {
  content: counter(pd-toc) ". ";
  color: var(--green);
  font-weight: 800;
}
/* h3はぶら下げてh2との階層が分かるようにする */
.pd-toc .pd-toc__item--h3 > .pd-toc__link {
  padding-left: 22px;
  font-size: 13.5px;
  position: relative;
  color: var(--gray-600);
}
.pd-toc__item--h3 > .pd-toc__link::before {
  content: "";
  position: absolute;
  left: 6px;
  /* 折り返して複数行になっても1行目の高さに合わせる（top:50%だと中央にずれる） */
  top: 18px;
  width: 8px;
  height: 1px;
  background: var(--gray-400);
}

@media (max-width: 640px) {
  .pd-toc { padding: 16px 18px; margin: 26px 0 30px; }
  .pd-toc__link { padding: 8px 0; }
}

/* ---- 記事CTA（本文直下バナー & 記事中カード / includes/post-cta.php） ---- */
.pd-cta {
  border-radius: 14px;
  background: linear-gradient(135deg, #1a7a3c 0%, #14602f 100%);
  color: #fff;
  padding: 28px 30px;
  margin: 36px 0;
}
.pd-cta--banner { margin-top: 48px; padding: 34px 36px; }
.pd-cta__label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .16);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}
.pd-cta__title { font-size: 19px; font-weight: 800; line-height: 1.5; margin-bottom: 8px; }
.pd-cta--banner .pd-cta__title { font-size: 22px; }
.pd-cta__lead { font-size: 13.5px; line-height: 1.8; opacity: .92; margin: 0 0 18px; }
.pd-cta__actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pd-cta__btn {
  display: inline-block;
  background: #fff;
  color: #1a7a3c;
  font-weight: 800;
  font-size: 14.5px;
  border-radius: 999px;
  padding: 12px 26px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  transition: transform .15s, box-shadow .15s;
}
.pd-cta__btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .16); text-decoration: none; color: #14602f; }
.pd-cta__link { color: #fff; font-size: 13.5px; font-weight: 700; text-decoration: underline; }
.pd-cta__link:hover { opacity: .85; color: #fff; }
/* 記事本文内(.article-body)に挿入された場合のリンク色の上書き */
.article-body .pd-cta a { color: inherit; }
.article-body .pd-cta a.pd-cta__btn { color: #1a7a3c; }

@media (max-width: 640px) {
  .pd-cta, .pd-cta--banner { padding: 24px 20px; }
  .pd-cta__btn { width: 100%; text-align: center; }
}
