/* カテゴリ一覧：サムネだけの詰めグリッド（雑記以外） */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 6px 0 14px;
}

.cats-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #f2f4f7;
  aspect-ratio: 125/176;
  /* 横長にしたいなら 16/9 */
}

.cats-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}

.cats-thumb:hover img {
  transform: scale(1.03);
}

/* ===================== Modal (統合版) ===================== */

/* 画面全体のモーダル層 */
.post-modal {
  position: fixed;
  inset: 0;
  display: none;
}

.post-modal[aria-hidden="false"] {
  display: block;
  /* 中央寄せはやめる（ヘッダー下に寄せるため） */
}

.post-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
}

/* ヘッダー高さ（必要に応じてJSで上書き可） */
:root {
  --header-h: 80px;
}

/* モーダルの外側スクロール＆上寄せ（=上辺をヘッダー直下へ） */
.post-modal__center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  /* ← 上に寄せる */
  justify-content: center;
  padding: calc(var(--header-h)) clamp(12px, 4vw, 32px) 16px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ダイアログ本体（カードの親）。ボタンのabsolute基準にする */
.post-modal__dialog {
  position: relative;
  /* ★ これが重要：ボタンの基準 */
  margin: 0 auto;
  width: min(92vw, 720px);
  background: transparent;
  padding-top: 44px;
  /* ★ ボタン分のクリアランス */
}

/* コンテンツ差し替え領域（記事などを注入） */
.post-modal__content {
  position: relative;
  z-index: 1;
  /* ボタンはz-index:3で上に載る */
}

/* カード化（見た目） */
.article-card--modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
  overflow: hidden;
}

/* 画像 */
.article-thumb-wrap {}

.article-thumb-wrap--modal {
  width: 100%;
  padding-top: 80px;

}

.article-thumb-wrap img.article-thumb-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* 日付（小さめ、センター） */
.article-dates--modal {
  margin: 10px auto 0;
  padding: 0 16px;
  max-width: 640px;
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.6;
  text-align: center;
}

/* タイトル＆本文余白 */
.article-card-body {
  padding: 12px 16px 16px;
}

.article-title--modal {
  margin: 6px auto 6px;
  max-width: 640px;
  font-size: 1.2rem;
  line-height: 1.4;
  font-weight: 700;
  text-align: center;
}

.article-subtitle--modal {
  margin: 0 auto 10px;
  max-width: 600px;
  font-size: .75rem;
  line-height: 1.7;
  color: #6b7280;
  text-align: center;
}

/* 2行省略 */
.clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* ----- 閉じるボタン（シンプル・テキストのみ） ----- */
.post-modal__close {
  position: absolute;
  top: max(72px, env(safe-area-inset-top, 72px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;

  padding: 4px 6px;
  border: none;
  background: none;
  /* 背景なし */
  box-shadow: none;

  color: #666;
  font-size: 12px;
  line-height: 1;
  text-decoration: underline;
  /* 下線付き */
  cursor: pointer;
}

/* hover/focus で色だけ濃く */
.post-modal__close:hover {
  color: #333;
}

.post-modal__close:active {
  transform: translateX(-50%) scale(0.96);
  filter: brightness(0.92);
}

.post-modal__close:focus-visible {
  outline: 2px solid #899fff;
  outline-offset: 2px;
}

/* アクションボタン */
.modal-actions {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.modal-read-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 6px;
  text-decoration: none;
  background: #0c1d67;
  color: #fff;
  font-weight: 600;
  transition: filter .15s ease;
}

.modal-read-btn:hover {
  filter: brightness(1.05);
}

/* 1回だけ定義（重複排除） */
.article-excerpt {
  margin: 8px 12px;
  font-size: .82rem;
  color: #555;
  line-height: 1.7;
}

/* スクロール固定 */
body.modal-open {
  overflow: hidden;
}

/* スマホ微調整 */
@media (max-width: 480px) {
  .post-modal__dialog {
    width: 94vw;
    padding-top: 48px;
  }

  .article-card-body {
    padding: 10px 12px 14px;
  }

  .article-title--modal {
    font-size: 1.1rem;
  }
}