@font-face {
	font-family: 'JetBrains Mono';
	font-display: swap;
	src: local('JetBrains Mono'), url('/css/jetbrains-mono-r.woff2') format('woff2');
}

@font-face {
	font-family: 'JetBrains Mono';
	font-style: italic;
	font-display: swap;
	src: local('JetBrains Mono'), url('/css/jetbrains-mono-i.woff2') format('woff2');}

@font-face {
	font-family: 'JetBrains Mono';
	font-weight: 700;
	font-display: swap;
	src: local('JetBrains Mono'), url('/css/jetbrains-mono-b.woff2') format('woff2');
}

:root {
	color-scheme: light dark;
	
	&:has(> head > meta[name="color-scheme"][content="dark"]) {
    	color-scheme: dark;
	}
	&:has(> head > meta[name="color-scheme"][content="light"]) {
		color-scheme: light;
	}
	
	/* font-size: 32px; */
}

:root {	
	--code-ligatures: none;
	--tab-border: none;
	--code-style: normal;
	--code-weight: normal;
	
	--content-max-width: 768px;
	
	--body-background-color: light-dark(#eee, #111);
	--body-color: light-dark(#222, #bbb);
	
	--breadcrumb-separator-color: #666; /* no dark style */
	
	--link-color: light-dark(#000, #aaa);
	--header-number-color: #888; /* no dark style */
	
	--main-background-color: light-dark(#fafafa, #333);
	--main-link-color: light-dark(#a00, #ff7085); /* also used for label accent color */
	
	--toc-border-color: light-dark(#eee, #111); /* also used for settings */
	--toc-number-color: light-dark(#555, #888);
	
	--tutorials-item-color: #000;
	--tutorials-item-hover-color: #a00;
	--tutorials-link-color: #fafafa;
	--tutorials-link-hover-color: #fafafa;
	
	--theme-switcher-toc-background-color: light-dark(#ccc, #333); /* used by settings and toc */
	
	--color-red: light-dark(#f00, #f88);
	--color-green: light-dark(#080, #7e7);
	--color-blue: light-dark(#00f, #99f);
	
	--color-kbd: light-dark(#000, #eee);
	--color-q: light-dark(#660, #dda);
	--color-editor-item: light-dark(#511, #c99);
	
	--pre-border-color: #999; /* no dark style */
	
	--tab-line-color: light-dark(#ddd, #555);
	
	--godot-symbol: light-dark(#00009c, #abc9ff); /* operators like * +, ... */
	--godot-keyword: light-dark(#e62282, #ff7085); /* var, func, ... */
	--godot-control-flow-keyword: light-dark(#bd1fcc, #ff8ccc); /* if, for, ... */
	--godot-base-type: light-dark(#009933, #42ffc2); /* script base type; Color, Vector2, ... */
	--godot-engine-type: light-dark(#1c8c66, #8fffdb); /* script engine type; Color, Vector2, ... */
	--godot-user-type: light-dark(#2e7366, #c7ffed); /* used-defined types */
	--godot-comment: light-dark(#14141480, #cdcfd280); /* comments */
	--godot-string: light-dark(#996b00, #ffeda1); /* strings */
	--godot-background: light-dark(#ffffff, #1d2229); /* background */
	--godot-text: light-dark(#393939, #cdcfd2); /* text without highlighting */
	--godot-selection: light-dark(#2e80ff33, #70bafa66); /* #2e80ff66; selected text; used for ins/del */
	--godot-number: light-dark(#008c47, #a1ffe0); /* numbers */
	--godot-function: light-dark(#0039e6, #57b3ff); /* function invocation */
	--godot-member-variable: light-dark(#0066ad, #bce0ff); /* member variable access. */

	--godot-gdscript-function-definition: light-dark(#009999, #66e6ff); /* function definition */
	--godot-gdscript-global-function: light-dark(#5c2eb8, #a3a3f5); /* global function invocation */
	--godot-gdscript-node-path: light-dark(#2e8c00, #b8c47d); /* ^"" node path */
	--godot-gdscript-node-reference: light-dark(#008000, #63c259); /* % or $ node reference */
	--godot-gdscript-annotation: light-dark(#cc5e00, #ffb373); /* annotation; export, onready, ... */
	--godot-gdscript-string-name: light-dark(#cc8f73, #ffc2a6); /* &"" StringName literal */
}

.red {
	color: var(--color-red);
}

.green {
	color: var(--color-green);
}

.blue {
	color: var(--color-blue);
}

body, figure, h3, ol, ul, li {
	margin: 0;
	padding: 0;
}

body {
	background-color: var(--body-background-color);
	color: var(--body-color);
	font: 1.125rem/1.5em -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	text-align: center;
}

a,a:visited {
	color: var(--link-color);
	text-decoration: none;
}

a:hover,a:visited:hover {
	text-decoration: underline;
}

header,main,footer {
	box-sizing: border-box;
	content: contain;
	margin: 0.5em auto;
	max-width: var(--content-max-width);
}

header {
	background: url('/favicon.svg') top center/45px no-repeat;
	margin: 9px auto;
	padding-top: 60px;
	min-height: 5.55rem;
	font-size: 1.375rem;
	line-height: 1.2;
	font-weight: 700;
	user-select: none;
	-webkit-user-select: none;
}

header li {
	display: inline-block;
	white-space: nowrap;
}

header li:not(:first-child)::before {
	color: var(--breadcrumb-separator-color);
	content: "›";
	padding: 0.25em;
}

main {
	background-color: var(--main-background-color);
	/* contain: layout paint; all contain styles disabled because video controls fail on Brave otherwise */
	counter-reset: h2;
	padding: 1em 1em 0;
	text-align: left;
}

main p {
	margin: 1em 0;
}

main a,main a:visited {
	color: var(--main-link-color);
	text-decoration: underline;
}

hgroup {
	text-align: center;
	font-size: 1.375rem;
	min-height: 7.4rem;
}

hgroup p {
	font-size: 1.25rem;
	font-weight: bold;
	margin: 1em 0 0 0;
}

.published{
	font-size: 1rem;
	font-weight: normal;
}

h1 {
	font-size: 2.25rem;
	margin: 0;
}

h2 {
	counter-reset: h3;
	font-size: 1.375rem;
	margin: 1em 0;
}

h2:before {
	content: counter(h2)" ";
	counter-increment: h2;
}

h2:before,h3:before {
	color: var(--header-number-color);
	font-size: 1rem;
}

/* section {
	contain: layout paint;
} */

h3 {
	font-size: 1.25rem;
	margin: 1em 0;
}

h3:before {
	counter-increment: h3;
	content: counter(h2)"."counter(h3)" ";
}

details {
	/* contain: content; */
	font-size: 1rem;
	margin: 1em 0;
	padding: 0 1em;
}

summary {
	color: var(--main-link-color);
	cursor: pointer;
	font-size: 1.125rem;
	font-weight: 700;
	margin: 0 -1em;
}

summary::first-line {
	color: var(--body-color);
}

code {
	color: var(--godot-symbol);
	font: 0.875rem 'JetBrains Mono',Courier,monospace;
	font-variant-ligatures: var(--code-ligatures);
}

pre {
	background-color: var(--godot-background);
	border: 1px solid var(--pre-border-color);
	color: var(--godot-symbol);
	contain: content;
	font: 0.875rem 'JetBrains Mono',Courier,monospace;
	padding: 1em;
	tab-size: 4;
	overflow-x: auto;
}

img, svg {
	max-width: 100%;
	height: auto;
}

b,i,q,p code,summary code {
	background: inherit;
	font-size: inherit;
	white-space: nowrap;
}

del,ins {
	background-color: var(--godot-selection);
	color: inherit;
	font-style: inherit;
	font-weight: inherit;
	text-decoration: none;
}

del {
	text-decoration: line-through;
}

b {
	color: var(--color-editor-item);
}

q {
	color: var(--color-q);
	font-style: italic;
}

kbd {
	color: var(--color-kbd);
	font-family: 'JetBrains Mono',Courier,monospace;
}

figure {
	/* contain: content; */
	text-align: center;
	display: block;
	margin: 1em auto;
}

figcaption {
	font-size: 1rem;
	font-style: italic
}

.comment {
	color: var(--godot-comment);
	font-style: var(--code-style);
}

.control-flow {
	color: var(--godot-control-flow-keyword);
}

.annotation {
	color: var(--godot-gdscript-annotation);
	font-weight: var(--code-weight);
}

.keyword {
	color: var(--godot-keyword);
	font-weight: var(--code-weight);
}

.core-type {
	color: var(--godot-base-type);
}

.engine-type {
	color: var(--godot-engine-type);
}

.user-type {
	color: var(--godot-user-type);
}

.function {
	color: var(--godot-function);
	font-style: var(--code-style);
}

.function-definition {
	color: var(--godot-gdscript-function-definition);
	font-style: var(--code-style);
}

.global-function {
	color: var(--godot-gdscript-global-function);
	font-style: var(--code-style);
}

.member {
	color: var(--godot-member-variable);
}

.number {
	color: var(--godot-number);
}

.node-reference {
	color: var(--godot-gdscript-node-reference);
	font-style: var(--code-style);
}

.node-path {
	color: var(--godot-gdscript-node-path);
	font-style: var(--code-style);
}

.string {
	color: var(--godot-string);
}

.symbol {
	color: var(--godot-symbol);
}

.string-name {
	color: var(--godot-gdscript-string-name);
	font-style: var(--code-style);
}

.var {
	color: var(--godot-text);
}

.tab {
	border-left: 1px var(--tab-border) var(--tab-line-color);
}


.collection ol {
	margin: 1em 0;
	text-align: center;
}

.collection li {
	background: var(--tutorials-item-color) center top/100% 135px no-repeat;
	display: inline-block;
	margin: 2px;
	min-width: 240px;
}

.collection li:hover {
	background-color: var(--tutorials-item-hover-color);
}

.collection li a,.collection li a:visited {
	color: var(--tutorials-link-color);
	display: block;
	font-size: 1.125rem;
	padding: 137px 2px 0;
	text-decoration: none;
}

.collection li a:hover {
	color: var(--tutorials-link-hover-color);
}

.collection hgroup, .page hgroup {
	min-height: auto;
}

button {
	appearance: none;
	background: none;
	border: none;
	color: inherit;
	cursor: pointer;
	font: inherit;
	margin: 0;
	padding: 0 10px;
	width: 100%;
}

label {
	accent-color: var(--main-link-color);
	display: block;
	padding: 0 1.5em;
	text-align: left;
}

label:hover {
	background-color: var(--toc-border-color);
}

#settings,#toc {
	background-color: var(--theme-switcher-toc-background-color);
	border: 4px solid var(--toc-border-color);
	font-size: 0.875rem;
	position: fixed;
	top: 0;
	user-select: none;
	-webkit-user-select: none;
}

#settings {
	left: 0;
}

#toc {
	box-sizing: border-box;
	counter-reset: toc-h2;
	right: 0;
	text-align: left;
	max-height: 100vh;
	overflow: auto;
}

#toc :before {
	color: var(--toc-number-color);
}

#toc ol,.collection ol {
	list-style-type: none;
}

#toc li {
	margin: 0 1em;
}

.toc-h2:before {
	content: counter(toc-h2)" ";
	counter-increment: toc-h2;
	counter-reset: toc-h3;
}

.toc-h3:before {
	content: counter(toc-h2)"."counter(toc-h3)" ";
	counter-increment: toc-h3;
}

.support-ko-fi,.support-patreon {
	background: url(https://catlikecoding.com/images/logo-patreon.svg) center/contain no-repeat;
	display: inline-block;
	height: 100px;
}

.support-patreon {
	width: 92px;
}

.support-ko-fi {
	background-image: url(https://catlikecoding.com/images/kofi_symbol.svg);
	width: 145px;
}

.svg-grid {
	stroke: gray;
}

.svg-coordinates {
	font: 16px 'JetBrains Mono',Courier,monospace;
	fill: var(--body-color);
}

line, polyline, rect {
	fill: none;
	stroke-linejoin: round;
	stroke-linecap: round;
	stroke-width: 1px;
	vector-effect: non-scaling-stroke;
}

polyline {
	stroke-width: 3px;
}

.svg-f0 {
	color: var(--godot-keyword);
	stroke: var(--godot-keyword);
	text-decoration: overline;
	text-decoration-style: solid;
	text-decoration-thickness: 2px;
}

.svg-f1 {
	color: var(--godot-function);
	stroke: var(--godot-function);
	stroke-dasharray: 5px, 5px;
	text-decoration-line: overline;
	text-decoration-style: dashed;
	text-decoration-thickness: 2px;
}

.svg-f2 {
	color: var(--godot-string);
	stroke: var(--godot-string);
	stroke-dasharray: 0px, 5px;
	text-decoration-line: overline;
	text-decoration-style: dotted;
	text-decoration-thickness: 2px;
}

math {
	font-size: 1.25rem;
}

.donation-plea {
	font-size: 1rem;
	font-style: italic;
	text-align: center;
}

.donation-plea-kofi {
	background: url(https://catlikecoding.com/images/kofi_symbol.svg) left/contain no-repeat;
	padding-left: 1.5rem;
}

.donation-plea-patreon {
	background: url(https://catlikecoding.com/images/logo-patreon.svg) left/contain no-repeat;
	padding-left: 1.125rem;
}

@media print {
	main,body {
		background-color: #fff;
	}
	
	main {
		width: 100%;
	}

	#settings,#toc {
		display: none;
	}

	h2 {
		page-break-before: always;
	}

	details,figure,footer,h2,p,pre,section section,table {
		page-break-inside: avoid;
	}
}
