/**
 * 見出し h1–h6 ＋ ユーティリティ .text-heading-1 … 6
 *
 * @package Sankoudenki
 */

:root {
	--heading-h1-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.625rem);
	/* H3 との差をはっきり（旧 H2 ≒ H3 だった） */
	--heading-h2-size: clamp(1.4375rem, 1.15rem + 0.9vw, 1.875rem);
	--heading-h3-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.375rem);
	--heading-h4-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
	--heading-h5-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
	--heading-h6-size: clamp(0.6875rem, 0.65rem + 0.1vw, 0.75rem);
	--heading-display: "Noto Sans JP", var(--font-sans, sans-serif);
	--heading-color: #0f172a;
	--heading-accent: #155c89;
	--heading-muted: #475569;
	/* 見出し上余白（各見出しの font-size に対する em） */
	--doc-space-before-h1: 0;
	--doc-space-before-h2: 2.75em;
	--doc-space-before-h3: 2.25em;
	--doc-space-before-h4: 2em;
	--doc-space-before-h5: 1.75em;
	--doc-space-before-h6: 1.5em;
	--doc-space-after-h2: 0.65em;
}

/* ── ユーティリティ（テンプレート・手動クラス用） ── */

.text-heading-1,
.text-heading-2,
.text-heading-3,
.text-heading-4,
.text-heading-5,
.text-heading-6 {
	font-family: var(--heading-display);
	color: var(--heading-color);
}

.text-heading-1 {
	font-size: var(--heading-h1-size);
	font-weight: 900;
	line-height: 1.3;
	letter-spacing: -0.02em;
}

.text-heading-2 {
	font-size: clamp(1.5rem, 1.15rem + 1.4vw, 2.625rem);
	font-weight: 900;
	line-height: 1.35;
}

.text-heading-3 {
	font-size: var(--heading-h3-size);
	font-weight: 900;
	line-height: 1.4;
}

.text-heading-4 {
	font-size: var(--heading-h4-size);
	font-weight: 700;
	line-height: 1.45;
	color: var(--heading-accent);
}

.text-heading-5 {
	font-size: var(--heading-h5-size);
	font-weight: 700;
	line-height: 1.5;
}

.text-heading-6 {
	font-size: var(--heading-h6-size);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--heading-accent);
}

/* ── 本文エリア（固定ページ・投稿ブロック） ── */

.doc-prose :is(h1, h2, h3, h4, h5, h6),
.doc-prose--company :is(h1, h2, h3, h4, h5, h6),
.editor-styles-wrapper :is(h1, h2, h3, h4, h5, h6).wp-block-heading {
	font-family: var(--heading-display);
	color: var(--heading-color);
}

.doc-prose h1,
.doc-prose--company h1,
.editor-styles-wrapper h1.wp-block-heading {
	font-size: var(--heading-h1-size);
	font-weight: 900;
	line-height: 1.3;
	letter-spacing: -0.02em;
	margin: 0 0 1.25rem;
}

.doc-prose h2,
.doc-prose--company h2,
.doc-prose--works-list h2,
.doc-prose--efforts h2,
.doc-prose--service-page h2,
.doc-prose--service-denki h2,
.doc-prose--company .is-style-doc-subhead,
.doc-prose--works-list .is-style-doc-subhead,
.doc-prose--efforts .is-style-doc-subhead,
.doc-prose--service-page .is-style-doc-subhead,
.doc-prose--service-denki .is-style-doc-subhead,
.doc-prose--company h2.is-style-doc-subhead,
.doc-prose--works-list h2.is-style-doc-subhead,
.doc-prose--efforts h2.is-style-doc-subhead,
.doc-prose--service-page h2.is-style-doc-subhead,
.doc-prose--service-denki h2.is-style-doc-subhead,
.doc-prose .doc-subhead,
.doc-prose h2.is-style-doc-subhead,
.service-related-works h2.is-style-doc-subhead,
.editor-styles-wrapper h2.wp-block-heading,
.editor-styles-wrapper h2.is-style-doc-subhead {
	font-size: var(--heading-h2-size);
	font-weight: 900;
	line-height: 1.4;
	margin-top: var(--doc-space-before-h2);
	margin-bottom: var(--doc-space-after-h2);
	padding-left: 0.875rem;
	border-left: 3px solid var(--heading-accent);
}

.doc-prose > h2:first-child,
.doc-prose--company > h2:first-child,
.doc-prose > h2.is-style-doc-subhead:first-child,
.doc-prose--company > h2.is-style-doc-subhead:first-child,
.doc-prose--efforts > h2.is-style-doc-subhead:first-child,
.doc-prose--company .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child,
.doc-prose--works-list .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child,
.doc-prose--efforts .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child,
.doc-prose--service-page .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child,
.doc-prose--service-denki .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child,
.doc-prose--company .doc-story:first-child > :is(h2, .doc-subhead):first-child,
.doc-prose .is-style-doc-story:first-child > :is(h2, .is-style-doc-subhead):first-child {
	margin-top: 0;
}

.doc-prose h2 + p,
.doc-prose--company h2 + p,
.doc-prose--company .is-style-doc-subhead + p,
.doc-prose--company .doc-subhead + p {
	margin-top: 0.75rem;
}

.doc-prose h3,
.doc-prose--company h3,
.editor-styles-wrapper h3.wp-block-heading {
	font-size: var(--heading-h3-size);
	font-weight: 900;
	line-height: 1.45;
	margin-top: var(--doc-space-before-h3);
	margin-bottom: 0.65em;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid #e2e8f0;
}

.doc-prose h4,
.doc-prose--company h4,
.editor-styles-wrapper h4.wp-block-heading {
	font-size: var(--heading-h4-size);
	font-weight: 700;
	line-height: 1.45;
	color: var(--heading-accent);
	margin-top: var(--doc-space-before-h4);
	margin-bottom: 0.5em;
}

.doc-prose h5,
.doc-prose--company h5,
.editor-styles-wrapper h5.wp-block-heading {
	font-size: var(--heading-h5-size);
	font-weight: 700;
	line-height: 1.5;
	margin-top: var(--doc-space-before-h5);
	margin-bottom: 0.45em;
}

.doc-prose h6,
.doc-prose--company h6,
.editor-styles-wrapper h6.wp-block-heading {
	font-size: var(--heading-h6-size);
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--heading-accent);
	margin-top: var(--doc-space-before-h6);
	margin-bottom: 0.35em;
}

.doc-prose :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6),
.doc-prose--company :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) {
	margin-top: 1.5em;
}
