/*
 * 見出しの大きさと余白(N85・D258)。
 *
 * ★なぜ theme.json から出したか
 * theme.json の styles.elements.* は「素の要素セレクタ(0,0,1)」で出力される。
 * 限界が3つそろった——
 *   ① 大きさがコアの既定プリセットに負ける(D240)
 *   ② :where() で包むと自分の既定に負ける(D242。h2(0,0,1) に :where(…)(0,0,0) が負ける)
 *   ③ 余白がレイアウト規則 :root :where(.is-layout-flow) > *(0,1,0) に負ける(D246)
 * ③のせいで、elements.h2 の上下の余白は一度も効いていなかった。
 *
 * ★base.css に混ぜてはいけない(D258)
 * 自社の子テーマは localift-base-styles(＝base.css)を dequeue している。
 * 混ぜると自社サイトにだけ届かない。article.css・blog.css を別ハンドルにしたのと同じ理由。
 *
 * ★詳細度の決まり(D258)——同点＋読み込み順に頼らない
 *
 *   大きさ(font-size / line-height)  h2 { … }                                    (0,0,1)
 *       相手はブラウザの既定だけ。子テーマはクラス1つ(.doc h2 = 0,1,1)で上回れる。
 *
 *   余白(margin)                     :root :where(.is-layout-flow, …) > h2 { … }  (0,1,1)
 *       相手はコアの :root :where(.is-layout-flow) > *(0,1,0)。
 *       0,1,1 なら「確実に」勝つ。同点にして読み込み順に預けない。
 *
 * :where() の中はクラスだけ。要素名は外に出す(D242)。
 * 余白だけ器を上げるのは、コアが同じプロパティを設定しているから(D249・D250の基準そのもの)。
 */

/* --------------------------------------------------------------
 * 大きさ ── 素の要素セレクタ(0,0,1)
 * theme.json の elements.h2 / elements.h3 から、同じ値で移した。
 * ★theme.json には、大きさ・太さ・行間の宣言が1つも残っていない(D263)。
 * 全見出しの既定も含めてこのファイルが持つので、同点を出力順に委ねる箇所が無い。
 * ------------------------------------------------------------ */

/*
 * 1) 全見出しの既定(D263)。theme.json の elements.heading から移した。
 *
 * ★elements.heading と elements.h2 は、どちらも素の要素セレクタ(0,0,1)で出る。
 * theme.json に両方あると勝敗がWordPressの出力順で決まり、実際に
 * elements.h2 の line-height:1.35 は一度も効かず、elements.heading の 1.4 が
 * 出ていた(N85で実測)。同じファイルの中に前後で書けば「後勝ち」で決まる。
 */
h1,
h2,
h3,
h4,
h5,
h6 {
	line-height: 1.4;
	font-weight: 700;
}

/* 2) h2 / h3 の個別。上より後段に書くので、同点の綱引きではなく後勝ちで決まる */
h2 {
	font-size: 2.5rem;
	line-height: 1.35;
}

h3 {
	font-size: 1.25rem;
	line-height: 1.5;
}

/* 記事タイトル。ブロックのクラス(0,1,0)で足りる */
.wp-block-post-title {
	font-size: 2.5rem;
	line-height: 1.35;
}

/* --------------------------------------------------------------
 * 余白 ── 0,1,1 でレイアウト規則に確実に勝つ
 *
 * 値は theme.json の spacing プリセットと同じ:
 *   h2 上 --70(6rem=96px) / 下 --40(1.5rem=24px)
 *   h3 上 --50(2.5rem=40px) / 下 --20(0.5rem=8px)
 * プリセットの変数ではなく実値で書く(D230。子テーマが同じスラッグを
 * 別の値で定義でき、コアの既定に負けることもあるため)。
 * ------------------------------------------------------------ */

:root :where( .is-layout-flow, .is-layout-constrained ) > h2 {
	margin-top: 6rem;
	margin-bottom: 1.5rem;
}

:root :where( .is-layout-flow, .is-layout-constrained ) > h3 {
	margin-top: 2.5rem;
	margin-bottom: 0.5rem;
}
