/* ==================================================
   ブログ（投稿・ブログ一覧・カテゴリ・タグ・検索結果）
   読み込み: functions.php の条件（is_singular('post') など）
   出力位置: 親テーマの style.css の直後
   ※ 2026/11 にトークンへ移行済み（.claude/css-guardrails.json の ignore から外す）

   ※ クラス名について:
     ak-compare__col--ok などの名前は、記事本文（WordPress に保存された HTML）とブログ作成アプリが使っていて変えられない。
     ガードレールが禁止する形（__ / --）の名前と、親テーマの本文の囲み post_content（_ を含む）は、
     クラスと同じ詳細度の属性セレクタ [class~="…"] で受ける。
     新しい部品を作るときは、この形を増やさず data-variant などを使うこと。

   ※ 詳細度について:
     親テーマの css/design-plus.css が後から読み込まれ、[class~="post_content"] p { margin: 0 0 2em } などを持つ。
     部品の中の余白を消すルールは、[class~="post_content"] を付けて詳細度で上回る（!important は使わない）
   ================================================== */

/* ---------- 本文の基本 ---------- */
.entry-content,
[class~="post_content"],
.wp-block-post-content {
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--color-ink-primary);
}

/* 囲み部品の最後の要素の下余白を消す */
:is([class~="post_content"], .entry-content, .wp-block-post-content) :is(
  .ak-summary,
  .ak-tip,
  .ak-note,
  .ak-warn,
  blockquote,
  .ak-routine,
  [class~="ak-before-after__panel"],
  [class~="ak-compare__col"],
  .ak-example-card
) > :last-child {
  margin-bottom: 0;
  margin-block-end: 0;
}
/* 囲み部品の最初の段落の下余白を消す（ラベルの直後に本文が来るため） */
[class~="post_content"] :is(.ak-summary, .ak-tip, .ak-note, .ak-warn) > p:first-child { margin-bottom: 0; }

/* ---------- 見出し ---------- */
/* h2: 紺のグラデーションの文字と下線 */
.entry-content h2,
[class~="post_content"] h2,
.wp-block-heading {
  margin: var(--space-xl) 0 var(--space-sm);
  padding-bottom: var(--space-2xs);
  background: var(--gradient-brand);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.entry-content h2::after,
[class~="post_content"] h2::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  margin-top: var(--space-2xs);
  background: var(--gradient-brand);
}
.entry-content h3,
[class~="post_content"] h3 {
  margin: var(--space-lg) 0 var(--space-2xs);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-ink-primary);
}

/* ---------- 箇条書き ---------- */
.entry-content ul,
.entry-content ol,
[class~="post_content"] ul,
[class~="post_content"] ol {
  margin: var(--space-sm) 0 var(--space-md);
  padding-left: var(--space-md);
}
.entry-content li,
[class~="post_content"] li {
  margin: var(--space-2xs) 0;
  line-height: var(--leading-body);
}
.entry-content ul li::marker,
[class~="post_content"] ul li::marker { color: var(--color-ink-muted); }
.entry-content ol li::marker,
[class~="post_content"] ol li::marker {
  font-weight: var(--weight-bold);
  color: var(--color-ink-brand);
}

/* ---------- ラベル（囲みの左上の小さな札） ---------- */
.ak-label,
[class~="ak-summary__label"],
[class~="ak-box__label"] {
  position: absolute;
  top: calc(var(--space-2xs) * -1);
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0 var(--space-2xs);
  border-radius: var(--radius-sharp);
  background: var(--color-brand);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-body);
  color: var(--color-ink-inverse);
}
[class~="ak-label--primary"] { background: var(--color-brand); }
[class~="ak-label--ok"] { background: var(--color-state-success); }
[class~="ak-label--ng"] { background: var(--color-state-error); }
[class~="ak-label--muted"] { background: var(--color-ink-secondary); }

/* ---------- 番号つきの手順（ak-steps） ---------- */
.ak-steps {
  margin: var(--space-md) 0;
  padding: var(--space-md) var(--space-sm);
  border-radius: var(--radius-soft);
  background: var(--color-surface-subtle);
  counter-reset: step;
}
.ak-steps li {
  position: relative;
  padding-left: var(--space-xl);
  list-style: none;
}
.ak-steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  top: var(--space-3xs);
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: var(--color-surface-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-ink-brand);
}

/* ---------- 囲み（POINT・TIP・NOTE・注意・引用） ---------- */
.ak-summary,
.ak-tip,
.ak-note,
.ak-warn {
  position: relative;
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-sm) var(--space-sm);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-base);
}
/* POINT（まとめ）は薄い紺の面 */
.ak-summary {
  border: var(--border-strong);
  background: var(--color-surface-subtle);
}
/* 注意は薄いピンクの面 */
.ak-warn { background: var(--color-surface-accent); }
.ak-tip [class~="ak-box__label"],
.ak-note [class~="ak-box__label"] { background: var(--color-state-success); }
.ak-warn [class~="ak-box__label"] { background: var(--color-state-error); }

.entry-content blockquote,
[class~="post_content"] blockquote {
  margin: var(--space-md) 0;
  padding: var(--space-sm);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-subtle);
}
.entry-content blockquote cite,
[class~="post_content"] blockquote cite {
  display: block;
  margin-top: var(--space-2xs);
  font-size: var(--text-sm);
  font-style: normal;
  text-align: right;
  color: var(--color-ink-muted);
}

/* ---------- 文字の飾り ---------- */
.ak-muted { color: var(--color-ink-muted); }
.ak-small { font-size: var(--text-sm); }
/* 文字の下に引くマーカー */
.ak-underline {
  padding: 0 var(--space-3xs);
  background: var(--gradient-marker);
}

/* ---------- 良い例・悪い例の比較（ak-compare） ---------- */
.ak-compare {
  display: grid;
  gap: var(--space-xs);
  margin: var(--space-md) 0;
}
[class~="ak-compare__row"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
}
[class~="ak-compare__col"] {
  position: relative;
  padding: var(--space-sm);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-subtle);
}
.ak-compare [class~="ak-compare__head"] {
  margin: 0 0 var(--space-3xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-ink-primary);
}
[class~="ak-compare__col--ng"] { background: var(--color-surface-accent); }
[class~="ak-compare__col--ok"] [class~="ak-compare__head"] { color: var(--color-state-success); }
[class~="ak-compare__col--ng"] [class~="ak-compare__head"] { color: var(--color-state-error); }

/* 背景の大きな ○ / ×（文字の後ろに置く） */
[class~="ak-compare__col"] > * {
  position: relative;
  z-index: var(--z-raised);
}
[class~="ak-compare__col--ok"]::before,
[class~="ak-compare__col--ng"]::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: auto;
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  line-height: 1;
  color: var(--color-line-strong);
  pointer-events: none;
}
[class~="ak-compare__col--ok"]::before { content: "〇"; }
[class~="ak-compare__col--ng"]::before { content: "×"; }

/* ---------- 練習のルーティン（ak-routine） ---------- */
.ak-routine {
  position: relative;
  padding-top: var(--space-lg);
  background: var(--color-surface-subtle);
}
[class~="ak-routine--simple"] {
  padding: var(--space-md);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
}
[class~="post_content"] [class~="ak-routine__head"] {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  text-align: center;
  color: var(--color-ink-brand);
}
.ak-routine [class~="ak-routine__grid"] {
  display: grid;
  gap: var(--space-xs);
  justify-items: center;
}
.ak-routine [class~="ak-routine__item"] {
  display: grid;
  grid-template-columns: 4.2em 1fr;
  gap: var(--space-sm);
  align-items: center;
  width: min(100%, 980px);
  padding: var(--space-xs) 0;
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-base);
}
.ak-routine [class~="ak-routine__time"] {
  margin: 0;
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  text-align: center;
  color: var(--color-ink-brand);
}
.ak-routine [class~="ak-routine__text"] {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  min-width: 0;
  margin: 0;
}
.ak-routine [class~="ak-routine__pill"] {
  display: inline-flex;
  flex: 0 0 3.4em;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xs);
  border: var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--color-surface-subtle);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1;
  text-align: center;
  color: var(--color-ink-brand);
}
.ak-routine [class~="ak-routine__content"] {
  min-width: 0;
  line-height: var(--leading-body);
  color: var(--color-ink-primary);
}

/* ---------- 気づきの Before / After（ak-before-after） ---------- */
.ak-before-after {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-xs);
  align-items: start;
  margin: var(--space-lg) 0;
}
[class~="ak-before-after__panel--before"] { grid-column: 1; }
[class~="ak-before-after__panel--after"] { grid-column: 3; }
/* 間の矢印（PC は右向き、スマホは下向き） */
.ak-before-after::after {
  content: "▶";
  grid-row: 1;
  grid-column: 2;
  align-self: flex-start;
  margin-top: var(--space-lg);
  font-size: var(--text-xl);
  line-height: 1;
  color: var(--color-line-strong);
}
[class~="ak-before-after__panel"] {
  position: relative;
  padding: var(--space-sm);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-subtle);
}
.ak-before-after [class~="ak-before-after__title"] {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}
[class~="ak-before-after__panel--before"] { background: var(--color-surface-accent); }
[class~="ak-before-after__panel--before"] [class~="ak-before-after__title"] { color: var(--color-state-error); }
[class~="ak-before-after__panel--after"] [class~="ak-before-after__title"] { color: var(--color-state-success); }

/* ---------- 例の列挙（ak-example-cards） ---------- */
.ak-example-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}
.ak-example-card {
  padding: var(--space-sm);
  border: var(--border-hairline);
  border-radius: var(--radius-soft);
  background: var(--color-surface-subtle);
}
.ak-example-card [class~="ak-example-card__title"] {
  margin: 0 0 var(--space-2xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-body);
  color: var(--color-ink-brand);
}
.ak-example-card ul {
  margin: 0;
  padding-left: var(--space-md);
}
.ak-example-card li { margin: var(--space-3xs) 0; }

/* ---------- スマホ ---------- */
@media (max-width: 640px) {
  .entry-content h2,
  [class~="post_content"] h2 { font-size: var(--text-lg); }

  .ak-summary,
  .ak-tip,
  .ak-note,
  .ak-warn,
  .entry-content blockquote,
  [class~="post_content"] blockquote { padding: var(--space-md) var(--space-sm) var(--space-sm); }

  .ak-label,
  [class~="ak-summary__label"],
  [class~="ak-box__label"] { left: var(--space-2xs); }

  .ak-steps li { padding-left: var(--space-lg); }
  [class~="ak-compare__row"] { grid-template-columns: 1fr; }
  .ak-routine [class~="ak-routine__item"] { grid-template-columns: 5.8em 1fr; }
  .ak-example-cards { gap: var(--space-xs); }

  .ak-before-after { grid-template-columns: 1fr; }
  [class~="ak-before-after__panel--before"],
  [class~="ak-before-after__panel--after"] { grid-column: 1; }
  .ak-before-after::after {
    content: "▼";
    grid-row: 2;
    grid-column: 1;
    justify-self: center;
    margin: var(--space-3xs) 0;
  }
  [class~="ak-before-after__panel--after"] { grid-row: 3; }
}
