/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Arcade Planet homepage, wiki: the reading pages under /wiki/ (written by tools/build-wiki.mjs). Loaded after
   css/style.css and css/themes.css and built only from their variables, so every theme of the start page dresses the
   wiki too. No 3D, no pictures behind the text; everything reads without JavaScript (the search stays hidden then,
   the page menu of phones opens through :target). */

/* the bar always wears its glass here: there is no hero behind it */
.wiki .top {
	background: var(--bar-solid);
	border-bottom-color: var(--separator);
}
.wiki .wrap {
	width: min(100% - 2.5rem, 84rem);
}
.wiki section[id]:not(.hero) {
	padding-block: 0;
}
.wiki main {
	overflow-x: visible;
}

/* ---------- the three columns: page tree, text, "on this page" ---------- */
.wgrid {
	display: grid;
	grid-template-columns: 16.5rem minmax(0, 1fr) 13rem;
	gap: 0 2.6rem;
	align-items: start;
	padding-block: 1.6rem 4rem;
}
.wnav {
	grid-column: 1;
}
.doc {
	grid-column: 2;
	grid-row: 1;
}
.wtoc {
	grid-column: 3;
	grid-row: 1;
}
.wnav,
.wtoc {
	position: sticky;
	top: 5.2rem;
	max-height: calc(100vh - 6.2rem);
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--separator) transparent;
}

/* ---------- left: module, search, page tree ---------- */
.wnav {
	padding: 0.2rem 0.9rem 1rem 0;
	border-right: 1px solid var(--separator);
}
.wmod {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 0.9rem;
	padding: 0.6rem 0.7rem;
	border: 1px solid var(--separator);
	border-left: 3px solid var(--accent);
	border-radius: var(--radius);
	background: linear-gradient(90deg, var(--selector), var(--selector-end));
	color: var(--title);
	font: 500 1.05rem/1.1 var(--head);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
}
.wmod small {
	display: block;
	margin-bottom: 0.2rem;
	/* on the lavender bar --secondary was only 4.97 : 1 */
	color: var(--primary);
	font-size: 0.72rem;
	letter-spacing: 0.2em;
}
.wmod .mini {
	flex: none;
	width: 2rem;
	height: 1.25rem;
}
.wsearch {
	position: relative;
	margin-bottom: 0.9rem;
}
.wsearch[hidden] {
	display: none;
}
.wsearch input {
	width: 100%;
	padding: 0.55rem 2.6rem 0.55rem 0.7rem;
	border: 1px solid var(--separator);
	border-radius: var(--radius);
	background: var(--quiet);
	color: var(--title);
	font: 400 0.98rem/1.2 var(--body);
}
.wsearch input::placeholder {
	color: var(--secondary);
}
.wsearch input:focus-visible {
	outline-offset: 0;
	border-color: var(--accent);
}
.wsearch .key {
	position: absolute;
	right: 0.5rem;
	top: 0.5rem;
}
.wresults {
	position: absolute;
	z-index: 25;
	left: 0;
	right: 0;
	top: calc(100% + 0.35rem);
	margin: 0;
	padding: 0.3rem;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--frame);
	box-shadow: 0 1.2rem 3rem #000a;
	list-style: none;
}
.wresults a {
	display: block;
	padding: 0.5rem 0.6rem;
	border-left: 3px solid transparent;
	border-radius: var(--radius);
	color: var(--title);
	font: 500 1rem/1.15 var(--head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
}
.wresults a small {
	display: block;
	margin-top: 0.2rem;
	color: var(--secondary);
	font: 400 0.82rem/1.3 var(--body);
	letter-spacing: 0;
	text-transform: none;
}
.wresults a:hover,
.wresults a:focus-visible {
	border-left-color: var(--ring);
	background: var(--selector);
	outline: none;
}
.wresults .none {
	padding: 0.5rem 0.6rem;
	color: var(--secondary);
	font-size: 0.9rem;
}
.wtree,
.wtree ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
.wtree .grp {
	margin: 1.1rem 0 0.35rem 0.7rem;
	color: var(--secondary);
	font: 500 0.74rem/1 var(--head);
	letter-spacing: 0.2em;
	text-transform: uppercase;
}
.wtree a {
	display: block;
	padding: 0.36rem 0.7rem;
	border-left: 3px solid transparent;
	border-radius: var(--radius);
	color: var(--primary);
	font: 500 1.02rem/1.15 var(--head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
}
.wtree .sub a {
	padding-left: 1.5rem;
	font-size: 0.95rem;
}
.wtree .sub2 a {
	padding-left: 2.3rem;
	font-size: 0.9rem;
}
.wtree a:hover {
	color: var(--title);
	background: var(--quiet);
}
/* the page you are on looks like the selected row of the app */
.wtree a[aria-current] {
	border-left-color: var(--ring);
	background: linear-gradient(90deg, var(--selector), var(--selector-end));
	color: var(--title);
}
.wnav-close,
.wmenu {
	display: none;
}

/* ---------- middle: the text ---------- */
.doc {
	min-width: 0;
	max-width: 47rem;
}
.crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0.5rem;
	margin: 0 0 0.9rem;
	padding: 0;
	list-style: none;
	color: var(--secondary);
	font: 500 0.88rem/1.2 var(--head);
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.crumbs li + li::before {
	content: '›';
	margin-right: 0.5rem;
	color: var(--accent);
}
.crumbs a {
	color: var(--secondary);
	text-decoration: none;
}
.crumbs a:hover {
	color: var(--title);
}
.doc h1 {
	margin: 0 0 0.7rem;
	color: var(--title);
	font: 700 clamp(2.3rem, 5vw, 3.4rem) / 1 var(--head);
	letter-spacing: calc(0.02em + var(--head-track));
	text-transform: uppercase;
}
.doc .lead {
	max-width: none;
	margin: 0 0 1.4rem;
	color: var(--primary);
	font-size: 1.12rem;
}
.doc h2 {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	margin: 2.6rem 0 0.9rem;
	color: var(--title);
	font: 700 1.8rem/1.1 var(--head);
	letter-spacing: 0.03em;
	text-transform: uppercase;
	scroll-margin-top: 5.5rem;
}
.doc h2::after {
	content: '';
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, var(--border), transparent);
	opacity: 0.7;
}
.doc h3 {
	margin: 1.7rem 0 0.5rem;
	color: var(--title);
	font: 500 1.3rem/1.15 var(--head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	scroll-margin-top: 5.5rem;
}
.doc p,
.doc ul,
.doc ol {
	margin: 0 0 1rem;
}
.doc li {
	margin-bottom: 0.35rem;
}
.doc li::marker {
	color: var(--secondary);
}
.doc a {
	text-decoration-color: var(--accent);
	text-underline-offset: 0.18em;
}
.doc code {
	padding: 0.08em 0.36em;
	border: 1px solid var(--separator);
	border-radius: var(--radius);
	background: var(--quiet);
	color: var(--title);
	font: 0.9em/1.3 ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
	overflow-wrap: anywhere;
}
/* a name as it stands in the app: caps in the font of the menus (never a picture of text) */
.ui {
	color: var(--title);
	font: 500 1.02em/1.2 var(--head);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	white-space: nowrap;
}
.ui.wrapok {
	white-space: normal;
}
/* chips under the title: where it is in the app, how many entries, BALD */
.meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.6rem;
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}
.meta li {
	margin: 0;
	padding: 0.3rem 0.6rem;
	border: 1px solid var(--separator);
	border-radius: var(--radius);
	background: var(--quiet);
	color: var(--secondary);
	font: 500 0.86rem/1.1 var(--head);
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.meta b {
	color: var(--title);
	font-weight: 500;
}
.meta .soonflag b {
	color: var(--ring);
	letter-spacing: 0.18em;
}

/* numbered steps: the number sits in a key cap */
.steps {
	padding: 0;
	list-style: none;
	counter-reset: step;
}
.steps > li {
	position: relative;
	margin: 0 0 0.7rem;
	padding: 0.85rem 1rem 0.9rem 3.5rem;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--glass-solid);
	counter-increment: step;
}
.steps > li::before {
	content: counter(step);
	position: absolute;
	left: 0.95rem;
	top: 0.85rem;
	min-width: 1.75rem;
	padding: 0.3rem 0;
	border: 1px solid var(--accent);
	border-bottom-width: 2px;
	border-radius: var(--radius);
	background: var(--key-bg);
	color: var(--title);
	font: 500 0.95rem/1 var(--head);
	text-align: center;
}
.steps b {
	color: var(--title);
	font-weight: 600;
}

/* two system tabs that are plain anchors: they work without scripts */
.jump {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 0 0 1.4rem;
}
.jump .btn {
	font-size: 1.1rem;
	padding: 0.6rem 1.1rem 0.6rem 0.75rem;
}

.doc .notice-t {
	margin: 0 0 0.45rem;
	color: var(--title);
	font: 500 1.4rem/1.1 var(--head);
	letter-spacing: 0.03em;
	text-transform: uppercase;
}
.doc .notice p + p {
	margin-top: 0.5rem;
}
.doc .notice {
	margin: 1.4rem 0;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
	background: var(--glass-solid);
}
.hint {
	margin: 1.1rem 0;
	padding: 0.8rem 1rem;
	border: 1px solid var(--separator);
	border-left: 3px solid var(--accent);
	border-radius: var(--card-radius);
	background: var(--quiet);
	font-size: 0.97rem;
}
.hint b {
	color: var(--title);
	font: 500 1rem/1 var(--head);
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* tables scroll in their own box on phones, never the page */
.tbl {
	margin: 0 0 1.2rem;
	overflow-x: auto;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--glass-solid);
}
.tbl table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.96rem;
}
.tbl th,
.tbl td {
	padding: 0.6rem 0.9rem;
	border-bottom: 1px solid var(--separator);
	text-align: left;
	vertical-align: top;
}
.tbl tr:last-child > * {
	border-bottom: 0;
}
.tbl thead th,
.tbl tbody th {
	color: var(--title);
	font: 500 0.98rem/1.2 var(--head);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}
.tbl thead th {
	color: var(--secondary);
	font-size: 0.8rem;
	letter-spacing: 0.16em;
}

.doc .shot {
	margin: 1.4rem 0;
	box-shadow: 0 1rem 2.6rem #0008;
}
.doc .shot figcaption {
	font: 400 0.88rem/1.5 var(--body);
	letter-spacing: 0;
	text-transform: none;
	text-align: left;
	padding: 0.6rem 0.9rem;
	border-top: 1px solid var(--separator);
	color: var(--secondary);
	font-size: 0.88rem;
}

/* ---------- the wiki start: modules and topics ---------- */
.mods,
.topics {
	display: grid;
	gap: 0.9rem;
	margin: 0 0 1.2rem;
	padding: 0;
	list-style: none;
}
.mods {
	grid-template-columns: 1.5fr 1fr;
}
.topics {
	grid-template-columns: repeat(3, 1fr);
}
.mods li,
.topics li {
	margin: 0;
}
.tile {
	position: relative;
	display: block;
	height: 100%;
	padding: 1rem 1.1rem 1.1rem;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--glass-solid);
	color: var(--primary);
	text-decoration: none;
	transition:
		border-color 0.22s,
		background 0.22s;
}
a.tile:hover,
a.tile:focus-visible {
	border-color: var(--accent);
	background: var(--glass-hover);
}
.tile h3 {
	margin: 0 0 0.35rem;
	font-size: 1.3rem;
}
.tile p {
	margin: 0;
	font-size: 0.94rem;
}
.tile .state {
	font-size: 0.72rem;
	padding: 0.26rem 0.45rem;
}
.tile.main {
	border-left: 3px solid var(--ring);
	background: linear-gradient(90deg, var(--selector), var(--selector-end));
}
.tile.main h3 {
	font-size: 1.7rem;
	font-weight: 700;
}
.tile.off {
	border-style: dashed;
	background: var(--quiet);
}
.tile.off h3 {
	color: var(--secondary);
}
.tile .go {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.8rem;
	color: var(--title);
	font: 500 1rem/1 var(--head);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/* ---------- a settings menu, row by row ---------- */
.set-group {
	margin: 0 0 1.4rem;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--glass-solid);
	overflow: hidden;
}
.set {
	padding: 0.85rem 1rem 0.9rem;
	border-bottom: 1px solid var(--separator);
	border-left: 3px solid transparent;
	scroll-margin-top: 5.5rem;
}
.set:last-child {
	border-bottom: 0;
}
/* the row a deep link points at lights up like the selected row of the app */
.set:target {
	border-left-color: var(--ring);
	background: linear-gradient(90deg, var(--selector), var(--selector-end));
}
.set-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.3rem 1rem;
}
.set h3 {
	margin: 0;
	font-size: 1.25rem;
}
.set h3 a {
	color: inherit;
	text-decoration: none;
}
.set h3 a::after {
	content: '#';
	margin-left: 0.45rem;
	color: var(--accent);
	opacity: 0;
	transition: opacity 0.22s;
}
.set h3 a:hover::after,
.set h3 a:focus-visible::after {
	opacity: 1;
}
.set .val {
	color: var(--secondary);
	font: 500 0.86rem/1.2 var(--head);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}
.set .val b {
	color: var(--title);
	font-weight: 500;
}
.set p {
	margin: 0.4rem 0 0;
	font-size: 0.97rem;
	overflow-wrap: anywhere;
}
.set .kind {
	margin-top: 0.45rem;
	color: var(--secondary);
	font-size: 0.86rem;
}

/* ---------- foot of a page: before / after ---------- */
.pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.9rem;
	margin-top: 2.8rem;
	padding-top: 1.4rem;
	border-top: 1px solid var(--separator);
}
.pager a,
.pager span {
	padding: 0.8rem 1rem;
	border: 1px solid var(--separator);
	border-radius: var(--card-radius);
	background: var(--quiet);
	color: var(--title);
	font: 500 1.15rem/1.15 var(--head);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
}
.pager small {
	display: block;
	margin-bottom: 0.3rem;
	color: var(--secondary);
	font-size: 0.74rem;
	letter-spacing: 0.2em;
}
.pager .next {
	grid-column: 2;
	text-align: right;
}
.pager a:hover {
	border-color: var(--accent);
}
.pager span {
	color: var(--secondary);
	border-style: dashed;
}

/* ---------- right: on this page ---------- */
.wtoc {
	padding-left: 1rem;
	border-left: 1px solid var(--separator);
}
.wtoc .toc-t {
	margin: 0.2rem 0 0.6rem;
	color: var(--secondary);
	font: 500 0.74rem/1 var(--head);
	letter-spacing: 0.2em;
	text-transform: uppercase;
}
.wtoc ol {
	margin: 0;
	padding: 0;
	list-style: none;
}
.wtoc a {
	display: block;
	padding: 0.28rem 0;
	color: var(--secondary);
	font-size: 0.9rem;
	line-height: 1.3;
	text-decoration: none;
}
.wtoc a:hover,
.wtoc a[aria-current] {
	color: var(--title);
}
.wtoc ol ol a {
	padding-left: 0.8rem;
	font-size: 0.84rem;
}

/* ---------- narrower: the list "on this page" moves under the title ---------- */
@media (max-width: 1180px) {
	.wgrid {
		grid-template-columns: 15.5rem minmax(0, 1fr);
	}
	.wtoc {
		position: static;
		grid-column: 2;
		grid-row: 1;
		max-height: none;
		margin-bottom: 1.2rem;
		padding: 0.8rem 1rem;
		border: 1px solid var(--separator);
		border-radius: var(--card-radius);
		background: var(--quiet);
	}
	.wtoc ol {
		display: flex;
		flex-wrap: wrap;
		gap: 0 1.3rem;
	}
	.wtoc ol ol {
		display: none;
	}
	.doc {
		grid-column: 2;
		grid-row: 2;
	}
	.wnav {
		grid-row: 1 / span 2;
	}
}

/* ---------- phones: one column; the page tree is a sheet under the bar ---------- */
@media (max-width: 860px) {
	.wgrid {
		display: block;
		padding-top: 0.9rem;
	}
	/* the links of the start page give way: the logo leads there, the wiki keeps its own row below */
	.wiki .top nav a.sec {
		display: none;
	}
	.wmenu {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.8rem;
		margin: 0 0 1rem;
		padding: 0.7rem 0.9rem;
		border: 1px solid var(--separator);
		border-left: 3px solid var(--accent);
		border-radius: var(--radius);
		background: linear-gradient(90deg, var(--selector), var(--selector-end));
		color: var(--title);
		font: 500 1.1rem/1.1 var(--head);
		letter-spacing: 0.05em;
		text-transform: uppercase;
		text-decoration: none;
	}
	.wmenu small {
		display: block;
		margin-bottom: 0.2rem;
		color: var(--secondary);
		font-size: 0.72rem;
		letter-spacing: 0.2em;
	}
	.wnav {
		display: none;
		position: static;
		max-height: none;
		margin-bottom: 1.2rem;
		padding: 0.9rem;
		border: 1px solid var(--separator);
		border-radius: var(--card-radius);
		background: var(--frame);
	}
	/* without scripts the link "Menü" points at the tree (:target); with scripts js/wiki.js sets .open */
	.wnav:target,
	.wnav.open {
		display: block;
		scroll-margin-top: 4.5rem;
	}
	.wnav-close {
		display: block;
		margin-top: 0.9rem;
		padding: 0.7rem;
		border: 1px solid var(--separator);
		border-radius: var(--radius);
		color: var(--title);
		font: 500 1rem/1 var(--head);
		letter-spacing: 0.08em;
		text-align: center;
		text-transform: uppercase;
		text-decoration: none;
	}
	.wtree a {
		padding-block: 0.62rem;
	}
	.wtoc {
		margin-bottom: 1.1rem;
	}
	.wtoc ol {
		display: block;
	}
	.wtoc a {
		padding-block: 0.42rem;
	}
	.mods,
	.topics {
		grid-template-columns: 1fr;
	}
	.doc .lead {
		font-size: 1.04rem;
	}
	.doc h2 {
		font-size: 1.55rem;
		margin-top: 2.1rem;
	}
	.steps > li {
		padding: 0.8rem 0.85rem 0.85rem 3.1rem;
	}
	.steps > li::before {
		left: 0.75rem;
	}
	.set .val {
		white-space: normal;
	}
	.pager {
		grid-template-columns: 1fr;
	}
	.pager .next {
		grid-column: 1;
	}
	.ui {
		white-space: normal;
	}
}

/* ---------- paper: the text alone, dark on white ---------- */
@media print {
	html,
	body {
		background: #fff !important;
		color: #000;
	}
	.top,
	.wnav,
	.wmenu,
	.wtoc,
	.pager,
	footer nav,
	.skip {
		display: none !important;
	}
	.wgrid {
		display: block;
	}
	.doc,
	.doc * {
		color: #000 !important;
		background: none !important;
		box-shadow: none !important;
	}
	.doc a[href^='http']::after {
		content: ' (' attr(href) ')';
	}
	.set,
	.steps > li {
		break-inside: avoid;
	}
}
