/* The latent space on the home page. html.in-space shows the space; without it the page is the
   reader. The space is dark unless the visitor chose the light theme: black with white type,
   set on the root so the dialogs and the chat that open over it follow. */

html.in-space:not([data-theme="light"]) {
  color-scheme: dark;
  --surface-nav: #000000;
  --surface-canvas: #000000;
  --surface-sunken: rgba(255, 255, 255, 0.06);
  --surface-hover: rgba(255, 255, 255, 0.1);
  --surface-active: rgba(255, 255, 255, 0.16);
  --surface-float: #000000;
  --surface-bar: #000000;
  --surface-backdrop: rgba(0, 0, 0, 0.7);
  --surface-inverse: #ffffff;
  --glass-fill: rgba(255, 255, 255, 0.055);
  --glass-fill-hover: rgba(255, 255, 255, 0.09);
  --glass-float: rgba(20, 20, 20, 0.72);
  --glass-lift: 0 18px 50px -24px rgba(0, 0, 0, 0.8);
  --edge-hi: rgba(255, 255, 255, 0.42);
  --edge-mid: rgba(255, 255, 255, 0.14);
  --edge-lo: rgba(255, 255, 255, 0.05);
  --edge-glow: rgba(255, 255, 255, 0.95);
  --text-primary: #ffffff;
  --text-secondary: #c4c4c4;
  --text-tertiary: #9a9a9a;
  --text-inverse: #000000;
  --text-body: #ffffff;
  --accent: #ffffff;
  --number: #636363;
  --accent-fill: #ffffff;
  --accent-fill-hover: #ffffff;
  --accent-on: #000000;
  --accent-soft: rgba(255, 255, 255, 0.12);
  --focus-ring: #ffffff;
  --danger-fg: #ff8a80;
}

html:not(.in-space) .space {
  display: none;
}
html.in-space,
html.in-space body {
  overflow: hidden;
  height: 100%;
}
html.in-space body {
  padding-bottom: 0;
}
html.in-space .shell,
html.in-space .tabbar,
html.in-space .blobs,
html.in-space .spine,
html.in-space .skip,
html.in-space #filter-clear {
  display: none !important;
}

.space {
  position: fixed;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: var(--surface-canvas);
  color: var(--text-primary);
  font-size: var(--fs-sm);
  --space-glass: var(--surface-float);
  --dot: var(--text-primary);
  /* The controls float on the fluid as glass: a tint, a blur and a lit edge. No border. */
  --glass-tint: rgba(10, 10, 10, 0.42);
  --glass-line: transparent;
  --glass-top: transparent;
  --glass-drop: 0 0 0 0 transparent;
  --glass-blur: blur(22px) saturate(160%);
  --spring: cubic-bezier(0.23, 1, 0.32, 1);
  /* The one ink of the figures. */
  --figure: var(--text-primary);
}
html.in-space[data-theme="light"] .space {
  --glass-tint: rgba(255, 255, 255, 0.55);
}
.space canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
.space button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
/* Feedback on the press itself, not on release. */
.space button,
.space a {
  transition: scale 140ms var(--spring), background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.space button:active,
.space a:active {
  scale: 0.95;
}
.space-tether {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.space-tether path {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-width: 1;
  stroke-dasharray: 2 5;
  stroke-linecap: round;
  opacity: 0.7;
}

/* Labels ------------------------------------------------------------------------------------ */

.space-labels {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 1600ms ease;
}
/* When the years start to play, the names come in from nothing with the lines. */
.space.arriving .space-labels {
  opacity: 0;
  transition: none;
}
.space-label {
  z-index: 1;
  position: absolute;
  top: 0;
  left: 0;
  max-width: 190px;
  opacity: 0;
  visibility: hidden;
  will-change: transform;
  transition: opacity 260ms ease, visibility 0s linear 260ms;
  text-shadow: 0 0 8px var(--surface-canvas), 0 0 2px var(--surface-canvas);
}
.space-label.on {
  visibility: visible;
  transition: opacity 260ms ease, visibility 0s;
}
.space-label:not(.on) {
  opacity: 0 !important;
}
.space-label b {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: var(--fw-medium);
  line-height: 20px;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text-secondary);
}
.space-label.strong b {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}
.space-label span {
  display: none;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-tertiary);
}
.space-label.near {
  max-width: 230px;
}
.space-label.near span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.space-cluster,
.space-mark {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  will-change: transform;
}
.space-cluster {
  z-index: 0;
  opacity: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 45px);
  font-weight: var(--fw-light);
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-shadow: 0 0 14px var(--surface-canvas), 0 0 4px var(--surface-canvas);
}
.space-mark {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-tertiary);
  text-shadow: 0 0 8px var(--surface-canvas), 0 0 2px var(--surface-canvas);
}
.space-mark.pole {
  font-size: 13px;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}
/* The name of a group of lanes on the timeline. */
.space-mark.group {
  font-size: 10px;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-shadow: 0 0 8px var(--surface-canvas), 0 0 2px var(--surface-canvas);
}

/* Controls ------------------------------------------------------------------------------------ */

.space-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) 0;
  pointer-events: none;
}
.space-top > * {
  pointer-events: auto;
}
.space-brand {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px 6px 8px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  text-align: left;
}
.space-brand:hover {
  background: var(--surface-hover);
}
.space-brand > span {
  display: grid;
  line-height: 1.15;
}
.space-brand b {
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--fw-regular);
  letter-spacing: -0.01em;
  text-transform: lowercase;
}
.space-brand small {
  white-space: nowrap;
  font-size: 11px;
  color: var(--text-tertiary);
}
/* What the owner does, next to the name: the first thing a new visitor reads. Two lines, like
   the name and the role beside it. It lets a drag on the canvas through. */
.space-lede {
  flex: 0 1 auto;
  min-width: 0;
  display: grid;
  margin: 0 auto 0 0;
  padding-left: var(--space-3);
  border-left: 1px solid var(--border-hairline);
  line-height: 1.3;
  text-shadow: 0 0 8px var(--surface-canvas), 0 0 2px var(--surface-canvas);
  pointer-events: none;
}
.space-lede b,
.space-lede span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.space-lede b {
  color: var(--text-primary);
  font-size: 15px;
  font-weight: var(--fw-medium);
}
.space-lede span {
  color: var(--text-tertiary);
  font-size: 12px;
}
/* Less room: the line alone, on two lines when it has to. */
@media (max-width: 1000px) {
  .space-lede span {
    display: none;
  }
  .space-lede b {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    white-space: normal;
    font-size: 13px;
    text-wrap: balance;
  }
}
.space-tools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--space-glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float);
}
.space-icon,
.space-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 32px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
}
.space-icon:hover,
.space-pill:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.space-icon[aria-pressed="true"] {
  background: var(--accent-fill);
  color: var(--accent-on);
}
.space-pill {
  padding: 0 12px 0 10px;
  background: var(--accent-fill);
  color: var(--accent-on);
  font-weight: var(--fw-medium);
}
.space-pill:hover {
  background: var(--accent-fill-hover);
  color: var(--accent-on);
}

.space-legend {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  display: grid;
  gap: 1px;
  padding: 6px;
  border-radius: var(--radius-menu);
  transform: translateY(-50%);
}
.space-type {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 7px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
}
.space-type:hover {
  background: var(--surface-hover);
}
/* The icon of the kind, in the kind's colour. */
.space-type-icon {
  display: inline-flex;
  flex: none;
  color: var(--dot);
}
.space-type[aria-pressed="false"] {
  color: var(--text-tertiary);
  opacity: 0.6;
}
.space-type[aria-pressed="false"] .space-type-icon {
  color: inherit;
}
.space-type small {
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.space i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
}

.space-bottom {
  position: absolute;
  left: 50%;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  width: min(680px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}
.space-bottom > * {
  pointer-events: auto;
}
.space-hint {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  text-shadow: 0 0 8px var(--surface-canvas), 0 0 2px var(--surface-canvas);
  transition: opacity var(--dur-slow) var(--ease);
}
.space.touched .space-hint,
.space.has-query .space-hint {
  opacity: 0;
}
.space:not(.on-time) .space-hint .years,
.space.on-time .space-hint .free {
  display: none;
}
.space-axes {
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--space-glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  scrollbar-width: none;
}
/* Time: play, a slider for the shown moment over the activity per year, and what that moment is. */
.space-time {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: min(560px, 100%);
  padding: 5px 18px 5px 6px;
  border-radius: var(--radius-pill);
}
.space-scrub {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 46px;
}
/* One column per year: how much was going on. One series, so one hue and no legend. */
.space-activity {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.space-col {
  position: absolute;
  top: 3px;
  bottom: 0;
}
.space-col i {
  position: absolute;
  bottom: 13px;
  left: 50%;
  width: min(22px, calc(100% - 2px));
  min-height: 2px;
  max-height: calc(100% - 13px);
  border-radius: 4px 4px 0 0;
  background: color-mix(in srgb, var(--figure) 62%, transparent);
  box-shadow: none;
  translate: -50% 0;
  transition: opacity 200ms ease;
}
.space-col.ahead i {
  opacity: 0.32;
}
.space-col small {
  position: absolute;
  bottom: 0;
  left: 50%;
  font-size: 9px;
  line-height: 11px;
  translate: -50% 0;
}
/* The running year is a narrow slot at the end: its name stays inside the chart. */
.space-col:last-child small {
  right: 5px;
  left: auto;
  translate: none;
}
.space-time input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
}
.space-time input::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}
.space-time input::-moz-range-track {
  height: 100%;
  background: transparent;
}
/* The thumb is the line of the shown moment. */
.space-time input::-webkit-slider-thumb {
  width: 4px;
  height: 100%;
  border: 0;
  border-radius: 2px;
  background: var(--figure);
  box-shadow: 0 0 0 2px var(--surface-canvas);
  -webkit-appearance: none;
  appearance: none;
}
.space-time input::-moz-range-thumb {
  width: 4px;
  height: 100%;
  border: 0;
  border-radius: 2px;
  background: var(--figure);
  box-shadow: 0 0 0 2px var(--surface-canvas);
}
.space-time input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.space-time output {
  flex: none;
  min-width: 34px;
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.space .space-time output small {
  color: inherit;
  font-size: inherit;
}
.space-time .space-icon .icon:nth-child(2),
.space-time .space-icon[aria-pressed="true"] .icon:nth-child(1) {
  display: none;
}
.space-time .space-icon[aria-pressed="true"] .icon:nth-child(2) {
  display: block;
}
.space-signals .past {
  color: var(--text-tertiary);
  font-style: italic;
}
.space-axes {
  position: relative;
}
.space-axes-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--surface-inverse);
  transition: transform 520ms var(--spring), width 520ms var(--spring);
}
.space-axes button {
  position: relative;
  flex: none;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.space-axes button:hover {
  background: var(--surface-hover);
}
.space-axes button[aria-checked="true"] {
  background: transparent;
  color: var(--text-inverse);
}
.space-axes button[aria-checked="true"]:hover {
  background: transparent;
}
.space-lens,
.space-custom {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--space-glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float);
}
.space-lens {
  height: 46px;
}
.space-lens:focus-within {
  border-color: var(--focus-ring);
}
.space-lens .icon {
  flex: none;
  color: var(--text-tertiary);
}
.space-lens input,
.space-custom input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--fs-md);
}
.space-custom {
  width: auto;
  max-width: 100%;
  height: 40px;
  padding-right: 4px;
}
.space-custom input {
  width: 170px;
  font-size: var(--fs-sm);
}
.space:not(.has-query) .space-lens .space-x,
.space.has-query .space-lens .kbd {
  display: none;
}
.space-x {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
}
.space-x:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}
.space-results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.space.on-time .space-results {
  flex-wrap: nowrap;
  justify-content: safe center;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.space.on-time .space-results button {
  flex: none;
}
.space-results p {
  margin: 0;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--space-glass);
  color: var(--text-secondary);
  font-size: 12px;
}
.space-results button,
.space-near button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--space-glass);
  font-size: 12px;
}
.space-results button span,
.space-near button span {
  overflow: hidden;
  max-width: 200px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.space-results button:hover,
.space-near button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.space small {
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.space-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.space-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

/* Dossier: a card that stays next to its node ------------------------------------------------ */

.space-dossier {
  position: absolute;
  top: 0;
  left: 0;
  width: 360px;
  max-height: calc(100dvh - 240px);
  overflow-y: auto;
  padding: var(--space-6);
  border-radius: var(--radius-card);
  background: var(--space-glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float);
  will-change: transform;
  animation: space-in 460ms var(--spring);
}
/* The glass arrives: it grows from its node and comes into focus. */
@keyframes space-in {
  from {
    opacity: 0;
    scale: 0.86;
    filter: blur(12px);
  }
}
.space-dossier-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: 11px;
}
.space-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: var(--fw-regular);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.space-when {
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.space-dossier h2 {
  margin: 6px 0 0;
  outline: none;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: var(--fw-light);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.space-dossier p {
  margin: var(--space-2) 0 0;
  color: var(--text-secondary);
  line-height: 1.5;
}
.space-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
}
.space-signals span::before {
  content: "· ";
}
.space-signals span:first-child::before {
  content: "";
}
.space-signals .up {
  color: var(--text-primary);
}
.space-signals .up::before {
  content: "● " !important;
}
.space-signals .down {
  color: var(--text-tertiary);
}
.space-highlights {
  margin: var(--space-2) 0 0;
  padding-left: 18px;
  color: var(--text-secondary);
}
.space-dossier a:not(.space-btn) {
  color: var(--accent);
  text-decoration: underline;
}
.space-dossier audio {
  width: 100%;
  height: 36px;
  margin-top: var(--space-3);
}
.space-preview {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  margin-top: var(--space-3);
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--surface-sunken);
}
.space-preview iframe {
  width: 200%;
  height: 200%;
  border: 0;
  background: #fff;
  transform: scale(0.5);
}
.space-tags,
.space-near ul {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
}
.space-tags button {
  padding: 2px 9px;
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: 11px;
}
.space-tags button:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.space-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
}
.space-near h3 {
  margin: var(--space-4) 0 0;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: var(--fw-regular);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.space-near ul {
  margin-top: var(--space-2);
}
.space-latest h3 {
  margin: var(--space-3) 0 0;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: var(--fw-regular);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.space-latest ul {
  display: grid;
  gap: 6px;
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}
.space-latest li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  line-height: 1.35;
}
.space-latest a {
  flex: 1;
  min-width: 0;
}
.space-latest small {
  flex: none;
}
/* Semantic zoom: from far away the dossier is a title and one line; close up it is everything. */
.space-dossier[data-level="1"] > :not(.space-dossier-head, h2, .space-summary),
.space-dossier[data-level="2"] > :is(.space-more, .space-near) {
  display: none;
}
.space-dossier[data-level="1"] {
  width: 280px;
}

.space-caption {
  position: absolute;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: var(--space-4);
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 10px 12px 10px 16px;
  border: 0;
  border-radius: var(--radius-menu);
  background: var(--space-glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
}
.space-caption-text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}
.space-caption-text b {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--fw-regular);
  letter-spacing: -0.02em;
}
.space-caption-text span {
  color: var(--text-secondary);
  font-size: 12px;
}
.space-caption-buttons {
  display: flex;
  flex: none;
  gap: 4px;
}

.space-help {
  width: min(560px, calc(100vw - 24px));
}
.space-help-body {
  padding: var(--space-2) var(--space-4) var(--space-4);
  color: var(--text-secondary);
  line-height: 1.55;
}
.space-help-body ol {
  margin: var(--space-3) 0;
  padding-left: 20px;
}
.space-help-body li + li {
  margin-top: 4px;
}
.space-help-body b,
.space-help-body dt {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}
.space-help-body dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px var(--space-4);
  margin: 0;
}
.space-help-body dd {
  margin: 0;
}

/* The chat button sits above the search bar's row on wide screens; keep it clear of it. */
html.in-space .ask-dock {
  z-index: 6;
}

@media (max-width: 760px) {
  .space-brand small,
  .space-brand b span,
  .space-lede,
  .space-pill span,
  .space-time output small,
  .space-lens .kbd {
    display: none;
  }
  /* Seven controls and the name on one line: the name gives way first. */
  .space-top {
    gap: 6px;
    padding-right: 10px;
    padding-left: 10px;
  }
  .space-brand {
    flex: 0 1 auto;
    min-width: 0;
    padding: 6px 6px 6px 4px;
  }
  .space-brand > span {
    min-width: 0;
  }
  .space-brand b {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .space-tools {
    flex: none;
    gap: 0;
  }
  .space-icon {
    min-width: 29px;
  }
  .space-legend {
    top: calc(58px + env(safe-area-inset-top));
    right: 0;
    left: 0;
    display: flex;
    gap: 0;
    padding: 0 8px;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transform: none;
    scrollbar-width: none;
  }
  .space-type {
    flex: none;
    gap: 6px;
    padding: 3px 8px 3px 6px;
    font-size: 11px;
  }

  .space-pill {
    padding: 0;
  }
  .space-brand b {
    font-size: 15px;
  }
  .space-axes {
    justify-content: flex-start;
  }
  .space-dossier {
    top: auto;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 2;
    width: auto;
    max-height: 62dvh;
    transform: none !important;
  }
  .space-dossier[data-level="1"] {
    width: auto;
  }
  .space-caption {
    bottom: calc(136px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    width: calc(100vw - 24px);
  }
  .space-custom input {
    width: 110px;
  }
}

@media (hover: hover) {
  .space-hint .touch {
    display: none;
  }
}
@media (hover: none) {
  .space-hint .mouse {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .space-dossier {
    animation: none;
  }
}

/* Glass ------------------------------------------------------------------------------------------
   Every floating control is the same material: a tint, a blur and a lit edge, fully rounded.
   Bigger surfaces are more opaque, so text on them reads over the fluid. */

.space-tools,
.space-legend,
.space-time,
.space-axes,
.space-lens,
.space-custom,
.space-results p,
.space-results button,
.space-dossier,
.space-numbers,
.space-tip,
.space-caption {
  border: 0;
  background: var(--glass-tint);
  box-shadow: none;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.space-dossier,
.space-numbers,
.space-tip,
.space-caption {
  --glass-tint: rgba(10, 10, 10, 0.66);
}
html.in-space[data-theme="light"] .space-dossier,
html.in-space[data-theme="light"] .space-numbers,
html.in-space[data-theme="light"] .space-tip,
html.in-space[data-theme="light"] .space-caption {
  --glass-tint: rgba(255, 255, 255, 0.74);
}
.space-near button,
.space-tags button,
.space-btn {
  border-color: var(--glass-line);
  background: var(--surface-sunken);
}
.space-near button:hover,
.space-tags button:hover,
.space-btn:hover,
.space-results button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}
.space-lens:focus-within {
  border-color: var(--border-strong);
}
.space-results button,
.space-caption {
  animation: space-in 380ms var(--spring) backwards;
}
.space-results button:nth-child(2) {
  animation-delay: 40ms;
}
.space-results button:nth-child(3) {
  animation-delay: 80ms;
}
.space-results button:nth-child(4) {
  animation-delay: 120ms;
}
.space-results button:nth-child(5) {
  animation-delay: 160ms;
}
.space-theme .icon:nth-child(2),
html.in-space[data-theme="light"] .space-theme .icon:nth-child(1) {
  display: none;
}
html.in-space[data-theme="light"] .space-theme .icon:nth-child(2) {
  display: block;
}

@media (prefers-reduced-transparency: reduce) {
  .space {
    --glass-tint: var(--surface-canvas);
    --glass-blur: none;
  }
  .space-results p,
  .space-results button,
  .space-dossier,
  .space-numbers,
  .space-tip,
  .space-caption {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  .space {
    --glass-tint: var(--surface-canvas);
    --glass-line: var(--text-secondary);
  }
}
@media (prefers-reduced-motion: reduce) {
  .space-results button,
  .space-caption,
  .space-dossier {
    animation: space-fade 200ms ease;
  }
  .space-axes-thumb,
  .space button,
  .space a {
    transition: none;
  }
}
@keyframes space-fade {
  from {
    opacity: 0;
  }
}

/* Numbers --------------------------------------------------------------------------------------
   The work in figures: a panel with a count per group of lanes, the topics per year and the
   longest periods. One hue throughout; a node's colour only shows as a dot next to its name. */

.space-tile {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: start;
  gap: 0 6px;
  white-space: nowrap;
  transition: opacity 240ms ease;
}
.space-tile.idle {
  opacity: 0.45;
}
.space-tile-label {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.3;
}
.space-tile-label i {
  width: 7px;
  height: 7px;
}
.space-tile b {
  color: var(--text-primary);
  font-size: 18px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.space .space-tile small {
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: normal;
}
.space-numbers {
  position: absolute;
  top: calc(62px + env(safe-area-inset-top));
  right: var(--space-4);
  z-index: 1;
  width: 372px;
  max-height: calc(100dvh - 62px - 92px);
  overflow-y: auto;
  padding: var(--space-5) var(--space-6) var(--space-6);
  border-radius: var(--radius-card);
  animation: space-in 420ms var(--spring);
}
.space-numbers[hidden] {
  display: none;
}
.space-numbers-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: 11px;
}
.space-numbers h2 {
  margin: 0;
  outline: none;
  font-family: var(--font-display);
  font-size: 29px;
  font-weight: var(--fw-light);
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
}
.space-numbers .space-btn {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
}
.space-numbers .space-btn[aria-pressed="true"] {
  border-color: transparent;
  background: var(--accent-fill);
  color: var(--accent-on);
}
.space-numbers .space-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-3);
}
.space-numbers section {
  margin-top: var(--space-4);
}
.space-numbers h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: var(--fw-semibold);
}
.space-numbers section > p,
.space-none {
  margin: 2px 0 0;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.4;
}

/* Topics per year: one hue, stronger where more carried the tag. */
.space-focus {
  display: grid;
  grid-template-columns: minmax(0, 104px) repeat(var(--years, 12), minmax(0, 1fr));
  align-items: center;
  gap: 2px;
  margin-top: var(--space-2);
}
.space-focus small {
  font-size: 9px;
  line-height: 14px;
  text-align: center;
}
.space-focus small.at {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}
.space-focus .space-tag {
  overflow: hidden;
  padding: 0 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 16px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-focus .space-tag:hover {
  color: var(--text-primary);
  text-decoration: underline;
}
.space i.space-cell {
  width: auto;
  height: 14px;
  border-radius: 4px;
  background: var(--surface-sunken);
  box-shadow: none;
  transition: opacity 200ms ease;
}
.space-focus .space-cell {
  cursor: pointer;
}
.space i.space-cell[data-step="1"] {
  background: color-mix(in srgb, var(--figure) 30%, transparent);
}
.space i.space-cell[data-step="2"] {
  background: color-mix(in srgb, var(--figure) 52%, transparent);
}
.space i.space-cell[data-step="3"] {
  background: color-mix(in srgb, var(--figure) 76%, transparent);
}
.space i.space-cell[data-step="4"] {
  background: var(--figure);
}
.space i.space-cell.ahead {
  opacity: 0.3;
}
.space-focus .space-cell:hover {
  outline: 1.5px solid var(--text-primary);
  outline-offset: 0;
}
.space-focus-scale {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 6px;
  color: var(--text-tertiary);
  font-size: 9px;
}
.space-focus-scale .space-cell {
  width: 14px;
}
.space-focus-scale span {
  padding: 0 3px;
}

/* The longest periods: ranked bars, square at the start and round at the end. */
.space-longest {
  display: grid;
  gap: 1px;
  margin-top: var(--space-2);
}
.space-rank {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 6px;
  margin: 0 -6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 11.5px;
  text-align: left;
}
.space-rank:hover {
  background: var(--surface-hover);
}
.space-rank-name {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-rank-name i {
  width: 7px;
  height: 7px;
}
.space-rank-bar {
  display: block;
  height: 8px;
}
.space-rank-bar i {
  display: block;
  width: 0;
  height: 8px;
  min-width: 3px;
  border-radius: 0;
  background: color-mix(in srgb, var(--figure) 72%, transparent);
  box-shadow: none;
  transition: width 260ms var(--spring);
}
.space .space-rank small {
  color: var(--text-primary);
  text-align: right;
}

/* The same values as tables. */
.space-tables,
.space-numbers.as-tables .space-charts {
  display: none;
}
.space-numbers.as-tables .space-tables {
  display: block;
}
.space-table {
  margin-top: var(--space-4);
  overflow-x: auto;
}
.space-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.space-table caption {
  padding-bottom: 4px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: var(--fw-semibold);
  text-align: left;
}
.space-table th,
.space-table td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--border-hairline);
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}
.space-table th:first-child {
  overflow: hidden;
  max-width: 150px;
  text-align: left;
  text-overflow: ellipsis;
}
.space-table thead th {
  color: var(--text-tertiary);
  font-weight: var(--fw-medium);
}
/* A column per year: tight, so the whole table fits the panel. */
.space-table.dense th,
.space-table.dense td {
  padding: 3px 1px;
  font-size: 10px;
}
.space-table.dense th:first-child {
  max-width: 96px;
  padding-right: 4px;
  font-size: 11px;
}
.space-table tbody th {
  font-weight: var(--fw-regular, 400);
}

/* One tooltip for every figure: the value in front, then a line per series. */
.space-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 9;
  display: grid;
  gap: 1px;
  min-width: 96px;
  max-width: 250px;
  padding: 8px 12px;
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 11.5px;
  line-height: 1.4;
  pointer-events: none;
}
.space-tip[hidden] {
  display: none;
}
.space-tip > b {
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: var(--fw-semibold);
}
.space-tip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.space-tip-row b {
  min-width: 10px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: var(--fw-semibold);
}
.space-tip-row.none {
  opacity: 0.5;
}
/* A short line in the series colour, not a box. */
.space-tip-row i {
  width: 10px;
  height: 2px;
  border-radius: 0;
  box-shadow: none;
}
@media (max-width: 760px) {
  /* On a phone the panel hangs under the legend and leaves the time slider free. */
  .space-numbers {
    top: calc(92px + env(safe-area-inset-top));
    right: 8px;
    left: 8px;
    z-index: 2;
    width: auto;
    max-height: calc(100dvh - 92px - 244px);
    padding: var(--space-3) var(--space-4) var(--space-4);
  }
}
@media (prefers-reduced-motion: reduce) {
  .space-numbers {
    animation: space-fade 200ms ease;
  }
}

/* Controls: ghost pills and small capitals, as on the rest of the site. */
.space-brand:hover {
  background: transparent;
}
.space-brand img {
  filter: none;
}
.space-lede {
  border-left-color: var(--border-soft);
}
.space-lede b {
  font-weight: var(--fw-regular);
}
.space .space-pill,
.space .space-pill:hover {
  padding: 0 16px;
  background: var(--surface-inverse);
  color: var(--text-inverse);
  font-size: var(--fs-label);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.space-pill .icon {
  display: none;
}
.space-icon[aria-pressed="true"] {
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
.space-type,
.space-axes button,
.space-btn,
.space-mark.group {
  font-size: var(--fs-label);
  font-weight: var(--fw-regular);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.space-legend {
  padding: 10px 8px;
}
.space-type {
  border-radius: var(--radius-pill);
}
.space-type:hover {
  background: transparent;
  color: var(--text-primary);
}
.space-btn,
.space-near button,
.space-tags button {
  background: transparent;
}
.space-numbers .space-btn[aria-pressed="true"] {
  background: var(--surface-inverse);
  color: var(--text-inverse);
}
.space-dossier a:not(.space-btn) {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
@media (max-width: 760px) {
  .space-pill .icon {
    display: block;
  }
  .space .space-pill,
  .space .space-pill:hover {
    padding: 0;
  }
  .space-legend {
    padding: 0 8px;
    border: 0;
    background: none;
  }
}

/* The lit edge on the glass: a ring of light, brighter at the top left. Under a fine pointer a
   glow follows the pointer along it (app.js gives its place). */
.space-tools,
.space-legend,
.space-time,
.space-axes,
.space-lens,
.space-custom,
.space-dossier,
.space-numbers,
.space-caption,
.space-tip {
  border: 0;
}
.space-tools,
.space-time,
.space-lens,
.space-custom {
  position: relative;
}
.space-tools::before,
.space-legend::before,
.space-time::before,
.space-axes::before,
.space-lens::before,
.space-custom::before,
.space-dossier::before,
.space-numbers::before,
.space-caption::before,
.space-tools::after,
.space-legend::after,
.space-time::after,
.space-axes::after,
.space-lens::after,
.space-custom::after,
.space-dossier::after,
.space-numbers::after,
.space-caption::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.space-tools::before,
.space-legend::before,
.space-time::before,
.space-axes::before,
.space-lens::before,
.space-custom::before,
.space-dossier::before,
.space-numbers::before,
.space-caption::before {
  background: linear-gradient(150deg, var(--edge-hi), var(--edge-lo) 28%, var(--edge-lo) 72%, var(--edge-mid));
}
.space-tools::after,
.space-legend::after,
.space-time::after,
.space-axes::after,
.space-lens::after,
.space-custom::after,
.space-dossier::after,
.space-numbers::after,
.space-caption::after {
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 0%), var(--edge-glow), transparent 65%);
  opacity: 0;
  transition: opacity 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .space-tools:hover::after,
  .space-legend:hover::after,
  .space-time:hover::after,
  .space-axes:hover::after,
  .space-lens:hover::after,
  .space-lens:focus-within::after,
  .space-custom:hover::after,
  .space-dossier:hover::after,
  .space-numbers:hover::after,
  .space-caption:hover::after {
    opacity: 1;
  }
}
/* A pane that scrolls cannot carry the ring (it would scroll along), so its edge is a soft
   inner light instead. */
.space-dossier::before,
.space-dossier::after,
.space-numbers::before,
.space-numbers::after {
  display: none;
}
.space-dossier,
.space-numbers {
  box-shadow: inset 0 1px 0 var(--edge-mid), inset 0 0 0 1px var(--edge-lo);
}
.space .space-btn,
.space-near button,
.space-tags button,
.space-results button,
.space-results p {
  border: 0;
  background: var(--glass-fill);
}
.space-btn:hover,
.space-near button:hover,
.space-tags button:hover,
.space-results button:hover {
  background: var(--glass-fill-hover);
}
.space button:active,
.space a:active {
  scale: 0.97;
}
@media (max-width: 760px) {
  .space-legend::before,
  .space-legend::after {
    display: none;
  }
}
