/* ==========================================================================
   BPS Hub — the vault's front door.
   Tokens, header, rail, LEDs, panels and plate are the explorer's own
   (bps-explorer-v2/public/style.css); keep them in step when that changes.
   Sections take the zone gems — sapphire · aquamarine · amethyst · spessartine — as identity,
   one each. Emerald / citrine / ruby are status only, and always ship with a label.
   ========================================================================== */

:root {
	color-scheme: dark;

	--void: #05060a;
	--floor: #080a0f;
	--rack: #0e1117;
	--rack-2: #131722;
	--bezel: #1a1f2b;
	--hair: rgba(196, 210, 232, 0.08);
	--hair-2: rgba(196, 210, 232, 0.14);
	--hair-3: rgba(196, 210, 232, 0.24);

	--ink: #ecf0f6;
	--ink-2: #b3bccb;
	--ink-3: #8c97a8;
	--platinum: #dce3ec;
	--diamond: #f3f7fc;

	--fire: linear-gradient(90deg, #ff4d4d, #ff9b2f, #ffe24a, #4fdc8a, #3fa2ff, #8a63ff);

	--sapphire: #5087ee;
	--aquamarine: #2aa79c;
	--amethyst: #b070dc;
	--spessartine: #c9773a;

	--emerald: #2db47e;
	--citrine: #d8a328;
	--ruby: #eb4a6e;

	--link: #93b6f4;

	--display: "Iowan Old Style", "Palatino Linotype", Palatino, "URW Palladio L", P052, "Book Antiqua", Georgia, serif;
	--sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

	--r-lg: 14px;
	--r: 10px;
	--r-sm: 6px;
	--gutter: clamp(16px, 3vw, 32px);
	--maxw: 1380px;
}

.gem-sapphire { --gem: var(--sapphire); --gem-glow: rgba(80, 135, 238, 0.16); }
.gem-aquamarine { --gem: var(--aquamarine); --gem-glow: rgba(42, 167, 156, 0.16); }
.gem-amethyst { --gem: var(--amethyst); --gem-glow: rgba(176, 112, 220, 0.16); }
.gem-spessartine { --gem: var(--spessartine); --gem-glow: rgba(201, 119, 58, 0.16); }

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 108px; }

body {
	margin: 0;
	min-height: 100vh;
	background: var(--void);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* The floor: the explorer's diamond lattice seen down [110], under two soft pools of light. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background:
		radial-gradient(1100px 560px at 78% -8%, rgba(80, 135, 238, 0.11), transparent 62%),
		radial-gradient(800px 480px at -6% 4%, rgba(176, 112, 220, 0.06), transparent 60%),
		url("/lattice.svg") center top / 70px 99px repeat,
		var(--void);
	-webkit-mask-image: linear-gradient(180deg, #000 0%, #000 45%, rgba(0, 0, 0, 0.55) 100%);
	mask-image: linear-gradient(180deg, #000 0%, #000 45%, rgba(0, 0, 0, 0.55) 100%);
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--diamond); }
a:focus-visible {
	outline: 2px solid var(--sapphire);
	outline-offset: 2px;
	border-radius: 4px;
}

h1, h2, h3 { font-weight: 600; margin: 0; }
p { margin: 0 0 10px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--diamond); color: #0a0d13; padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }

/* ---------- facility header ---------- */

.facility {
	position: sticky;
	top: 0;
	z-index: 50;
	background: rgba(5, 6, 10, 0.84);
	-webkit-backdrop-filter: blur(16px) saturate(140%);
	backdrop-filter: blur(16px) saturate(140%);
	border-bottom: 1px solid var(--hair);
}
.facility::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 1px;
	background: var(--fire);
	opacity: 0.28;
}

.facility-bar {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 10px var(--gutter);
	display: flex;
	align-items: center;
	gap: 20px;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: none; }
.brand:hover { color: var(--ink); }
.brand img { width: 34px; height: 34px; display: block; filter: drop-shadow(0 2px 10px rgba(241, 140, 33, 0.3)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--display); font-size: 1.22rem; font-weight: 600; letter-spacing: 0.005em; }
.brand-sub { font-size: 0.6rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); margin-top: 3px; }

.halls { display: flex; gap: 2px; margin-left: auto; }
.hall {
	display: inline-flex;
	align-items: baseline;
	gap: 7px;
	padding: 8px 11px;
	color: var(--ink-2);
	font-size: 0.86rem;
	font-weight: 550;
	border-radius: 8px;
	white-space: nowrap;
}
.hall-code { font-family: var(--mono); font-size: 0.64rem; color: var(--ink-3); letter-spacing: 0.02em; }
.hall:hover { color: var(--ink); background: rgba(255, 255, 255, 0.04); }

.rail-wrap { border-top: 1px solid var(--hair); }
.rail {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 0 var(--gutter);
	height: 32px;
	display: flex;
	align-items: center;
	gap: 22px;
	font-size: 0.74rem;
	white-space: nowrap;
	overflow-x: auto;
	scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { display: inline-flex; align-items: center; gap: 7px; }
.rail-item[hidden] { display: none; }
.rail-k { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.6rem; font-weight: 600; color: var(--ink-3); }
.rail-v { color: var(--ink-2); font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rail-clock { margin-left: auto; }
/* The treasury journal's latest holdings, from the hub (not the pulse): a link, so it says so on hover. */
.rail-treasury { color: inherit; border-radius: 4px; }
.rail-treasury .rail-v { color: var(--ink); }
.rail-asof { font-family: var(--mono); font-size: 0.66rem; color: var(--ink-3); }
.rail-treasury:hover .rail-k, .rail-treasury:hover .rail-v { color: var(--diamond); }
.rail-v.flash { animation: ink-flash 1.6s ease-out; }

/* ---------- LEDs ---------- */

.led {
	--led: #566174;
	display: inline-block;
	flex: none;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.75), transparent 45%), var(--led);
	box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}
.led[data-state="ok"] { --led: var(--emerald); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 9px rgba(45, 180, 126, 0.7); }
.led[data-state="warn"] { --led: var(--citrine); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 9px rgba(216, 163, 40, 0.7); }
.led[data-state="fault"] { --led: var(--ruby); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45), 0 0 9px rgba(235, 74, 110, 0.75); }
.led.is-live[data-state="ok"] { animation: led-breathe 2.6s ease-in-out infinite; }

/* ---------- layout ---------- */

main {
	max-width: var(--maxw);
	margin: 0 auto;
	padding: 26px var(--gutter) 72px;
}

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px 40px;
	margin: 18px 0 22px;
	flex-wrap: wrap;
}
.eyebrow {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 10px;
	font-size: 0.66rem;
	font-weight: 650;
	text-transform: uppercase;
	letter-spacing: 0.16em;
	color: var(--ink-3);
}
.eyebrow .code {
	font-family: var(--mono);
	font-weight: 600;
	letter-spacing: 0.04em;
	color: var(--ink-2);
	padding: 2px 6px;
	border: 1px solid var(--hair-2);
	border-radius: 4px;
}
.display {
	font-family: var(--display);
	font-weight: 500;
	font-size: clamp(2rem, 1.3rem + 2vw, 2.9rem);
	line-height: 1.04;
	letter-spacing: -0.012em;
	color: var(--diamond);
}
.lede { max-width: 460px; margin: 0; color: var(--ink-2); font-size: 0.9rem; }

.legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 22px;
	margin: 0 0 22px;
	padding: 0;
	list-style: none;
	font-size: 0.74rem;
	color: var(--ink-3);
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend .led + .led { margin-left: 6px; }
.legend .stage { margin-right: 0; }

/* ---------- panels ---------- */

.panel {
	position: relative;
	min-width: 0;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0) 140px), var(--rack);
	border: 1px solid var(--hair);
	border-radius: var(--r-lg);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 24px 48px -30px rgba(0, 0, 0, 0.9);
}
.panel + .panel { margin-top: 16px; }

.panel-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 12px;
	min-height: 46px;
	padding: 10px 16px;
	border-bottom: 1px solid var(--hair);
}
.panel-code {
	font: 600 0.62rem var(--mono);
	color: var(--ink-3);
	border: 1px solid var(--hair-2);
	border-radius: 4px;
	padding: 1px 5px;
}
.panel-title {
	font-size: 0.72rem;
	font-weight: 650;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-2);
}
.panel-note { font-size: 0.76rem; color: var(--ink-3); }
.panel-meta {
	margin-left: auto;
	font: 500 0.72rem var(--mono);
	color: var(--ink-3);
	white-space: nowrap;
}

/* A section's zone gem: the code chip takes it, and a hairline of it runs under the head. */
.hall-panel .panel-code { color: var(--gem); border-color: color-mix(in srgb, var(--gem) 45%, transparent); }
.hall-panel .panel-head { position: relative; }
.hall-panel .panel-head::after {
	content: "";
	position: absolute;
	left: 16px;
	bottom: -1px;
	width: 64px;
	height: 1px;
	background: var(--gem);
	opacity: 0.7;
}

/* ---------- bays: one per project ---------- */

.bays {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 12px;
	padding: 14px;
}

.bay {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 172px;
	padding: 14px 22px 14px 18px;
	overflow: hidden;
	border-radius: var(--r);
	color: var(--ink-2);
	background:
		radial-gradient(260px 120px at 0% 0%, var(--gem-glow), transparent 70%),
		linear-gradient(180deg, #1b202c 0%, #151923 55%, #12151e 100%);
	border: 1px solid rgba(255, 255, 255, 0.06);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -1px 0 rgba(0, 0, 0, 0.55), 0 14px 28px -22px rgba(0, 0, 0, 0.9);
	transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
/* The bezel's edge in the section's gem. */
.bay::before {
	content: "";
	position: absolute;
	left: 0;
	top: 12px;
	bottom: 12px;
	width: 3px;
	border-radius: 0 2px 2px 0;
	background: var(--gem);
	opacity: 0.85;
	box-shadow: 0 0 12px var(--gem);
}
.bay:hover {
	color: var(--ink);
	border-color: rgba(255, 255, 255, 0.16);
	transform: translateY(-2px);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -1px 0 rgba(0, 0, 0, 0.55), 0 20px 34px -22px rgba(0, 0, 0, 0.95), 0 0 0 1px color-mix(in srgb, var(--gem) 30%, transparent);
}
.bay:focus-visible { outline-offset: 3px; border-radius: var(--r); }

.bay-top { display: flex; align-items: center; gap: 10px; }
.bay-code { font: 600 0.62rem var(--mono); color: var(--ink-3); letter-spacing: 0.02em; }
.bay-probe { display: inline-flex; align-items: center; gap: 7px; font: 500 0.64rem var(--mono); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bay-probe .led { width: 6px; height: 6px; }
.bay .stage { margin-left: auto; }

.bay-name {
	margin-top: 4px;
	font-family: var(--display);
	font-size: 1.32rem;
	font-weight: 600;
	line-height: 1.15;
	color: var(--diamond);
	letter-spacing: 0.002em;
}
.bay-what { font-size: 0.82rem; line-height: 1.5; color: var(--ink-2); }
.bay-foot {
	margin-top: auto;
	padding-top: 10px;
	display: flex;
	align-items: center;
	gap: 10px;
	border-top: 1px solid var(--hair);
}
.bay-host { font: 0.68rem var(--mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bay-go {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 2px;
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--link);
	white-space: nowrap;
}
.bay-go svg { width: 14px; height: 14px; transition: transform 0.15s; }
.bay:hover .bay-go { color: var(--diamond); }
.bay:hover .bay-go svg { transform: translateX(2px); }
.bay-grille {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 5px;
	background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0 2px, rgba(255, 255, 255, 0.05) 2px 4px);
	opacity: 0.8;
}

/* Not answering at its public address: still reachable as a link, visibly quieter. */
.bay[data-up="0"] .bay-name { color: var(--ink-2); }
.bay[data-up="0"]::before { opacity: 0.35; box-shadow: none; }

/* Members: the subscription gets the dispersion hairline along its foot, decoration only. */
.bay[data-stage="members"] .bay-foot { border-top-color: transparent; position: relative; }
.bay[data-stage="members"] .bay-foot::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: -1px;
	height: 1px;
	background: var(--fire);
	opacity: 0.45;
}
.bay[data-stage="members"] .bay-go {
	padding: 4px 10px 4px 12px;
	border-radius: 999px;
	color: #0a0d13;
	background: var(--platinum);
}
.bay[data-stage="members"]:hover .bay-go { color: #0a0d13; background: var(--diamond); }

/* ---------- downloads (dl.js) ---------- */

/* A card with a download row is a box: its cover link stretches over it, the row sits above. */
.bay-cover { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.bay-cover:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.dl { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dl-card { margin-top: auto; padding-top: 2px; }
.dl-card + .bay-foot { margin-top: 0; }
.dl-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 13px 6px 10px;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 650;
	color: var(--diamond);
	text-decoration: none;
	background: color-mix(in srgb, var(--gem, var(--sapphire)) 20%, #10131b);
	border: 1px solid color-mix(in srgb, var(--gem, var(--sapphire)) 55%, transparent);
	transition: background 0.15s, border-color 0.15s;
}
.dl-btn:hover { background: color-mix(in srgb, var(--gem, var(--sapphire)) 34%, #10131b); border-color: var(--gem, var(--sapphire)); color: #fff; }
.dl-btn[hidden] { display: none; }
.dl-btn .dl-label { white-space: nowrap; }
.dl-btn[hidden] + .dl-meta { display: none; }
.dl-btn svg { width: 14px; height: 14px; flex: none; }
.dl-meta { font: 500 0.64rem var(--mono); color: var(--ink-2); }
.dl-meta:empty { display: none; }
.dl-all { font-size: 0.72rem; color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--hair-3); text-underline-offset: 3px; }
.dl-all:hover { color: var(--diamond); }

/* ---------- stage tags ---------- */

.stage {
	display: inline-flex;
	align-items: center;
	font: 650 0.58rem var(--sans);
	text-transform: uppercase;
	letter-spacing: 0.1em;
	padding: 2px 7px;
	border-radius: 4px;
	color: var(--ink-2);
	border: 1px solid var(--hair-2);
	white-space: nowrap;
}
.stage[data-stage="live"] { color: var(--ink); border-color: rgba(45, 180, 126, 0.5); background: rgba(45, 180, 126, 0.12); }
.stage[data-stage="members"] { color: var(--diamond); border-color: var(--hair-3); background: rgba(220, 227, 236, 0.08); }

/* ---------- plate ---------- */

.plate { border-top: 1px solid var(--hair); background: rgba(5, 6, 10, 0.7); }
.plate-inner { max-width: var(--maxw); margin: 0 auto; padding: 18px var(--gutter) 26px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; font-size: 0.74rem; color: var(--ink-3); }
.plate-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-family: var(--display); font-size: 0.9rem; }
.plate-link { color: var(--ink-2); }
.plate-link:hover { color: var(--diamond); }
.hall[aria-current="page"] { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.plate-spec { margin-left: auto; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.02em; }

/* ---------- motion ---------- */

@keyframes led-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes ink-flash { 0% { color: #ffffff; text-shadow: 0 0 18px rgba(200, 220, 255, 0.9); } 100% { text-shadow: 0 0 0 transparent; } }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
	.bay:hover { transform: none; }
}

/* ---------- narrow ---------- */

@media (max-width: 900px) {
	/* Only the journal link stays: the halls are on the page itself, the journal is not. */
	.halls .hall:not(.hall-reports) { display: none; }
	.panel-note { flex-basis: 100%; order: 5; }
}

@media (max-width: 680px) {
	html { scroll-padding-top: 96px; }
	.page-head { margin-top: 6px; }
	.display br { display: none; }
	.bays { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
	.bay { min-height: 0; }
	.plate-spec { margin-left: 0; }
}

@media (forced-colors: active) {
	.bay { border: 1px solid CanvasText; }
	.led { forced-color-adjust: none; }
}

/* "All systems" (dl.js): the project's own files, one per system. Cards clip what overflows them, so
   the list opens in place, under the row. */
.dl-more { font-size: 0.72rem; }
.dl-more > summary { cursor: pointer; list-style: none; color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--hair-3); text-underline-offset: 3px; }
.dl-more > summary::-webkit-details-marker { display: none; }
.dl-more > summary::after { content: " ▾"; text-decoration: none; display: inline-block; margin-left: 2px; }
.dl-more[open] > summary::after { content: " ▴"; }
.dl-more > summary:hover, .dl-more[open] > summary { color: var(--diamond); }
.dl-more[open] { flex-basis: 100%; }
.dl-list { list-style: none; margin: 8px 0 2px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; }
.dl-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 9px; border-radius: 6px; color: var(--ink-2); text-decoration: none; border: 1px solid var(--hair); background: rgba(255, 255, 255, 0.02); }
.dl-list a:hover { color: #fff; border-color: color-mix(in srgb, var(--gem, var(--sapphire)) 55%, transparent); background: color-mix(in srgb, var(--gem, var(--sapphire)) 14%, transparent); }
.dl-list a.is-you { border-color: color-mix(in srgb, var(--gem, var(--sapphire)) 45%, transparent); }
.dl-size { font: 500 0.62rem var(--mono); color: var(--ink-3); white-space: nowrap; }
