@import "colors.css";

@font-face {
	font-family: murecho;
	src: url(/font/Murecho-Regular.woff2);
	font-display: swap;
}
@font-face {
	font-family: murecho-bold;
	src: url(/font/Murecho-ExtraBold.woff2);
	font-display: swap;
}
@font-face {
	font-family: alkatra;
	src: url(/font/Alkatra.ttf);
	font-display: swap;
}

html, body {
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
}

body {
	background: var(--color-background-body);
	color: var(--color-text);
	font-family: "murecho", sans-serif;
}

nav {
	background: var(--color-background-content);
}

a[href] {
	color: var(--color-link);
	font-weight: bold;
	text-decoration: none;
}
code > a[href] {
	color: inherit;
}
nav a[href] {
	color: var(--color-text);
	border-bottom: none;
}
nav a[href].current {
	color: var(--color-link-current);
}
a[href].download {
	font-size: 1.5em;
}

ul {
	margin-block-start: 0;
	margin-block-end: 0;
	padding-inline-start: 0;
}

li {
	list-style-type: none;
}

table {
	margin-left: auto;
	margin-right: auto;
	margin-top: 0.5em;
	margin-bottom: 1em;
	border-collapse: collapse;
}

table > thead {
	border-bottom: 1px solid gray;
}

table.auto-funs tr th:nth-child(1) {
	width: 10%;
}
table.auto-funs tr th:nth-child(2) {
	width: 45%;
}
table.auto-funs tr th:nth-child(3) {
	width: 45%;
}

table.syntax-translate {
	width: 100%;
}

table.setters {
	table-layout: fixed;
}
table.setters tr th:nth-child(1) {
	width: 15%;
}
table.setters tr th:nth-child(2) {
	width: 20%;
}
table.setters tr th:nth-child(3) {
	width: 55%;
}

table tr, table th {
	padding: 0;
}
table > tbody > tr {
	border-bottom: 1px solid var(--color-tr);
}
table > tbody > tr:last-child {
	border-bottom: none;
}

table td {
	padding-left: 0.2em;
	padding-right: 0.2em;
}

table.operators tr td:first-child {
	text-align: center;
}

ul.bullets {
	padding-left: 1.5em;
}
ul.bullets li {
	margin: 0.5em;
	list-style-type: disc;
}
ul.bullets ul {
	padding-left: 1.5em;
}
ul.bullets ul li {
	list-style-type: circle;
}

#home keen-icon {
	color: var(--color-header);
	width: 2.5em;
	height: 2.5em;
	padding-left: 0.5em;
	padding-right: 0.5em;
	transform: translate(0, 0.25em);
	stroke-width: 0.1em;
}

header nav {
	height: 3em;
	padding-left: 0;
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	font-family: 'hack', monospace;
	border-bottom: 1px solid var(--color-faint);
	position: relative;
	z-index: 999;
}

header nav ul {
	height: 3em;
}

header nav ul li {
	margin-top: 0.5em;
	margin-right: 0.75em;
	padding-left: 0.75em;
}

#side-nav-wrapper {
	display: flex;
	flex-direction: row;
}

#side-nav-wrapper nav {
	display: flex;
	flex-direction: column;
	margin-top: 2em;
	font-size: 80%;
	height: 100%;
	padding-left: 1em;
	padding-right: 1em;
	padding-bottom: 1em;
	border: 2px solid var(--color-faint);
	border-left: none;
	min-width: 8em;
}

nav ul li {
	margin-top: 0.25em;
}

#side-nav-wrapper nav ul a.current::after {
	content: " \2B05";
	font-weight: bold;
}

nav ul {
	display: flex;
	margin: 0;
	padding: 0;
}

nav ul.grow {
	flex-grow: 1;
}

#side-nav-wrapper nav ul {
	flex-direction: column;
	padding-top: 1em;
}

nav ul li {
	font-size: 125%;
}

main {
	background: var(--color-background-content);

	width: 52em;
	margin-top: 1em;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: 1em;
	padding-top: 0.5em;
	padding-bottom: 0.5em;
	padding-left: 2em;
	padding-right: 2em;
}
main.play {
	width: 64em;
}

main h1, main h2, main h3 {
	color: var(--color-header);
	font-family: murecho-bold;
	width: fit-content;
	margin-top: 1em;
	margin-bottom: 0.25em;
	margin-left: 1rem;
	border-bottom: var(--border-width) solid transparent; /* affects the border-image width */
	border-image: linear-gradient(
		to right,
		transparent 0 0.25em,
		var(--border-color) 0.25em calc(100% - 0.25em),
		transparent calc(100% - 0.25em) 100%
	) 1;
}

main h1 {
	width: fit-content;
	font-size: 2rem;
	margin-top: 1em;
	--border-width: 3px;
	--border-color: var(--color-header);
}
main h1:first-of-type {
	margin-top: 0.25em;
}

main h2 {
	font-size: 1.5rem;
	--border-width: 1.5px;
	--border-color: color-mix(in srgb, var(--color-header) 50%, transparent);
}

main h3 {
	font-size: 1.33rem;
	--border-width: 1px;
	--border-color: color-mix(in srgb, var(--color-header) 25%, transparent);
}

aside {
	margin-left: 4em;
	margin-right: 4em;
	margin-top: 1em;
	margin-bottom: 1em;
	--border: var(--color-faint);
	--border-width: 0.15rem;
	background-color: var(--color-background-code);

	&:not(.small) {
		margin-top: 2em;
		padding: 1em;
		padding-top: 0em;
		padding-bottom: 0em;
		border: var(--border-width) solid var(--border);
	}
}
aside > h4 {
	font-family: alkatra;
	font-size: 80%;
	text-align: center;
	margin-top: 0;
	margin-left: auto;
	margin-right: auto;
	margin-bottom: -1.5em;
	position: relative;
	height: 1.5em;
	bottom: 0.85em;
	font-size: 1.5em;
	background-color: var(--color-background-code);
	position: relative;
	--border-radius: 1.5em;
	border-radius: var(--border-radius);
  	width: 50%;
}
aside > h4::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0; /* top right bottom left */
	height: 50%;
	border: var(--border-width) solid var(--border);
	border-bottom: none;
	border-top-left-radius: var(--border-radius);
	border-top-right-radius: var(--border-radius);
}
aside.small {
	padding: 0.25em;
}

div.code-block {
	max-width: 44em;
	margin-left: auto;
	margin-right: auto;
	margin-top: 0.5em;
	margin-bottom: 0.5em;
	padding: 0.5em;
	background: var(--color-background-code);
	font-family: 'hack', monospace;
}
div.code-block > pre {
	margin: 0;
}

code {
	font-weight: bold;
	font-family: 'hack', monospace;
	font-size: 95%;
}

keen-icon {
	display: inline-block;
	margin-left: 0.25em;
	margin-right: 0.25em;
	width: 0.75em;
	height: 0.75em;
	transform: scale(1.5);
	transform-origin: bottom;
}

#next {
	margin-top: 1em;
	margin-bottom: 0.5em;
	float: right;
	font-size: 125%;
}
#next::before {
	content: "\279e";
	margin-right: 0.5em;
}

section.collapsible > div {
	interpolate-size: allow-keywords;
	height: auto;
	overflow: hidden;
	transition: height 0.5s ease-out;
}
section.collapsible.collapsed > div {
	height: 0;
}

section.collapsible > h2 {
	display: inline-block;
}
section.collapsible > button {
	display: inline-block;
}
section.collapsible > button {
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
}
section.collapsible > button > keen-icon {
	transform-origin: center center;
	rotate: 180deg;
	transition: rotate 0.5s ease-out;
}
section.collapsible.collapsed > button > keen-icon {
	rotate: 0deg;
}

keen-runnable + keen-runnable {
	margin-top: 1em;
}

/* Ideally this would go in keen-text.css, but the tooltip element is attached to the document root so it does not get clipped */
.hover-tooltip {
	position: fixed;
	inset: auto;
	margin: 0;
	padding: 0.5em;
	white-space: pre-wrap;

	background: var(--color-background-hover);
	color: var(--color-text);
	border: 1px solid var(--color-faint);
}

main h1:has(+ a) {
	display: inline-block;
}
main h1 + a {
	display: inline-block;
	margin-left: 2em;
}

.doc-entry {
	margin-top: 1em;
}
.doc-entry:target {
	animation: highlight 2s ease-out;
}
@keyframes highlight {
  0%   { background-color: #ffff99; }
  100% { background-color: transparent; }
}
.doc-entry > .doc-comment {
	margin-block-start: 0.5em;
	margin-block-end: 0;
	margin-left: 2em;
}
.doc-entry > .member {
	margin-top: 0.25em;
	margin-left: 2em;
}

pre.doc-comment {
	font-family: inherit;
}
