/* Collection surfaces share the library's tokens in both appearances. */
.collections-page .member-page-heading {
  flex-wrap: wrap;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--heading-rule);
}

.collections-page .member-page-heading > div,
.collections-page .collection-card,
.collections-page .collection-summary,
.collections-page .collection-card__identity,
.collections-page .chart-card,
.collections-page .collection-form__field {
  min-width: 0;
}

.collections-page h1,
.collections-page .collection-card__identity strong,
.collections-page .chart-card__title,
.collections-page .chart-card__artist,
.collections-page .shelf-switch__text,
.collections-page .collection-archive-notice {
  overflow-wrap: anywhere;
}

.collections-page .collection-card,
.collections-page .collection-panel,
.collections-page .empty-state {
  color: var(--ink);
  background: var(--sidebar-bg);
}

.collections-page .collection-card:hover {
  border-color: var(--hairline);
  box-shadow: none;
}

.collections-page .collection-summary {
  display: grid;
  gap: 0.75rem;
}

.collections-page .collection-card__link,
.collections-page .collection-rename-link,
.collections-page .back-link {
  color: var(--accent);
}

.collections-page .collection-card__link:hover strong {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.collections-page .collection-rename-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-self: start;
}

.collections-page .tag--collection {
  width: fit-content;
  max-width: 100%;
  color: var(--ink);
  border-color: var(--tag-neutral-line);
  background: transparent;
  overflow-wrap: anywhere;
}

.collections-page .collection-search,
.collections-page .collection-rename-form {
  width: 100%;
  max-width: 100%;
}

.collections-page .collection-search__controls {
  align-items: end;
}

.collections-page .collection-sort {
  flex: 1 1 12rem;
  max-width: 22rem;
}

.collections-page input[type="text"],
.collections-page input[type="search"],
.collections-page select {
  min-width: 0;
  max-width: 100%;
  color: var(--ink);
  background-color: var(--surface);
}

.collections-page .collection-rename-errors {
  color: var(--ink);
  border-left: 2px solid var(--heading-rule);
  padding-inline-start: 0.75rem;
}

.collections-page .collection-rename-errors ul {
  margin: 0;
  padding-inline-start: 1rem;
}

.collections-page .collection-archive-notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--rule);
}

.collections-page .collection-archive-notice p,
.collections-page .collection-archive-notice form,
.collections-page .member-page-heading__actions form {
  margin: 0;
}

.collections-page .member-page-heading__actions {
  flex: 1 1 16rem;
}

.collections-page .button {
  max-width: 100%;
  white-space: normal;
}

.collections-page a:focus-visible,
.collections-page input:focus-visible,
.collections-page select:focus-visible,
.collections-page button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

@media (max-width: 40rem) {
  .collections-page .collection-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .collections-page .collection-panel,
  .collections-page .collection-card {
    padding: 1rem;
  }

  .collections-page .chart-selection-row {
    grid-template-columns: auto minmax(0, 1fr);
  }
}

.collections-page {
  width: min(56rem, calc(100% - 1.5rem));
  margin-inline: auto;
}

.collections-page .collection-card--shelf {
  display: grid;
  align-items: stretch;
  gap: 0.75rem;
}

.collections-page .collection-card__link {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
}

.collections-page .shelf-switch__form {
  margin: 0;
}

.collections-page .shelf-switch {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0 0;
  border: 0;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.collections-page .shelf-switch__text b,
.collections-page .shelf-switch__text small {
  display: block;
}

.collections-page .shelf-switch__text small {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.collections-page .shelf-switch__track {
  position: relative;
  flex: none;
  width: 2.6rem;
  height: 1.5rem;
  border: 1.5px solid var(--hairline);
  border-radius: var(--radius-pill);
}

.collections-page .shelf-switch__track::after {
  content: "";
  color: transparent;
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--hairline);
}

.collections-page .shelf-switch__track--on {
  border-color: var(--selected-line);
  background: var(--selected-fill);
}

.collections-page .shelf-switch__track--on::after {
  color: transparent;
  left: calc(100% - 1.1rem - 2px);
  background: var(--selected-line);
}

@media (max-width: 40rem) {
  .collections-page .collection-card__link {
    flex-direction: column;
  }

  .collections-page .collection-card__meta {
    justify-items: start;
    text-align: left;
  }
}
