article.grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
}

.cluster-list {
    padding: 1rem;
    border-right: 1px solid var(--border);
    height: 90vh;
    overflow: auto;
}

.cluster-item {
    display: flex;
    font-size: 0.6rem;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 1rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}


.cluster-detail-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  background-color: white;
  padding: 2rem;
  overflow-y: auto;
}

.map-container {
    height: 90vh;
    border: 1px solid var(--border);
    border-radius: var(--border-radius); 
}

.document-details {
  padding: 0 1rem;
}

.collection-section {
  margin-top: 1rem;
  border-top: 1px solid #e0e0e0;
  padding-top: 1rem;
  gap: 1rem;
}

.collection-list {
  padding-left: 2rem;
}

.span-full {
  grid-column: 1 / -1;
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.loading-message {
  font-weight: bold;
  margin-bottom: 0px !important;
}

.loading-error {
  color: #721c24;
  font-weight: bold;
  background-color: #f8d7da;
  padding: 1rem;
  border-radius: 0.25rem;
}

.hierarchical-cluster > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.hierarchical-cluster > summary::-webkit-details-marker {
  display: none;
}

.hierarchical-cluster > summary::before {
  content: "▶";
  font-size: 0.6rem;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.hierarchical-cluster[open] > summary::before {
  transform: rotate(90deg);
}

/* Indent nested collapsible groups and leaf items by one level each */
.hierarchical-subclusters > .cluster-tree-item > .hierarchical-cluster,
.cluster-item-leaf {
  margin-left: 1.5rem;
}

.cluster-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  font-size: 0.65rem;
  min-width: 0;
  overflow: hidden;
}

.cluster-info strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-info span {
  display: block;
  white-space: normal;
  overflow-wrap: break-word;
}

.cluster-item-leaf {
  font-size: 0.6rem;
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.hierarchical-subclusters {
  background: color-mix(in srgb, var(--background) 95%, var(--primary));
}

.highlight-cluster {
  font-size: 0.55rem;
  padding: 0.2rem 0.4rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.highlight-cluster[aria-pressed="true"] {
  outline: 2px solid var(--primary);
}

.doc-count,
.cluster-score {
  color: var(--muted-color, #888);
  font-size: 0.55rem;
}

/* The score the map is currently colored and sorted by */
.cluster-score.active {
  color: inherit;
  font-family: monospace;
  font-size: 0.65rem;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: var(--pico-spacing);
}

.map-header p,
.map-header label {
  margin: 0;
}

.score-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.score-select select {
  width: auto;
  margin: 0;
}

.top-clusters-toggle {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.top-cluster-item {
  justify-content: space-between;
  margin-bottom: 0;
  padding: 0.4rem 0.5rem;
}

/* Position of a top cluster in the hierarchy */
.cluster-info .cluster-path {
  color: var(--muted-color, #888);
  font-size: 0.55rem;
}
