/* SPDX-License-Identifier: BSD-3-Clause */
/* ABOUTME: Styles for the uCentral schema reference: fixed header, scrolling field tree and detail panes. */
/* ABOUTME: Neutral documentation palette: dark text on white, grey rules, one link colour. */

:root {
	--bg: #ffffff;
	--panel: #fafafa;
	--text: #1a1a1a;
	--muted: #5c5c5c;
	--line: #e2e2e2;
	--link: #1f4a7a;
	--selected: #ececec;
	--code-bg: #f4f4f4;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body { display: flex; flex-direction: column; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.88em; }

header {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 24px;
	padding: 8px 24px;
	min-height: 52px;
	border-bottom: 1px solid var(--line);
	background: var(--bg);
}

.brand { font-weight: 600; color: var(--text); white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }

.docs { display: flex; align-self: stretch; gap: 20px; }
.docs a { display: flex; align-items: center; padding: 6px 0; color: var(--muted); border-bottom: 2px solid transparent; }
.docs a:hover { color: var(--text); text-decoration: none; }
.docs a[aria-current] { color: var(--text); border-bottom-color: var(--text); font-weight: 500; }

.version { color: var(--muted); font-size: 13px; white-space: nowrap; }
#version, #compare { width: 15.5em; }

select, input[type="search"] {
	font: inherit;
	font-size: 14px;
	color: var(--text);
	background: var(--bg);
	border: 1px solid #cfcfcf;
	border-radius: 3px;
	padding: 4px 8px;
}

select:focus, input[type="search"]:focus { outline: none; border-color: var(--text); }

#search { margin-left: auto; width: min(360px, 40vw); }

.layout { flex: 1; display: flex; min-height: 0; }

#tree {
	width: 300px;
	flex: none;
	overflow: auto;
	padding: 16px 8px 40px;
	border-right: 1px solid var(--line);
	background: var(--panel);
	font-family: var(--mono);
	font-size: 13px;
}

#tree ul { list-style: none; margin: 0; padding-left: 14px; }
#tree > ul { padding-left: 0; }
#tree li { margin: 0; }
#tree summary { cursor: pointer; }
#tree summary::marker { color: #9a9a9a; }
#tree li > a { margin-left: 15px; }
#tree a { display: inline-block; padding: 1px 6px; border-left: 2px solid transparent; color: var(--text); }
#tree a:hover { text-decoration: none; background: var(--selected); }
#tree a[aria-current] { background: var(--selected); border-left-color: var(--text); font-weight: 600; }
#tree a.variant, .children a.variant { color: var(--muted); }

#detail { flex: 1; overflow: auto; padding: 28px 48px 64px; max-width: 1100px; }

h1 { margin: 8px 0 8px; font-size: 24px; font-weight: 600; font-family: var(--mono); display: flex; align-items: center; gap: 12px; }
h2 { margin: 32px 0 8px; font-size: 15px; font-weight: 600; }

.crumbs { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.crumbs .here { color: var(--text); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.type { background: var(--code-bg); border: 1px solid var(--line); padding: 1px 6px; border-radius: 3px; color: var(--text); }
.ref { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.ref::before { content: "definition: "; font-family: system-ui, sans-serif; }

.description { font-size: 15px; max-width: 75ch; white-space: pre-line; }
.muted { color: var(--muted); }
.notice { padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--muted); background: var(--panel); }

.copy {
	font: 12px system-ui, sans-serif;
	color: var(--muted);
	background: var(--bg);
	border: 1px solid #cfcfcf;
	border-radius: 3px;
	padding: 2px 8px;
	cursor: pointer;
}

.copy:hover { color: var(--text); border-color: var(--text); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 16px 0; padding: 12px 16px; border: 1px solid var(--line); background: var(--panel); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.children { border-collapse: collapse; width: 100%; font-size: 14px; }
.children th { text-align: left; color: var(--muted); font-weight: 500; border-bottom: 1px solid #cfcfcf; padding: 6px 10px; }
.children td { border-bottom: 1px solid var(--line); padding: 7px 10px; vertical-align: top; }
.children td:first-child { font-family: var(--mono); white-space: nowrap; }
.children td:nth-child(2) { white-space: nowrap; }
.children tbody tr:hover { background: var(--panel); }
.required { color: var(--text); margin-left: 2px; }

.hits { list-style: none; padding: 0; }
.hits li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.hits a { font-family: var(--mono); margin-right: 10px; }
.hits p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 800px) {
	header { flex-wrap: wrap; height: auto; padding: 8px 16px; }
	#search { width: 100%; margin-left: 0; }
	#tree { display: none; }
	#detail { padding: 16px; }
}

.diff { border: 1px solid var(--line); border-radius: 4px; margin: 12px 0 16px; overflow: hidden; }
.diff-head { display: flex; align-items: baseline; gap: 12px; padding: 7px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.diff-head a { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.diff-status { color: var(--muted); font-size: 12px; }
.diff-lines { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.diff-lines td { padding: 1px 10px; vertical-align: top; }
.diff-lines .sign { width: 1.5em; padding-right: 0; text-align: center; user-select: none; color: var(--muted); }
.diff-lines .key { width: 34%; white-space: nowrap; }
.diff-lines .val { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-lines .del { background: #ffebe9; }
.diff-lines .del .sign { background: #ffd7d5; color: #82071e; }
.diff-lines .add { background: #e6ffec; }
.diff-lines .add .sign { background: #ccffd8; color: #116329; }
.diff-lines .ctx .key, .diff-lines .ctx .val { color: var(--muted); }
.stat-add { color: #116329; font-family: var(--mono); font-weight: 600; }
.stat-del { color: #82071e; font-family: var(--mono); font-weight: 600; }
.documented > summary { cursor: pointer; color: var(--link); margin: 8px 0; }
