/* ============================================================================
   Marley Arena — leaderboard
   Direction: a test-bench scope readout. Deep indigo field, sodium-amber as the
   live reading, scope-cyan for comparison, coral for cost/failure. The seven-axis
   polar gauge is the signature; everything around it stays quiet.
   ========================================================================== */

/* ---- Fonts (bundled locally; graceful system fallbacks) ------------------- */
@font-face {
	font-family: "Chakra Petch"; font-style: normal; font-weight: 600;
	font-display: swap; src: url("assets/fonts/chakra-petch-600.woff2") format("woff2");
}
@font-face {
	font-family: "Chakra Petch"; font-style: normal; font-weight: 700;
	font-display: swap; src: url("assets/fonts/chakra-petch-700.woff2") format("woff2");
}
@font-face {
	font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400 600;
	font-display: swap; src: url("assets/fonts/hanken-grotesk.woff2") format("woff2");
}
@font-face {
	font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600;
	font-display: swap; src: url("assets/fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
	/* field */
	--bg:        #12122a;
	--bg-deep:   #0d0d1f;
	--panel:     #1a1b38;
	--panel-2:   #212347;
	--line:      #2e2f57;
	--line-soft: #24264a;

	/* ink */
	--ink:       #ecebf6;
	--ink-dim:   #a3a3c9;
	--ink-mute:  #6f6f9b;

	/* instruments */
	--amber:     #ffb627;   /* live reading / leader / brand */
	--cyan:      #57d1e8;   /* comparison / positive data */
	--coral:     #ff5d6c;   /* intervention / cost / failure */
	--amber-dim: #ffb6271a;
	--cyan-dim:  #57d1e81a;

	--font-display: "Chakra Petch", "Segoe UI Semibold", system-ui, sans-serif;
	--font-body:    "Hanken Grotesk", system-ui, -apple-system, sans-serif;
	--font-mono:    "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

	--radius: 10px;
	--maxw: 1180px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background:
		radial-gradient(1100px 700px at 78% -8%, #1c1d44 0%, transparent 60%),
		radial-gradient(900px 600px at 0% 0%, #181a3a 0%, transparent 55%),
		var(--bg);
	color: var(--ink);
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

/* faint moving scanline — the only ambient motion, killed under reduced-motion */
.scanline {
	position: fixed; inset: 0; z-index: 0; pointer-events: none;
	background: repeating-linear-gradient(
		to bottom, transparent 0, transparent 2px, #ffffff05 3px, transparent 4px);
	mix-blend-mode: overlay; opacity: .5;
}

main, .masthead, .colophon { position: relative; z-index: 1; }

/* ---- Type primitives ------------------------------------------------------ */
.eyebrow, .section-label, .masthead-meta dt, th, .chip, .pill, .legend, .tag {
	font-family: var(--font-mono);
	text-transform: uppercase;
	letter-spacing: .14em;
}

.eyebrow {
	display: inline-block;
	font-size: .72rem; color: var(--amber);
	border: 1px solid var(--amber); border-radius: 2px;
	padding: .28em .6em; margin-bottom: .55rem;
}

h1 {
	font-family: var(--font-display);
	font-weight: 700; font-size: clamp(2.6rem, 7vw, 4.6rem);
	line-height: .92; letter-spacing: -.01em; margin: 0;
}

.section-label {
	font-size: .76rem; color: var(--ink-dim);
	margin: 0 0 1.1rem; font-weight: 600;
}
.section-label .muted {
	text-transform: none; letter-spacing: normal;
	font-family: var(--font-body); color: var(--ink-mute); font-weight: 400;
}
.muted { color: var(--ink-mute); }

/* ---- Masthead ------------------------------------------------------------- */
.masthead {
	max-width: var(--maxw); margin: 0 auto; padding: clamp(2rem, 5vw, 3.6rem) 1.5rem 1.6rem;
}
.masthead-row {
	display: flex; justify-content: space-between; align-items: flex-end;
	gap: 2rem; flex-wrap: wrap;
}
.masthead-meta {
	display: grid; grid-template-columns: auto auto; gap: .15rem 1.1rem;
	margin: 0; text-align: right; align-content: end;
}
.masthead-meta dt { font-size: .64rem; color: var(--ink-mute); align-self: center; }
.masthead-meta dd {
	margin: 0; font-family: var(--font-mono); font-size: .82rem; color: var(--ink-dim);
}
.masthead-meta dd b { color: var(--amber); font-weight: 600; }
.dek {
	max-width: 54ch; margin: 1.4rem 0 0; color: var(--ink-dim);
	font-size: 1.02rem;
}

/* ---- Layout sections ------------------------------------------------------ */
main { max-width: var(--maxw); margin: 0 auto; padding: 1rem 1.5rem 4rem; }
section { margin-top: clamp(2.4rem, 5vw, 3.6rem); }

/* ---- Hero: scope + standings --------------------------------------------- */
.hero {
	display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(1.2rem, 3vw, 2.6rem); align-items: stretch;
}
.hero-scope, .standings, .frontier, .table-wrap, .project-card {
	background: linear-gradient(180deg, var(--panel) 0%, var(--bg-deep) 140%);
	border: 1px solid var(--line); border-radius: var(--radius);
}
.hero-scope { padding: 1.4rem 1.4rem 1.1rem; display: flex; flex-direction: column; }
.standings  { padding: 1.4rem; }

.scope {
	position: relative; flex: 1;
	display: flex; align-items: center; justify-content: center;
	min-height: 320px;
	background:
		radial-gradient(circle at 50% 46%, #10112c 0%, #0c0c1e 70%);
	border-radius: 8px; border: 1px solid var(--line-soft);
	overflow: hidden;
}
.scope svg { width: 100%; height: auto; max-width: 420px; display: block; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem;
	margin: 1rem 0 0; padding: 0; font-size: .68rem; }
.legend li { display: flex; align-items: center; gap: .45rem; color: var(--ink-dim); }
.legend .swatch { width: 12px; height: 3px; border-radius: 2px; }
/* Legend draws the real line (colour + dash) so identity is never colour-alone. */
.legend .swatch-line { flex: none; overflow: visible; }

/* standings list */
.standings-list { list-style: none; margin: 0; padding: 0; }
.standings-list li {
	display: grid; grid-template-columns: auto 1fr auto; align-items: center;
	gap: .9rem; padding: .85rem 0; border-bottom: 1px solid var(--line-soft);
}
.standings-list li:last-child { border-bottom: 0; }
.rank {
	font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
	color: var(--ink-mute); width: 1.4em; text-align: center;
}
.standings-list li:first-child .rank { color: var(--amber); }
.std-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem;
	overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.std-sub { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-mute);
	text-transform: uppercase; letter-spacing: .08em; }
.std-score {
	font-family: var(--font-mono); font-weight: 600; font-size: 1.6rem;
	color: var(--cyan); text-align: right;
}
.std-bar {
	grid-column: 1 / -1; height: 3px; background: var(--line); border-radius: 2px;
	overflow: hidden; margin-top: -.3rem;
}
.std-bar > span { display: block; height: 100%; background: var(--amber); }

/* ---- Frontier scatter ----------------------------------------------------- */
.frontier { padding: 1.4rem; }
.frontier-plot { width: 100%; }
.frontier-plot svg { width: 100%; height: auto; display: block; }
.frontier-plot text { font-family: var(--font-mono); fill: var(--ink-mute); }

/* ---- Runs table ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.runs { width: 100%; border-collapse: collapse; min-width: 720px; }
.runs th {
	font-size: .62rem; color: var(--ink-mute); font-weight: 600;
	text-align: right; padding: .85rem .7rem; border-bottom: 1px solid var(--line);
	white-space: nowrap; cursor: pointer; user-select: none;
}
.runs th:first-child, .runs td:first-child { text-align: left; padding-left: 1.2rem; }
.runs th.sortable:hover { color: var(--ink); }
.runs th[aria-sort] { color: var(--amber); }
.runs th .arrow { opacity: .9; }
.runs td {
	font-family: var(--font-mono); font-size: .84rem; text-align: right;
	padding: .7rem; border-bottom: 1px solid var(--line-soft); color: var(--ink-dim);
	white-space: nowrap; vertical-align: middle;
}
.runs tbody tr { cursor: pointer; transition: background .12s ease; }
.runs tbody tr:hover { background: #ffffff06; }
.runs tbody tr:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }
.runs tbody tr:last-child td { border-bottom: 0; }
.cell-model { font-family: var(--font-display); font-weight: 600; font-size: .92rem;
	color: var(--ink); }
.cell-project { color: var(--ink-dim); }
.mini-radar { display: inline-block; vertical-align: middle; }
.composite-val { color: var(--amber); font-weight: 600; }

/* ---- Chips / pills -------------------------------------------------------- */
.chip {
	display: inline-block; font-size: .58rem; padding: .2em .5em;
	border-radius: 3px; border: 1px solid currentColor; line-height: 1;
}
.chip-oneshot { color: var(--cyan); }
.chip-iv      { color: var(--coral); }
.chip-fail    { color: var(--coral); border-style: dashed; }
.chip-abandon { color: var(--ink-mute); }
.chip-ghost   { color: var(--ink-mute); border-color: var(--line); }

/* ---- Project cards -------------------------------------------------------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.project-card { padding: 1.3rem 1.3rem 1.1rem; display: flex; flex-direction: column; }
.project-card h3 {
	font-family: var(--font-display); font-weight: 700; font-size: 1.2rem;
	margin: .2rem 0 .1rem;
}
.project-slug { font-family: var(--font-mono); font-size: .62rem; color: var(--amber);
	text-transform: uppercase; letter-spacing: .12em; }
.project-challenge {
	font-size: .9rem; color: var(--ink-dim); margin: .7rem 0 1rem;
	padding: .7rem .8rem; background: #00000026; border-left: 2px solid var(--cyan);
	border-radius: 0 4px 4px 0;
}
.project-winner { margin-top: auto; font-size: .82rem; color: var(--ink-mute);
	font-family: var(--font-mono); }
.project-winner b { color: var(--ink); font-weight: 600; }
.project-winner .win-score { color: var(--amber); }
.project-link { font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase;
	letter-spacing: .1em; color: var(--cyan); text-decoration: none; margin-top: .6rem;
	display: inline-block; }
.project-link:hover { text-decoration: underline; }
.project-link::after { content: " ↗"; }

/* ---- Drawer --------------------------------------------------------------- */
.drawer-overlay {
	position: fixed; inset: 0; z-index: 40; background: #05060f99;
	backdrop-filter: blur(2px);
}
.drawer {
	position: fixed; top: 0; right: 0; z-index: 50; height: 100dvh;
	width: min(560px, 94vw); background: var(--bg-deep);
	border-left: 1px solid var(--line); box-shadow: -30px 0 60px #00000066;
	transform: translateX(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
	overflow-y: auto; padding: 1.6rem 1.6rem 3rem;
}
.drawer.open { transform: translateX(0); }
.drawer-close {
	position: absolute; top: 1rem; right: 1rem; z-index: 2;
	background: var(--panel); color: var(--ink-dim); border: 1px solid var(--line);
	width: 34px; height: 34px; border-radius: 6px; cursor: pointer; font-size: .9rem;
}
.drawer-close:hover { color: var(--ink); border-color: var(--amber); }

.drawer h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem;
	margin: 0 2.5rem .1rem 0; line-height: 1.1; }
.drawer .d-sub { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-mute);
	text-transform: uppercase; letter-spacing: .1em; }
.drawer .d-section { margin-top: 1.6rem; }
.drawer .d-section > h4 {
	font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase;
	letter-spacing: .14em; color: var(--ink-mute); margin: 0 0 .7rem;
	border-bottom: 1px solid var(--line-soft); padding-bottom: .4rem; font-weight: 600;
}
.d-radar { display: flex; justify-content: center; }
.d-dims { display: grid; gap: .5rem; }
.d-dim { display: grid; grid-template-columns: 8.5rem 1fr 1.6rem; align-items: center;
	gap: .7rem; font-size: .8rem; }
.d-dim .dn { font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase;
	letter-spacing: .06em; color: var(--ink-dim); }
.d-dim .db { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.d-dim .db > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--cyan)); }
.d-dim .dv { font-family: var(--font-mono); color: var(--ink); text-align: right; }
.d-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.d-stat { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 6px;
	padding: .7rem .8rem; }
.d-stat .k { font-family: var(--font-mono); font-size: .58rem; text-transform: uppercase;
	letter-spacing: .1em; color: var(--ink-mute); }
.d-stat .v { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700;
	color: var(--ink); margin-top: .1rem; }
.d-stat .v.good { color: var(--cyan); }
.d-stat .v.bad { color: var(--coral); }
.d-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.d-iv { border-left: 2px solid var(--coral); padding: .1rem 0 .1rem .8rem; font-size: .84rem;
	color: var(--ink-dim); }
.d-iv .iv-head { font-family: var(--font-mono); font-size: .6rem; text-transform: uppercase;
	letter-spacing: .08em; color: var(--coral); margin-bottom: .15rem; }
.d-tools { display: grid; gap: .35rem; }
.d-tool { display: grid; grid-template-columns: 6.5rem 1fr auto; align-items: center;
	gap: .6rem; font-family: var(--font-mono); font-size: .72rem; color: var(--ink-dim); }
.d-tool .tb { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden;
	display: flex; }
.d-tool .tb .ok { background: var(--cyan); height: 100%; }
.d-tool .tb .err { background: var(--coral); height: 100%; }
.d-notes { font-size: .9rem; color: var(--ink-dim); background: var(--panel);
	border: 1px solid var(--line-soft); border-radius: 6px; padding: .8rem .9rem;
	line-height: 1.5; }
.d-rationale { font-size: .78rem; color: var(--ink-mute); margin-top: .2rem;
	grid-column: 1 / -1; font-style: italic; line-height: 1.45; }

/* ---- Colophon ------------------------------------------------------------- */
.colophon { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem;
	font-family: var(--font-mono); font-size: .68rem; color: var(--ink-mute);
	border-top: 1px solid var(--line-soft); letter-spacing: .04em; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
	.hero { grid-template-columns: 1fr; }
	.project-grid { grid-template-columns: 1fr; }
	.masthead-row { align-items: flex-start; }
	.masthead-meta { text-align: left; }
}

/* ---- A11y ----------------------------------------------------------------- */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
	.scanline { display: none; }
	* { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
