:root {
	--figuremark: #44d;
  --code: var(--figuremark);
  --preformatted: #333;
}

h4 {
	margin-top: 3rem;
}

code {
	font-weight: 600;
}

pre {
	font-size: 0.8rem;
}

li {
	margin-top: 0.5rem;
}

hr {
	margin: 1.5rem auto;
	background-color: transparent;
	border-bottom: 3px solid var(--figuremark);
	width: 50%;
}

hr:after {
	content: "";
}

hr, hr:after {
	height: 2.5rem;
}

figure.figuremark, article > figure.figuremark {
	break-inside: avoid;
	text-align: left;
	font-family: var(--mono-font);
	margin: 4rem 0;
	font-size: 1.2rem;
	line-height: 2rem;
}

figure > * {
	margin: 0 auto;
}

.figure-content {
	text-align; left;
	white-space: pre;
	tab-size: 2;
	hyphens: none;
	overflow-x: auto;
	overflow-y: hidden;
}

figcaption {
	font-family: var(--sans-font);
	font-size: 1.3rem;
	font-weight: bold;
	display: inline-block;
	width: 100%;
	padding-bottom: 0.2rem;
	margin-bottom: 1rem;
}

figcaption a, figcaption a:visited {
	color: var(--figuremark);
	color: inherit;
	text-decoration: none;
}

.figure-number {
	float: right;
}

figure.example figcaption {
	color: var(--figuremark);
}

figure.example {
	padding-bottom: 1rem;
}

figure.example .line {
	min-height: 2rem;
}

figure.example, figure.example figcaption {
	border-bottom: 2px solid var(--figuremark);
}

figure.example:not(:has(figcaption)) {
	border-top: 2px solid var(--figuremark);
	padding-top: 1rem;
}

figure figcaption:not(:has(.figure-title)) {
	/* display: none; */
}

.insert {
	color: green;
	font-weight: bold;
}

.remove {
	color: red;
	text-decoration: line-through;
}

.result {
	background-color: #eee;
	color: #444;
	display: inline-block;
	width: 100%;
	margin: 0.5rem 0;
	white-space: pre-wrap;
}

.result:before {
	content: " > ";
}

.comment {
	font-style: italic;
	color: #999;
	padding-left: 0.2rem;
}

.comment:before {
	content: "// ";
}

.highlight {
	color: #06f;
	font-weight: bold;
}

.reference {
	color: white;
	background-color: #f80;
	border-radius: 0.3rem;
	padding: 0.2rem 0.4rem;
}

.attributed {
	color: mediumorchid;
}

div.highlight, pre.highlight, .highlight code {
	font-weight: normal;
}

div.highlight {
	margin: 4rem 0;
}

figure.poetry, figure.quotation {
	font-family: var(--serif-font);
	font-size: 1.6rem;
	line-height: 2.5rem;
	margin: 3rem 0;
	max-width: 90vw;
	display: inline-block;
}

figure.poetry figcaption, figure.quotation figcaption {
	text-align: right;
	font-style: italic;
	font-weight: 600;
	padding: 0;
}

figure.poetry .figure-content {
	margin: 0 auto;
	overflow: auto;
}

figure.poetry .reference {
	border-radius: 50%;
	display: inline-block;
	width: 2rem;
	height: 2rem;
	padding: 0.1rem;
	text-align: center;
	vertical-align: text-bottom;
	font-family: var(--sans-font);
	font-size: 1.5rem;
	line-height: 2rem;
	font-weight: bold;
	background-color: crimson;
}

figure.poetry .highlight {
	color: blueviolet;
}

figure.poetry .insert {
	text-decoration-line: underline;
  text-decoration-style: dashed;
  text-underline-offset: 0.3rem;
  text-decoration-thickness: 0.2rem;
}

figure.poetry .comment {
	font-style: normal;
}

figure.poetry .comment:before {
	content: "[ ";
}

figure.poetry .comment:after {
	content: " ]";
}

figure.poetry .figure-number {
	display: none;
}

figure.quotation .figure-number {
	float: none;
	bottom: 0;
	font-size: 1rem;
	line-height: 1.2rem;
	font-style: normal;
	color: #888;
}

figure.quotation {
	max-width: 55%;
	font-size: 2rem;
}	

figure.quotation figcaption {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

figure.quotation .figure-title {
	font-size: 1.6rem;
	color: crimson;
}

figure.quotation .figure-title:before {
	content: "~ "
}

figure.quotation .figure-content {
	white-space: pre-wrap;
	text-align: justify;
	line-height: 3rem;
	padding-bottom: 1.5rem;
}

figure.quotation .figure-content:before {
	content: "“";
}

figure.quotation .figure-content:after {
	content: "”";
	float: right;
	margin-top: -3rem;
}

figure.quotation .figure-content:before, figure.quotation .figure-content:after {
	font-size: 2.3rem;
	color: #888;
	padding: 0 0.1rem;
}

figure.quotation .highlight {
	background-color: #fd3;
	color: black;
	padding: 0.2rem 0.5rem;
	border-radius: 0.4rem;
}

figure.quotation .insert {
	color: fuchsia;
	font-variant-caps: all-small-caps;
}

.incept .comment {
	font-style: normal;
	padding-left: 0;
}

.incept .comment:before {
	content: "";
}

.incept .remove {
	text-decoration: none;
}

.incept .result {
	display: inline;
}

.incept .result:before {
	content: "";
}

.incept span.figuremark:not(.line) {
	font-weight: bold;
}

.incept span.figuremark.implicit {
	font-weight: normal;
	text-decoration: underline;
	text-decoration-style: dotted;
	text-decoration-thickness: 0.15rem;
	text-underline-offset: 0.2rem;
}

.incept span.figuremark.implicit:has(+ .highlight) {
	text-decoration-color: #06f;
}

.incept span.figuremark.implicit:has(+ .insert) {
	text-decoration-color: green;
}

.incept span.figuremark.implicit:has(+ .remove) {
	text-decoration-color: red;
}

.incept span.figuremark.implicit:has(+ .comment) {
	text-decoration-color: #999;
}

.incept span.figuremark.implicit:has(+ .result) {
	text-decoration-color: #444;
	background-color: #eee;
}

.incept span.figuremark.implicit:has(+ .attributed) {
	text-decoration-color: mediumorchid;
}

.incept .reference {
	background-color: transparent;
	color: #f60;
	padding: 0;
}

figure.example .figure-content {
	display: flex;
	flex-direction: column;
	margin: 1rem 0;
}

figure.example:not(.incept) .line:has(> .reference) {
	/* background-color: #fda; */
}

@media (prefers-color-scheme: dark) {
	:root {
		--figuremark: #99d;
	}
	
	.highlight {
		color: #0af;
	}
	
	.insert {
		color: mediumspringgreen;
	}
	
	.reference {
		background-color: #f70;
	}
	
	figure.poetry .highlight {
		color: mediumorchid;
	}
	
	pre code {
		color: #ccc;
	}

}

@media only screen and (max-width: 900px) {

	figure.quotation {
		max-width: 75%;
	}

}

@media only screen and (max-width: 600px) {

	figure.quotation {
		max-width: 90%;
	}

}

@media only screen and (max-width: 680px) {

	figure.poetry {
		font-size: 1.1rem;
		line-height: 2rem;
	}
	
	figure.poetry figcaption {
		font-size: 1rem;
	}
	
	figure.poetry .reference {
		width: 1.2rem;
		height: 1.2rem;
		padding: 0.05rem;
		font-size: 0.9rem;
		line-height: 1.2rem;
	}

	figure.poetry .insert {
		text-underline-offset: 0.2rem;
		text-decoration-thickness: 0.1rem;
	}
}
