/* WCAG 2.2 1.4.3 contrast on white:
 * navy 16.59:1 / text-secondary 9.03:1 / muted 4.83:1
 * gold is used as a filled CTA with navy text for 8.84:1 contrast.
 */

:root {
  --navy: #0e1e3a;
  --navy-2: #1a2332;
  --text-secondary: #3d4a5a;
  --text-muted: #6b7280;
  --bg-tint: #f6f8fb;
  --border: #d8dee8;
  --success: #00876a;
  --success-text: #006b4f;
  --gold: #f5b04a;
  --gold-strong: #f2a52f;
  --gold-soft: #fff7e6;
  --gold-border: #f1d59b;
  --focus: #005bd3;
  --danger: #b42318;
}

.blog-shell {
  min-height: 100vh;
  background: #fff;
  color: var(--navy);
  font-family:
    "Pretendard Variable",
    Pretendard,
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    "Noto Sans JP",
    Meiryo,
    sans-serif;
}

.blog-list-page,
.blog-article-page {
  width: min(100% - 40px, 700px);
  margin: 0 auto;
  padding: 72px 0 96px;
  font-size: 16.5px;
  line-height: 1.8;
}

/* 一覧だけ本文より広い。700px は日本語1行を読ませるための制約で、カードの並びには効かない。
   1072px は共通ヘッダー・フッターの内容幅（.public-site-*-inner の max-width 1120px - padding 24px×2）と一致させている。 */
.blog-list-page {
  width: min(100% - 40px, 1072px);
  padding-top: 24px;
}

.blog-page-header,
.blog-article-header {
  margin-bottom: 48px;
}

/* カード列は 1072px まで広がるが、見出し部は読ませる文章なので本文と同じ行長に留める
   （CJK の行長は 40 文字前後が上限。WCAG 2.2 SC 1.4.8）。 */
.blog-page-header {
  max-width: 700px;
  margin-bottom: 12px;
}

.blog-eyebrow {
  margin: 0 0 12px;
  color: var(--success-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.blog-page-header .blog-eyebrow {
  margin-bottom: 8px;
}

.blog-page-header h1,
.blog-article-header h1 {
  margin: 0 0 20px;
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.blog-page-header h1 {
  margin-bottom: 12px;
  font-size: clamp(28px, 6vw, 36px);
}

.blog-description {
  margin: 0;
  color: var(--text-secondary);
}

.blog-card-list {
  display: grid;
  /* auto-fill + minmax で列数が幅に追従する（1072px→3列 / 700px前後→2列 / モバイル→1列）。
     media query を足さないのは、記事が増えても列数の分岐を書き足さずに済ませるため。 */
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.blog-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-tint);
  transition: border-color 150ms ease, transform 150ms ease;
}

.blog-card:hover {
  border-color: var(--gold-border);
  transform: translateY(-2px);
}

/* グリッドではタイトルと説明文の行数がカードごとに違う。日付を下端へ送らないと、
   カードの高さが揃っていても日付の縦位置だけがばらついて横方向に読めなくなる。 */
.blog-card a {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 16px 24px;
  color: inherit;
  text-decoration: none;
}

.blog-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.5;
}

/* .blog-list-page が継承させる 16.5px は本文を読ませる寸法で、300px 台のカードでは1行が短くなりすぎる。 */
/* 説明文を全文出すと 4 行 102px になり、3 行 90px のタイトルより塊が大きくなって主従が逆転する。
   文字サイズ比（20/15 = 完全4度）は既に足りているので、効くのは行数のほう。
   ここで切るのは表示だけで、記事ページの meta description は blog.$slug.tsx が別に出力する。 */
.blog-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.blog-card time {
  margin-top: auto;
}

.blog-card time,
.blog-article-header time {
  color: var(--text-muted);
  font-size: 14px;
}

.blog-empty {
  padding: 32px 0;
  color: var(--text-secondary);
}

.blog-toc {
  margin: 0 0 48px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-tint);
}

.blog-toc p {
  margin: 0 0 8px;
  font-weight: 800;
}

.blog-toc ol {
  margin: 0;
  padding-left: 24px;
}

.blog-toc a {
  color: var(--success-text);
}

.blog-section {
  margin: 0 0 56px;
}

.blog-section h2 {
  margin: 0 0 18px;
  /* アンカーの移動位置は、idを持つ要素のscroll-margin-topを参照する。 */
  scroll-margin-top: calc(var(--public-site-header-height) + 12px);
  font-size: 27px;
  line-height: 1.4;
}

.blog-section p {
  margin: 0 0 16px;
}

.blog-checklist,
.blog-source-links {
  margin: 20px 0 0;
  padding-left: 24px;
}

.blog-checklist li,
.blog-source-links li {
  margin: 0 0 10px;
}

.blog-source-links a {
  color: var(--success-text);
  overflow-wrap: anywhere;
}

.blog-image-grid {
  display: grid;
  gap: 32px;
  margin-top: 24px;
}

.blog-image {
  margin: 0;
}

.blog-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.blog-image figcaption {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.blog-journal-wrap {
  overflow-x: auto;
  margin: 24px 0 0;
}

.blog-journal {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.blog-journal th,
.blog-journal td {
  padding: 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.blog-journal th {
  background: var(--bg-tint);
  font-weight: 800;
}

.blog-journal td:nth-child(2),
.blog-journal td:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.blog-comparison-wrap {
  overflow-x: auto;
  margin: 24px 0 0;
}

.blog-comparison {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.6;
}

.blog-comparison th,
.blog-comparison td {
  padding: 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.blog-comparison thead th {
  background: var(--bg-tint);
  font-weight: 800;
}

.blog-comparison tbody th {
  width: 25%;
  font-weight: 800;
}

.blog-note {
  margin-top: 20px;
  padding: 16px 20px;
  border-left: 4px solid var(--gold);
  background: var(--gold-soft);
  color: var(--navy-2);
}

.blog-cta {
  margin: 56px 0 0;
  text-align: center;
}

.blog-cta a {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--gold);
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.blog-cta a:hover {
  background: var(--gold-strong);
}

@media (max-width: 640px) {
  .blog-list-page {
    width: calc(100% - 32px);
  }

  .blog-article-page {
    width: min(100% - 32px, 700px);
    padding-top: 48px;
  }
}
