@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
	--bg: #06060a;
	--bg-2: #0b0c14;
	--ink: #eef0fb;
	--ink-dim: #9ba0c0;
	--ink-dimmer: #6c7093;
	--accent: #8b7bff;
	--accent-2: #ff5da2;
	--accent-3: #35d0ba;
	--line: rgba(255,255,255,0.09);
	--panel-bg: rgba(10,10,18,0.62);
	--font-display: 'Space Grotesk', system-ui, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-display);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

/* faint carbon-fibre texture over everything */
body::before {
	content: '';
	position: fixed;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	opacity: 0.5;
	background-image:
		repeating-linear-gradient(135deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 6px),
		repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 6px);
}

/* vignette */
body::after {
	content: '';
	position: fixed;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%);
}

#webgl { position: fixed; inset: 0; z-index: 0; }
#webgl canvas { display: block; }
.label2d {
	pointer-events: none;
	font-family: var(--font-mono);
	font-size: 11px;
	letter-spacing: 0.04em;
	color: var(--ink);
	background: rgba(6,6,12,0.55);
	border: 1px solid var(--line);
	border-radius: 3px;
	padding: 2px 6px;
	white-space: nowrap;
	transform: translate(-50%, -160%);
}
.label2d-dim {
	font-size: 9px;
	color: var(--ink-dimmer);
	background: rgba(6,6,12,0.4);
	padding: 1px 5px;
}

/* ---------------- loading ---------------- */
#loading {
	position: fixed; inset: 0; z-index: 100;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	gap: 18px; background: var(--bg);
	transition: opacity 0.6s ease, visibility 0.6s ease;
}
#loading.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-mark { font-family: var(--font-mono); letter-spacing: 0.35em; font-size: 14px; color: var(--ink-dim); }
.loading-bar { width: 220px; height: 2px; background: rgba(255,255,255,0.1); overflow: hidden; }
.loading-bar span { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); animation: loadsweep 1.1s ease-in-out infinite; }
@keyframes loadsweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.loading-label { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dimmer); }

/* ---------------- nav ---------------- */
#nav {
	position: fixed; top: 0; left: 0; right: 0; z-index: 45;
	display: flex; align-items: center; justify-content: space-between;
	padding: 18px 28px;
	background: linear-gradient(to bottom, rgba(6,6,10,0.85), transparent);
	pointer-events: none;
}
#nav > * { pointer-events: auto; }
.nav-brand { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-mono); font-size: 14px; }
.nav-brand-gnu { color: var(--ink-dim); }
.nav-brand-slash { color: var(--accent); }
.nav-brand-hurd { color: var(--ink); font-weight: 500; }
.nav-brand-sub { margin-left: 10px; font-size: 10px; color: var(--ink-dimmer); letter-spacing: 0.08em; text-transform: uppercase; display: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(10px); max-width: 62vw; justify-content: center; }
.nav-link {
	appearance: none; border: none; background: transparent; color: var(--ink-dim);
	font-family: var(--font-display); font-size: 12.5px; padding: 7px 12px; border-radius: 999px;
	cursor: pointer; display: flex; align-items: center; gap: 7px; transition: background 0.25s, color 0.25s;
	white-space: nowrap;
}
.nav-link .nav-index { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dimmer); }
.nav-link:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--bg); background: var(--ink); }
.nav-link.active .nav-index { color: rgba(6,6,10,0.55); }
.nav-source { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dimmer); text-decoration: none; }
.nav-source:hover { color: var(--ink-dim); }

/* ---------------- world panels ---------------- */
.world {
	position: fixed; inset: 0; z-index: 10;
	pointer-events: none;
	opacity: 0; visibility: hidden;
	transition: opacity 0.7s ease;
}
body[data-world="overview"] .world[data-world-panel="overview"],
body[data-world="components"] .world[data-world-panel="components"],
body[data-world="boot"] .world[data-world-panel="boot"],
body[data-world="compare"] .world[data-world-panel="compare"],
body[data-world="shell"] .world[data-world-panel="shell"],
body[data-world="translators"] .world[data-world-panel="translators"],
body[data-world="qemu"] .world[data-world-panel="qemu"] {
	opacity: 1; visibility: visible;
}

.hud { position: absolute; pointer-events: auto; }
.hud-top-left { top: 108px; left: 28px; max-width: 480px; }
.hud-top-right { top: 108px; right: 28px; max-width: 340px; }
.hud-bottom-left { bottom: 28px; left: 28px; }
.hud-bottom { bottom: 28px; left: 50%; transform: translateX(-50%); }

.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.world h1 { font-size: 40px; line-height: 1.08; margin: 0 0 16px; font-weight: 500; letter-spacing: -0.01em; }
.world h1 em { font-style: normal; color: var(--accent); }
.world h1 span#component-count { color: var(--accent); }
.lede { font-size: 15px; line-height: 1.55; color: var(--ink-dim); margin: 0 0 14px; max-width: 44ch; }
.lede code { font-family: var(--font-mono); font-size: 0.92em; color: var(--ink); background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; }
.hint { font-family: var(--font-mono); font-size: 11px; color: var(--ink-dimmer); }

/* legend (overview) */
.legend { display: flex; flex-direction: column; gap: 6px; background: var(--panel-bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; backdrop-filter: blur(10px); }
.legend-item { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-dim); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* category chips (components) */
.category-chips { display: flex; gap: 8px; flex-wrap: wrap; max-width: 90vw; justify-content: center; }
.chip {
	font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.03em; color: var(--ink-dim);
	background: var(--panel-bg); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
	cursor: pointer; display: flex; align-items: center; gap: 8px; backdrop-filter: blur(10px);
	transition: color 0.2s, border-color 0.2s;
}
.chip .legend-dot { width: 7px; height: 7px; }
.chip.active { color: var(--ink); border-color: currentColor; }
.chip:hover { color: var(--ink); }

/* boot scrubber */
.boot-scrubber { display: flex; align-items: center; gap: 12px; width: min(920px, 88vw); background: var(--panel-bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; backdrop-filter: blur(10px); }
.boot-btn {
	appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--ink);
	width: 34px; height: 34px; border-radius: 50%; cursor: pointer; flex: none; font-size: 14px;
	display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.boot-btn:hover { background: rgba(255,255,255,0.1); }
.boot-play { background: var(--accent); color: #08080d; border-color: var(--accent); }
.boot-track { flex: 1; display: flex; gap: 4px; align-items: center; height: 34px; }
.boot-node {
	flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.12); cursor: pointer; position: relative;
	transition: background 0.25s;
}
.boot-node.done { background: rgba(139,123,255,0.45); }
.boot-node.active { background: var(--accent); box-shadow: 0 0 12px var(--accent); }

.boot-step-card { background: var(--panel-bg); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; backdrop-filter: blur(10px); }
.boot-step-index { font-family: var(--font-mono); font-size: 10px; color: var(--ink-dimmer); margin-bottom: 6px; letter-spacing: 0.06em; }
.boot-step-card h2 { font-size: 19px; margin: 0 0 8px; font-weight: 500; }
.boot-step-card p { font-size: 13px; line-height: 1.55; color: var(--ink-dim); margin: 0; }

/* shell terminal */
.shell-terminal {
	width: min(640px, 90vw); display: flex; flex-direction: column; gap: 10px;
	background: var(--panel-bg); border: 1px solid var(--line); border-radius: 14px;
	padding: 14px 16px; backdrop-filter: blur(10px); font-family: var(--font-mono);
}
.term-output { max-height: 170px; overflow-y: auto; font-size: 12px; line-height: 1.6; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.term-line-cmd { color: var(--ink); }
.term-line-cmd .term-prompt-inline { color: #4ce07a; margin-right: 6px; }
.term-line-out { color: var(--ink-dim); white-space: pre-wrap; }
.term-line-err { color: var(--accent-2); }
.term-inputline { display: flex; align-items: center; gap: 8px; }
.term-prompt { color: #4ce07a; font-size: 13px; white-space: nowrap; }
.term-input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; color: var(--ink); font-family: var(--font-mono); font-size: 13px; }
.term-input::placeholder { color: var(--ink-dimmer); }
.term-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* compare */
.compare-btn {
	font-family: var(--font-mono); font-size: 12px; color: var(--ink); background: rgba(255,93,162,0.14);
	border: 1px solid rgba(255,93,162,0.4); border-radius: 8px; padding: 10px 16px; cursor: pointer; margin-top: 4px;
	transition: background 0.2s;
}
.compare-btn:hover { background: rgba(255,93,162,0.24); }
.compare-note { margin-top: 14px; font-size: 13px; line-height: 1.5; color: var(--accent-3); min-height: 1.5em; max-width: 40ch; }
.hud-label { top: 132px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; color: var(--ink-dimmer); }
.hud-label-left { left: 41%; transform: translateX(-50%); }
.hud-label-mid { left: 67%; transform: translateX(-50%); }
.hud-label-right { left: 92%; transform: translateX(-50%); }

/* translators */
.translator-command {
	font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; color: var(--accent-3);
	background: rgba(0,0,0,0.3); border: 1px solid var(--line); border-radius: 8px;
	padding: 10px 12px; margin: 6px 0 10px; white-space: pre-wrap; word-break: break-word;
}
.translator-controls { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(760px, 90vw); }
.translator-actions { display: flex; gap: 10px; }
.translator-btn-detach { background: rgba(255,45,76,0.12); border-color: rgba(255,45,76,0.4); }
.translator-btn-detach:hover { background: rgba(255,45,76,0.22); }
.compare-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.compare-btn:disabled:hover { background: rgba(255,93,162,0.14); }
.translator-btn-detach:disabled:hover { background: rgba(255,45,76,0.12); }

.label2d-terminal { font-family: var(--font-mono); font-size: 12px; color: #4ce07a; background: transparent; border: none; transition: opacity 0.1s; }

/* ---------------- detail card ---------------- */
.detail-card {
	position: fixed; top: 0; right: -420px; width: 380px; height: 100%; z-index: 40;
	background: rgba(8,8,14,0.86); border-left: 1px solid var(--line); backdrop-filter: blur(16px);
	padding: 96px 28px 28px; overflow-y: auto; transition: right 0.5s cubic-bezier(.16,.8,.3,1);
}
.detail-card.open { right: 0; }
.detail-close {
	position: absolute; top: 90px; right: 24px; width: 30px; height: 30px; border-radius: 50%;
	border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--ink); cursor: pointer; font-size: 16px;
	z-index: 1;
}
.detail-category { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.detail-card h3 { font-size: 24px; margin: 0 0 6px; }
.detail-blurb { color: var(--ink-dim); font-size: 13px; margin: 0 0 16px; }
.detail-card p { font-size: 13.5px; line-height: 1.6; color: var(--ink-dim); }
.detail-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-block h4 { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dimmer); margin: 0 0 10px; }
.detail-block ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-dim); line-height: 1.7; }
.detail-mono p { color: var(--accent-2); }
.detail-block-ipc.hidden { display: none; }
.detail-rpc-name { font-family: var(--font-mono); font-size: 15px; color: var(--accent-3); margin-bottom: 4px; }
.detail-rpc-from { font-size: 11.5px; color: var(--ink-dimmer); margin-bottom: 12px; }
.detail-rpc-fields { display: flex; gap: 18px; margin-bottom: 10px; }
.detail-rpc-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-dimmer); display: block; margin-bottom: 4px; }
.detail-rpc-fields ul { margin: 0; padding-left: 15px; font-size: 12px; color: var(--ink-dim); line-height: 1.55; }

/* ---------------- footer ---------------- */
#foot-credit {
	position: fixed; bottom: 10px; right: 16px; z-index: 15; font-family: var(--font-mono); font-size: 10px;
	color: var(--ink-dimmer); pointer-events: auto;
}
#foot-credit a { color: var(--ink-dimmer); }
#foot-credit a:hover { color: var(--ink-dim); }

@media (min-width: 900px) { .nav-brand-sub { display: inline; } }

@media (max-width: 760px) {
	#nav { flex-wrap: wrap; gap: 10px; }
	.nav-links { order: 3; width: 100%; justify-content: space-between; flex-wrap: wrap; row-gap: 6px; }
	.nav-link { padding: 6px 10px; font-size: 12px; }
	.nav-link span.nav-index { display: none; }
	.hud-top-left, .hud-top-right { position: absolute; max-width: calc(100vw - 56px); }
	.hud-top-left { top: 250px; }
	.hud-top-right { top: auto; bottom: 118px; left: 28px; right: 28px; }
	.world h1 { font-size: 28px; }
	.detail-card { width: 100%; right: -100%; }
	.detail-close { top: 190px; }
	#foot-credit { display: none; }
}
