/* ==========================================================================
   entry-content.css — 記事の本文（the_content）。NEWS 記事・BLOG 記事・ブロックエディタで共用
   - サイト：.c-entry__content の中
   - 管理画面：ブロックエディタの編集画面（.editor-styles-wrapper）。enqueue_block_assets で読む（inc/enqueue.php）
   どちらにも当たるよう、セレクタは :is(.c-entry__content, .editor-styles-wrapper) で書く
   ========================================================================== */

:is(.c-entry__content, .editor-styles-wrapper) {
	color: var(--color-text);
	font-family: var(--ff-sans);
	font-size: var(--fs-body);
	line-height: var(--lh-body);
	letter-spacing: var(--ls-body);
	overflow-wrap: anywhere;
	line-break: strict;
}

.c-entry__content > * + * {
	margin-top: 1.9em;
}

:is(.c-entry__content, .editor-styles-wrapper) h2 {
	margin-top: 2.5em;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--color-line-strong);
	font-family: var(--ff-mincho);
	font-size: 20px;
	font-weight: 500;
	line-height: 1.6;
	letter-spacing: 0.06em;
	scroll-margin-top: calc(var(--header-h) + 16px);
}

:is(.c-entry__content, .editor-styles-wrapper) h3 {
	margin-top: 2em;
	padding-left: 12px;
	border-left: 2px solid var(--color-brand);
	font-family: var(--ff-sans);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.7;
}

:is(.c-entry__content, .editor-styles-wrapper) h4 {
	margin-top: 1.6em;
	font-family: var(--ff-sans);
	font-size: var(--fs-body);
	font-weight: 700;
}

/* リスト（ブロックエディタのリストは ul.wp-block-list。クラスなしは旧エディタ・手入力） */
:is(.c-entry__content, .editor-styles-wrapper) :is(ul, ol):is(.wp-block-list, :not([class])) {
	padding-left: 1.5em;
}

:is(.c-entry__content, .editor-styles-wrapper) ul:is(.wp-block-list, :not([class])) {
	list-style: disc;
}

:is(.c-entry__content, .editor-styles-wrapper) ol:is(.wp-block-list, :not([class])) {
	list-style: decimal;
}

:is(.c-entry__content, .editor-styles-wrapper) li + li {
	margin-top: 0.4em;
}

:is(.c-entry__content, .editor-styles-wrapper) a {
	color: var(--color-brand);
	text-decoration: underline;
	text-underline-offset: 0.25em;
}

:is(.c-entry__content, .editor-styles-wrapper) a:hover {
	text-decoration-thickness: 2px;
}

:is(.c-entry__content, .editor-styles-wrapper) strong {
	font-weight: 700;
}

/* 画像（単体・2枚並びのギャラリー） */
:is(.c-entry__content, .editor-styles-wrapper) img {
	max-width: 100%;
	height: auto;
}

:is(.c-entry__content, .editor-styles-wrapper) figcaption {
	margin-top: 8px;
	color: var(--color-muted);
	font-size: var(--fs-note);
	line-height: var(--lh-note);
	text-align: left;
}

.c-entry__content .wp-block-gallery {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 16px;
}

/* コアのギャラリーは画像に width: calc(50% - …) を付ける（:not(#individual-image) や :nth-last-child を重ねた
 * 強いセレクタを @media の中にも持つ）。グリッドで並べるので、ここだけ !important で1マスいっぱいに戻す */
.c-entry__content .wp-block-gallery.has-nested-images figure.wp-block-image:not(#individual-image),
.c-entry__content .wp-block-gallery > * {
	width: 100% !important;
	min-width: 0;
	margin: 0;
}

.c-entry__content .wp-block-gallery img {
	width: 100%;
	aspect-ratio: 392 / 260;
	object-fit: cover;
}

@media (min-width: 768px) {
	.c-entry__content .wp-block-gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* 引用 */
:is(.c-entry__content, .editor-styles-wrapper) blockquote {
	margin: 0;
	padding: 16px 20px;
	border-left: 2px solid var(--color-brand);
	background: var(--color-bg-mid);
}

:is(.c-entry__content, .editor-styles-wrapper) blockquote cite {
	display: block;
	margin-top: 8px;
	color: var(--color-muted);
	font-size: var(--fs-note);
	font-style: normal;
}

/* 表（SP ではみ出すときは、表の外枠だけを横スクロール） */
.c-entry__content .wp-block-table {
	overflow-x: auto;
}

:is(.c-entry__content, .editor-styles-wrapper) table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--fs-body-xs);
}

:is(.c-entry__content, .editor-styles-wrapper) :is(th, td) {
	padding: 12px 16px;
	border: 1px solid var(--color-line-weak);
	text-align: left;
	vertical-align: top;
}

:is(.c-entry__content, .editor-styles-wrapper) th,
:is(.c-entry__content, .editor-styles-wrapper) thead td {
	background: var(--color-bg-mid);
	font-weight: 700;
}

:is(.c-entry__content, .editor-styles-wrapper) hr {
	height: 0;
	margin-block: 2.5em;
	border: 0;
	border-top: 1px solid var(--color-line-weak);
}

@media (min-width: 768px) {
	:is(.c-entry__content, .editor-styles-wrapper) h2 {
		font-size: 24px;
	}

	:is(.c-entry__content, .editor-styles-wrapper) h3 {
		font-size: 18px;
	}
}
