/* Candy Web Database - Candy Arts */

.cwdb {
	--cwdb-bg: #ffffff;
	--cwdb-text: #1f2328;
	--cwdb-link: #2557c7;
	--cwdb-code: #b5480f;
	--cwdb-sidebar: #f3f5f7;
	--cwdb-field: #ffffff;
	--cwdb-accent: #2557c7;
	--cwdb-accent-text: #ffffff;
	--cwdb-ui-text: var(--cwdb-text);
	--cwdb-border: rgba(127, 127, 127, 0.35);
	--cwdb-border-width: 1px;
	--cwdb-radius: 8px;
	--cwdb-rule: rgba(127, 127, 127, 0.3);
	--cwdb-scale: 1;
	box-sizing: border-box;
	max-width: 100%;
	line-height: 1.5;
}

.cwdb *,
.cwdb *::before,
.cwdb *::after {
	box-sizing: inherit;
}

/* Layout */

.cwdb-layout {
	display: grid;
	grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
	border: var(--cwdb-border-width) solid var(--cwdb-border);
	border-radius: var(--cwdb-radius);
	background: var(--cwdb-bg);
	overflow: clip;
}

.cwdb-sidebar {
	min-width: 0;
	background: var(--cwdb-sidebar);
	color: var(--cwdb-ui-text);
	border-right: var(--cwdb-border-width) solid var(--cwdb-border);
	font-size: 15px;
}

.cwdb-sidebar-body {
	padding: 12px;
}

.cwdb-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 16px 32px 32px;
	background: var(--cwdb-bg);
	color: var(--cwdb-text);
}

/* Everything above the footer: grows, so a short page's footer sits at the bottom */
.cwdb-body {
	flex: 1 0 auto;
	min-width: 0;
}

/* Sidebar */

.cwdb-nav-toggle {
	display: none;
}

.cwdb-pickers {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 10px;
}

.cwdb-picker {
	display: flex;
	flex: 1 1 0;
	min-width: 0;
	flex-direction: column;
	gap: 2px;
	margin: 0;
	font-size: 12px;
	font-weight: 600;
}

/* Documentation on its own row, Version and Language side by side below it */
.cwdb-picker-database {
	flex-basis: 100%;
}

.cwdb .cwdb-nav-select,
.cwdb .cwdb-search-input {
	width: 100%;
	min-height: 34px;
	margin: 0;
	padding: 4px 8px;
	border: var(--cwdb-border-width) solid var(--cwdb-border);
	border-radius: var(--cwdb-radius);
	background: var(--cwdb-field);
	color: var(--cwdb-ui-text);
	font: inherit;
	font-size: 14px;
	font-weight: 400;
}

.cwdb-search {
	margin-bottom: 10px;
}

.cwdb-tree,
.cwdb-results,
.cwdb-about {
	padding: 4px;
	border-radius: var(--cwdb-radius);
	background: var(--cwdb-list, transparent);
}

.cwdb-about {
	margin-top: 10px;
}

.cwdb-about-title {
	display: block;
	padding: 2px 6px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.cwdb .cwdb-sidebar ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cwdb .cwdb-sidebar ul ul {
	padding-left: 14px;
}

.cwdb .cwdb-sidebar li {
	margin: 0;
	padding: 0;
}

.cwdb-sidebar summary {
	display: flex;
	align-items: center;
	gap: 2px;
	cursor: pointer;
	list-style: none;
}

.cwdb-sidebar summary::-webkit-details-marker {
	display: none;
}

.cwdb-sidebar summary::before {
	content: "";
	flex: none;
	width: 0;
	height: 0;
	margin: 0 5px 0 3px;
	border-top: 4px solid transparent;
	border-bottom: 4px solid transparent;
	border-left: 5px solid var(--cwdb-arrow, currentColor);
	transition: transform 0.15s;
}

.cwdb-sidebar details[open] > summary::before {
	transform: rotate(90deg);
}

.cwdb-leaf {
	padding-left: 13px !important;
}

.cwdb .cwdb-sidebar a,
.cwdb-category {
	display: block;
	flex: 1;
	padding: 2px 6px;
	border-radius: calc(var(--cwdb-radius) / 2);
	color: inherit;
	text-decoration: none;
	overflow-wrap: anywhere;
}

.cwdb-category {
	font-weight: 600;
}

.cwdb .cwdb-sidebar a:hover {
	background: var(--cwdb-hover, rgba(127, 127, 127, 0.15));
}

.cwdb .cwdb-sidebar a.is-current {
	background: var(--cwdb-accent);
	color: var(--cwdb-accent-text);
}

.cwdb .cwdb-results a {
	padding: 4px 6px;
}

.cwdb-result-title {
	display: block;
	font-weight: 600;
}

.cwdb-result-text {
	display: block;
	font-size: 12px;
	opacity: 0.8;
}

.cwdb-results p {
	margin: 4px 6px;
}

/* Toolbar */

.cwdb-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	font-size: 14px;
}

.cwdb-breadcrumbs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	opacity: 0.85;
}

.cwdb .cwdb-breadcrumbs a {
	color: inherit;
}

.cwdb-size {
	display: flex;
	flex: none;
	gap: 4px;
}

.cwdb .cwdb-size button,
.cwdb .cwdb-nav-toggle {
	min-width: 34px;
	min-height: 30px;
	margin: 0;
	padding: 2px 8px;
	border: var(--cwdb-border-width) solid var(--cwdb-border);
	border-radius: var(--cwdb-radius);
	background: var(--cwdb-button, var(--cwdb-field));
	color: var(--cwdb-ui-text);
	font: inherit;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
}

.cwdb .cwdb-size button:hover,
.cwdb .cwdb-nav-toggle:hover {
	background: var(--cwdb-hover, var(--cwdb-field));
}

.cwdb .cwdb-size button:focus-visible,
.cwdb .cwdb-nav-toggle:focus-visible,
.cwdb .cwdb-sidebar a:focus-visible {
	outline: 2px solid var(--cwdb-accent);
	outline-offset: 1px;
}

/* Page text (Web_Converter.gd's HTML) */

.cwdb-text {
	font-size: calc(var(--cwdb-scale) * 16px);
	white-space: pre-wrap;
	overflow-wrap: break-word;
}

.cwdb-header {
	margin: 0 -32px 16px;
	padding: 8px 32px;
	background: var(--cwdb-header-bg, transparent);
	color: var(--cwdb-header-text, inherit);
}

/* Footer: after the page, reaching the docs area's bottom edge */
.cwdb-footer {
	flex: none;
	margin: 16px -32px -32px;
	padding: 8px 32px;
	background: var(--cwdb-footer-bg, transparent);
	color: var(--cwdb-footer-text, inherit);
}

/* Fixed footer (footer_scrolls "0"): stays at the bottom of the window while the docs area is on screen */
.cwdb-footer.cwdb-footer-fixed {
	position: sticky;
	bottom: 0;
	z-index: 1;
	/* The page's background under the footer's own, so the page doesn't show through */
	background: linear-gradient(var(--cwdb-footer-bg, transparent), var(--cwdb-footer-bg, transparent)), var(--cwdb-bg);
}

.cwdb .cwdb-text a {
	color: var(--cwdb-link);
	text-decoration: underline;
}

.cwdb .cwdb-text code {
	padding: 0.05em 0.3em;
	border-radius: 4px;
	background: rgba(127, 127, 127, 0.12);
	color: var(--cwdb-code);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
	font-size: 0.92em;
	white-space: pre-wrap;
}

.cwdb .cwdb-text img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

.cwdb .cwdb-text img.cwdb-zoomable {
	cursor: zoom-in;
}

.cwdb .cwdb-text img.cwdb-zoomable:focus-visible {
	outline: 2px solid var(--cwdb-accent);
	outline-offset: 2px;
}

/* Full-size image viewer (candy-web-database.js) */

.cwdb-viewer {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	box-sizing: border-box;
	padding: 24px;
	overflow: auto;
	background: rgba(0, 0, 0, 0.85);
	cursor: zoom-out;
}

.cwdb-viewer img {
	display: block;
	flex: none;
	margin: auto;
	max-width: 100%;
	max-height: 100%;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
	cursor: default;
}

.cwdb-viewer.can-zoom img {
	cursor: zoom-in;
}

.cwdb-viewer.is-actual img {
	max-width: none;
	max-height: none;
	cursor: zoom-out;
}

.cwdb-viewer .cwdb-viewer-close {
	position: fixed;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #ffffff;
	font: 28px/40px sans-serif;
	text-align: center;
	cursor: pointer;
}

.cwdb-viewer .cwdb-viewer-close:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.cwdb-center {
	text-align: center;
}

.cwdb-left {
	text-align: left;
}

.cwdb-right {
	text-align: right;
}

.cwdb-fill {
	text-align: justify;
}

.cwdb-indent {
	margin-left: 2em;
}

.cwdb .cwdb-text .cwdb-list {
	margin: 0;
	padding-left: 1.6em;
}

.cwdb .cwdb-text .cwdb-list li {
	margin: 0;
}

.cwdb .cwdb-hr {
	height: 0;
	margin: 0.6em 0;
	border: 0;
	border-top: 1px solid var(--cwdb-rule);
}

.cwdb-table {
	max-width: 100%;
	overflow-x: auto;
}

.cwdb .cwdb-table table {
	width: auto;
	margin: 0;
	border-collapse: collapse;
	font-size: inherit;
	text-align: inherit;
}

/* A table in [center] or [right] is aligned as a whole, as RichTextLabel does: */
.cwdb .cwdb-center > .cwdb-table table {
	margin-left: auto;
	margin-right: auto;
}

.cwdb .cwdb-right > .cwdb-table table {
	margin-left: auto;
}

.cwdb .cwdb-table td {
	padding: 4px 10px;
	border: 1px solid var(--cwdb-rule);
	vertical-align: top;
	/* Cells take the alignment around the table, as in RichTextLabel: */
	text-align: inherit;
}

.cwdb-hint {
	text-decoration: underline dotted;
	cursor: help;
}

.cwdb-missing,
.cwdb-link-missing {
	opacity: 0.7;
}

/* Previous / next */

.cwdb-pager {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	margin-top: 32px;
	padding-top: 16px;
	border-top: 1px solid var(--cwdb-rule);
}

.cwdb .cwdb-pager a {
	display: flex;
	flex-direction: column;
	max-width: 48%;
	padding: 8px 12px;
	border: var(--cwdb-border-width) solid var(--cwdb-border);
	border-radius: var(--cwdb-radius);
	color: inherit;
	text-decoration: none;
}

.cwdb .cwdb-pager a:hover {
	background: var(--cwdb-hover, rgba(127, 127, 127, 0.1));
}

.cwdb-next {
	margin-left: auto;
	text-align: right;
}

.cwdb-pager-label {
	font-size: 12px;
	opacity: 0.75;
}

.cwdb-pager-title {
	color: var(--cwdb-link);
	font-weight: 600;
}

/* Index of databases */

.cwdb .cwdb-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cwdb .cwdb-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	height: 100%;
	padding: 16px;
	border: 1px solid rgba(127, 127, 127, 0.35);
	border-radius: 8px;
	color: inherit;
	text-decoration: none;
}

.cwdb .cwdb-card:hover {
	border-color: currentColor;
}

.cwdb-card-title {
	font-size: 1.15em;
	font-weight: 700;
}

.cwdb-card-text {
	opacity: 0.8;
}

/* Phones and narrow columns */

@media (max-width: 800px) {
	.cwdb-layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.cwdb-sidebar {
		border-right: 0;
		border-bottom: var(--cwdb-border-width) solid var(--cwdb-border);
	}

	.cwdb.cwdb-js .cwdb-nav-toggle {
		display: block;
		width: calc(100% - 24px);
		margin: 12px;
	}

	.cwdb.cwdb-js .cwdb-sidebar-body {
		display: none;
		padding-top: 0;
	}

	.cwdb.cwdb-js .cwdb-sidebar.is-open .cwdb-sidebar-body {
		display: block;
	}

	.cwdb-main {
		padding: 12px 16px 24px;
	}

	.cwdb-header {
		margin: 0 -16px 12px;
		padding: 8px 16px;
	}

	.cwdb-footer {
		margin: 12px -16px -24px;
		padding: 8px 16px;
	}

	.cwdb-indent {
		margin-left: 1em;
	}
}
