/* FASCIInation website (decision 157). The game's look (docs/STYLE.md, data/ui_theme.json):
   dark text mode, greyscale with colour only where it means something, gold for the one main
   thing, Unscii in whole multiples of its pixel size, windows with a double frame and a title in
   the frame, calm. No dot or dash separators: gaps, columns and frames divide. */

@font-face {
	font-family: "Unscii 16";
	src: url("/fonts/unscii-16.ttf") format("truetype");
	font-display: swap;
}
@font-face {
	font-family: "Unscii 8";
	src: url("/fonts/unscii-8.ttf") format("truetype");
	font-display: swap;
}

:root {
	color-scheme: dark;
	--backdrop: #0b0c0f;
	--panel: #13141a;
	--panel-top: #181920;
	--well: #0a0b0e;
	--well-frame: #33353f;
	--raised: #1e2028;
	--raised-hover: #272a34;
	--select-back: #1c1a14;
	--frame: #a9abb8;
	--frame-dim: #4a4c58;
	--rule: #2d2f38;
	--text: #e6e6ec;
	--muted: #8a8c98;
	--dim: #5c5e69;
	--title: #f0dc98;
	--accent: #f8d070;
	--accent-dim: #8a7440;
	--danger: #ff6e6e;
	--good: #8ae09a;
	--warn: #ff9a7a;
	--quest: #a8c8ff;
	--cell: 8px;
	--mono: "Unscii 16", ui-monospace, "Cascadia Mono", Consolas, monospace;
	--mono8: "Unscii 8", "Unscii 16", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { background: var(--backdrop); }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--backdrop);
	color: var(--text);
	font: 16px/24px var(--mono);
	-webkit-font-smoothing: none;
	-moz-osx-font-smoothing: grayscale;
	font-smooth: never;
	text-rendering: optimizeSpeed;
}

a { color: var(--text); text-decoration: underline; text-decoration-color: var(--frame-dim); text-underline-offset: 4px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent-dim); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

p { margin: 0 0 16px; }
code { font-family: var(--mono); color: var(--title); background: var(--well); padding: 0 4px; border-radius: 2px; overflow-wrap: anywhere; }
em { font-style: normal; color: var(--title); }
strong { font-weight: normal; }
.gold { color: var(--title); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.warn { color: var(--warn); }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; background: var(--panel); padding: 8px 16px; z-index: 10; }

/* --- Top and bottom ---------------------------------------------------------------------- */

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	max-width: 1008px;
	width: 100%;
	margin: 0 auto;
	padding: 16px 24px;
	flex-wrap: wrap;
}
.brand { font: 16px/24px var(--mono8); text-decoration: none; letter-spacing: 1px; color: var(--text); }
.brand .gold { color: var(--accent); }
.nav { display: flex; gap: 8px 24px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

main { flex: 1; width: 100%; min-width: 0; max-width: 1008px; margin: 0 auto; padding: 8px 24px 48px; }
main > * { min-width: 0; }

.foot {
	border-top: 1px solid var(--rule);
	padding: 24px;
	text-align: center;
	color: var(--muted);
}
.foot nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 8px; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--accent); }
.foot p { margin: 0; }

/* --- Windows: double frame, title in the frame, shadow one cell right and down ----------- */

.window {
	position: relative;
	background: var(--panel);
	border: 3px double var(--frame);
	padding: 24px 24px 8px;
	margin: 24px 0 32px;
	box-shadow: var(--cell) var(--cell) 0 rgba(0, 0, 0, 0.65), 0 0 0 8px rgba(0, 0, 0, 0.25);
}
.window-title {
	position: absolute;
	top: -13px;
	left: 0;
	right: 0;
	text-align: center;
	pointer-events: none;
}
.window-title span { background: var(--panel); padding: 0 8px; color: var(--text); }
.window.narrow { max-width: 640px; margin-left: auto; margin-right: auto; }

h1, h2, h3 { font-weight: normal; margin: 0 0 16px; }
.section {
	display: flex;
	align-items: center;
	gap: 8px;
	font: 8px/16px var(--mono8);
	font-size: 8px;
	letter-spacing: 1px;
	color: var(--dim);
	margin: 32px 0 16px;
}
.section::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.section .count { color: var(--muted); }

/* --- Buttons (raised cells; hover lifts; focus gold; the main action in gold) ------------ */

.button {
	display: inline-block;
	font: inherit;
	color: var(--text);
	background: var(--raised);
	border: 1px solid var(--well-frame);
	border-radius: 4px;
	padding: 4px 16px;
	min-height: 32px;
	line-height: 22px;
	text-decoration: none;
	cursor: pointer;
}
.button:hover { background: var(--raised-hover); color: var(--text); }
.button:active { background: var(--select-back); color: var(--accent); }
.button.primary { color: var(--accent); border-color: var(--accent-dim); background: var(--select-back); }
.button.primary:hover { border-color: var(--accent); background: #26231a; }
.button.danger { color: var(--danger); border-color: #5a2a2e; }
.button.big { padding: 12px 24px; font-size: 16px; }
.button.small { min-height: 24px; padding: 0 12px; }
.button[disabled] { opacity: 0.5; cursor: default; }

/* --- Hero: the logo over a calm scene of characters --------------------------------------- */

.hero {
	position: relative;
	overflow: hidden;
	margin: 0 0 32px;
	min-height: 440px;
	border-bottom: 1px solid var(--rule);
}
.scene {
	position: absolute;
	inset: 0;
	margin: 0;
	font: 16px/16px var(--mono);
	color: var(--dim);
	white-space: pre;
	overflow: hidden;
	user-select: none;
}
.scene .s { color: #9fb0e0; }
.scene .m { color: #3a3d4a; }
.scene .g { color: #4c6a4f; }
.scene .f { color: var(--accent); }
.scene .k { color: var(--muted); }
.scene .w { color: #c9cbd6; }
.hero-inner { position: relative; text-align: center; padding: 24px 0 40px; }

.logo {
	display: flex;
	justify-content: center;
	align-items: flex-end;
	gap: 8px;
	margin: 0 0 8px;
	font-weight: normal;
}
.logo-f, .logo-nation {
	font: 32px/32px var(--mono8);
	color: var(--text);
	text-shadow: 2px 0 #05060a, -2px 0 #05060a, 0 2px #05060a, 0 -2px #05060a, 2px 2px #05060a;
}
.logo-ascii {
	font: 16px/16px var(--mono8);
	white-space: pre;
	text-align: left;
	color: var(--title);
}
.logo-ascii b { font-weight: normal; background: rgba(11, 12, 15, 0.92); }
.logo-ascii .r0 { color: #f0dc98; }
.logo-ascii .r1 { color: #e2cf8f; }
.logo-ascii .r2 { color: #d4c186; }
.logo-ascii .r3 { color: #c5b37d; }
.logo-ascii .r4 { color: #b7a574; }
.logo-ascii .r5 { color: #a8976b; }
.logo-ascii .r6 { color: #9a8962; }
.tagline { color: var(--muted); font: 8px/16px var(--mono8); font-size: 8px; letter-spacing: 2px; margin: 0 0 24px; }
.pitch { max-width: 560px; margin: 0 auto 24px; background: rgba(11, 12, 15, 0.8); padding: 0 8px; }
.actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.status { min-height: 24px; }
.hero .status { display: inline-block; background: rgba(11, 12, 15, 0.85); padding: 0 8px; }

/* --- Features and screenshots --------------------------------------------------------------- */

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 32px; }
.features .window { margin: 16px 0 24px; }
.features p { color: var(--muted); }

/* Screenshots (decision 189): site.js sizes every .px frame so one game pixel is a whole number
   of device pixels; without script the picture fills its frame (pixelated, never smoothed). */
.shots { margin: 32px 0 16px; }
.px { display: block; position: relative; overflow: hidden; background: var(--well); margin: 0 auto; }
.px img {
	display: block;
	width: 100%;
	height: auto;
	image-rendering: crisp-edges;
	image-rendering: pixelated;
}
.px.snapped img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; }
.stage { margin: 16px 0 16px; }
/* Frames as rings outside the picture (box-shadow): a border would take width from the picture. */
.stage-link { display: block; width: max-content; max-width: 100%; margin: 0 auto; box-shadow: 0 0 0 1px var(--well-frame); cursor: zoom-in; }
.stage-link:hover { box-shadow: 0 0 0 1px var(--accent-dim); }
.stage-link:focus-visible { outline-offset: 4px; }
.stage figcaption { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0 0; color: var(--muted); max-width: 960px; margin: 0 auto; }
.thumbs { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.thumbs li { min-width: 0; }
.thumb { display: block; box-shadow: 0 0 0 1px var(--well-frame); cursor: pointer; }
.thumb:hover { box-shadow: 0 0 0 1px var(--accent-dim); }
.thumb[aria-current="true"] { box-shadow: 0 0 0 2px var(--accent); }
.thumb-cap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.community { margin-top: 48px; }
.news-teaser { margin-top: 48px; }

/* --- Lightbox: one screenshot as large as the screen allows, crisp, in a game window ------ */

.lightbox {
	padding: 0;
	border: 3px double var(--frame);
	background: var(--panel);
	color: var(--text);
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	overflow: visible;
	box-shadow: var(--cell) var(--cell) 0 rgba(0, 0, 0, 0.65);
}
.lightbox::backdrop { background: rgba(5, 6, 8, 0.88); }
.lightbox figure { margin: 0; padding: 8px; }
.lb-view { touch-action: pan-y; }
.lb-view.pan { touch-action: none; cursor: grab; }
.lb-view .px { margin: 0; }
.lightbox figcaption { display: flex; justify-content: space-between; gap: 16px; padding: 8px 4px 0; }
.lb-nav, .lb-close {
	position: absolute;
	font: 32px/32px var(--mono8);
	color: var(--text);
	background: var(--raised);
	border: 1px solid var(--well-frame);
	border-radius: 4px;
	width: 48px;
	height: 48px;
	cursor: pointer;
}
.lb-nav:hover, .lb-close:hover { background: var(--raised-hover); color: var(--accent); }
.lb-prev { left: 16px; top: calc(50% - 40px); }
.lb-next { right: 16px; top: calc(50% - 40px); }
.lb-close { right: -12px; top: -24px; font-size: 16px; width: 32px; height: 32px; line-height: 16px; }

/* --- Forms (wells: dark cells with a thin round frame) ------------------------------------- */

.form { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.form label { color: var(--muted); }
.form input:not([type="checkbox"]) {
	font: inherit;
	color: var(--text);
	background: var(--well);
	border: 1px solid var(--well-frame);
	border-radius: 4px;
	padding: 4px 8px;
	min-height: 32px;
	width: 100%;
}
.form input:focus { border-color: var(--accent); outline: none; }
.form .button { align-self: flex-start; margin-top: 8px; }
.hint { color: var(--dim); margin: 0 0 8px; }
.checks { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; color: var(--text) !important; }
.check input { width: 16px; height: 16px; margin: 4px 0 0; accent-color: var(--accent); flex: none; }
.message { min-height: 24px; margin: 0; color: var(--danger); }
.message.ok { color: var(--good); }
.closed { color: var(--warn); }

/* --- Account --------------------------------------------------------------------------------- */

.account-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.account-name { font: 32px/32px var(--mono8); margin: 0; overflow-wrap: anywhere; }
.notice { border: 1px solid var(--accent-dim); background: var(--select-back); border-radius: 4px; padding: 16px; margin: 16px 0; }
.chars { width: 100%; border-collapse: collapse; margin: 0 0 16px; }
.chars th { text-align: left; color: var(--dim); font-weight: normal; padding: 4px 8px; }
.chars td { padding: 4px 8px; border-top: 1px solid var(--rule); }
.chars tr:nth-child(even) td { background: #17181f; }
.chars .num { text-align: right; }
.chars td:first-child { color: var(--title); }
.orders td:first-child, .tiers td:first-child { color: var(--text); white-space: nowrap; }
.orders td:nth-child(5), .orders td:nth-child(6) { white-space: nowrap; }
.tiers td:last-child { color: var(--muted); }
.scroll-x { overflow-x: auto; }
.tier-page { color: #c8925e; }
.tier-chapter { color: #c4cce0; }
.tier-codex { color: #eec865; }
.pay .order dd.price { color: var(--accent); }
.pay .form .button.big { align-self: stretch; text-align: center; }

/* --- Download ------------------------------------------------------------------------------- */

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 24px; margin: 24px 0; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts .hash { color: var(--muted); }
.steps { padding-left: 24px; margin: 0 0 16px; }
.steps li { margin: 0 0 8px; }

/* --- Legal ---------------------------------------------------------------------------------- */

.doclist { list-style: none; padding: 0; margin: 0 0 16px; }
.doclist li { display: grid; grid-template-columns: 120px 1fr max-content; gap: 8px 16px; padding: 8px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.doclist .lang { color: var(--muted); }
.legal { max-width: 800px; margin-left: auto; margin-right: auto; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0 0 16px; border-bottom: 1px solid var(--rule); margin-bottom: 24px; }
.legal-nav a { text-decoration: none; color: var(--muted); }
.legal-nav a[aria-current="page"] { color: var(--accent); }
.legal-nav .spacer { flex: 1; }
.prose h1 { color: var(--title); font: 32px/40px var(--mono8); margin: 0 0 24px; overflow-wrap: anywhere; }
.prose h2 { color: var(--text); margin: 32px 0 8px; }
.prose p, .prose li { color: #c4c5cf; overflow-wrap: anywhere; }
.prose ul { padding-left: 24px; }
.prose li { margin: 0 0 8px; }

.post h2 { margin: 8px 0 16px; }

/* --- Phones --------------------------------------------------------------------------------- */

@media (max-width: 640px) {
	.thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.top { padding: 16px; }
	main { padding: 8px 16px 32px; }
	.window { padding: 24px 16px 8px; }
	.hero { min-height: 400px; }
	.logo { gap: 4px; }
	.logo-f, .logo-nation { font-size: 16px; line-height: 16px; }
	.logo-ascii { font-size: 8px; line-height: 8px; }
	.logo-f, .logo-ascii, .logo-nation { flex: none; }
}
@media (max-width: 400px) {
	.logo { transform: scale(0.9); transform-origin: center bottom; }
	.button.big { padding: 8px 16px; }
	.lb-nav { width: 32px; height: 32px; font-size: 16px; line-height: 16px; }
	.lb-prev { left: 4px; }
	.lb-next { right: 4px; }
	.doclist li { grid-template-columns: 1fr max-content; }
	.doclist li .muted { grid-column: 1 / -1; grid-row: 2; }
	.prose h1, .account-name { font-size: 16px; line-height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
