/*
 * 旧サイトの CSS（legacy/）の後に読む「部品の違いの吸収」だけを書く。旧サイトの見た目そのものは legacy/ が正。
 * 旧 CSS と同じ強さ（html:root）で書く。
 */

/* スマホとパソコンの出し分け（旧サイトは端末の種類で出し分け。新サイトは画面の幅で：781px 以下がスマホ。Plugin::SP_MAX と同じ） */
@media (max-width: 781px) {
	html:root .ys-pc {
		display: none !important;
	}
	/* 旧サイトのスマホには隠れた PC 用の要素が無いので、その前後の要素が最後・最初の子だった（旧 CSS の > :last-child・> :first-child の余白 0） */
	html:root :not(.ys-pc):has(~ .ys-pc):not(:has(~ :not(.ys-pc))) {
		margin-bottom: 0;
	}
	html:root .ys-pc ~ :not(.ys-pc):not(:not(.ys-pc) ~ *) {
		margin-top: 0;
	}
}
@media (min-width: 782px) {
	html:root .ys-sp {
		display: none !important;
	}
	/* 同じく、旧サイトの PC には隠れたスマホ用の要素が無い */
	html:root :not(.ys-sp):has(~ .ys-sp):not(:has(~ :not(.ys-sp))) {
		margin-bottom: 0;
	}
	html:root .ys-sp ~ :not(.ys-sp):not(:not(.ys-sp) ~ *) {
		margin-top: 0;
	}
}

/* カラムの幅（旧サイトは style="flex-basis:…" で、WordPress の CSS が [style*=flex-basis] に flex-grow:0 を当てていた） */
@media (min-width: 782px) {
	html:root .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column.ys-flex-basis {
		flex-grow: 0;
	}
}
html:root .wp-block-columns.is-not-stacked-on-mobile > .wp-block-column.ys-flex-basis {
	flex-grow: 0;
}

/* 料金プランの切り替えボタンの画像（旧サイトは style="width:117px"） */
html:root .custom-pagination button img {
	width: 117px;
}

/* エディターでの、表示しないブロックの印 */
.ys-omizu-placeholder {
	padding: 16px;
	background-color: #f0f0f0;
	font-size: 14px;
}

/*
 * WordPress のブロックの CSS と旧 CSS の強さの順を戻す。旧 CSS は html:root を付けて強くしてあるため、
 * 旧サイトでは WordPress の指定が勝っていたところで、旧 CSS が勝ってしまう。そこだけ WordPress の指定を同じ強さで書き直す。
 */
/* 画像の中央寄せ：旧サイトは WordPress の display: table（画像の幅の箱）が Nishiki Pro の .aligncenter（display: block）に勝っていた */
html:root .wp-block-image .aligncenter,
html:root .wp-block-image .alignleft,
html:root .wp-block-image .alignright,
html:root .wp-block-image.aligncenter,
html:root .wp-block-image.alignleft,
html:root .wp-block-image.alignright {
	display: table;
}

/* ボタン（旧 CSS：[class^="btn"] { min-width: 320px }）が、幅 320px の画面では箱からはみ出して右が切れていた（旧サイトの不具合）。
   その幅（374px 以下）だけ、箱より広くならないようにする。
   それより広い画面（PC のフッターの 3 列のボタンなど、箱から少しはみ出しても切れずに見えている所）は旧サイトのまま */
@media (max-width: 374px) {
	html:root [class^="btn"] {
		min-width: min(320px, 100%);
	}
}
