@charset "utf-8";

/* # rustdoc のスタイルを模倣した独自スタイル。
 *
 * 完全に模倣しない理由は以下の通り。
 *
 * - 引用先の要素はやや幅が狭く調整が必要
 * - 原文の要素は Markdown 由来のため単純
 * - 原文のスタイルは Web フォントを含み重量級
 * - 原文のスタイルは将来変更されうる
 * */

@layer lang {
	/* 原文フォント */
	:where(:host, :not(:lang(en))) > :lang(en) { 
		--quote-serif: "Georgia", serif;
		--quote-sans: "Arial", sans-serif;
		font-family: var(--quote-serif);
	}

	/* 訳文フォント */
	:where(:host, :not(:lang(ja))) > :lang(ja) { 
		--quote-serif: "Times New Roman", "Biz UDMincho", serif;
		--quote-sans: "Arial", "Biz UDGothic", sans-serif;
		font-family: var(--quote-serif);
	}

	/* 訳文は両端揃え */
	:where(p, li):lang(ja) {
		text-align: justify;
	}
}

blockquote {
	/* 見出しの基本設定 */
	h1, h2, h3, h4, h5, h6 {
		font-family: var(--quote-sans);
		border-color: var(--base0-color); 
		border-width: thin; 
	}

	/* 中レベル見出しには下線を付加 */
	h2, h3, h4 {
		border-bottom-style: solid;
	}

	/* 見出しのサイズ設定 */
	h1 { font-size: 1.5rem; }
	h2 { font-size: 1.375rem; margin: 1.5rem 0 1rem; padding: 0 0 1rem; }
	h3 { font-size: 1.25rem; margin: 1rem 0 0.33rem; padding: 0 0 0.33rem; }
	h4 { font-size: 1.125rem; margin: 1rem 0 0.33rem; padding: 0 0 0.33rem; }
	h5 { font-size: 1rem; margin: 1rem 0 0.33rem; }
	h5 { font-size: 1rem; margin: 1rem 0 0.33rem; }

	/* 箇条書のインデント */
	ol, ul { padding-left: 1.5em; }
	li { margin: 0.5em 0; }

	/* コードの色設定 */
	a.trait, span.trait { color: #6e4fc9; }
	a.fn, span.fn { color: #ad7c37; }
	a.trait, span.trait { color: #ad378a; }
	a.primitive, span.primitive { color: #ad378a; }
	a.primitive *, span.primitive * { color: inherit !important; }

	/* 要約と詳細のマーカ設定 */
	details {
		> summary {
			display: block;
			margin-left: 1rem;

			&::before {
				display: inline-block;
				width: 1rem;
				margin-left: -1rem;
				vertical-align: text-top;
				font-size: xx-small;
				font-family: system-ui;
				cursor: pointer;
				color: #999;
			}
		}

		&[open] summary::before {
			content: "\25BC";
		}

		&:not([open]) summary::before {
			content: "\25B6";
		}
	}

	/* 説明アイテム */
	details.desc {
		summary {
			cursor: pointer;
			color: #999;

			& + div {
				margin-left: 1rem;
			}
		}

		&[open] summary {
			width: 0;
			visibility: hidden;
			float: left;
		}

		&[open] summary::before {
			visibility: visible;
		}
	}

	/* メソッドアイテム */
	details.method {
		margin: 1em 0;

		.rightside {
			float: right;
			margin-left: 2em;
		}

		summary {
			pointer-events: none;

			&::before {
				pointer-events: auto;
			}

			a {
				pointer-events: auto;
			}

			& > code {
				background-color: transparent;
			}

			& + div {
				margin-left: 1rem;
			}
		}
	}
}

