/*
 * Block styles registered in functions.php (is-style-*), plus small fixes for presets.
 * Loaded on the front end and in the block editor (add_editor_style).
 */

/* Headings: balanced lines and Japanese phrase-aware breaks (no single character left on the last line). */
:is(h1, h2, h3, h4) {
	text-wrap: balance;
	word-break: auto-phrase;
}

/*
 * Headings inside a block with its own text color (e.g. white on the navy presets) follow that color.
 * Needs real specificity: theme.json's heading color is output as a plain "h1, h2, ..." rule.
 */
.has-text-color :is(h1, h2, h3, h4, h5, h6):not(.has-text-color) { color: inherit; }
:is(.has-navy-background-color, .has-navy-gradient-background) .is-style-cw-eyebrow { color: #f2b27a; }

/* Buttons: outline style on dark backgrounds */
.wp-block-button.is-style-outline > .wp-block-button__link {
	background: transparent;
	border: 2px solid currentColor;
	color: inherit;
}

/* Paragraph: ラベル（見出しの上） */
.is-style-cw-eyebrow {
	margin-bottom: 0.4em;
	color: var(--wp--preset--color--accent-dark);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.is-style-cw-eyebrow + :is(h1, h2, h3) { margin-top: 0; }

/* Group: カード */
.wp-block-group.is-style-cw-card {
	height: 100%;
	padding: 28px 26px;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-top: 4px solid var(--wp--preset--color--navy);
	border-radius: 6px;
}
.wp-block-group.is-style-cw-card > :first-child { margin-top: 0; }
.wp-block-group.is-style-cw-card > :last-child { margin-bottom: 0; }

/* List: チェックリスト */
.wp-block-list.is-style-cw-checklist { list-style: none; margin-left: 0; padding-left: 0; }
.wp-block-list.is-style-cw-checklist > li {
	position: relative;
	margin-bottom: 0.7em;
	padding: 14px 18px 14px 48px;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 6px;
}
.wp-block-list.is-style-cw-checklist > li::before {
	content: "";
	position: absolute;
	left: 18px;
	top: 50%;
	width: 16px;
	height: 9px;
	border-left: 3px solid var(--wp--preset--color--accent);
	border-bottom: 3px solid var(--wp--preset--color--accent);
	transform: translateY(-70%) rotate(-45deg);
}

/* List: 年表 (write the date in bold at the start of each item) */
.wp-block-list.is-style-cw-timeline {
	list-style: none;
	margin-left: 0;
	padding-left: 0;
	border-left: 2px solid var(--wp--preset--color--line);
}
.wp-block-list.is-style-cw-timeline > li { position: relative; margin: 0 0 1.1em; padding-left: 24px; }
.wp-block-list.is-style-cw-timeline > li::before {
	content: "";
	position: absolute;
	left: -7px;
	top: 0.65em;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--wp--preset--color--navy);
}
.wp-block-list.is-style-cw-timeline > li > strong:first-child { display: block; color: var(--wp--preset--color--navy); }

/* Table: 項目表 */
.wp-block-table.is-style-cw-info table { border-collapse: collapse; width: 100%; border: 0; }
.wp-block-table.is-style-cw-info td {
	padding: 16px 12px;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
	vertical-align: top;
}
.wp-block-table.is-style-cw-info td:first-child {
	width: 32%;
	color: var(--wp--preset--color--navy);
	font-weight: 700;
}

/* Latest posts: お知らせ一覧 */
.wp-block-latest-posts.is-style-cw-news { margin-left: 0; padding-left: 0; }
.wp-block-latest-posts.is-style-cw-news li {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 24px;
	margin: 0;
	padding: 16px 0;
	border-bottom: 1px solid var(--wp--preset--color--line);
}
.wp-block-latest-posts.is-style-cw-news .wp-block-latest-posts__post-date {
	order: -1;
	min-width: 9em;
	color: var(--wp--preset--color--muted);
	font-size: inherit;
}

@media (max-width: 768px) {
	.wp-block-table.is-style-cw-info tr { display: block; padding-bottom: 12px; border-bottom: 1px solid var(--wp--preset--color--line); }
	.wp-block-table.is-style-cw-info td { display: block; width: 100%; padding: 6px 0; border-bottom: 0; }
	.wp-block-table.is-style-cw-info td:first-child { width: 100%; padding-top: 16px; }
}
