/**
 * デザインの土台（docs/design-rules.md）。
 *
 * どのページでも読み込む、いちばん小さな1枚。ここでやることは3つだけ。
 *
 * 1. 決まりの色・文字・弧の大きさを CSS 変数にする（--lastshot-*）
 * 2. 共通の形（見出し・ボタン・マーカー・区切り）を決める
 * 3. ブロックスタイル（枠だけのボタン・押してほしいボタン・比較のポイント）
 *
 * 色はすべて変数から使う。変数の中身は theme.json のパレットから来るので、
 * 「デザイン」タブでメイン色やボタンの色を変えると、ここも一緒に変わる。
 */

/* --- 1. 変数 ----------------------------------------------------------- */

:root {
	/* 色（決まり1章） */
	--lastshot-paper: var( --wp--preset--color--base, #ffffff );
	--lastshot-main: var( --wp--preset--color--primary, #12355b );
	--lastshot-main-soft: var( --wp--preset--color--primary-light, #f2f5f9 );
	--lastshot-cta: var( --wp--preset--color--accent, #c2410c );
	--lastshot-ink: var( --wp--preset--color--contrast, #1f2328 );
	--lastshot-muted: var( --wp--preset--color--contrast-2, #5b6270 );

	/* 本文より少し弱い文字（カテゴリーの説明文など） */
	--lastshot-ink-soft: #3f4652;
	--lastshot-line: var( --wp--preset--color--border, #e3e5e8 );
	--lastshot-line-strong: #d5d9df;
	--lastshot-line-light: #eef0f3;
	--lastshot-alert: var( --wp--preset--color--caution, #b91c1c );
	--lastshot-alert-soft: var( --wp--preset--color--caution-light, #fdf3f3 );
	--lastshot-info: var( --wp--preset--color--contrast-2, #5b6270 );
	--lastshot-info-soft: var( --wp--preset--color--base-2, #f5f6f8 );
	--lastshot-avatar-bg: #e8edf3;
	--lastshot-dim: #d6e0ec;
	--lastshot-marker: #fde68a;

	/*
	 * カテゴリーの色。カテゴリーごとに決めた色を lastshot-core が
	 * その場所だけで上書きする。決めていないときはメイン色。
	 */
	--lastshot-cat: var( --lastshot-main );

	/* 右上の角だけを切る弧の大きさ（決まり3章） */
	--lastshot-arc-thumb: 16px;
	--lastshot-arc-list: 18px;
	--lastshot-arc-cat: 32px;
	--lastshot-arc-card: 36px;
	--lastshot-arc-wide: 40px;
	--lastshot-arc-cta: 18px;

	/*
	 * 写真・カードの形は --lastshot-media-radius で切り替える
	 * （決まり3章）。ここでは**決めない**。
	 *
	 * 設定「LastShot → デザイン → 写真・カードの形」を選ぶと、
	 * LastShot Core が head に 1 行だけ出す（四角 0／角丸 12px）。
	 * 弧（初期値）のときは何も出さないので、場所ごとの
	 * `var( --lastshot-media-radius, 今までの弧 )` の控えがそのまま効く
	 * （プラグインが無効のときも同じ＝今までの弧）。
	 *
	 * 効くのは一覧・カード・サムネイルの写真と、シェアの囲み・
	 * ランキングの囲み・フッターのロゴの台。記事のアイキャッチ
	 * （featured.css）と記事の中の部品・ボタンは対象外。
	 */

	/*
	 * 押してほしいボタンの形は --lastshot-btn-radius で切り替える
	 * （決まり3章・9章）。ここでは**決めない**。
	 *
	 * 設定「LastShot → デザイン → ボタンの形」を選ぶと、LastShot Core が
	 * head に 1 行だけ出す（弧／四角／角丸）。出ていないとき（プラグインが
	 * 無効のとき）は、ボタンごとの控えの値＝今までの弧になる。
	 *
	 * 弧のときの大きさは、ボタンごとに --lastshot-btn-arc で決める
	 * （押してほしいボタン 18px／M2 と G3 は 24px）。
	 */

	/* うすい影（カテゴリーのボタンだけ） */
	--lastshot-shadow: 0 1px 2px rgb( 18 53 91 / 8% );
}

/* --- 2. 共通の形 ------------------------------------------------------- */

/*
 * サイドバー・一覧の見出しは、本文の h2 と同じ形にする
 * （メイン色の文字＋下にメイン色の 2px の線だけ）。
 */
.lastshot-widget__heading,
.lastshot-sidebar__heading,
.lastshot-sidebar .wp-block-search__label {
	display: block;
	margin: 0 0 var( --wp--preset--spacing--30, 1rem );
	padding: 0 0 0.4rem;
	border: 0;
	border-bottom: 2px solid var( --lastshot-main );
	color: var( --lastshot-main );
	font-size: var( --wp--preset--font-size--large, 1.125rem );
	font-weight: 700;
	line-height: 1.4;
}

/*
 * トップページのセクションの見出し（決まり6章）。
 *
 * 形は「見出しの文字（パソコン 24px・スマホ 20px・太字）＋そのあとに
 * 右へ伸びるうすい灰色の 1px の線（上下中央・文字との間 16px）」。
 *
 * 記事本文の見出しの設定（LastShot →「記事」→「本文のデザイン」）には
 * 連動させない。トップページは、どの見出しのデザインを選んでも同じ形に
 * する（0.11.9 で決めた）。プラグイン側の見出し（.lastshot-mag-head。
 * 新着記事・カテゴリーごとの新着）も、同じ形・同じ数字でそろえてある。
 *
 * サイトエディターでは本文の見出しの CSS（.is-root-container h2）が
 * この見出しにも当たるので、飾り（地・枠・弧・::before）をいったん
 * 打ち消してから指定する。ブロックの見出しには wp-block-heading が付くので、
 * 2つのクラスを並べた形で「本文の見出し」より強くしている。
 */
.lastshot-section-heading,
.lastshot-section-heading.wp-block-heading {
	display: flex;
	align-items: center;
	gap: 16px;
	margin: 0 0 var( --wp--preset--spacing--30, 1rem );
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var( --lastshot-main );
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.4;
}

/* 本文の見出しの飾り（頭の四角・短い太線など）は、トップでは出さない。 */
.lastshot-section-heading::before,
.lastshot-section-heading.wp-block-heading::before {
	content: none;
}

/* 文字のあとに、右へ伸びる線。 */
.lastshot-section-heading::after,
.lastshot-section-heading.wp-block-heading::after {
	content: "";
	position: static;
	flex: 1 1 auto;
	width: auto;
	height: 1px;
	border: 0;
	background-color: var( --lastshot-line-strong );
}

@media (max-width: 781.98px) {

	.lastshot-section-heading,
	.lastshot-section-heading.wp-block-heading {
		font-size: 1.25rem;
	}
}

/* 一覧（アーカイブ）の見出しも同じ形。 */
.wp-block-query-title {
	padding-bottom: 0.4rem;
	border-bottom: 2px solid var( --lastshot-main );
	color: var( --lastshot-main );
}

/* 記事の題名（h1）。 */
.wp-block-post-title {
	margin: 0 0 var( --wp--preset--spacing--30, 1rem );
	line-height: 1.45;
}

/* 「もっと見る」の、枠だけのボタン。 */
.lastshot-more-link {
	margin-top: var( --wp--preset--spacing--30, 1rem );
	text-align: center;
}

.lastshot-more-link a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0.6rem 1.6rem;
	border: 1px solid var( --lastshot-line-strong );
	color: var( --lastshot-main );
	font-weight: 700;
	text-decoration: none;
}

.lastshot-more-link a:hover,
.lastshot-more-link a:focus {
	border-color: var( --lastshot-main );
	background: var( --lastshot-main-soft );
	text-decoration: none;
}

/* --- 3. ボタン --------------------------------------------------------- */

/*
 * 標準はメイン色の塗り（theme.json）。角は四角。
 * ここでは「枠だけ」「文字だけ」「押してほしいボタン」の3つを足す。
 */

.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 44px;
	text-decoration: none;
}

/* メイン色の枠だけ。 */
.wp-block-button.is-style-lastshot-outline .wp-block-button__link {
	border: 1px solid var( --lastshot-main );
	background-color: transparent;
	color: var( --lastshot-main );
}

.wp-block-button.is-style-lastshot-outline .wp-block-button__link:hover,
.wp-block-button.is-style-lastshot-outline .wp-block-button__link:focus {
	background-color: var( --lastshot-main-soft );
	color: var( --lastshot-main );
}

/* 文字だけのリンク（下線）。 */
.wp-block-button.is-style-lastshot-text .wp-block-button__link {
	min-height: 0;
	padding: 0;
	border: 0;
	background-color: transparent;
	color: var( --lastshot-main );
	text-decoration: underline;
}

/*
 * いちばん押してほしいボタン。
 * ボタンの色の塗りと、右上の角だけを切る弧（決まり3章）。
 * 形は設定で変えられる（弧・四角・角丸。初期値は弧）。
 */
.wp-block-button.is-style-lastshot-cta .wp-block-button__link {
	--lastshot-btn-arc: var( --lastshot-arc-cta );

	border: 0;
	border-radius: var( --lastshot-btn-radius, 0 var( --lastshot-arc-cta ) 0 0 );
	background-color: var( --lastshot-cta );
	color: var( --lastshot-paper );
	font-weight: 700;
}

.wp-block-button.is-style-lastshot-cta .wp-block-button__link:hover,
.wp-block-button.is-style-lastshot-cta .wp-block-button__link:focus {
	background-color: var( --lastshot-ink );
	color: var( --lastshot-paper );
}

/* スマホでは、押してほしいボタンを幅いっぱいにする（決まり9章）。 */
@media (max-width: 599px) {

	.wp-block-button.is-style-lastshot-cta,
	.wp-block-button.is-style-lastshot-cta .wp-block-button__link {
		width: 100%;
	}
}

/* --- 4. 比較のポイント（番号つきリストのブロックスタイル） ------------- */

/*
 * core/list（番号つき）に付けるスタイル。記事の中身（HTML）は変わらない。
 * 各項目の最初の太字を見出しとして扱う。
 *
 * 56px の四角いメイン色の中に「ポイント」と数字を縦に並べる。
 * 「ポイント」は ::before、数字は ::after で描くので、
 * 記事には何も足さない（番号は CSS が数える）。
 */
.wp-block-list.is-style-lastshot-points {
	list-style: none;
	margin-block: var( --wp--preset--spacing--40, 1.5rem );
	padding: 0;
	counter-reset: lastshot-point;
}

.wp-block-list.is-style-lastshot-points > li {
	position: relative;
	box-sizing: border-box;
	min-height: 56px;
	margin: 0;
	padding: 0.9rem 0 0.9rem 72px;
	border-top: 1px solid var( --lastshot-line );
	counter-increment: lastshot-point;
	line-height: 1.8;
}

.wp-block-list.is-style-lastshot-points > li:last-child {
	border-bottom: 1px solid var( --lastshot-line );
}

/* 四角の地と「ポイント」の文字。 */
.wp-block-list.is-style-lastshot-points > li::before {
	content: "ポイント";
	position: absolute;
	top: 0.9rem;
	left: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	box-sizing: border-box;
	width: 56px;
	height: 56px;
	padding-top: 7px;
	background: var( --lastshot-main );
	color: var( --lastshot-paper );
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
}

/* 数字。 */
.wp-block-list.is-style-lastshot-points > li::after {
	content: counter( lastshot-point );
	position: absolute;
	top: calc( 0.9rem + 22px );
	left: 0;
	width: 56px;
	color: var( --lastshot-paper );
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
}

/* 項目の最初の太字を見出しとして扱う。 */
.wp-block-list.is-style-lastshot-points > li > strong:first-child,
.wp-block-list.is-style-lastshot-points > li > b:first-child {
	display: block;
	margin-bottom: 0.15em;
	color: var( --lastshot-main );
	font-size: var( --wp--preset--font-size--large, 1.125rem );
	line-height: 1.5;
}

/* 本文のリストのデザイン（content-list-*.css）の印は出さない。 */
.wp-block-list.is-style-lastshot-points > li::marker {
	content: "";
}

@media (max-width: 599px) {

	.wp-block-list.is-style-lastshot-points > li {
		padding-left: 60px;
	}

	.wp-block-list.is-style-lastshot-points > li::before,
	.wp-block-list.is-style-lastshot-points > li::after {
		width: 48px;
	}

	.wp-block-list.is-style-lastshot-points > li::before {
		height: 48px;
		padding-top: 5px;
		font-size: 9px;
	}

	.wp-block-list.is-style-lastshot-points > li::after {
		top: calc( 0.9rem + 18px );
		font-size: 19px;
	}
}

/* --- 6. フッター ------------------------------------------------------- */

.lastshot-footer__about {
	margin: 0 auto;
	max-width: 46em;
	color: var( --lastshot-dim );
	line-height: 1.8;
}
