/**
 * blog-article.css
 *
 * blog CPT 記事本文の共通デザイン。article.html（hatena-lp由来）で
 * インライン<style>として使われていたクラス群をテーマ側に集約したもの。
 *
 * - 新方式（_article_format = standard）の記事はインライン<style>不要
 * - 旧方式（Elementor / インラインCSSを埋め込んだ記事）はインライン側が
 *   後勝ちで優先されるため影響なし
 *
 * スコープ: `.blog-post-content` 配下に限定（他ページへの波及防止）
 * 規約: CSSネスティング禁止。フラットセレクタで記述。
 */

/* ===================================
 * Layout
 * =================================== */
.blog-post-content .l-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.2rem;
}

/* ===================================
 * Article Header — PDCA P1-1 cream + serif 編集マガジン版
 * 旧 navy slab #2A5772 / 白 sans H1 (SaaS dashboard 風) を撤廃し、
 * Bloomberg / NYT / Economist 流の cream + serif H1 + 細罫線に再設計。
 * =================================== */
.blog-post-content .article-header {
  background-color: transparent;       /* defer to body cream / paper */
  color: #1a1a1a;
  padding: 2.5rem 0 1.75rem;
  margin-bottom: 1.5rem;
  border-top: 1px solid #d8d2c5;
  border-bottom: 1px solid #e9e1cf;
}

.blog-post-content .article-title {
  font-family: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "EB Garamond", serif;
  font-weight: 600;
  color: #1a1a1a;
  font-size: 2.4rem;
  line-height: 1.28;
  margin-bottom: 0.75rem;
  /* PDCA P0-5: 日本語見出し line-break ルール */
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
  font-feature-settings: "palt";
  hanging-punctuation: allow-end;
  line-break: strict;
}

.blog-post-content .article-subtitle {
  font-family: "EB Garamond", "Shippori Mincho", "Yu Mincho", serif;
  font-style: italic;
  color: #4a4a4a;
  font-size: 1.15rem;
  line-height: 1.55;
  font-weight: 400;
  margin-bottom: 1rem;
  max-width: 38em;
}

.blog-post-content .article-meta {
  display: flex;
  align-items: center;
  font-size: 0.78rem;
  margin-top: 1.25rem;
  color: #555;
  font-family: "JetBrains Mono", "Source Code Pro", monospace;
  letter-spacing: 0.04em;
  flex-wrap: wrap;
  gap: 14px;
}

.blog-post-content .article-date {
  display: flex;
  align-items: center;
}

.blog-post-content .article-date i {
  margin-right: 0.45rem;
  color: #A0241F;
  opacity: 0.85;
}

.blog-post-content .article-author {
  display: flex;
  align-items: center;
}

.blog-post-content .article-author i {
  margin-right: 0.45rem;
  color: #A0241F;
  opacity: 0.85;
}

/* ===================================
 * TOC（目次）
 * =================================== */
.blog-post-content .toc {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.blog-post-content .toc-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #2A5772;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}

.blog-post-content .toc-title i {
  margin-right: 0.5rem;
}

.blog-post-content .toc-list {
  list-style-type: none;
  padding-left: 0;
  counter-reset: item;
}

.blog-post-content .toc-list li {
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 2rem;
}

.blog-post-content .toc-list li::before {
  counter-increment: item;
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0;
  background-color: #2A5772;
  color: white;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.blog-post-content .toc-list a {
  color: #2A5772;
  text-decoration: none;
  transition: color 0.3s;
}

.blog-post-content .toc-list a:hover {
  color: #1a3a4f;
  text-decoration: underline;
}

/* ===================================
 * Article Content Card（本文ラップ）
 * =================================== */
.blog-post-content .article-content {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* ===================================
 * Typography（見出し）
 * =================================== */
.blog-post-content .section-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #2A5772;
  margin: 1.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #E4EAEB;
}

.blog-post-content .section-content {
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.blog-post-content .page-subheading {
  color: #2A5772;
  font-size: 1.4rem;
  font-family: "Jost", sans-serif;
  font-weight: 500;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-left: 1rem;
  border-left: 4px solid #2A5772;
}

/* ===================================
 * Highlight Box（結論・要点ボックス）
 * =================================== */
.blog-post-content .highlight-box {
  background-color: #E4EAEB;
  border-left: 4px solid #2A5772;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
}

.blog-post-content .highlight-title {
  font-weight: 600;
  color: #2A5772;
  margin-bottom: 0.5rem;
}

/* ===================================
 * Point Box
 * =================================== */
.blog-post-content .point-box {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 1.2rem;
  margin: 1rem 0;
  border: 1px solid #e9ecef;
}

.blog-post-content .point-title {
  font-weight: 600;
  color: #2A5772;
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.blog-post-content .point-title i {
  margin-right: 0.5rem;
  color: #2A5772;
}

/* ===================================
 * Success Box
 * =================================== */
.blog-post-content .success-box {
  background-color: #d4edda;
  border-left: 4px solid #28a745;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
}

.blog-post-content .success-title {
  font-weight: 600;
  color: #155724;
  margin-bottom: 0.5rem;
}

/* ===================================
 * Warning Box
 * =================================== */
.blog-post-content .warning-box {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border-radius: 0 8px 8px 0;
}

.blog-post-content .warning-title {
  font-weight: 600;
  color: #856404;
  margin-bottom: 0.5rem;
}

/* ===================================
 * Comparison Table
 * =================================== */
.blog-post-content .comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  /* PDCA P0-4: 列幅崩壊を防ぐ ─ 5 列 .comparison-table が混み合うと
     th/td の最小幅で勝手に伸縮し最終列が消える事象が発生していた。
     table-layout: fixed で各列を均等幅に固定 + first-child を 24% / 残りを 19% ずつ。 */
  table-layout: fixed;
}
.blog-post-content .comparison-table th:first-child,
.blog-post-content .comparison-table td:first-child {
  width: 24%;
}
.blog-post-content .comparison-table th:not(:first-child),
.blog-post-content .comparison-table td:not(:first-child) {
  width: auto;
  word-break: break-word;
}

.blog-post-content .comparison-table th,
.blog-post-content .comparison-table td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  font-size: 0.9rem;
}

.blog-post-content .comparison-table th {
  background-color: #E4EAEB;
  color: #2A5772;
  font-weight: 600;
}

.blog-post-content .comparison-table tr:nth-child(even) {
  background-color: #f8f9fa;
}

.blog-post-content .comparison-table td:first-child {
  font-weight: 500;
}

/* ===================================
 * Prompt Box（プロンプト例の暗色表示）
 * =================================== */
.blog-post-content .prompt-box {
  background-color: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  margin: 1rem 0;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
  font-family: "Zen Kaku Gothic New", sans-serif;
}

.blog-post-content .prompt-label {
  display: inline-block;
  background-color: #2A5772;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.8rem;
}

/* ===================================
 * CTA Box
 * =================================== */
.blog-post-content .cta-box {
  background-color: #2A5772;
  color: white;
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
  text-align: center;
}

.blog-post-content .cta-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.blog-post-content .cta-description {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
}

.blog-post-content .cta-button {
  display: inline-block;
  background-color: #f0b90b;
  color: #2A5772;
  padding: 0.75rem 2rem;
  border-radius: 4px;
  font-weight: 600;
  transition: background-color 0.3s, transform 0.3s;
}

.blog-post-content .cta-button:hover {
  background-color: #e0a800;
  transform: translateY(-2px);
}

/* ===================================
 * Article Footer
 * =================================== */
.blog-post-content .article-footer {
  background-color: #E4EAEB;
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  text-align: center;
}

.blog-post-content .article-footer-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: #2A5772;
  margin-bottom: 0.75rem;
}

.blog-post-content .article-footer-update {
  font-size: 0.9rem;
  color: #545454;
  font-style: italic;
}

.blog-post-content .article-footer-update i {
  margin-right: 0.5rem;
  color: #2A5772;
}

/* ===================================
 * Back to Top（画面右下の固定ボタン）
 * =================================== */
.blog-post-content .back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: #2A5772;
  color: white;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s, transform 0.3s;
  z-index: 100;
}

.blog-post-content .back-to-top:hover {
  background-color: #1a3a4f;
  transform: translateY(-2px);
}

.blog-post-content .back-to-top i {
  font-size: 1.2rem;
}

/* ===================================
 * Screenshot caption（画像下の小さめ説明文）
 * =================================== */
.blog-post-content .screenshot-caption {
  font-size: 0.85rem;
  color: #6b7280;
  text-align: center;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* ===================================
 * Responsive
 * =================================== */
@media (max-width: 767px) {
  .blog-post-content .article-title { font-size: 1.8rem; }
  .blog-post-content .article-subtitle { font-size: 0.9rem; }
  .blog-post-content .section-title { font-size: 1.3rem; }
  .blog-post-content .comparison-table { font-size: 0.8rem; }
  .blog-post-content .comparison-table th,
  .blog-post-content .comparison-table td { padding: 0.6rem 0.4rem; }
  /* PDCA P0-2: モバイルでは back-to-top を非表示にして、底部 CTA stacking を解消 */
  body.single-blog .blog-post-content .back-to-top { display: none !important; }
}

/* ===================================
 * Generic table scroll wrapper (mobile overflow fix)
 *   - blog-article-support.php の hatenahp_blog_wrap_tables_for_scroll が
 *     全 <table> を <div class="hb-table-scroll"> でラップする。
 *   - PC 幅では透明、モバイル幅でのみ横スクロール表示。
 * =================================== */
.single-blog .hb-table-scroll {
  max-width: 100%;
  margin: 1.5em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.single-blog .hb-table-scroll table {
  margin: 0;
}
@media (max-width: 767px) {
  .single-blog .hb-table-scroll {
    border: 1px solid #e5e1d8;
    border-radius: 6px;
    background: #fff;
  }
  /* mobile では table を強制的に「読める最小幅」まで広げ、wrapper で横スクロールさせる。
     これがないと td が縮小されて文字が潰れる。 */
  .single-blog .hb-table-scroll > table {
    min-width: 640px;
    width: max-content;
  }
  .single-blog .hb-table-scroll::-webkit-scrollbar {
    height: 6px;
  }
  .single-blog .hb-table-scroll::-webkit-scrollbar-thumb {
    background: #c8c2b3;
    border-radius: 3px;
  }
  /* PDCA P3-2: 1列目を sticky 固定（横スクロール時もカテゴリ列が見える）
     position: sticky を td/th に効かせるため background-clip と border-collapse 調整 */
  .single-blog .hb-table-scroll > table {
    border-collapse: separate;
    border-spacing: 0;
  }
  .single-blog .hb-table-scroll > table th:first-child,
  .single-blog .hb-table-scroll > table td:first-child {
    position: sticky;
    left: 0;
    background: #f8f6ef;
    box-shadow: 1px 0 0 0 #e5e1d8;
    z-index: 1;
  }
  .single-blog .hb-table-scroll > table thead th:first-child {
    background: #ede8d8;
    z-index: 2;
  }
}
