/* core/heading block styles
 * CSS変数名はWPが生成する実名を使用:
 *   slug "font-32" → --wp--preset--font-size--font-32
 *   slug "size-32" → --wp--preset--spacing--size-32
 */

:root h1.wp-block-heading {
	font-size: var(--wp--preset--font-size--font-32);
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.03em;
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-32);
}

/* ── H2 左寄せ（デフォルト）: 左にグラデーション縦バー ── */
:root h2.wp-block-heading:not(.kw-label-ja) {
	position: relative;
	font-size: var(--wp--preset--font-size--font-32);
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.03em;
	color: var(--wp--preset--color--text-primary);
	padding-left: var(--wp--preset--spacing--size-24);
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-32);
}

:root h2.wp-block-heading:not(.kw-label-ja)::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	border-radius: 2px;
	background: linear-gradient(
		to bottom,
		var(--wp--preset--color--primary-500),
		var(--wp--preset--color--primary-800)
	);
}

/* ── H2 中央寄せ: テキスト下に横グラデーションバー（96px）── */
:root h2.wp-block-heading:not(.kw-label-ja).has-text-align-center {
	padding-left: 0;
	padding-bottom: var(--wp--preset--spacing--size-24);
	text-align: center;
}

:root h2.wp-block-heading:not(.kw-label-ja).has-text-align-center::before {
	top: auto;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 96px;
	height: 4px;
	background: linear-gradient(
		to right,
		var(--wp--preset--color--primary-500),
		var(--wp--preset--color--primary-800)
	);
}

/* ── H2 右寄せ: 右にグラデーション縦バー ── */
:root h2.wp-block-heading:not(.kw-label-ja).has-text-align-right {
	padding-left: 0;
	padding-right: var(--wp--preset--spacing--size-24);
	text-align: right;
}

:root h2.wp-block-heading:not(.kw-label-ja).has-text-align-right::before {
	left: auto;
	right: 0;
}

/* ── セクション英語大見出し（Works / Column 等）はバーなし ── */
:root h2.wp-block-heading.kw-heading-section-en {
	color: inherit;
	padding-left: 0;
	padding-right: 0;
	padding-bottom: 0;
}

:root h2.wp-block-heading.kw-heading-section-en::before {
	display: none;
}

/* ── kw-label-ja（セクション見出しのJA小見出し）H1/H2リセット ── */
:root :is(h1, h2).wp-block-heading.kw-label-ja {
	position: static;
	font-size: var(--wp--preset--font-size--font-20);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.05em;
	color: var(--wp--preset--color--base-text);
	padding-left: 0;
	padding-right: 0;
	margin-top: 0;
	margin-bottom: 0;
}

:root :is(h1, h2).wp-block-heading.kw-label-ja::before {
	display: none;
}

:root h3.wp-block-heading {
	font-size: var(--wp--preset--font-size--font-24);
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.03em;
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-24);
}

:root h4.wp-block-heading {
	font-size: var(--wp--preset--font-size--font-20);
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0.03em;
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-16);
}

:root h5.wp-block-heading {
	font-size: var(--wp--preset--font-size--font-18);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.03em;
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-12);
}

:root h6.wp-block-heading {
	font-size: var(--wp--preset--font-size--font-16);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.02em;
	margin-top: 0;
	margin-bottom: var(--wp--preset--spacing--size-8);
}

/* ── 本文フロー内の見出し上マージン ──
 * 各見出しは margin-top:0 でリセットしているため、段落など先行ブロックの
 * 直後に見出しが来ると詰まる。post-content 本文内でのみ、先行する兄弟要素を
 * 持つ見出しに上マージンを復活させる（隣接兄弟結合子＝先頭見出しには効かない）。
 */
:root .wp-block-post-content :is(p, ul, ol, figure, table, blockquote) + :is(h1, h2, h3, h4, h5, h6).wp-block-heading {
	margin-top: var(--wp--preset--spacing--size-48);
}

:root .wp-block-post-content :is(p, ul, ol, figure, table, blockquote) + :is(h3, h4, h5, h6).wp-block-heading {
	margin-top: var(--wp--preset--spacing--size-32);
}