/* Reading pages (history.html, wiki.html, privacy.html). Linked only by these pages (i18n-util.mjs renderNgHeadAssets).
   Read mode: the text is the point. Literata at 18 px in a 60-75 character measure, headlines in Plex Condensed.
   Each page has its own paper: history = a chronicle with the dates in the margin and a pile of covers taped beside it;
   wiki = a small notice on one strip with the fennec pasted over its edge; privacy = a typed document in a ruled frame.
   Wrappers carry `rd-` classes; the ids and classes the generators read (#historyStory,
   h1#wikicontHeader, div#wikicont) keep their shape. Uses ng.css primitives (sheet, tape, ruled frame). */

/* ─── Shared: the page is the wall, the sheets are built inside ──────────── */

main.ng-page {
	width: min(1120px, calc(100% - 2 * var(--s4)));
	padding: 0;
	background: none;
	box-shadow: none;
}

main.ng-page::before,
main.ng-page::after {
	content: none;
}

.rd-sheet {
	position: relative;
}

.ng-pagehead h1 {
	margin: 0;
	overflow-wrap: anywhere;
}

/* ─── History: a chronicle ───────────────────────────────────────────────── */
/* Sheet 1: the headline and seven entries; each entry's date sits in the left margin in the
   console face (the accent's date role). Distance between entries follows the time between them. */

.rd-chron {
	max-width: 1040px;
	margin: 0 auto;
}

.rd-chron-in {
	padding: var(--s7) var(--s8) calc(var(--s8) + var(--s6));
}

#historyheader h1 {
	font: 300 var(--t6)/1.02 var(--f-disp);
}

#historyStory {
	margin-top: var(--s7);
}

.storyEntry {
	display: grid;
	grid-template-columns: 13rem minmax(0, 38rem);
	column-gap: var(--s6);
	align-items: start;
}

#historyStory .storyEntry h2 {
	margin: 0;
	padding-top: .3em;
	color: var(--accent);
	font: 400 var(--t1)/1.75 var(--f-con);
	font-variant-numeric: tabular-nums;
	-webkit-font-smoothing: none;
}

.storyEntry p {
	grid-column: 2;
	margin: 0;
	font: 400 var(--t2)/1.7 var(--f-read);
}

/* time as distance: months apart in 2012, then a year, then the long gaps */
#historyStory .storyEntry:nth-child(2),
#historyStory .storyEntry:nth-child(3) {
	margin-top: var(--s5);
}

#historyStory .storyEntry:nth-child(4) {
	margin-top: var(--s6);
}

#historyStory .storyEntry:nth-child(5),
#historyStory .storyEntry:nth-child(6) {
	margin-top: var(--s8);
}

#historyStory .storyEntry:nth-child(7) {
	margin-top: var(--s7);
}

/* the closing thank-you: one more row of the chronicle, without a date */
#historyStory .storyEntry:last-child {
	margin-top: var(--s7);
}

#historyStory #historyNote {
	color: var(--dim);
	font: italic 400 var(--t1)/1.65 var(--f-read);
}

/* Sheet 2 hangs beside the chronicle: a pile of the early games' covers, one line and the button to the hub. */
main.rd-hist {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 20.5rem;
	gap: var(--s6);
	align-items: start;
	width: min(1400px, calc(100% - 2 * var(--s4)));
}

.rd-hist .rd-chron {
	max-width: none;
	margin: 0;
}

.rd-hist .rd-chron-in {
	padding-bottom: var(--s8);
}

@media (min-width: 1181px) {
	.rd-hist .storyEntry {
		grid-template-columns: 10rem minmax(0, 38rem);
	}
}

.rd-old {
	position: sticky;
	top: var(--s4);
	transform: rotate(.5deg);
}

.rd-old-in {
	padding: var(--s5) var(--s5) var(--s6);
}

.rd-pile {
	position: relative;
	display: block;
	aspect-ratio: 29 / 35;
}

.rd-pile img {
	position: absolute;
	width: 57%;
	height: auto;
	padding: var(--s1);
	background: var(--logo-slip);
	box-shadow: 3px 4px 0 var(--shadow);
	transition: transform 120ms cubic-bezier(.2, .7, .2, 1);
}

.rd-pile img:nth-child(1) { top: 0; left: 0; transform: rotate(-5deg); }
.rd-pile img:nth-child(2) { top: 7%; right: 0; transform: rotate(4deg); }
.rd-pile img:nth-child(3) { top: 28%; left: 4%; transform: rotate(3deg); }
.rd-pile img:nth-child(4) { top: 38%; right: 2%; transform: rotate(-4deg); }
.rd-pile img:nth-child(5) { top: 59%; left: 0; transform: rotate(-2deg); }
.rd-pile img:nth-child(6) { top: 67%; right: 0; transform: rotate(5deg); }

.rd-pile:hover img:nth-child(odd) { transform: rotate(-2deg) translateY(-3px); }
.rd-pile:hover img:nth-child(even) { transform: rotate(2deg) translateY(-3px); }

#historyOld {
	margin: var(--s5) 0 0;
	font: 400 var(--t2)/1.55 var(--f-read);
}

#historyPlay {
	margin: var(--s5) 0 0;
}

#historyPlay .ng-buy {
	display: flex;
	font: 400 var(--t1)/1.6 var(--f-con);
	overflow-wrap: anywhere;
	text-transform: uppercase;
	-webkit-font-smoothing: none;
	justify-content: center;
	min-height: 56px;
	padding: var(--s3) var(--s4);
	text-align: center;
}

/* a short window cannot hold the whole sheet: it stays where it hangs */
@media (max-height: 760px) {
	.rd-old {
		position: static;
	}
}

/* no room for two sheets side by side: the pile goes under the chronicle, over its torn foot */
@media (max-width: 1180px) {
	main.rd-hist {
		display: block;
		width: min(1120px, calc(100% - 2 * var(--s4)));
	}

	.rd-hist .rd-chron {
		max-width: 1040px;
		margin: 0 auto;
	}

	.rd-old {
		position: relative;
		z-index: 1;
		max-width: 22rem;
		margin: calc(-1 * var(--s7)) auto 0;
	}
}

/* ─── Wiki («Вступить»): a small notice on one strip ─────────────────────── */

.rd-notice {
	max-width: 54rem;
	margin: var(--s4) auto 0;
	padding: var(--s7) var(--s7) var(--s7);
	transform: rotate(-.4deg);
}

.rd-notice h1 {
	max-width: 30rem;
	font: 300 var(--t5)/1.08 var(--f-disp);
}

.ng-join {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 15rem;
	gap: var(--s6);
	align-items: start;
	margin-top: var(--s5);
}

#wikicont {
	max-width: 34rem;
	font: 400 var(--t2)/1.7 var(--f-read);
}

#wikicont a {
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

#wikicont a:hover,
#wikicont a:focus-visible {
	text-decoration-thickness: 2px;
}

.ng-cta {
	margin: var(--s6) 0 0;
}

/* the fennec, pasted half over the notice's right edge */
.rd-print {
	margin: calc(-1 * var(--s5)) calc(-1 * var(--s8) - var(--s5)) 0 0;
	padding: var(--s2);
	background: var(--panel-2);
	box-shadow: 4px 5px 1px var(--shadow);
	transform: rotate(2.4deg);
}

.rd-print img {
	display: block;
	width: 100%;
	height: auto;
}

/* ─── Privacy: a typed document in a ruled frame ─────────────────────────── */

.rd-doc {
	max-width: 56rem;
	margin: 0 auto;
}

.rd-doc-in {
	padding: var(--s6);
}

.rd-frame {
	padding: var(--s7) var(--s7) var(--s6);
}

.rd-frame .ng-pagehead {
	text-align: center;
}

.rd-frame h1 {
	font: 400 var(--t5)/1.1 var(--f-disp);
}

#privacyText {
	max-width: 40rem;
	margin: var(--s6) auto 0;
}

#privacyText .storyEntry {
	display: block;
}

#privacyText .storyEntry + .storyEntry {
	margin-top: var(--s6);
}

/* the preamble: the whole notice in three sentences, set apart by italic */
#privacyText .storyEntry:first-child p {
	font-style: italic;
}

#privacyText .storyEntry h2 {
	margin: 0 0 var(--s2);
	font: 600 var(--t2)/1.3 var(--f-disp);
}

#privacyText .storyEntry p + p {
	margin-top: var(--s3);
}

#privacyUpdated {
	max-width: 40rem;
	margin: var(--s7) auto 0;
	color: var(--dim);
	font: 400 var(--t1)/1.5 var(--f-read);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

/* ─── Tablet: the margin narrows, the overhangs come in ──────────────────── */

@media (max-width: 1000px) {
	.rd-chron-in {
		padding: var(--s7) var(--s6) calc(var(--s8) + var(--s5));
	}

	.storyEntry {
		grid-template-columns: 10rem minmax(0, 1fr);
		column-gap: var(--s5);
	}

	.rd-print {
		margin-right: calc(-1 * var(--s6));
	}
}

/* ─── Phone (390): one recomposed column ─────────────────────────────────── */

@media (max-width: 760px) {
	main.ng-page {
		width: calc(100% - 2 * var(--s4));
		margin-top: var(--s6);
		padding: 0;
		overflow-x: clip;
		overflow-y: visible;
		padding-top: var(--s4);
	}

	/* history: the date moves above its entry */
	.rd-chron-in {
		padding: var(--s6) var(--s4) calc(var(--s7) + var(--s5));
	}

	#historyheader h1 {
		font-size: var(--t5);
	}

	#historyStory {
		margin-top: var(--s6);
	}

	.storyEntry {
		display: block;
	}

	#historyStory .storyEntry h2 {
		padding-top: 0;
		margin-bottom: var(--s2);
	}

	.storyEntry p {
		font-size: var(--t1);
	}

	/* wiki: the print comes inside the notice, under the text */
	.rd-notice {
		padding: var(--s6) var(--s4) var(--s6);
		transform: rotate(-.3deg);
	}

	.rd-notice h1 {
		font-size: var(--t4);
	}

	.ng-join {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--s6);
	}

	.rd-print {
		max-width: 16rem;
		margin: 0 auto;
		transform: rotate(1.6deg);
	}

	/* privacy: the frame keeps its double rule, its padding shrinks */
	.rd-doc-in {
		padding: var(--s3);
	}

	.rd-frame {
		padding: var(--s5) var(--s4) var(--s5);
	}

	.rd-frame h1 {
		font-size: var(--t4);
	}

	#privacyText .storyEntry p {
		font-size: var(--t1);
	}
}

/* ─── Reduced motion: hover lifts stay as colour / underline only ────────── */

@media (prefers-reduced-motion: reduce) {
	.rd-pile img {
		transition: none;
	}

	.rd-pile:hover img:nth-child(odd) {
		transform: rotate(-2deg);
	}

	.rd-pile:hover img:nth-child(even) {
		transform: rotate(2deg);
	}
}
