/*
 * Nivoli Games front end.
 *
 * Hand-written, no build step, no framework, no external font and no request to
 * anything but this file. Loaded only on the plugin's own templates (see
 * Template\Assets), so the rest of the site is untouched.
 *
 * Everything below is scoped under `.ng`, the wrapper each template opens with.
 * The one exception is the fixed reading-progress bar, which cannot live inside
 * a scrolled container, and the two `html.ng-js` hooks the script sets.
 *
 * The custom properties are the whole design system. Retune the six at the top
 * and the rest follows: every colour, rule, panel and shadow is derived from
 * them with color-mix, and each derivation ships a flat hex fallback first for
 * browsers without it.
 */

:root {
	/* ---- the six ---------------------------------------------------------- */
	--ng-bg: #262320;        /* page background, inherited from the site       */
	--ng-fg: #ddd6c6;        /* body text: 10.8:1 on the background           */
	--ng-accent: #e8b45e;    /* links, focus rings, counts: 8.28:1            */
	--ng-muted: #a89f8e;     /* secondary text: 5.96:1, AA at any size        */
	--ng-rule: #423d36;      /* hairlines and borders                         */
	--ng-measure: 70ch;      /* prose column width                            */

	/* ---- derived ---------------------------------------------------------- */
	--ng-panel: #2f2b27;
	--ng-panel: color-mix(in srgb, var(--ng-fg) 7%, var(--ng-bg));
	--ng-panel-2: #35302b;
	--ng-panel-2: color-mix(in srgb, var(--ng-fg) 12%, var(--ng-bg));
	--ng-code-bg: #1e1b19;
	--ng-code-bg: color-mix(in srgb, #000 22%, var(--ng-bg));
	--ng-accent-ink: #1a1816;
	--ng-accent-ink: color-mix(in srgb, #000 30%, var(--ng-bg));
	--ng-accent-soft: #3a3227;
	--ng-accent-soft: color-mix(in srgb, var(--ng-accent) 14%, var(--ng-bg));

	/* ---- type and rhythm -------------------------------------------------- */
	--ng-font: Inter, "Inter var", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
	--ng-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", monospace;
	--ng-size: 1.1875rem;    /* 19px at a 16px root */
	--ng-leading: 1.7;
	--ng-gap: 1.25rem;
	--ng-radius: 4px;
}

/* ---------------------------------------------------------------- shell ---- */

.ng {
	box-sizing: border-box;
	max-width: 74rem;
	margin: 0 auto;
	padding: 1.5rem clamp(1rem, 4vw, 2rem) 4rem;
	color: var(--ng-fg);
	font-family: var(--ng-font);
	font-size: var(--ng-size);
	line-height: var(--ng-leading);
	/* Nothing inside a plugin template may widen the page. Long unbroken
	   strings (1990s URLs, file paths) wrap instead of pushing the layout. */
	overflow-wrap: break-word;
}

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

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

.ng a {
	color: var(--ng-accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.ng a:hover {
	text-decoration-thickness: 2px;
}

/* One focus treatment for everything interactive, including the scrollable
   `pre` containers, which are focusable so a keyboard can scroll them. */
.ng a:focus,
.ng button:focus,
.ng select:focus,
.ng summary:focus,
.ng [tabindex]:focus {
	outline: 2px solid var(--ng-accent);
	outline-offset: 2px;
	border-radius: 2px;
}

.ng a:focus:not(:focus-visible),
.ng button:focus:not(:focus-visible),
.ng select:focus:not(:focus-visible),
.ng summary:focus:not(:focus-visible) {
	outline: none;
}

.ng-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ----------------------------------------------------------- typography ---- */

.ng-title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	line-height: 1.15;
	letter-spacing: -0.01em;
}

.ng-eyebrow {
	margin: 0 0 0.25rem;
	color: var(--ng-muted);
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ng-section {
	margin: 2.5rem 0 0;
	/* A wide table or map inside a section must not stretch the section. */
	min-width: 0;
}

.ng-section-heading {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	margin: 0 0 0.75rem;
	padding-bottom: 0.4rem;
	border-bottom: 1px solid var(--ng-rule);
	font-size: 1.25rem;
	line-height: 1.3;
}

.ng-empty,
.ng-notice {
	margin: 0.5rem 0;
	color: var(--ng-muted);
}

.ng-backlink {
	margin: 3rem 0 0;
	padding-top: 1rem;
	border-top: 1px solid var(--ng-rule);
	font-size: 0.95rem;
}

/* ---------------------------------------------------------------- prose ---- */

.ng-prose {
	max-width: var(--ng-measure);
	min-width: 0;
}

.ng-prose > * + * {
	margin-top: 1.15em;
}

.ng-prose p,
.ng-prose li {
	margin-top: 0;
	margin-bottom: 0;
}

.ng-prose h2,
.ng-prose h3,
.ng-prose h4 {
	margin: 2.2em 0 0.6em;
	line-height: 1.25;
	/* Anchor targets sit below the sticky game bar rather than under it. */
	scroll-margin-top: 5rem;
}

.ng-prose h2 {
	font-size: 1.4em;
}

.ng-prose h3 {
	font-size: 1.15em;
}

.ng-prose h4 {
	font-size: 1em;
	color: var(--ng-muted);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.ng-prose ul,
.ng-prose ol {
	padding-left: 1.4em;
}

.ng-prose li + li {
	margin-top: 0.4em;
}

.ng-prose blockquote {
	margin-left: 0;
	margin-right: 0;
	padding: 0.2em 0 0.2em 1em;
	border-left: 3px solid var(--ng-rule);
	color: var(--ng-muted);
}

.ng-prose hr {
	border: 0;
	border-top: 1px solid var(--ng-rule);
}

.ng-prose img {
	border-radius: var(--ng-radius);
}

.ng-prose code {
	padding: 0.1em 0.35em;
	background: var(--ng-code-bg);
	border-radius: 3px;
	font-family: var(--ng-mono);
	font-size: 0.9em;
}

/* The 838 guides that converted to paragraphs with no headings at all. Slightly
   tighter than the outlined ones: with nothing to break up the page, generous
   paragraph spacing reads as a list of unrelated sentences. */
.ng-prose--flat > * + * {
	margin-top: 1em;
}

/* --------------------------------------- preserved monospace and scrollers -- */

/*
 * The 123 guides kept byte for byte. This is the intended rendering, not a
 * fallback: they contain ASCII maps and space-aligned tables, so the text is
 * monospace, it does NOT wrap, and the block scrolls sideways on its own instead
 * of making the page scroll. Comfortable line height and a low-contrast panel
 * make a wall of fixed-width text readable rather than merely preserved.
 */
.ng-scroller {
	max-width: 100%;
	margin: 1.5rem 0;
	overflow-x: auto;
	overflow-y: hidden;
	background: var(--ng-code-bg);
	border: 1px solid var(--ng-rule);
	border-left: 3px solid var(--ng-accent-soft);
	border-radius: var(--ng-radius);
	/* Scroll one cell at a time on touch, and tell the browser this element
	   owns horizontal gestures so a swipe does not navigate back. */
	overscroll-behavior-x: contain;
}

.ng-scroller pre,
.ng-prose pre {
	margin: 0;
	padding: 1rem 1.15rem;
	background: none;
	border: 0;
	color: var(--ng-fg);
	font-family: var(--ng-mono);
	font-size: 0.86rem;
	line-height: 1.55;
	/* Never `pre-wrap`: wrapping is what destroys the maps. */
	white-space: pre;
	tab-size: 8;
	-moz-tab-size: 8;
}

.ng-scroller--table {
	padding: 0;
}

.ng-scroller table {
	margin: 0;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.ng-scroller th,
.ng-scroller td {
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--ng-rule);
	text-align: left;
	vertical-align: top;
}

.ng-notice--preserved {
	max-width: var(--ng-measure);
	margin: 0 0 1.5rem;
	padding: 0.75rem 1rem;
	background: var(--ng-panel);
	border-left: 3px solid var(--ng-accent-soft);
	border-radius: var(--ng-radius);
	color: var(--ng-muted);
	font-size: 0.9rem;
	line-height: 1.55;
}

/* -------------------------------------------------------------- spoilers ---- */

.ng-spoiler {
	max-width: var(--ng-measure);
	margin: 1.5rem 0;
	padding: 0.25rem 1rem;
	background: var(--ng-panel);
	border: 1px dashed var(--ng-rule);
	border-radius: var(--ng-radius);
}

.ng-spoiler-summary {
	padding: 0.6rem 0;
	color: var(--ng-accent);
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
}

.ng-spoiler[open] .ng-spoiler-summary {
	margin-bottom: 0.5rem;
	border-bottom: 1px solid var(--ng-rule);
}

.ng-spoiler-body > *:first-child {
	margin-top: 0;
}

/* ---------------------------------------------------------- breadcrumbs ---- */

.ng-crumbs {
	margin: 0 0 1.5rem;
	font-size: 0.85rem;
}

.ng-crumbs-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.6rem;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--ng-muted);
}

.ng-crumb + .ng-crumb::before {
	content: "/";
	margin-right: 0.6rem;
	color: var(--ng-rule);
}

.ng-crumb-current {
	color: var(--ng-muted);
}

/* -------------------------------------------- buttons, chips and badges ---- */

/*
 * Two selectors on every button rule, on purpose. A button is usually an `<a>`,
 * and `.ng a` (one class, one element) outranks a bare `.ng-button` (one class):
 * with a single selector the label inherits the link colour and renders amber on
 * amber. `.ng .ng-button` outranks it and covers `<button>` too.
 */
.ng-button,
.ng .ng-button {
	display: inline-block;
	padding: 0.5rem 0.95rem;
	background: var(--ng-accent);
	border: 1px solid var(--ng-accent);
	border-radius: var(--ng-radius);
	color: var(--ng-accent-ink);
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.ng-button:hover,
.ng .ng-button:hover {
	background: color-mix(in srgb, var(--ng-accent) 85%, #fff);
	color: var(--ng-accent-ink);
}

.ng-button--quiet,
.ng .ng-button--quiet {
	background: none;
	border-color: var(--ng-rule);
	color: var(--ng-fg);
	font-weight: 400;
}

.ng-button--quiet:hover,
.ng .ng-button--quiet:hover {
	background: var(--ng-panel);
	color: var(--ng-fg);
}

.ng-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.75rem 0 0;
	padding: 0;
	list-style: none;
}

.ng-chip {
	padding: 0.2rem 0.6rem;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: 999px;
	font-size: 0.85rem;
}

.ng-chip a {
	text-decoration: none;
}

.ng-chip a:hover {
	text-decoration: underline;
}

.ng-chip--active {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	background: var(--ng-accent-soft);
}

.ng-chip-remove {
	text-decoration: none;
	font-size: 1.1em;
	line-height: 1;
}

/* Full body colour rather than muted: at 0.75em on the second panel tone the
   muted value lands at 4.38:1, which is under AA, and a count is information. */
.ng-count {
	padding: 0.05rem 0.45rem;
	background: var(--ng-panel-2);
	border-radius: 999px;
	color: var(--ng-fg);
	font-size: 0.75em;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.ng-tag {
	display: inline-block;
	margin-left: 0.35rem;
	padding: 0 0.4rem;
	border: 1px solid var(--ng-rule);
	border-radius: 3px;
	color: var(--ng-muted);
	font-family: var(--ng-mono);
	font-size: 0.7rem;
	text-transform: lowercase;
	white-space: nowrap;
}

/* Search results. These two are deliberately not scoped to `.ng`: they render
   inside the theme's own search template, where there is no `.ng` wrapper. */
.ng-badge {
	display: inline-block;
	margin-right: 0.4rem;
	padding: 0.05rem 0.45rem;
	background: var(--ng-accent-soft);
	border: 1px solid var(--ng-rule);
	border-radius: 3px;
	color: var(--ng-accent);
	font-size: 0.75em;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	vertical-align: 0.08em;
}

.ng-result-meta {
	color: var(--ng-muted);
	font-size: 0.85em;
}

/* ------------------------------------------------------- game page hero ---- */

.ng-hero {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.5rem;
	margin: 0 0 2rem;
}

.ng-hero-art {
	max-width: 16rem;
}

.ng-cover-img {
	display: block;
	width: 100%;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
}

.ng-cover-noart {
	display: grid;
	place-items: center;
	aspect-ratio: 3 / 4;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	color: var(--ng-rule);
	font-size: 4rem;
	font-weight: 700;
}

.ng-hero-facts {
	margin: 0 0 0.75rem;
	color: var(--ng-muted);
}

.ng-hero-guides {
	margin: 1.25rem 0 0;
}

.ng-stores {
	margin-top: 1.25rem;
}

.ng-stores-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ng-store {
	display: inline-block;
	padding: 0.35rem 0.75rem;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	font-size: 0.9rem;
	text-decoration: none;
}

.ng-store:hover {
	background: var(--ng-panel-2);
	text-decoration: underline;
}

.ng-jump {
	margin: 2rem 0 0;
	padding: 0.75rem 1rem;
	background: var(--ng-panel);
	border-radius: var(--ng-radius);
}

.ng-jump-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.95rem;
}

.ng-jump-list a {
	display: inline-flex;
	align-items: baseline;
	gap: 0.4rem;
	text-decoration: none;
}

.ng-jump-list a:hover {
	text-decoration: underline;
}

/* ------------------------------------------------------- lists and cards ---- */

.ng-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ng-list--parts {
	counter-reset: ng-part;
	list-style: none;
}

.ng-item {
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--ng-rule);
}

.ng-item:last-child {
	border-bottom: 0;
}

.ng-item-title {
	font-size: 1.05rem;
	font-weight: 600;
	text-decoration: none;
}

.ng-item-title:hover {
	text-decoration: underline;
}

.ng-item--current .ng-item-title {
	color: var(--ng-fg);
	font-weight: 700;
}

.ng-item-meta {
	margin: 0.2rem 0 0;
	color: var(--ng-muted);
	font-size: 0.85rem;
	line-height: 1.5;
}

.ng-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
	gap: 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ng-card {
	min-width: 0;
}

.ng-card-link {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	height: 100%;
	color: var(--ng-fg);
	text-decoration: none;
}

.ng-card-link:hover .ng-card-title {
	color: var(--ng-accent);
	text-decoration: underline;
}

.ng-card-art {
	display: block;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
}

.ng-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ng-card-noart {
	display: grid;
	place-items: center;
	height: 100%;
	color: var(--ng-rule);
	font-size: 2.5rem;
	font-weight: 700;
}

.ng-card-title {
	display: block;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.35;
}

.ng-card-meta {
	display: block;
	color: var(--ng-muted);
	font-size: 0.8rem;
	line-height: 1.4;
}

/* ------------------------------------------------------ archive controls ---- */

.ng-archive-head {
	margin-bottom: 1.5rem;
}

.ng-archive-intro {
	max-width: var(--ng-measure);
	margin: 0;
	color: var(--ng-muted);
}

.ng-az {
	margin: 0 0 1.25rem;
}

.ng-az-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ng-az-link {
	display: inline-block;
	min-width: 2rem;
	padding: 0.3rem 0.45rem;
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
	text-align: center;
	text-decoration: none;
}

.ng-az-link:hover {
	background: var(--ng-panel-2);
	text-decoration: none;
}

.ng-az-link.is-current {
	background: var(--ng-accent);
	border-color: var(--ng-accent);
	color: var(--ng-accent-ink);
	font-weight: 700;
}

/* Letters with no games. Muted and borderless, so plainly not a link, but at
   full opacity: dimming it further would drop below AA, and a letter you cannot
   read is not a useful way of saying "nothing here". */
.ng-az-link--off {
	border-color: transparent;
	color: var(--ng-muted);
}

.ng-filters {
	margin: 0 0 1.5rem;
	padding: 1rem;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
}

.ng-filters-heading {
	margin: 0 0 0.75rem;
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ng-muted);
}

.ng-filters-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
}

.ng-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin: 0;
	min-width: 0;
	flex: 1 1 11rem;
}

.ng-field--actions {
	flex: 0 0 auto;
	flex-direction: row;
	gap: 0.5rem;
	align-items: center;
}

.ng-label {
	color: var(--ng-muted);
	font-size: 0.8rem;
}

.ng-select {
	max-width: 100%;
	padding: 0.45rem 0.5rem;
	background: var(--ng-bg);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	color: var(--ng-fg);
	font: inherit;
	font-size: 0.95rem;
}

.ng-results {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
	margin: 0 0 1.25rem;
}

.ng-results-count {
	margin: 0;
	color: var(--ng-muted);
	font-size: 0.9rem;
	font-variant-numeric: tabular-nums;
}

.ng-chips--active {
	margin: 0;
}

/* WordPress's own pagination markup, toned to match. */
.ng .navigation.pagination {
	margin-top: 2.5rem;
}

.ng .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.ng .page-numbers {
	display: inline-block;
	padding: 0.35rem 0.7rem;
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	font-size: 0.9rem;
	text-decoration: none;
}

.ng .page-numbers.current {
	background: var(--ng-accent);
	border-color: var(--ng-accent);
	color: var(--ng-accent-ink);
	font-weight: 700;
}

/* --------------------------------------------- walkthrough page furniture -- */

/* Fixed, so it cannot be inside `.ng`. Hidden until the script announces
   itself: a progress bar frozen at zero is worse than no progress bar. */
.ng-progress {
	display: none;
}

html.ng-js .ng-progress {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 60;
	display: block;
	height: 3px;
	background: transparent;
	pointer-events: none;
}

.ng-progress-bar {
	width: 100%;
	height: 100%;
	background: var(--ng-accent);
	transform: scaleX(var(--ng-progress, 0));
	transform-origin: 0 50%;
	transition: transform 80ms linear;
}

.ng-gamebar {
	position: sticky;
	top: 0;
	z-index: 20;
	margin: 0 0 1.25rem;
	padding: 0.5rem 0;
	background: var(--ng-bg);
	border-bottom: 1px solid var(--ng-rule);
}

.ng-gamebar-link {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	color: var(--ng-fg);
	text-decoration: none;
}

.ng-gamebar-img {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 3px;
	object-fit: cover;
}

.ng-gamebar-text {
	display: flex;
	flex-direction: column;
	line-height: 1.25;
}

.ng-gamebar-label {
	color: var(--ng-muted);
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ng-gamebar-title {
	font-size: 1rem;
	font-weight: 600;
}

.ng-gamebar-link:hover .ng-gamebar-title {
	color: var(--ng-accent);
	text-decoration: underline;
}

.ng-head {
	margin: 0 0 1.5rem;
}

.ng-head-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1rem;
	margin: 0;
	color: var(--ng-muted);
	font-size: 0.9rem;
}

.ng-head-by {
	color: var(--ng-fg);
	font-weight: 600;
}

/* ------------------------------------------------------------- credit ---- */

.ng-credit {
	max-width: var(--ng-measure);
	margin: 0 0 2rem;
	padding: 1rem 1.15rem;
	background: var(--ng-panel);
	border-left: 3px solid var(--ng-accent);
	border-radius: var(--ng-radius);
}

.ng-credit-heading {
	margin: 0;
	color: var(--ng-muted);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ng-credit-name {
	margin: 0.2rem 0 0;
	font-size: 1.2rem;
	font-weight: 700;
	line-height: 1.3;
}

.ng-credit-note,
.ng-credit-origin,
.ng-credit-notice,
.ng-credit-thanks {
	margin: 0.5rem 0 0;
	color: var(--ng-muted);
	font-size: 0.88rem;
	line-height: 1.55;
}

.ng-credit-thanks {
	font-size: 0.8rem;
	font-style: italic;
}

.ng-credit-action {
	margin: 0.75rem 0 0;
}

/* No byline recorded. Same weight of component, not a hole in the page: the
   accent border stays, the copy explains, nothing says "Anonymous". */
.ng-credit--uncredited {
	border-left-color: var(--ng-rule);
}

.ng-credit--uncredited .ng-credit-heading {
	color: var(--ng-fg);
	font-size: 0.95rem;
	letter-spacing: 0;
	text-transform: none;
}

/* ------------------------------------------------- layout and contents ---- */

.ng-layout {
	min-width: 0;
}

.ng-main {
	/* Without this a wide `pre` inside a grid item blows the column out and
	   the page scrolls sideways: `minmax(0, 1fr)` alone is not enough. */
	min-width: 0;
}

.ng-toc {
	margin: 0 0 1.5rem;
	padding: 0.5rem 0.9rem;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
}

.ng-toc-summary {
	padding: 0.4rem 0;
	color: var(--ng-muted);
	cursor: pointer;
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/*
 * Numbered by CSS counter rather than by the list marker. The h3 entries live in
 * a nested `ol` inside a wrapper `li`, and a marker would number that wrapper
 * too: the outline would read 1, 2 (nothing), 3. The counter is incremented by
 * the real entries only, so the top level counts 1 to n and the sub-entries are
 * shown by indentation.
 */
.ng-toc-list {
	counter-reset: ng-toc;
	margin: 0.4rem 0 0.5rem;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
	line-height: 1.45;
}

.ng-toc-list--sub {
	margin: 0.3rem 0;
	padding-left: 1.1rem;
	color: var(--ng-muted);
}

.ng-toc-item {
	margin: 0.3rem 0;
}

.ng-toc-item--h2::before {
	content: counter(ng-toc) ". ";
	color: var(--ng-muted);
	font-variant-numeric: tabular-nums;
}

.ng-toc-item--h2 {
	counter-increment: ng-toc;
}

.ng-toc-item--h3::before {
	content: "";
}

.ng-toc-link {
	text-decoration: none;
}

.ng-toc-link:hover {
	text-decoration: underline;
}

/* Set by the script as the reader passes each heading. */
.ng-toc-link.is-current {
	color: var(--ng-fg);
	font-weight: 700;
}

.ng-partnav {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	justify-content: space-between;
	margin: 2.5rem 0 0;
	padding-top: 1.25rem;
	border-top: 1px solid var(--ng-rule);
}

.ng-partnav-link {
	flex: 1 1 12rem;
	padding: 0.75rem 1rem;
	background: var(--ng-panel);
	border: 1px solid var(--ng-rule);
	border-radius: var(--ng-radius);
	text-decoration: none;
}

.ng-partnav-link--next {
	text-align: right;
}

.ng-partnav-label {
	display: block;
	color: var(--ng-muted);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ng-partnav-title {
	display: block;
	color: var(--ng-accent);
	font-weight: 600;
}

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

.ng-contributor-head {
	max-width: var(--ng-measure);
	margin: 0 0 2rem;
}

.ng-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin: 1.25rem 0;
	padding: 1rem 0;
	border-top: 1px solid var(--ng-rule);
	border-bottom: 1px solid var(--ng-rule);
	list-style: none;
}

.ng-stat {
	display: flex;
	flex-direction: column;
}

.ng-stat-value {
	font-size: 1.5rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.ng-stat-label {
	color: var(--ng-muted);
	font-size: 0.8rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ng-contributor-thanks {
	color: var(--ng-muted);
	font-size: 0.9rem;
}

/* ---------------------------------------------------------- wide screens ---- */

@media (min-width: 44rem) {
	.ng-hero {
		grid-template-columns: 14rem minmax(0, 1fr);
		align-items: start;
		gap: 2rem;
	}

	.ng-hero-art {
		max-width: none;
	}
}

@media (min-width: 60rem) {
	.ng-layout--sided {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 15rem;
		gap: 2.5rem;
		align-items: start;
	}

	.ng-layout--sided .ng-main {
		grid-column: 1;
		grid-row: 1;
	}

	/* The contents list is one element in the DOM, ordered for a phone
	   (title, credit, contents, prose) and moved into the right-hand column
	   here. No duplicate markup, no duplicate anchor ids. */
	.ng-layout--sided .ng-side {
		grid-column: 2;
		grid-row: 1;
	}

	.ng-toc-wrap {
		position: sticky;
		top: 4.5rem;
		max-height: calc(100vh - 6rem);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	/* On a wide screen the list is simply there: the disclosure control would
	   be furniture. It stays open (the script only collapses it on narrow
	   viewports) and the fallback below covers the case where it does not. */
	.ng-toc > .ng-toc-summary {
		display: none;
	}

	.ng-toc:not([open]) > .ng-toc-body {
		display: block;
	}
}

/* --------------------------------------------------------- small screens ---- */

@media (max-width: 30rem) {
	.ng {
		--ng-size: 1.0625rem; /* 17px: 19px at 375px is a 32-character line */
		padding-bottom: 3rem;
	}

	.ng-grid {
		grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
		gap: 1rem;
	}

	.ng-partnav-link--next {
		text-align: left;
	}

	/* The bar is the only way back to the game on a phone, so it stays, but
	   without the artwork it is a single line of text. */
	.ng-gamebar-img {
		width: 2rem;
		height: 2rem;
	}
}

/* ------------------------------------------------------- reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
	.ng-progress-bar {
		transition: none;
	}

	.ng *,
	.ng *::before,
	.ng *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
