/* Copyright 2026 Quadrant Systems. All rights reserved.
 *
 * The stylesheet of the frame and the pages. Plain CSS on the tokens of
 * design-system/tokens/tokens.css (ADR-1). */

*, *::before, *::after { box-sizing: border-box; }

/* Hidden on the screen, read by screen readers. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

body {
	margin: 0;
	background: var(--q-surface);
	color: var(--q-text);
	font-family: var(--q-font-sans);
	font-size: var(--q-size-prose);
	line-height: var(--q-leading-prose);
}

::selection { background: var(--q-selection); color: var(--q-selection-on); }

a { color: var(--q-link); text-underline-offset: 2px; }
a:hover { color: var(--q-link-hover); }
a:focus-visible { outline: 2px solid var(--q-ring); outline-offset: 2px; border-radius: var(--q-radius-sm); }

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--q-space-4);
	padding: var(--q-space-3) var(--q-space-5);
	border-bottom: var(--q-line) solid var(--q-border);
	background: var(--q-surface);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: var(--q-space-2);
	color: var(--q-text);
	font-weight: var(--q-weight-medium);
	text-decoration: none;
}

.switch { display: flex; gap: var(--q-space-3); font-size: var(--q-size-caption); }
.switch a { color: var(--q-muted); text-decoration: none; }
.switch a[aria-current] { color: var(--q-text); font-weight: var(--q-weight-medium); }

.layout { display: flex; min-height: calc(100vh - 57px); }

.side {
	flex: 0 0 var(--q-sidebar-width);
	padding: var(--q-space-4);
	border-right: var(--q-line) solid var(--q-border);
	background: var(--q-surface-tint);
	font-size: var(--q-size-caption);
	overflow-y: auto;
}

.side h2 {
	margin: var(--q-space-4) 0 var(--q-space-2);
	color: var(--q-muted);
	font-size: var(--q-size-caption);
	font-weight: var(--q-weight-medium);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.side ul { margin: 0; padding: 0 0 0 var(--q-space-3); list-style: none; }
.side > .group > ul { padding-left: 0; }
.side li { margin: 2px 0; }
.side a { color: var(--q-text); text-decoration: none; }
.side a:hover { color: var(--q-link); }
.side a[aria-current="page"], .side a.current-repo { color: var(--q-primary); font-weight: var(--q-weight-medium); }

main {
	flex: 1 1 auto;
	min-width: 0;
	max-width: 52rem;
	padding: var(--q-space-6) var(--q-space-6) 96px;
}

h1, h2, h3, h4 { line-height: 1.25; font-weight: var(--q-weight-medium); }
h1 { font-size: var(--q-size-h1); margin: 0 0 var(--q-space-5); }
h2 { font-size: var(--q-size-h2); margin: var(--q-space-6) 0 var(--q-space-3); }
h3 { font-size: var(--q-size-h3); margin: var(--q-space-5) 0 var(--q-space-2); }

.anchor { margin-left: var(--q-space-1); color: var(--q-muted); text-decoration: none; visibility: hidden; }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus { visibility: visible; }

/* A term of CONTEXT.md (ADR-7): the word, a link or a span with tabindex
 * that takes the focus, and its meaning beside it, which the word names with
 * aria-describedby. The meaning shows on keyboard focus and while the pointer
 * is on the word or on the meaning (WCAG 1.4.13); a title attribute would show
 * only on hover. The meaning starts at the bottom edge of the word, with no
 * margin, so the pointer never leaves .term on the way between them. */
.term { position: relative; }
.term > :first-child { color: inherit; text-decoration: underline dotted; }
.term-tip {
	display: none;
	position: absolute;
	left: 0;
	top: 100%;
	z-index: 10;
	width: max-content;
	max-width: 24rem;
	margin: 0;
	padding: var(--q-space-2) var(--q-space-3);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius-sm);
	background: var(--q-surface);
	box-shadow: var(--q-shadow-overlay);
	color: var(--q-text);
	font-size: var(--q-size-caption);
	font-weight: normal;
	line-height: 1.4;
	white-space: normal;
}
.term:hover > .term-tip, .term > :focus + .term-tip { display: block; }

.meta { margin: 0 0 var(--q-space-4); color: var(--q-muted); font-size: var(--q-size-caption); }
.level, .draft {
	padding: 1px var(--q-space-2);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius-pill);
}
.draft { border-color: var(--q-warning-border); background: var(--q-warning-bg); color: var(--q-warning-text); }

.notice {
	padding: var(--q-space-3) var(--q-space-4);
	border: var(--q-line) solid var(--q-info-border);
	border-radius: var(--q-radius);
	background: var(--q-info-bg);
	color: var(--q-info-text);
}

code, pre { font-family: var(--q-font-mono); font-size: 0.9em; }
:not(pre) > code { padding: 1px 4px; border-radius: var(--q-radius-sm); background: var(--q-surface-tint); }
pre {
	overflow-x: auto;
	padding: var(--q-space-3) var(--q-space-4);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius);
	background: var(--q-surface-tint);
	line-height: 1.5;
}
pre.c-chroma { background: var(--q-surface-tint); }
pre.raw { white-space: pre-wrap; }

table { width: 100%; border-collapse: collapse; margin: var(--q-space-4) 0; font-size: 0.95em; }
th, td { padding: var(--q-space-2) var(--q-space-3); border-bottom: var(--q-line) solid var(--q-border); vertical-align: top; }
th { text-align: left; font-weight: var(--q-weight-medium); }
th[align="center"], td[align="center"] { text-align: center; }
th[align="right"], td[align="right"] { text-align: right; }

blockquote { margin: var(--q-space-4) 0; padding-left: var(--q-space-4); border-left: 3px solid var(--q-border); color: var(--q-muted); }

.callout {
	margin: var(--q-space-4) 0;
	padding: var(--q-space-3) var(--q-space-4);
	border-left: 3px solid var(--q-info-border);
	border-radius: var(--q-radius-sm);
	background: var(--q-info-bg);
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { margin: 0 0 var(--q-space-1); font-weight: var(--q-weight-medium); }
.callout-tip { border-color: var(--q-success-border); background: var(--q-success-bg); }
.callout-important { border-color: var(--q-primary); background: var(--q-surface-tint); }
.callout-warning { border-color: var(--q-warning-border); background: var(--q-warning-bg); }
.callout-caution { border-color: var(--q-error-border); background: var(--q-error-bg); }

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

.contains-task-list, li:has(> input[type="checkbox"]) { list-style: none; }

.footnotes { margin-top: var(--q-space-6); font-size: var(--q-size-caption); color: var(--q-muted); }

.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: var(--q-space-4); }
.products > h2 { grid-column: 1 / -1; margin-bottom: 0; }
.product {
	padding: var(--q-space-4);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius);
	background: var(--q-card);
	box-shadow: var(--q-shadow-card);
}
.product h3 { margin-top: 0; }
.product ul, .recent ul { margin: 0; padding-left: var(--q-space-4); }
.recent .repo, .recent time { color: var(--q-muted); font-size: var(--q-size-caption); }

@media (max-width: 48rem) {
	.layout { flex-direction: column; }
	.side { flex-basis: auto; border-right: 0; border-bottom: var(--q-line) solid var(--q-border); }
	main { padding: var(--q-space-5) var(--q-space-4) 64px; }
}

.find { position: relative; flex: 1; max-width: 28rem; margin: 0 var(--q-space-4); }
.find input, .search-page input {
	width: 100%;
	padding: var(--q-space-1) var(--q-space-2);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius-sm);
	background: var(--q-surface);
	color: var(--q-text);
	font: inherit;
	font-size: var(--q-size-caption);
}
.jump {
	position: absolute;
	z-index: 10;
	left: 0;
	right: 0;
	margin: var(--q-space-1) 0 0;
	padding: var(--q-space-2);
	list-style: none;
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius-sm);
	background: var(--q-surface);
	font-size: var(--q-size-caption);
}
.jump li { margin: 2px 0; }
.jump .repo, .results .repo, .facets .n, .count { color: var(--q-muted); font-size: var(--q-size-caption); }
.search-page { display: flex; gap: var(--q-space-2); max-width: 36rem; margin-bottom: var(--q-space-4); }
.search-page input { flex: 1; font-size: inherit; }
.search-layout { display: flex; gap: var(--q-space-6); align-items: flex-start; }
.facets { min-width: 10rem; font-size: var(--q-size-caption); }
.facets h2 { font-size: var(--q-size-caption); margin: 0 0 var(--q-space-2); }
.facets ul { margin: 0 0 var(--q-space-4); padding: 0; list-style: none; }
.facets a[aria-current] { font-weight: var(--q-weight-medium); }
.results { flex: 1; margin: 0; padding-left: var(--q-space-4); }
.results li { margin-bottom: var(--q-space-4); }
.snippet { margin: var(--q-space-1) 0 0; color: var(--q-muted); }
mark { background: var(--q-selection); color: var(--q-selection-on); border-radius: 2px; }
.pages { display: flex; gap: var(--q-space-4); }
@media (max-width: 48rem) { .search-layout { flex-direction: column; } .find { margin: 0; } }

/* The sign-in page of ADR-23 of the design system: the map of the Bernese
 * Alps behind one card, and the source of the map below it. The map takes
 * the map tokens and the mono font of the page through its use element. A
 * wide screen shows the symbol wide, each other screen the symbol upright. */
body.signin {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	padding: var(--q-space-4);
	background: var(--q-surface-tint);
}

.signin-map {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

/* The symbols of the map: drawn only through the use elements. */
.signin-symbols {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.signin-wide { display: none; }

@media (orientation: landscape) {
	.signin-wide { display: block; }
	.signin-upright { display: none; }
}

.signin-space {
	position: relative;
	flex: 1 1 0;
}

/* The card holds only the button and fits it. flex: none keeps the main rule
 * of the page layout from growing the card in the column of the page. */
.signin-card {
	position: relative;
	flex: none;
	width: max-content;
	max-width: 100%;
	align-self: center;
	padding: var(--q-space-4);
	border: var(--q-line) solid var(--q-border);
	border-radius: var(--q-radius);
	background: var(--q-card);
}

.signin-button {
	display: block;
	padding: var(--q-space-2) var(--q-space-4);
	border-radius: var(--q-radius);
	background: var(--q-primary);
	color: var(--q-primary-on);
	text-decoration: none;
	font-weight: var(--q-weight-medium);
}

.signin-button:hover { color: var(--q-primary-on); }

.signin-foot {
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.signin-source {
	margin: var(--q-space-4) 0 0;
	color: var(--q-muted);
	font-size: var(--q-size-caption);
}
