/* Layout of the site. Colours, type and base components come from css/brand.css.
   One accent (amber) on a deep space ground; system fonts only; no file but this server's. */

* { box-sizing: border-box; }

:root {
	--glow: rgba(255, 176, 0, 0.45);
	--line: color-mix(in srgb, var(--border) 70%, transparent);
	--glass: color-mix(in srgb, var(--bg) 72%, transparent);
	--wide: 76rem;
	--header: 4.25rem;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 1rem); }
body { overflow-wrap: break-word; min-height: 100vh; position: relative; }
h1, h2, h3, h4 { font-family: var(--font-mono); letter-spacing: -0.01em; }

/* The sky: stars and two soft nebulae, drawn with gradients only. */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
	background:
		radial-gradient(60rem 36rem at 85% -8%, rgba(120, 90, 255, 0.20), transparent 70%),
		radial-gradient(48rem 30rem at -5% 30%, rgba(255, 176, 0, 0.09), transparent 70%),
		radial-gradient(40rem 26rem at 70% 105%, rgba(40, 190, 255, 0.10), transparent 70%);
}
body::after {
	background-image:
		radial-gradient(1.5px 1.5px at 7% 12%, #fff, transparent),
		radial-gradient(1px 1px at 14% 64%, #cfe, transparent),
		radial-gradient(1.5px 1.5px at 22% 38%, #fff, transparent),
		radial-gradient(1px 1px at 31% 82%, #fed, transparent),
		radial-gradient(1px 1px at 38% 20%, #fff, transparent),
		radial-gradient(2px 2px at 46% 52%, #ffe, transparent),
		radial-gradient(1px 1px at 53% 90%, #fff, transparent),
		radial-gradient(1.5px 1.5px at 61% 8%, #cdf, transparent),
		radial-gradient(1px 1px at 68% 44%, #fff, transparent),
		radial-gradient(1.5px 1.5px at 74% 74%, #fff, transparent),
		radial-gradient(1px 1px at 81% 26%, #fed, transparent),
		radial-gradient(2px 2px at 88% 58%, #fff, transparent),
		radial-gradient(1px 1px at 93% 92%, #cfe, transparent),
		radial-gradient(1px 1px at 97% 14%, #fff, transparent),
		radial-gradient(1px 1px at 4% 88%, #fff, transparent),
		radial-gradient(1.5px 1.5px at 41% 70%, #cdf, transparent);
	background-size: 520px 520px;
	opacity: 0.55;
	animation: twinkle 7s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 0.7; } }
:root[data-theme="light"] body::after { display: none; }
:root[data-theme="light"] body::before { opacity: 0.45; }

.skip { position: absolute; left: -999rem; }
.skip:focus { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 50; padding: 0.5rem 1rem; background: var(--accent); color: var(--on-accent); border-radius: var(--radius-md); }

main { max-width: var(--wide); margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-7); }
main:focus { outline: none; }

/* Icons */
.icon { width: 1.15rem; height: 1.15rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-small { width: 0.9rem; height: 0.9rem; }

/* Top bar */
.top {
	position: sticky; top: 0; z-index: 30;
	background: var(--glass);
	-webkit-backdrop-filter: blur(14px) saturate(1.4);
	backdrop-filter: blur(14px) saturate(1.4);
	border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: var(--space-4); max-width: var(--wide); height: var(--header); margin: 0 auto; padding: 0 var(--space-4); }
.brand { display: flex; flex: none; border-radius: var(--radius-md); }
.brand img { height: 2rem; width: auto; display: block; }
.brand .wide { display: none; }
.top ul, footer ul, .tags, .chips { display: flex; flex-wrap: wrap; gap: 0.25rem var(--space-2); margin: 0; padding: 0; list-style: none; }
.top a, .top summary, .top button { text-decoration: none; }

.main-nav { display: none; margin-left: var(--space-3); }
.main-nav a {
	position: relative; display: inline-flex; align-items: center; gap: 0.45rem;
	padding: 0.5rem 0.8rem; color: var(--muted); font-weight: 600; font-size: 0.95rem; border-radius: var(--radius-md);
	transition: color var(--duration), background var(--duration);
}
.main-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.main-nav a::after {
	content: ""; position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.15rem; height: 2px; border-radius: 2px;
	background: var(--accent); box-shadow: 0 0 10px var(--glow);
	transform: scaleX(0); transform-origin: left; transition: transform 260ms cubic-bezier(.2, .8, .2, 1);
}
.main-nav a:hover::after { transform: scaleX(0.4); }
.main-nav a[aria-current] { color: var(--text); }
.main-nav a[aria-current]::after { transform: scaleX(1); }
.main-nav a[aria-current] .icon { color: var(--accent); }

.actions { display: none; align-items: center; gap: var(--space-2); margin-left: auto; white-space: nowrap; }
.login { color: var(--text); font-weight: 600; padding: 0.5rem 0.75rem; border-radius: var(--radius-md); text-decoration: none; }
.login:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }

/* The Play button stands out: amber, a halo that breathes. */
.play {
	display: inline-flex; align-items: center; gap: 0.5rem;
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, #fff), 0 0 18px var(--glow), 0 6px 20px -6px var(--glow);
	animation: halo 3.6s ease-in-out infinite;
}
.play:hover { box-shadow: 0 0 0 1px #fff3, 0 0 28px var(--glow), 0 8px 26px -4px var(--glow); }
@keyframes halo { 50% { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 70%, #fff), 0 0 30px var(--glow), 0 6px 26px -6px var(--glow); } }
.actions .play { padding: 0.45rem 1.1rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-big { padding: 0.75rem 1.6rem; font-size: 1.05rem; border-radius: var(--radius-lg); }
.btn-ghost { background: transparent; }

/* Dropdowns of the bar: a real button, a list under it. */
.dropdown { position: relative; }
.dropdown > summary, .theme {
	display: inline-flex; align-items: center; gap: 0.4rem; list-style: none;
	padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius-md);
	background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text);
	font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; user-select: none;
	transition: border-color var(--duration), background var(--duration);
}
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown > summary:hover, .theme:hover { border-color: var(--accent); background: var(--surface); }
.dropdown[open] > summary { border-color: var(--accent); }
.dropdown[open] > summary .icon-small { transform: rotate(180deg); }
.icon-small { transition: transform var(--duration); }
.drop {
	position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 40; min-width: 12rem;
	flex-direction: column; flex-wrap: nowrap !important; gap: 0.1rem !important; padding: 0.35rem !important;
	background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
	box-shadow: 0 18px 50px -10px #000a;
	animation: drop 140ms ease-out;
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.drop li { display: block; }
.drop a, .drop button {
	display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.55rem 0.7rem; border: 0; border-radius: var(--radius-md);
	background: none; color: var(--text); font: inherit; font-size: 0.92rem; text-align: left; cursor: pointer;
}
.drop a:hover, .drop button:hover { background: var(--surface-2); }
.drop a[aria-current] { color: var(--accent); }
.drop a .icon-small:last-child { margin-left: auto; }
.drop form { margin: 0; }
.code { display: inline-block; min-width: 1.9rem; padding: 0.05rem 0.35rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--accent); font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; text-align: center; }
.badge { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: var(--radius-pill); background: var(--accent); color: var(--on-accent); font-size: 0.8rem; font-weight: 800; }
.user .who { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }

.theme { padding: 0.45rem 0.6rem; }
.theme > span { display: none; }
:root:not([data-mode]) .theme-system, :root[data-mode="system"] .theme-system, :root[data-mode="light"] .theme-light, :root[data-mode="dark"] .theme-dark { display: inline-flex; }
.theme[hidden] { display: none; }

/* Menu of narrow screens */
.menu { margin-left: auto; }
.menu summary { display: inline-flex; align-items: center; gap: 0.5rem; list-style: none; padding: 0.45rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; font-weight: 600; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--accent); }
.panel {
	position: absolute; top: 100%; left: 0; right: 0; max-height: calc(100vh - var(--header)); overflow-y: auto;
	display: grid; gap: var(--space-4); padding: var(--space-4);
	background: var(--surface); border-bottom: 1px solid var(--border);
	box-shadow: 0 30px 60px -20px #000c;
}
.panel nav ul { flex-direction: column; gap: 0.15rem; }
.panel nav a { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.6rem; border-radius: var(--radius-md); color: var(--text); text-decoration: none; font-weight: 600; }
.panel nav a[aria-current] { background: var(--surface-2); color: var(--accent); }
.panel-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.panel .play { justify-content: center; padding: 0.8rem; }
.panel .plain { background: none; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text); padding: 0.45rem 0.8rem; font: inherit; cursor: pointer; }
.panel form { margin: 0; }

/* Language choice as a row: the panel and the footer. */
.languages { display: flex; gap: 0.5rem; }
.languages a { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.7rem 0.35rem 0.4rem; border: 1px solid var(--line); border-radius: var(--radius-md); color: var(--text); text-decoration: none; font-size: 0.9rem; }
.languages a[aria-current] { border-color: var(--accent); }
.languages a:hover { background: var(--surface-2); }

/* The picture of the theme in use: dark unless the system or the visitor says light. */
.on-light { display: none !important; }
:root[data-theme="light"] .on-light { display: block !important; }
:root[data-theme="light"] .on-dark { display: none !important; }

/* Hero */
.hero { display: grid; gap: var(--space-6); align-items: center; padding: var(--space-6) 0 var(--space-7); }
.hero-copy { position: relative; }
.hero .mark { width: 7rem; height: 7rem; filter: drop-shadow(0 0 28px var(--glow)); animation: float 9s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.hero h1 { margin: var(--space-4) 0 0; font-size: clamp(2.2rem, 1.2rem + 4vw, 3.8rem); line-height: 1.05; }
.hero .subtitle { margin: var(--space-2) 0 0; color: var(--accent); font-family: var(--font-mono); font-size: var(--text-lg); letter-spacing: 0.04em; text-shadow: 0 0 22px var(--glow); }
.hero .pitch { max-width: 34rem; margin: var(--space-4) 0; font-size: 1.15rem; color: var(--text); }
.buttons { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-5) 0 0; }
.facts { display: grid; gap: 0.5rem !important; margin: var(--space-5) 0 0 !important; }
.facts li { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--muted); }
.facts .icon { color: var(--ok); margin-top: 0.3rem; }

.hero-live { display: grid; gap: var(--space-4); grid-template-columns: 1fr 1fr; }
.hero-live .large { grid-column: 1 / -1; }

/* A scene is a small screen with a bezel and a caption. */
.live { margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.live .screen {
	position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg);
	background: #05070d; box-shadow: 0 0 0 1px #fff1 inset, 0 24px 50px -24px #000, 0 0 40px -12px rgba(120, 90, 255, 0.35);
}
.live .screen { aspect-ratio: 6 / 5; container-type: inline-size; }
.live iframe { position: absolute; top: 0; left: 0; width: 720px; height: 600px; border: 0; background: #05070d; transform-origin: 0 0; transform: scale(calc(100cqw / 720px)); }
.live .screen::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5rem; background: linear-gradient(transparent, #05070d); pointer-events: none; }
@supports not (transform: scale(calc(10px / 1px))) {
	.live iframe { position: static; width: 100%; height: 100%; transform: none; }
}
.live figcaption { display: grid; gap: 0.1rem; font-size: 0.85rem; color: var(--muted); }
.live figcaption strong { color: var(--text); font-family: var(--font-mono); font-size: 0.95rem; }

/* Illustrated sections */
.section-title { margin: 0 0 var(--space-5); text-align: center; font-size: var(--text-2xl); }
.features { padding: var(--space-6) 0; }
.feature { display: grid; gap: var(--space-5); align-items: center; padding: var(--space-5); margin-bottom: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 80%, transparent), color-mix(in srgb, var(--surface-2) 40%, transparent)); transition: border-color var(--duration), transform var(--duration); }
.feature:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); transform: translateY(-2px); }
.feature img { width: 100%; max-width: 26rem; height: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); justify-self: center; }
.feature h3 { margin: 0 0 var(--space-2); font-size: var(--text-xl); }
.feature p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.cta { margin: var(--space-7) 0 0; padding: var(--space-7) var(--space-5); text-align: center; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border)); border-radius: var(--radius-lg); background: radial-gradient(40rem 14rem at 50% 0%, rgba(255, 176, 0, 0.14), transparent 70%), var(--surface); }
.cta h2 { margin-top: 0; }
.cta .buttons { justify-content: center; }

/* Page heads, lists, chips and cards */
.page-head { padding: var(--space-6) 0 var(--space-4); }
.page-head h1 { margin: 0; font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); }
.lead { max-width: 44rem; margin: var(--space-3) 0 0; color: var(--muted); font-size: 1.15rem; }
.note { margin-top: var(--space-6); color: var(--muted); font-size: var(--text-sm); text-align: center; }

.chips { margin: 0 0 var(--space-5) !important; }
.chips a { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--text); font-size: 0.9rem; text-decoration: none; transition: border-color var(--duration), background var(--duration); }
.chips a:hover { border-color: var(--accent); }
.chips a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.chips .count { font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.7; }

.entries { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); padding: 0; list-style: none; }
.entry { position: relative; display: flex; flex-direction: column; gap: 0.35rem; padding: var(--space-5); border: 1px solid var(--line); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--surface) 82%, transparent); transition: border-color var(--duration), transform var(--duration); }
.entry:hover { border-color: var(--accent); transform: translateY(-2px); }
.entry h2 { margin: 0; font-size: 1.2rem; }
.entry h2 a { color: var(--text); text-decoration: none; }
.entry h2 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg); }
.entry .desc { margin: 0.25rem 0 0.5rem; color: var(--muted); }
.entry .tags { position: relative; z-index: 1; margin-top: auto !important; }
.meta { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.03em; }
.tags a { display: inline-block; padding: 0.1rem 0.6rem; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--muted); font-size: 0.78rem; text-decoration: none; }
.tags a:hover { border-color: var(--accent); color: var(--text); }
.tags a[data-tag="release"] { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: var(--space-5); }

/* Showcase grid */
.scene-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }

/* Articles: text, code and callouts in the same identity as the rest. */
.doc { max-width: 52rem; margin: 0 auto; }
.doc-head { padding: var(--space-6) 0 var(--space-4); border-bottom: 1px solid var(--line); margin-bottom: var(--space-4); }
.doc-head h1 { margin: var(--space-3) 0; font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.7rem); }
.back { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--accent); font-size: 0.9rem; text-decoration: none; font-weight: 600; }
.back:hover { text-decoration: underline; }
.prose { font-size: 1.05rem; }
.prose h2 { margin-top: var(--space-7); padding-top: var(--space-3); border-top: 1px solid var(--line); font-size: var(--text-2xl); }
.prose h2:first-child { border-top: 0; margin-top: var(--space-4); }
.prose h3 { margin-top: var(--space-6); }
.prose a { color: var(--link); }
.prose blockquote { margin: var(--space-5) 0; padding: var(--space-3) var(--space-5); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-6) 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }
.prose li::marker { color: var(--accent); }
.prose pre { position: relative; margin: var(--space-5) 0; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: 0 10px 30px -18px #000; padding-top: 2.4rem; }
.prose pre::before { content: ""; position: absolute; left: 0.9rem; top: 0.8rem; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #ff8a80; box-shadow: 1rem 0 #ffb000, 2rem 0 #5cf08a; }
.prose table { display: block; overflow-x: auto; }
.prose img { border-radius: var(--radius-md); }
.home-body .prose h2:first-child { border-top: 0; }

/* A scene card inside a page of Markdown */
.prose .scene { margin: var(--space-5) 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: #05070d; }
.prose .scene iframe { display: block; width: 100%; height: 36rem; border: 0; }

/* Footer */
footer { max-width: var(--wide); margin: 0 auto; padding: var(--space-6) var(--space-4); border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-sm); }
.foot { display: grid; gap: var(--space-6); margin-bottom: var(--space-5); }
.foot-brand img { width: 3rem; height: 3rem; }
.foot-brand .name { margin: var(--space-2) 0 0; color: var(--text); font-family: var(--font-mono); font-weight: 700; }
.foot-brand p { margin: 0.2rem 0; }
.foot-brand .languages { margin-top: var(--space-3); }
.columns { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.columns h2 { margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--text); text-transform: uppercase; letter-spacing: 0.08em; }
.columns ul { flex-direction: column; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); text-decoration: underline; }
footer .small { margin: 0.2rem 0; }

.frame { display: grid; place-items: center; min-height: 100vh; font-family: var(--font-mono); }

@media (min-width: 560px) { .hero-live { gap: var(--space-5); } }

@media (min-width: 900px) {
	.main-nav { display: block; }
	.actions { display: flex; }
	.menu { display: none; }
	.hero { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--space-7); }
	.feature { grid-template-columns: 1fr 1fr; padding: var(--space-6); }
	.feature.flip img { order: 2; }
	.foot { grid-template-columns: 18rem 1fr; }
}

@media (min-width: 1280px) {
	.brand .wide { display: block; }
	.brand .narrow { display: none; }
}

@media (max-width: 899px) {
	.hero { padding-top: var(--space-4); }
}

@media (max-width: 480px) {
	.hero-live { grid-template-columns: 1fr; }
	.buttons .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.hero .mark, .play, body::after { animation: none !important; }
	html { scroll-behavior: auto; }
}
footer .icon { display: none; }

/* A software update of the game: the same strip as in the game, in the site's own file. */
.site-notice { padding: 0.4rem 1rem; text-align: center; font-size: 0.9rem; color: #fff; background: #b45309; }
.site-notice[data-paused] { background: #b91c1c; }
