/**
 * ブログ一覧・ブログ記事単体 レイアウト崩れ防止
 * /blog/ ・カテゴリー等アーカイブ および 投稿個別ページで使用
 */

/* ---------- 縦書き・レイアウト崩れ防止（確実に適用） ---------- */
body.p-archive-blog,
body.home.blog,
body.archive,
body.single-post {
  writing-mode: horizontal-tb !important;
  direction: ltr !important;
  overflow-x: hidden;
}

body.p-archive-blog .l-outer,
body.p-archive-blog .l-container,
body.p-archive-blog .l-contents,
body.p-archive-blog .l-main,
body.p-archive-blog .p-archive,
body.home.blog .l-contents,
body.home.blog .l-main,
body.home.blog .p-archive,
body.archive .l-contents,
body.archive .l-main,
body.archive .p-archive,
body.single-post .l-contents,
body.single-post .l-main {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
}

/* ブログ一覧：物理プロパティで幅を固定（logical の影響を打ち消す） */
body.p-archive-blog .l-contents,
body.p-archive-blog .l-main {
  inline-size: 100% !important;
  margin-inline: auto !important;
}

body.p-archive-blog .p-archive--post,
body.p-archive-blog .p-post-cards {
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* ページネーション：カード一覧との間隔 */
body.p-archive-blog .c-pagination,
body.home.blog .c-pagination,
body.archive .c-pagination {
  margin-top: 40px;
}

/* ブログ一覧カード：参考画像どおり（角なし・ソフトシャドウ・16:9・カテゴリかぶせ・時計アイコン） */
body.p-archive-blog .p-post-cards-item,
body.home.blog .p-post-cards-item,
body.archive .p-post-cards-item {
  background: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border-radius: 0;
  overflow: hidden;
  padding-bottom: 20px;
}

body.p-archive-blog .p-post-cards-item__link,
body.home.blog .p-post-cards-item__link,
body.archive .p-post-cards-item__link {
  display: grid;
  row-gap: 14px;
  padding: 0 0 24px;
}

body.p-archive-blog .p-post-cards-item__image,
body.home.blog .p-post-cards-item__image,
body.archive .p-post-cards-item__image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

/* カテゴリ：ダークグレー・角なし・画像の下端にかぶせる */
body.p-archive-blog .p-post-cards-item__category .c-category,
body.home.blog .p-post-cards-item__category .c-category,
body.archive .p-post-cards-item__category .c-category {
  background: #374151;
  color: #ffffff;
  padding: 0.45em 14px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  border-radius: 0;
  min-width: 0;
  width: fit-content;
}

body.p-archive-blog .p-post-cards-item__category .c-category a,
body.home.blog .p-post-cards-item__category .c-category a,
body.archive .p-post-cards-item__category .c-category a {
  color: inherit;
}

body.p-archive-blog .p-post-cards-item__title,
body.home.blog .p-post-cards-item__title,
body.archive .p-post-cards-item__title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.6;
  margin: 0;
  padding: 0 24px;
  color: #1f2937;
}

body.p-archive-blog .p-post-cards-item__excerpt,
body.home.blog .p-post-cards-item__excerpt,
body.archive .p-post-cards-item__excerpt {
  font-size: 15px;
  line-height: 1.75;
  color: #6b7280;
  margin: 0;
  padding: 0 24px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

body.p-archive-blog .p-post-cards-item__date,
body.home.blog .p-post-cards-item__date,
body.archive .p-post-cards-item__date {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.p-archive-blog .p-post-cards-item__date .c-date,
body.home.blog .p-post-cards-item__date .c-date,
body.archive .p-post-cards-item__date .c-date {
  display: inline;
  margin: 0;
  padding: 0;
}

/* 日付の前の時計アイコン（アウトライン風） */
body.p-archive-blog .p-post-cards-item__date::before,
body.home.blog .p-post-cards-item__date::before,
body.archive .p-post-cards-item__date::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
  flex-shrink: 0;
}

/* ブログ記事単体：本文エリアの折り返し・幅 */
body.single-post .p-single,
body.single-post .p-single-post,
body.single-post .p-single-header,
body.single-post .p-single-content,
body.single-post .c-desc {
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 100%;
}

body.single-post .p-single-content {
  padding-left: 10px;
}

/* ========== レスポンシブ（参考画像に合わせた精密な余白・フォント） ========== */
@media (max-width: 767px) {
  body.p-archive-blog .p-post-cards,
  body.home.blog .p-post-cards,
  body.archive .p-post-cards {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  body.p-archive-blog .p-post-cards-item__link,
  body.home.blog .p-post-cards-item__link,
  body.archive .p-post-cards-item__link {
    row-gap: 10px !important;
    padding: 0 0 20px !important;
  }

  body.p-archive-blog .p-post-cards-item__image,
  body.home.blog .p-post-cards-item__image,
  body.archive .p-post-cards-item__image {
    aspect-ratio: 16 / 9;
  }

  /* カテゴリ：画像下端にかぶせ・ダークグレー・角なし */
  body.p-archive-blog .p-post-cards-item__category,
  body.home.blog .p-post-cards-item__category,
  body.archive .p-post-cards-item__category {
    position: static !important;
    inset: unset !important;
    aspect-ratio: unset !important;
    margin-top: -14px !important;
    margin-left: 20px !important;
    margin-right: 20px !important;
    margin-bottom: 0 !important;
    display: block !important;
    width: auto !important;
    max-width: calc(100% - 40px) !important;
    box-sizing: border-box;
    padding: 0 !important;
  }

  body.p-archive-blog .p-post-cards-item__category .c-category,
  body.home.blog .p-post-cards-item__category .c-category,
  body.archive .p-post-cards-item__category .c-category {
    display: inline-block;
    padding: 0.4em 12px !important;
    font-size: 11px !important;
    border-radius: 0 !important;
    background: #374151 !important;
  }

  body.p-archive-blog .p-post-cards-item__title,
  body.home.blog .p-post-cards-item__title,
  body.archive .p-post-cards-item__title {
    font-size: 16px;
    line-height: 1.55;
    padding: 0 20px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  body.p-archive-blog .p-post-cards-item__excerpt,
  body.home.blog .p-post-cards-item__excerpt,
  body.archive .p-post-cards-item__excerpt {
    font-size: 15px;
    line-height: 1.7;
    padding: 0 20px;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  body.p-archive-blog .p-post-cards-item__date,
  body.home.blog .p-post-cards-item__date,
  body.archive .p-post-cards-item__date {
    padding: 0 20px;
    font-size: 11px;
  }
}
