/* Dataset browser and frame viewer. Shares tokens with /labs/page.css. */

.datasets {
  padding: calc(var(--bar) + clamp(32px, 5vw, 72px)) var(--edge) var(--section);
}

.datasets h1 {
  max-width: 16ch;
}

.lead {
  max-width: 40rem;
  margin-top: 16px;
  color: var(--ink-muted);
  font-size: 1.125rem;
}

.dataset-card {
  max-width: 920px;
  margin-top: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.dataset-card + .dataset-card {
  margin-top: 24px;
}

.dataset-card--featured {
  border-color: var(--ink);
}

.dataset-card-link {
  display: block;
  padding: clamp(20px, 3vw, 32px);
  text-decoration: none;
}

.dataset-card-link:hover {
  background: var(--paper-2);
}

.dataset-card-link:hover .arrow {
  transform: translateX(3px);
}

.kicker {
  color: var(--green-ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dataset-card h2 {
  margin-top: 8px;
}

.dataset-card-link > p {
  max-width: 40rem;
  margin-top: 12px;
  color: var(--ink-muted);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 24px;
  padding: 0;
  list-style: none;
}

.stats b {
  display: block;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.stats span {
  color: var(--ink-muted);
  font-size: 13px;
}

.browse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-weight: 500;
}

.source {
  margin: 0;
  padding: 0 clamp(20px, 3vw, 32px) 8px;
}

#browser {
  max-width: 920px;
}

#browser > #session-status {
  margin-top: 12px;
  color: var(--ink-muted);
}

#session-status:empty {
  display: none;
}

.explorer {
  margin-top: 28px;
  border-top: 1px solid var(--line);
}

.folder {
  border-bottom: 1px solid var(--line);
}

.folder-name {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 16px 8px 8px;
  font-size: 1.05rem;
}

.folder-name .arrow {
  transform: rotate(90deg);
}

.folder-files {
  margin: 0;
  padding: 0 0 8px 28px;
  list-style: none;
}

.folder-files a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 10px 8px;
  color: inherit;
  text-decoration: none;
}

.folder-files a:hover {
  background: var(--paper-2);
}

.session-meta {
  color: var(--ink-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.viewer-back {
  margin-bottom: 16px;
}

.viewer-back a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 500;
  text-decoration: none;
}

.viewer-back a:hover {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.viewer-back .arrow {
  transform: rotate(180deg);
}

.viewer-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 8px;
}

.viewer-meta {
  color: var(--ink-muted);
}

.viewer-source {
  margin: 0;
}

.viewer-source .text-link {
  min-height: 0;
  font-size: 14px;
}

.stage {
  position: relative;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 4px;
  background: #111;
  aspect-ratio: 16 / 9;
}

.stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.cursor {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9), 0 0 10px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.cursor.down {
  background: var(--green);
  box-shadow: 0 0 0 2px #fff, 0 0 12px rgba(34, 197, 94, 0.85);
}

.hud {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  pointer-events: none;
}

.hud-wasd,
.hud-mouse,
.hud-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.hud-wasd {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(2, 40px);
}

.hud span {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.45);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 500;
}

.hud-wasd [data-key="W"] {
  grid-column: 2;
}

.hud-wasd [data-key="A"] {
  grid-row: 2;
  grid-column: 1;
}

.hud-wasd [data-key="S"] {
  grid-row: 2;
  grid-column: 2;
}

.hud-wasd [data-key="D"] {
  grid-row: 2;
  grid-column: 3;
}

.hud span.on {
  border-color: #fff;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.55);
}

.hud span.down {
  box-shadow: 0 0 0 2px var(--green), 0 0 18px rgba(34, 197, 94, 0.45);
}

.hud span.up {
  border-style: dashed;
  color: #fff;
}

.hud span.hud-delta {
  display: flex;
  gap: 0.35em;
  width: auto;
  height: 28px;
  padding: 0 10px;
  font: 500 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.hud span.hud-delta.on {
  border-color: #fff;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: none;
}

.hud-delta i {
  font-style: normal;
  opacity: 0.65;
}

.hud-delta b {
  min-width: 3ch;
  font-weight: inherit;
  text-align: right;
}

.stage-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-align: center;
}

.stage-message a {
  color: #fff;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.transport .btn {
  min-height: 44px;
  padding: 10px 16px;
}

.transport :disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.frame-counter {
  margin-left: auto;
  color: var(--ink-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 540px) {
  .hud-wasd {
    grid-template-columns: repeat(3, 32px);
    grid-template-rows: repeat(2, 32px);
  }

  .hud span {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

.mcap {
  margin-top: 28px;
}

.mcap-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}

#mcap-status {
  color: var(--ink-muted);
}

.mcap-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
  margin-top: 12px;
}

.mcap-channels {
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px 12px 8px;
}

.mcap-channels legend {
  padding: 0 4px;
  font-size: 13px;
  font-weight: 500;
}

.mcap-channels label {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 1px;
  align-items: start;
  padding: 6px 0;
  font-size: 12px;
}

.mcap-channels input {
  grid-row: 1 / span 2;
  margin: 2px 0 0;
}

.mcap-channel-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.3;
}

.mcap-channel-note {
  color: var(--ink-muted);
  line-height: 1.35;
}

.mcap-readout {
  min-width: 0;
  max-height: 460px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.mcap-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.mcap-topic {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
}

.mcap-when,
.mcap-empty {
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 13px;
}

.mcap-card dl {
  margin-top: 8px;
  font-size: 13px;
}

.mcap-field {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: 1px 12px;
  padding: 7px 0 2px;
}

.mcap-field-note {
  grid-column: 1 / -1;
  margin: 0 0 4px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.35;
}

.mcap-card dt {
  color: var(--ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.mcap-card dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .mcap-layout {
    grid-template-columns: 1fr;
  }
}
