/*
 * 旧サイトの CSS（legacy/。html:root 付きで強さをそろえてある）の前に読む「下地合わせ」。
 * テーマ・ONEsta・WordPress が付ける見た目のうち、旧サイトに無かったものを消す。
 * ここで消したものに旧サイトの指定があれば、後から読む legacy/ の指定が勝つ。
 */

/* 本文の文字：旧サイトの指定（reset.css の html・body）を使う。ONEsta の書体設定は旧 CSS（html:root body）の方が強いので、ここでは折り返し（ONEstar の break-word）だけ戻す */
:root body {
	overflow-wrap: normal;
	word-break: normal;
}

/* 見出し：旧サイトは色・書体・行の高さ・字間を親から受け継ぐ（テーマの見出し設定を打ち消す） */
:root :where(.wp-site-blocks) :is(h1, h2, h3, h4, h5, h6) {
	color: inherit;
	font-family: inherit;
	letter-spacing: inherit;
	line-height: inherit;
}

/* ブロックの間の空き：旧サイトには無い（WordPress のブロック間隔を打ち消して、ブラウザの標準の余白に戻す：旧サイトの LP には reset の CSS が無く、見出しなどはブラウザの標準の余白だった）。
   強さは WordPress の :root :where(.is-layout-flow) > * より 1 つ上（body の分）。旧サイトの要素への指定（html:root … h3 の下の余白など）には負けるようにする */
:root body :where(.wp-site-blocks, .wp-site-blocks *) > * {
	margin-block-start: revert;
	margin-block-end: revert;
}

/* 箱の大きさの数え方：旧サイトは、リセットの CSS で指定した要素以外（::before・::after など）はブラウザの標準（content-box）。
   テーマは全部を border-box にするので、旧サイトに合わせて戻す（旧 CSS で指定のあるものは旧 CSS が勝つ） */
:root :where(.wp-site-blocks) *,
:root :where(.wp-site-blocks) ::before,
:root :where(.wp-site-blocks) ::after {
	box-sizing: content-box;
}
/* ブラウザの標準で border-box のもの（表・ボタン・選択肢など）は、標準に戻す */
:root :where(.wp-site-blocks) :is(table, button, select, meter, progress, input:is([type="button" i], [type="submit" i], [type="reset" i], [type="color" i], [type="search" i], [type="image" i])) {
	box-sizing: border-box;
}

/* 画像：旧サイトは幅を CSS で決めていない画像は実寸のまま（WordPress・テーマの max-width: 100% で縮めない。旧 CSS の指定は旧 CSS が勝つ） */
:root :where(.wp-site-blocks) img {
	max-width: none;
}

/* ページ送り：ONEsta のページ送りの飾り（枠・今のページの背景）は旧サイトに無い。文字の色は旧サイトのリンク・本文の色 */
html:root body :is(.page-numbers, .page-numbers:hover, .page-numbers.current) {
	background: none;
	border: 0;
	border-radius: 0;
}
html:root body span.page-numbers {
	color: inherit;
}
html:root body a.page-numbers:hover {
	color: #0072b4;
}

/* 見出しの文字の大きさ・太さ：旧サイトはブラウザの標準（旧サイトの reset.css は h1・h2・h4〜h6 を 100% にしているが、h3 は書き漏れていてブラウザの標準の 1.17em のまま）。
   テーマの見出しの大きさ・太さを打ち消して、ブラウザの標準に戻す（旧 CSS の指定は旧 CSS が勝つ） */
:root :where(.wp-site-blocks) h1 { font-size: 2em; }
:root :where(.wp-site-blocks) h2 { font-size: 1.5em; }
:root :where(.wp-site-blocks) h3 { font-size: 1.17em; }
:root :where(.wp-site-blocks) h4 { font-size: 1em; }
:root :where(.wp-site-blocks) h5 { font-size: 0.83em; }
:root :where(.wp-site-blocks) h6 { font-size: 0.67em; }
:root :where(.wp-site-blocks) :is(h1, h2, h3, h4, h5, h6) { font-weight: bold; }

/* 横線（旧サイトの本文の <hr>。保存内容に <hr> を入れない規約のため div.ys-hr にした）：ブラウザの hr と同じ見た目。
   旧サイトの CSS（legacy/）の hr の指定は .ys-hr に直してあり、そちらが勝つように弱く書く */
html:root :where(.ys-hr) {
	display: block;
	height: 0;
	margin: 0.5em auto;
	overflow: hidden;
	border-style: inset;
	border-width: 1px;
	color: gray;
}

/* ページの箱：ONEstar は .wp-site-blocks を縦の flex にする（フッターを画面の下に寄せるため）。旧サイトはふつうの並び（body の中に直に要素）。
   flex の中では、左右の margin: auto の要素が中身の幅に縮み、上下の余白が重ならないので、旧サイトと同じふつうの並びに戻す */
html:root .wp-site-blocks {
	display: block;
	min-height: 0;
}

/* 本文の文字の色・書体・大きさ・行の高さ：旧サイトは CSS で決めていないところはブラウザの標準（黒・明朝・16px・normal）。テーマの設定を打ち消す（旧 CSS の指定は旧 CSS が勝つ） */
html:root body {
	color: #000;
	font-family: revert;
	font-size: revert;
	line-height: normal;
}

/* ページの高さ：テーマは html を高さ 100%、body を最低 100% にする（旧サイトに無い。最後の要素の下の余白がページの高さに入らなくなる） */
html:root {
	height: auto;
}
html:root body {
	min-height: 0;
}

/* 回り込み（alignleft など）：WordPress のレイアウトの指定（.is-layout-flow > .alignleft の float・余白）は旧サイトに無い
   （旧テーマは WordPress のブロックの CSS を外していて、旧 CSS にも指定が無かった。記事・アンケートのページの画像は回り込まずに並んでいた）。
   さんど・ふぃなんの LP（旧サイトの CSS に指定がある）はグループに WordPress のクラスが付かないので当たらない */
html:root .is-layout-flow > :is(.alignleft, .alignright, .aligncenter) {
	float: none;
	margin-inline-start: revert;
	margin-inline-end: revert;
}
