/* ==========================================================================
   QUEST sites — XIO house style: black, white, the grey in between.
   No gradients. Chrome is monospace; long-form text uses a readable sans.
   Shared by xSearch, xArchive, xImages, xWire, EXYRA and xStats.
   ========================================================================== */

:root {
	--bg: #000;
	--fg: #f2f2f2;
	--dim: #8a8a8a;
	--faint: #4a4a4a;
	--rule: #1e1e1e;
	--rule-hi: #333;
	--panel: #070707;
	--panel-hi: #0e0e0e;
	--warn: #ffb02e;
	--bad: #ff5c5c;
	--good: #8be28b;

	/* names the page CSS was written against */
	--line: var(--rule-hi);
	--muted: var(--dim);
	--tint: var(--panel-hi);

	--mono: "SFMono-Regular", "SF Mono", "JetBrains Mono", "Fira Code", "IBM Plex Mono", Consolas, "Liberation Mono", Menlo,
		monospace;
	--read: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	--gutter: clamp(1rem, 4vw, 3rem);
	--maxw: 66rem;
	color-scheme: dark;
}

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

html {
	background: var(--bg);
}

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--mono);
	font-size: 15px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

::selection {
	background: var(--fg);
	color: var(--bg);
}

a {
	color: var(--fg);
	text-decoration: none;
}

h1,
h2,
h3 {
	line-height: 1.3;
}

button,
input,
select,
textarea {
	font: inherit;
	color: inherit;
}

input[type="search"],
input[type="text"],
input[type="number"],
select {
	border: 1px solid var(--rule-hi);
	border-radius: 0;
	background: var(--panel);
	padding: 0.5rem 0.65rem;
	outline: none;
	transition: border-color 160ms;
}

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

button,
.button,
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.45rem;
	padding: 0.5rem 0.9rem;
	border: 1px solid var(--rule-hi);
	border-radius: 0;
	background: transparent;
	color: var(--fg);
	cursor: pointer;
	font-size: 0.72rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background 140ms, color 140ms, border-color 140ms;
}

button:hover,
.button:hover,
.btn:hover {
	background: var(--fg);
	color: var(--bg);
	border-color: var(--fg);
}

:focus-visible {
	outline: 1px solid var(--fg);
	outline-offset: 2px;
}

code,
pre {
	font-family: var(--mono);
}

pre {
	background: var(--panel);
	border: 1px solid var(--rule);
	padding: 0.7rem 0.9rem;
	overflow-x: auto;
}

/* ------------------------------------------------------------------ topbar */

.topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.7rem var(--gutter);
	background: rgba(0, 0, 0, 0.9);
	border-bottom: 1px solid var(--rule);
	backdrop-filter: blur(6px);
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.3em;
	font-size: 0.8rem;
	flex: none;
}

.mark {
	fill: none;
	stroke: currentColor;
	stroke-width: 12;
	stroke-linecap: butt;
}

.brand .mark {
	width: 22px;
	height: 22px;
	transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.brand:hover .mark {
	transform: rotate(180deg);
}

.topnav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1.4rem;
	margin-left: auto;
	font-size: 0.74rem;
	letter-spacing: 0.08em;
}

.topnav a {
	color: var(--dim);
	padding-bottom: 1px;
	border-bottom: 1px solid transparent;
	transition: color 160ms, border-color 160ms;
}

.topnav a:hover {
	color: var(--fg);
}

.topnav a[aria-current="page"] {
	color: var(--fg);
	border-bottom-color: var(--fg);
}

@media (max-width: 720px) {
	.topbar {
		flex-wrap: wrap;
	}

	.topnav {
		margin-left: 0;
		gap: 0.4rem 1rem;
	}
}

/* -------------------------------------------------------------------- page */

.container {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 0 var(--gutter) 5rem;
}

.hero {
	padding: clamp(2rem, 5vw, 3.2rem) 0 1.6rem;
	border-bottom: 1px solid var(--rule);
	margin-bottom: 1.6rem;
}

.hero-top {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
	flex-wrap: wrap;
}

.hero h1 {
	margin: 0;
	font-size: clamp(1.8rem, 5vw, 2.8rem);
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1.1;
}

.hero h1 a {
	color: inherit;
}

.kicker {
	margin: 0.45rem 0 0;
	color: var(--dim);
	font-size: 0.68rem;
	letter-spacing: 0.45em;
	text-transform: uppercase;
}

.sub {
	margin: 0.6rem 0 0;
	color: var(--dim);
	font-size: 0.85rem;
	max-width: 46rem;
}

.nav-link {
	display: inline-block;
	margin-top: 0.8rem;
	font-size: 0.78rem;
	color: var(--dim);
}

.nav-link:hover {
	color: var(--fg);
}

/* Centred search-engine front page (xSearch) */

.hero.center {
	text-align: center;
	padding-top: clamp(2.5rem, 7vw, 4.5rem);
	border-bottom: 0;
}

.hero.center .mark-big {
	width: 56px;
	height: 56px;
	margin-bottom: 1rem;
}

.hero.center h1 {
	font-size: clamp(2.2rem, 7vw, 3.6rem);
	letter-spacing: 0.18em;
	padding-left: 0.18em;
}

.hero.center .sub {
	margin-left: auto;
	margin-right: auto;
}

.hero.center .searchbox {
	margin-left: auto;
	margin-right: auto;
	max-width: 40rem;
	font-size: 1.02rem;
}

.hero.center .searchbox input {
	padding-top: 0.85rem;
	padding-bottom: 0.85rem;
}

.actions {
	display: flex;
	justify-content: center;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin-top: 1rem;
}

.actions form {
	margin: 0;
}

.hero:not(.center) .actions {
	justify-content: flex-start;
}

/* --------------------------------------------------------------- searchbox */

.searchbox {
	margin-top: 1.4rem;
	display: flex;
	border: 1px solid var(--rule-hi);
	background: var(--panel);
	transition: border-color 160ms;
	text-align: left;
}

.searchbox:focus-within {
	border-color: var(--fg);
}

.searchbox .prompt {
	padding: 0.6rem 0 0.6rem 0.8rem;
	color: var(--dim);
	user-select: none;
	align-self: center;
}

.searchbox input,
.searchbox input[type="search"] {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 0.6rem 0.7rem;
}

.searchbox button {
	border: 0;
	border-left: 1px solid var(--rule-hi);
	padding: 0 1.1rem;
	color: var(--dim);
}

.searchbox button:hover {
	color: var(--fg);
	background: var(--panel-hi);
}

/* ----------------------------------------------------------------- results */

.section {
	margin-top: 2.2rem;
}

.section > h2:not([class]),
.ui > h2:not([class]),
.ui main > h2:not([class]),
aside .box > h2:not([class]),
.status-modal > h2:not([class]) {
	margin: 0 0 1rem;
	font-size: 0.78rem;
	font-weight: 400;
	letter-spacing: 0.3em;
	text-transform: uppercase;
	color: var(--dim);
}

.section > h2:not([class])::before,
.ui > h2:not([class])::before,
.ui main > h2:not([class])::before,
aside .box > h2:not([class])::before,
.status-modal > h2:not([class])::before {
	content: ">";
	color: var(--fg);
	margin-right: 0.6rem;
}

.card {
	padding: 1rem 0 1.1rem;
	border-bottom: 1px solid var(--rule);
}

.card:first-of-type {
	border-top: 1px solid var(--rule);
}

.title-link {
	color: inherit;
}

.title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.35;
}

.title-link:hover .title {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.url-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.3rem 0.8rem;
	margin-top: 0.15rem;
}

.url {
	display: inline-block;
	color: var(--dim);
	word-break: break-all;
	font-size: 0.78rem;
}

a.url:hover {
	color: var(--fg);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.original-link {
	font-size: 0.72rem;
	white-space: nowrap;
	color: var(--faint);
}

.original-link:hover {
	color: var(--fg);
}

.meta {
	margin-top: 0.2rem;
	color: var(--faint);
	font-size: 0.72rem;
}

.summary {
	margin: 0.45rem 0 0;
	font-family: var(--read);
	font-size: 0.95rem;
	line-height: 1.55;
	color: #c9c9c9;
}

.card .summary {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.empty {
	margin: 0;
	padding: 2rem 1rem;
	border: 1px dashed var(--rule-hi);
	text-align: center;
	color: var(--dim);
	font-size: 0.85rem;
}

.notice,
.error {
	margin: 0 0 1rem;
	padding: 0.6rem 1rem;
	border-left: 2px solid var(--fg);
	background: var(--panel);
	color: var(--dim);
	font-size: 0.85rem;
}

.error {
	border-left-color: var(--bad);
	color: var(--fg);
}

.result-count {
	margin: 0 0 0.8rem;
	color: var(--dim);
	font-size: 0.78rem;
}

.pagination {
	margin-top: 1.5rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.page-link,
.page-current {
	border: 1px solid var(--rule-hi);
	padding: 0.25rem 0.6rem;
	font-size: 0.78rem;
	color: var(--dim);
	transition: background 140ms, color 140ms, border-color 140ms;
}

.page-link:hover {
	color: var(--fg);
	border-color: var(--fg);
}

.page-current {
	background: var(--fg);
	border-color: var(--fg);
	color: var(--bg);
	font-weight: 700;
}

.pager {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin: 1.5rem 0;
}

.footer-stats {
	color: var(--faint);
	font-size: 0.72rem;
	margin-top: 2.5rem;
	text-align: center;
}

/* ------------------------------------------------------------ status modal */

.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.8);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	z-index: 1000;
}

.modal-backdrop.is-open {
	display: flex;
}

.status-modal {
	width: min(640px, 100%);
	max-height: min(80vh, 720px);
	overflow: auto;
	border: 1px solid var(--rule-hi);
	padding: 1.4rem 1.4rem 1.2rem;
	background: var(--bg);
}

.status-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1px;
	margin-top: 1rem;
	padding: 1px;
}

.status-item {
	padding: 0.75rem 0.85rem;
	background: var(--bg);
	box-shadow: 0 0 0 1px var(--rule);
}

.status-label {
	display: block;
	font-size: 0.64rem;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--faint);
	margin-bottom: 0.2rem;
}

.status-value {
	font-size: 0.9rem;
	word-break: break-word;
}

.status-actions {
	display: flex;
	justify-content: flex-end;
	margin-top: 1rem;
}
