@font-face { font-family: Sharp; src: url(/v2-sharp.woff) format('woff'); font-display: swap; }
/* Frutiger Aero details on the cnrd.computer scheme: black, white ink, long-blur pure-blue glows, dark-to-blue gradients. */
:root {
  color-scheme: dark;
  --surface: #000000;
  --blue: #0000ff;
  --glow: 0 0 0.5em rgb(255 255 255 / 0.0888), 0 0 100em rgb(0 0 255 / 0.07);
  --glass: rgb(40 40 80 / 0.10);
  --glass-strong: rgb(120 120 170 / 0.10);
  --glass-edge: rgb(255 255 255 / 0.16);
  --gloss: linear-gradient(180deg, rgb(255 255 255 / 0.22) 0%, rgb(255 255 255 / 0.06) 48%, rgb(255 255 255 / 0) 52%, rgb(255 255 255 / 0.04) 100%);
  --aqua: #5c6bff;
  --aqua-deep: #0000ff;
  --line: rgb(180 180 210 / 0.14);
  --ink: #ffffff;
  --ink-2: #d2d3dc;
  --ink-3: #91939f;
  --series-1: #ff0000;
  --series-2: #00ff00;
  --series-3: #0000ff;
  --series-4: #00ffff;
  --series-5: #ff00ff;
  --series-6: #ffff00;
  --series-7: #000000;
  --other: #6d6f7c;
  --radius: 12px;
  --shadow: 0 0 0.1em rgb(255 255 255 / 0.75), 0 0 2em rgb(0 0 255 / 0.07), 0 0 100em rgb(0 0 255 / 0.06), inset 0 1px 0 rgb(255 255 255 / 0.12);
  font: 12px/1.4 "Segoe UI", Frutiger, "Frutiger Linotype", "Myriad Pro", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; color: var(--ink); background: var(--surface); }
body {
  display: grid; grid-template-columns: 1fr 360px; height: 100vh; overflow: hidden;
  background:
    radial-gradient(1400px 900px at 20% 120%, rgb(0 0 255 / 0.22), transparent 65%),
    radial-gradient(1800px 650px at 50% -18%, rgb(0 0 255 / 0.26), transparent 70%),
    linear-gradient(180deg, #000 0%, #000 50%, #020206 100%);
  background-attachment: fixed;
}
a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--blue); }
a:hover { color: #fff; border-bottom-color: var(--aqua); }
#brand a, #artwork a, #results a, #detail a:has(img) { border-bottom: 0; }
#panel a, #panel a:visited, #panel a:hover { color: inherit; text-decoration: none; border-bottom: 0; }

button, select, input {
  font: inherit; color: var(--ink); border: 1px solid var(--glass-edge); border-radius: 999px;
  background: var(--gloss), var(--glass-strong);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 1px 2px rgb(0 0 0 / 0.35);
  transition: background-color 120ms, border-color 120ms, box-shadow 120ms;
}
/* One control style for every button, dropdown and input (matches Fit / Reset). */
button, select, input { padding: 4px 12px; line-height: 1.4; min-height: 26px; }
button { cursor: pointer; }
button:hover, select:hover, input:hover, input:focus { border-color: rgb(255 255 255 / 0.5); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 0 1em rgb(0 0 255 / 0.28), 0 1px 2px rgb(0 0 0 / 0.5); }
button:active { background: var(--glass); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.4); }
/* Selected toggle: same pill, only a brighter rim and soft inner light. */
button[aria-pressed="true"] { border-color: rgb(255 255 255 / 0.7); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 0 10px rgb(255 255 255 / 0.10), 0 1px 2px rgb(0 0 0 / 0.35); }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, li:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 28px; max-width: 170px;
  /* Chevron drawn with gradients (CSP allows no image URLs), inset from the rounded edge. */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%), var(--gloss);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%, 0 0;
  background-size: 5px 5px, 5px 5px, 100% 100%; background-repeat: no-repeat; background-color: rgb(120 120 170 / 0.10);
}
select option { background: #000018; color: var(--ink); }
::selection { color: white; background: rgb(0 0 255 / 0.99); }
* { scrollbar-width: thin; scrollbar-color: rgb(80 80 255 / 0.4) transparent; }


#stage { position: relative; min-width: 0; min-height: 0; }
#space { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#space.dragging { cursor: grabbing; }

#left {
  position: absolute; top: 10px; left: 10px; width: 260px; max-height: calc(100% - 20px); overflow: auto;
  display: flex; flex-direction: column; gap: 10px; padding: 2px;
}
#brand { margin: 0; font: normal 44px/1 Sharp, monospace; letter-spacing: 0; }
#brand a {
  display: inline-block; text-decoration: none; opacity: 1; color: #fff;
  background: linear-gradient(180deg, #ffffff 0%, #e9ebf5 44%, #9a9db4 50%, #c9cbe0 78%, #ffffff 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgb(255 255 255 / 0.25)) drop-shadow(0 0 10px rgb(80 80 255 / 0.25));
  transition: opacity 160ms;
}
#brand a:hover, #brand a:focus-visible { opacity: 1; }
#controls, #actions {
  display: flex; flex-direction: column; gap: 7px; padding: 10px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(0 0 0 / 0) 35%, rgb(0 0 255 / 0.04)), rgb(0 0 0 / 0.55);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow);
}
#actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
#actions button.done { border-color: rgb(255 255 255 / 0.7); }
/* Axes / Clusters flip switch: the shared glass pill as the track, the active side as a lit knob. */
#controls .row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px;
  border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--gloss), var(--glass-strong);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 1px 2px rgb(0 0 0 / 0.35);
}
#controls .row button { min-height: 22px; padding: 2px 10px; }
#controls .row button:not([aria-pressed="true"]) { background: none; border-color: transparent; box-shadow: none; color: var(--ink-3); }
#controls .row button:not([aria-pressed="true"]):hover { color: var(--ink); }
#controls .row button[aria-pressed="true"] {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.30) 0%, rgb(255 255 255 / 0.10) 50%, rgb(255 255 255 / 0.03) 51%, rgb(255 255 255 / 0.08) 100%), rgb(160 160 200 / 0.18);
}
#controls label { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--ink-2); }
body.scatter .galaxy-only, body:not(.scatter) .scatter-only { display: none !important; }

#legend { display: flex; flex-direction: column; gap: 1px; max-height: 38vh; overflow: auto; margin-top: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
#legend .hint { color: var(--ink-3); margin: 0 0 3px; }
#legend button { display: grid; grid-template-columns: 12px 1fr auto; gap: 7px; align-items: center; text-align: left; border: 0; border-radius: 8px; background: none; box-shadow: none; padding: 2px 6px; color: var(--ink-2); }
#legend button:hover, #legend button.hot { color: var(--ink); background: linear-gradient(90deg, rgb(70 70 255 / 0.18), transparent); box-shadow: none; }
#legend button span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#legend button span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.swatch { width: 11px; height: 11px; border-radius: 50%; background: var(--other); }
.swatch.s0 { background-color: var(--series-1); } .swatch.s1 { background-color: var(--series-2); } .swatch.s2 { background-color: var(--series-3); }
.swatch.s3 { background-color: var(--series-4); } .swatch.s4 { background-color: var(--series-5); } .swatch.s5 { background-color: var(--series-6); }
.swatch.s6 { background-color: var(--series-7); box-shadow: 0 0 0 1px rgb(255 255 255 / 0.75); }
.swatch.empty { background: none; box-shadow: inset 0 0 0 1px var(--other); }

#tooltip {
  position: absolute; pointer-events: none; z-index: 5; width: 260px; padding: 7px; color: var(--ink);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.08), rgb(0 0 0 / 0) 35%, rgb(0 0 255 / 0.07)), rgb(4 4 8 / 0.88);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow);
}
#tooltip img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; margin-bottom: 5px; background: #000; border-radius: 8px; }
#tooltip .meta, .meta { color: var(--ink-3); }
#loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--ink-2); margin: 0; padding: 8px 16px; border-radius: 999px;
  background: var(--gloss), rgb(0 0 20 / 0.7); border: 1px solid var(--glass-edge); box-shadow: 0 0 2em rgb(0 0 255 / 0.2); }

#panel {
  min-width: 0; overflow: auto; padding: 12px 14px 24px; display: flex; flex-direction: column; gap: 12px;
  background: linear-gradient(180deg, rgb(0 0 0 / 0.8), rgb(4 4 12 / 0.6) 60%, rgb(0 0 255 / 0.05)), rgb(0 0 0 / 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border-left: 1px solid var(--glass-edge); box-shadow: inset 1px 0 0 rgb(255 255 255 / 0.06), -2em 0 6em rgb(0 0 255 / 0.04);
}
.search span { display: block; color: var(--ink-2); margin-bottom: 4px; }
.search input { width: 100%; cursor: text; }
.search input:focus { outline: none; }
.search input::placeholder { color: var(--ink-3); }
#summary { margin: 0; color: var(--ink-2); }
h2 { font-size: 11px; font-weight: 600; color: var(--ink-3); margin: 0 0 5px; text-transform: uppercase; letter-spacing: 0.08em; }
#results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: auto; }
#results li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 4px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
#results li:hover, #results li.hot { background: linear-gradient(180deg, transparent, rgb(40 40 255 / 0.22)); border-color: var(--line); }
#results img { width: 64px; aspect-ratio: 16 / 9; object-fit: cover; background: #000; border-radius: 6px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.5); }
#results .t { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#results li.more { display: block; padding: 0; cursor: default; border: 0; background: none; }
.more-button { display: block; width: fit-content; margin: 6px auto 0; text-align: center; }

#detail[hidden], #tooltip[hidden], #loading[hidden] { display: none; }
#detail {
  padding: 10px; display: flex; flex-direction: column; gap: 7px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(0 0 0 / 0) 30%, rgb(0 0 255 / 0.08)), rgb(0 0 0 / 0.6);
  border: 1px solid var(--glass-edge); border-radius: var(--radius); box-shadow: var(--shadow);
}
#detail img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; border-radius: 8px; }
#detail .actions { display: flex; flex-wrap: wrap; gap: 5px; }
#detail .nav { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; }
#detail .nav .count { text-align: center; color: var(--ink-2); font-variant-numeric: tabular-nums; }
#detail .nav button:disabled { opacity: 0.4; cursor: default; }
#results li.current { border-color: var(--glass-edge); background: linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(255 255 255 / 0.02)); }
#detail ol { margin: 0; padding-left: 18px; }
#detail ol li { cursor: pointer; color: var(--ink-2); }
#detail ol li:hover { color: var(--ink); }
#detail dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
#detail dt { color: var(--ink-3); }
#detail dd { margin: 0; overflow-wrap: anywhere; }

#facets { display: grid; grid-template-columns: 1fr; gap: 12px; }
.facet button { display: grid; grid-template-columns: minmax(0, 1fr) 90px 44px; gap: 8px; align-items: center; width: 100%; border: 0; border-radius: 8px; background: none; box-shadow: none; padding: 2px 6px; text-align: left; color: var(--ink-2); }
.facet button:hover { color: var(--ink); background: linear-gradient(90deg, rgb(70 70 255 / 0.18), transparent); box-shadow: none; }
.facet button.more-button { display: block; width: fit-content; margin: 6px auto 0; padding: 4px 12px; text-align: center; color: var(--ink);
  border: 1px solid var(--glass-edge); border-radius: 999px; background: var(--gloss), var(--glass-strong);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25), 0 1px 2px rgb(0 0 0 / 0.35); }
.facet button.more-button:hover { border-color: rgb(255 255 255 / 0.5); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), 0 0 1em rgb(0 0 255 / 0.28), 0 1px 2px rgb(0 0 0 / 0.5); background: var(--gloss), var(--glass-strong); }
.facet button span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet .bar { height: 7px; background: rgb(0 0 0 / 0.7); border-radius: 999px; position: relative; box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.5); }
.facet .bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.45) 0%, rgb(255 255 255 / 0.08) 50%, rgb(255 255 255 / 0) 51%), linear-gradient(90deg, #15152a, #3a3ab8);
  box-shadow: 0 0 6px rgb(0 0 255 / 0.3); min-width: 3px; }
.facet button span:last-child { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.note { color: var(--ink-3); margin: 0; }

@media (max-width: 800px) {
  body { grid-template-columns: minmax(0, 1fr); height: auto; overflow: auto; }
  #stage { display: flex; flex-direction: column; }
  #stage { width: 100vw; overflow: hidden; }
  #space { position: relative; height: 62vh; flex: none; width: 100%; min-width: 0; }
  #controls label select { max-width: 55vw; }
  #left { position: static; width: auto; max-height: none; margin: 8px; overflow: visible; }
  #brand { font-size: 36px; }
  #legend { max-height: 30vh; }
  #panel { border-left: 0; border-top: 1px solid var(--glass-edge); overflow: visible; min-width: 0; }
}
@media (prefers-reduced-transparency: reduce), (forced-colors: active) {
  #controls, #actions, #panel, #tooltip { -webkit-backdrop-filter: none; backdrop-filter: none; background: #000; }
}
@media (forced-colors: active) {
  .swatch { forced-color-adjust: none; }
}

/* Artwork card: markup and styling taken from cnrd.computer (#arranging-data-into-lists).
   Fonts: Aston Script Bold (TRF, as used on cnrd.computer) and EB Garamond (SIL OFL). */
@font-face { font-display: swap; font-family: 'cnrd-a'; font-style: normal; font-weight: 400; src: url(/v2-script.ttf) format('truetype'); }
@font-face { font-display: swap; font-family: 'cnrd-g'; font-style: normal; font-weight: 400; src: url(/v2-garamond.woff2) format('woff2'); }
#artwork { --secondary: white; font-family: 'cnrd-g', 'et-book', serif; font-size: 15px; line-height: 1.15; color: var(--secondary);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
#artwork p { margin: 0; }
#artwork h2 { display: table; margin: 0; font-family: 'cnrd-a', Arial, sans-serif; font-weight: 400; font-size: 1.6em; text-transform: none; letter-spacing: 0; color: var(--secondary); }
#artwork a, #artwork a:visited { display: block; color: var(--secondary); text-decoration: none; }
#artwork .up { margin: 0; max-width: 400px; box-shadow: none; border-radius: 1em; overflow: hidden; }
#artwork *:not(img):not(video) { padding: 0.2em; border-radius: 100px; box-shadow: 0 0 0.5em rgba(255, 255, 255, 0.0888), 0 0 100em rgba(0, 0, 255, 0.15); }
#artwork .up { padding: 0; border-radius: 1em; box-shadow: none; }
#artwork .proj { margin: 0; cursor: pointer; }
#artwork ::selection { color: white; background-color: rgba(0, 0, 255, 0.99); }
