/* Home page (index.html): the lead game sheet with its reverse, the games board, the
   news sheet, the roadmap console box, «О нас», the teletype. Uses the ng.css
   primitives (sheet, tape, flip card, stamp, console box, tree). The DOM keeps the
   page's heading order (lead, games, news, roadmap, about); the grid places them. */

/* ─── Board ──────────────────────────────────────────────────────────────── */

.ng-board {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
	grid-template-rows: auto auto 1fr auto;
	gap: var(--s7) 56px;
	align-items: start;
	max-width: 1320px;
	margin: 0 auto;
	padding: var(--s6) var(--s6) 0;
}

.ng-lead {
	grid-column: 1;
	grid-row: 1 / span 3;
}

.ng-news {
	grid-column: 2;
	grid-row: 1;
	margin-top: var(--s4);
}

.ng-plan-box {
	grid-column: 2;
	grid-row: 2;
}

.ng-about {
	grid-column: 2;
	grid-row: 3;
}

/* one rhythm between the home sections: the board's row gap (s7) above the games, the same above the footer */
.ng-games {
	grid-column: 1 / -1;
	grid-row: 4;
}

.ng-board + .ng-foot {
	margin-top: var(--s7);
}

/* ─── Lead sheet (flip card) ─────────────────────────────────────────────── */

.ng-lead {
	--tilt: -.4deg;
}

.ng-lead .ng-face {
	padding: var(--s6);
}

.ng-lead-tag {
	margin: 0;
}

.ng-lead-title {
	margin: var(--s4) 0 var(--s5);
	font: 300 var(--t6)/1.02 var(--f-disp);
	overflow-wrap: anywhere;
}

.ng-lead-title a,
.ng-g h3 a,
.ng-older-name {
	text-decoration: none;
}

.ng-lead-title a:hover,
.ng-lead-title a:focus-visible {
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
}

/* the game's screenshot, pasted in at a slight tilt */
.ng-print {
	margin: 0 -6px var(--s5) var(--s2);
	padding: var(--s2);
	background: var(--panel-2);
	box-shadow: 3px 4px 0 var(--shadow);
	transform: rotate(.9deg);
}

.ng-print img,
.ng-shot img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
}

.ng-print img {
	aspect-ratio: 600 / 338;
}

.ng-lead .ng-lede {
	max-width: 62ch;
	margin: 0;
	font-size: var(--t2);
	line-height: 1.62;
}

.ng-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px 28px;
	margin: var(--s5) 0;
}

/* the Steam facts under the buttons: three columns of dashed-rule entries */
.ng-face.front .ng-facts {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, .9fr);
	gap: var(--s4) 28px;
	margin: 0;
}

.ng-face.front .ng-facts div {
	padding-top: var(--s2);
	border-top: 1px dashed var(--dim);
}

.ng-facts dt {
	color: var(--dim);
	font-size: var(--t1);
}

.ng-facts dd {
	margin: 0;
	font-size: var(--t1);
	line-height: 1.45;
}

/* ─── Card reverses ──────────────────────────────────────────────────────── */

.ng-back-h {
	margin: 0 0 var(--s4);
	font: 300 var(--t4)/1.15 var(--f-disp);
}

/* the facts on a reverse: a ruled spec table */
.ng-face.back .ng-facts {
	display: grid;
	grid-template-columns: fit-content(9rem) minmax(0, 1fr);
	margin: 0;
	border-top: 2px solid var(--ink);
}

.ng-face.back .ng-facts div {
	display: contents;
}

.ng-face.back .ng-facts dt,
.ng-face.back .ng-facts dd {
	padding: var(--s2) 0;
	border-bottom: 1px dashed var(--dim);
}

.ng-face.back .ng-facts dt {
	padding-right: var(--s4);
}

.ng-face.back .ng-facts + .ng-facts {
	border-top: 0;
}

/* the DLC list as a console tree pane; one DLC shows its cover */
.ng-tree-win {
	margin: var(--s5) 0 var(--s2);
	padding: var(--s5) var(--s3) 10px;
}

.ng-dlc-tree img {
	display: none;
}

.ng-dlc-tree li:only-child {
	display: grid;
	grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
	gap: var(--s4);
	align-items: center;
	padding: 6px 0 var(--s1);
}

.ng-dlc-tree li:only-child::before,
.ng-dlc-tree li:only-child::after {
	content: none;
}

.ng-dlc-tree li:only-child img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 460 / 215;
	object-fit: cover;
}

.ng-credits {
	margin: var(--s4) 0 0;
	font-size: var(--t1);
	line-height: 1.5;
}

.ng-credits dt {
	color: var(--dim);
}

.ng-credits dd {
	margin: 0;
}

.ng-back-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0 22px;
	margin: var(--s2) 0 0;
	padding: 0;
	list-style: none;
}

/* ─── Games board ────────────────────────────────────────────────────────── */

.ng-games-head {
	position: relative;
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 28px;
	margin-left: 3%;
	padding: var(--s4) var(--s5);
	transform: rotate(-1deg);
}

.ng-games-head h2 {
	margin: 0;
	font: 300 var(--t6)/1 var(--f-disp);
}

.ng-games-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 44px 34px;
	align-items: start;
	margin-top: var(--s6);
}

/* a game's card shrinks with its age in width, height and area: Collapse > Mao > Ostalgie > Crisis.
   Collapse and the older games' heading with Mao share the first rows; Ostalgie and Crisis share the last.
   Every cover is a landscape crop (4:3 to 16:9, flatter with age), the title a step smaller. */
.ng-g-second {
	grid-column: 1 / span 7;
	grid-row: 1 / span 2;
	--tilt: -.8deg;
	--cover: 4 / 3;
}

.ng-older-h {
	grid-column: 8 / span 5;
	grid-row: 1;
	align-self: end;
	justify-self: start;
	margin: 0;
	padding: var(--s4) var(--s4) var(--s2);
	font: 300 var(--t4)/1.15 var(--f-disp);
	transform: rotate(1.2deg);
}

.ng-g-950740 {
	grid-column: 8 / span 5;
	grid-row: 2;
	--tilt: .7deg;
	--cover: 3 / 2;
}

/* the last row: two half-row areas, each card narrower than Mao (Mao = 5 of 12 columns, about 82% of a half) */
.ng-g-774091 {
	grid-column: 1 / span 6;
	grid-row: 3;
	justify-self: end;
	width: 73%;
	--tilt: -1.4deg;
	--cover: 16 / 10;
}

.ng-g-599750 {
	grid-column: 7 / span 6;
	grid-row: 3;
	justify-self: start;
	width: 63%;
	--tilt: .5deg;
	--cover: 16 / 9;
}

.ng-g .ng-face {
	padding: var(--s4);
}

.ng-g .ng-face.front {
	display: flex;
	flex-direction: column;
}

/* at rest the front alone sets the card's box (the age order). The reverse is a sheet of its own, at least the box
   high with its natural height when its content is longer; script.js (growTo) sets the card's height to it while
   the card is turned, so the card grows in the flow and everything below moves down, and releases it on the way
   back (the height is not animated: the site gate bans transitions of layout properties). Nothing on the reverse scrolls; the bottom row sits at the bottom of the sheet. */
.ng-lead .ng-face.back,
.ng-g .ng-face.back {
	position: absolute;
	inset: 0 0 auto;
	min-height: 100%;
}

.ng-shot {
	margin: 0 0 var(--s3);
}

.ng-g .ng-shot {
	aspect-ratio: var(--cover);
}

.ng-g .ng-shot img {
	height: 100%;
}

.ng-g-second .ng-shot img {
	object-position: 50% 30%;
}

.ng-g-950740 .ng-shot img {
	object-position: 62% 50%;
}

.ng-g-774091 .ng-shot {
	margin: var(--s3) 0 0;
}

.ng-g-599750 .ng-shot img {
	object-position: 30% 50%;
}

/* an older game's front: the icon beside its name, the foot on the last row */
.ng-g-older .ng-face.front {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-rows: auto auto auto auto 1fr;
	column-gap: var(--s3);
	align-items: center;
}

.ng-g-older .ng-face.front > *,
.ng-g-older .ng-g-copy > * {
	grid-column: 1 / -1;
}

.ng-g-older .ng-g-copy {
	display: contents;
}

.ng-g-older .ng-face.front > .ng-icon,
.ng-g-older .ng-g-copy > .ng-icon {
	grid-column: 1;
	width: 48px;
	height: 48px;
	margin: 0;
}

.ng-g-older .ng-face.front .ng-older-name {
	grid-column: 2;
}

.ng-g-older .ng-face.front .ng-face-foot {
	grid-row: -2;
	align-self: end;
}

.ng-icon {
	display: block;
	width: 64px;
	height: 64px;
	margin: 0 0 10px;
	box-shadow: 3px 4px 0 var(--shadow);
	transform: rotate(-3deg);
}

.ng-g h3 {
	margin: 0;
	font: 300 var(--t5)/1.08 var(--f-disp);
}

.ng-older-name {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font: 600 var(--t4)/1.2 var(--f-read);
}

.ng-g-774091 .ng-older-name {
	font-size: var(--t3);
}

.ng-g-599750 .ng-older-name {
	font-size: var(--t2);
}

.ng-g-599750 .ng-line {
	font-size: var(--t1);
}

/* wide desktop: the cards are wide enough for taller crops, which leave the reverses room for their DLC lists */
@media (min-width: 1181px) {
	.ng-g-950740 {
		--cover: 4 / 3;
	}

	.ng-g-774091,
	.ng-g-599750 {
		--cover: 3 / 2;
	}
}

.ng-g h3 a:hover,
.ng-g h3 a:focus-visible,
.ng-older-name:hover,
.ng-older-name:focus-visible {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.ng-line {
	margin: 6px 0 0;
	font-size: var(--t2);
	line-height: 1.45;
}

.ng-meta {
	margin: var(--s2) 0 0;
	color: var(--ink);
	font-size: var(--t1);
}

.ng-rev-l {
	color: var(--dim);
}

.ng-meta:empty {
	display: none;
}

/* ─── News sheet, roadmap console box, about ─────────────────────────────── */

.ng-news {
	position: relative;
	transform: rotate(.7deg);
}

.ng-news .ng-sheet {
	padding: var(--s5) var(--s5) var(--s7);
}

.ng-sec-h {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 6px 20px;
	margin-bottom: var(--s4);
}

.ng-sec-h h2 {
	margin: 0;
	font: 300 var(--t5)/1.05 var(--f-disp);
}

.ng-news-photo {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	margin: 0 0 var(--s3);
	padding: 6px;
	background: var(--panel-2);
	box-shadow: 3px 4px 0 var(--shadow);
	transform: rotate(-1.2deg);
}

.ng-news-item + .ng-news-item {
	margin-top: var(--s5);
}

.ng-news-item time {
	display: block;
	color: var(--dim);
	font: 400 var(--t1)/1.75 var(--f-con);
	-webkit-font-smoothing: none;
}

.ng-news-item h3 {
	margin: 0;
	font: 600 var(--t2)/1.4 var(--f-read);
}

.ng-news-item h3 a {
	text-decoration: none;
	overflow-wrap: anywhere;
}

.ng-news-item h3 a:hover,
.ng-news-item h3 a:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ng-plan-box {
	padding: var(--s6) var(--s5) var(--s4);
}

.ng-plan-box .ng-con-title {
	left: 50%;
	transform: translateX(-50%);
}

.ng-plan {
	display: grid;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ng-plan li {
	display: grid;
	grid-template-columns: 9ch minmax(0, 1fr);
	gap: var(--s3);
	align-items: baseline;
}

.ng-plan b {
	color: var(--con-dim);
	font: 400 var(--t1)/1.75 var(--f-con);
	font-variant-numeric: tabular-nums;
}

.ng-plan span {
	font: 400 var(--t2)/1.4 var(--f-read);
}

.ng-more {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-top: 10px;
	padding: 0 10px;
	border: 2px solid var(--con-ink);
	color: var(--con-ink);
}

.ng-more:hover,
.ng-more:focus-visible {
	background: var(--con-inv-bg);
	color: var(--con-inv-ink);
}

.ng-about {
	position: relative;
	margin: 0 6% 0 10%;
	transform: rotate(-1.3deg);
}

.ng-about .ng-sheet {
	padding: var(--s5);
}

.ng-about h2 {
	margin: 0 0 10px;
	font: 300 var(--t4)/1.1 var(--f-disp);
}

.ng-about p {
	margin: 0;
	font-size: var(--t2);
	line-height: 1.6;
}

/* ─── Teletype (built by script.js from the news items; no ticker without JS or with reduced motion) ─── */

.ng-ticker {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: stretch;
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 var(--s5);
	font: 400 var(--t1)/1.5 var(--f-con);
	-webkit-font-smoothing: none;
}

.ng-ticker > * {
	background: var(--con-bg);
	color: var(--con-ink);
	border-bottom: 6px double var(--con-ink);
}

.ng-tick-btn {
	display: flex;
	align-items: center;
	gap: var(--s3);
	min-height: 44px;
	padding: 0 var(--s4);
	background: var(--con-inv-bg);
	color: var(--con-inv-ink);
	white-space: nowrap;
}

/* Chinese: the CJK fallback sits low in the pixel face's line (ng.css .ng-kl); the pad lifts the label, not the lamp */
.ng-tick-btn > span:last-child:lang(zh) {
	padding-bottom: .3125em;
}

.ng-tick-btn:hover span:last-child,
.ng-tick-btn:focus-visible span:last-child {
	text-decoration: underline;
	text-underline-offset: 4px;
}

.ng-tick-btn:focus-visible {
	outline-offset: -4px;
}

/* the lamp: blinks while the tape runs, steady and dim when paused (state also in aria-pressed) */
.ng-lamp {
	width: 10px;
	height: 10px;
	background: var(--accent);
	box-shadow: 0 0 0 2px var(--con-inv-ink);
	animation: ng-lamp 1600ms steps(1, end) infinite; /* gate-allow: motion-loop the teletype lamp blinks while the tape runs; off under reduced motion */
}

.ng-tick-btn[aria-pressed="true"] .ng-lamp {
	animation: none;
	opacity: .45;
}

@keyframes ng-lamp {
	50% {
		opacity: .25;
	}
}

.ng-tick-win {
	display: flex;
	align-items: center;
	overflow: hidden;
}

.ng-tick-run {
	display: flex;
	width: max-content;
	animation: ng-tape 120s steps(1200, end) infinite; /* gate-allow: motion-loop the teleprinter ticker (SKILL Motion) in 1200 character steps; pauses on hover, off under reduced motion */
}

.ng-ticker:hover .ng-tick-run,
.ng-ticker.is-paused .ng-tick-run {
	animation-play-state: paused;
}

@keyframes ng-tape {
	to {
		transform: translateX(-50%);
	}
}

.ng-tick-run a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 var(--s6) 0 var(--s4);
	color: var(--con-dim);
	text-decoration: none;
	white-space: nowrap;
}

.ng-tick-run a:hover {
	color: var(--con-ink);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.ng-tick-run time {
	margin-right: var(--s4);
	color: var(--con-ink);
}

/* the console hangs from the teletype rule */
.ng-ticker + .ng-head .ng-head-con {
	border-top: 0;
}

@media (min-width: 761px) and (max-width: 1180px) {
	.ng-board {
		overflow-x: clip;
	}

	.ng-g-774091 {
		width: 78%;
	}

	.ng-g-599750 {
		width: 70%;
	}
}

/* tablet: Collapse takes the whole row, Mao the next under the heading, Ostalgie and Crisis share the last */
@media (min-width: 761px) and (max-width: 1000px) {
	.ng-g-second {
		grid-column: 1 / -1;
		grid-row: 1;
	}

	.ng-older-h {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.ng-g-950740 {
		grid-column: 1 / -1;
		grid-row: 3;
		justify-self: end;
		width: 82%;
	}

	.ng-g-774091 {
		grid-column: 1 / span 6;
		grid-row: 4;
		justify-self: stretch;
		width: auto;
	}

	.ng-g-599750 {
		grid-column: 7 / span 6;
		grid-row: 4;
		width: 90%;
	}
}

/* ─── Phone: one column of sheets ────────────────────────────────────────── */

@media (max-width: 1080px) {
	.ng-board {
		gap: var(--s7) var(--s6);
		padding: var(--s6) var(--s5) 0;
	}

	.ng-face.front .ng-facts {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
	}
}

@media (max-width: 760px) {
	.ng-board {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		gap: var(--s7);
		padding: var(--s6) var(--s4) 0;
		overflow-x: clip;
	}

	.ng-lead,
	.ng-news,
	.ng-plan-box,
	.ng-about,
	.ng-games {
		grid-column: 1;
		grid-row: auto;
	}

	/* the order of the approved phone layout: lead, news, roadmap, about, games */
	.ng-lead { order: 1; }
	.ng-news { order: 2; margin-top: 0; }
	.ng-plan-box { order: 3; }
	.ng-about { order: 4; margin: 0 2% 0 4%; }
	.ng-games { order: 5; }

	.ng-lead .ng-face {
		padding: var(--s5) var(--s4);
	}

	.ng-print {
		margin: 0 0 var(--s4);
	}

	.ng-face.front .ng-facts {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.ng-dlc-tree li:only-child {
		grid-template-columns: minmax(0, 1fr);
	}

	.ng-plan-box {
		padding: var(--s6) var(--s3) var(--s4);
	}

	.ng-plan li {
		grid-template-columns: 8ch minmax(0, 1fr);
		gap: var(--s2);
	}

	.ng-games-head {
		margin-left: 0;
		padding: var(--s5) var(--s4) var(--s3);
	}

	.ng-games-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 40px;
	}

	.ng-g-second,
	.ng-older-h,
	.ng-g-950740,
	.ng-g-774091,
	.ng-g-599750 {
		grid-column: 1;
		grid-row: auto;
		margin-top: 0;
	}

	/* full-width sheets, each older one a little narrower, stepping left and right */
	.ng-g-950740 {
		justify-self: end;
		width: 94%;
		--tilt: .5deg;
	}

	.ng-g-774091 {
		justify-self: start;
		width: 88%;
		--tilt: -1deg;
	}

	.ng-g-599750 {
		justify-self: end;
		width: 82%;
	}

	/* the pause key takes its own row above the tape: its label never runs off a narrow screen */
	.ng-ticker {
		grid-template-columns: minmax(0, 1fr);
		padding: 0 var(--s2);
	}

	.ng-tick-btn {
		white-space: normal;
	}

	.ng-ticker > * {
		border-bottom-width: 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ng-lamp,
	.ng-tick-run {
		animation: none;
	}
}
