.artist-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.artist-modal.hidden {
  display: none;
}

body.artist-modal-open {
  overflow: hidden;
}

.artist-modal-backdrop {
  position: absolute;
  inset: 0;
  /* Backdrop scrim — fixed functional overlay color, tuned per theme */
  background: rgba(8, 8, 10, 0.62);
}

html[data-theme="light"] .artist-modal-backdrop {
  background: rgba(20, 21, 24, 0.42);
}

.artist-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(86vh, 920px);
  display: flex;
  flex-direction: column;
  /* Surface, hairline border, radius and shadow come from edge.css (.artist-modal-panel) */
  overflow: hidden;
}

.artist-modal-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev);
}

.artist-modal-heading {
  min-width: 0;
}

.artist-modal-title {
  margin: 4px 0 0;
  font-size: var(--fs-hero);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-tight);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(70vw, 640px);
}

.artist-modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 20px 20px;
}

.artist-modal-cover {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card);
}

.artist-modal-cover-empty {
  display: block;
  border-radius: 50%;
}

.artist-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.artist-modal-actions .playlist-open,
.artist-add-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: var(--fw-semi);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.artist-modal-actions .playlist-open:hover,
.artist-add-btn:hover {
  background: var(--bg-elev);
  border-color: var(--focus);
}

.artist-modal-actions .playlist-open:active,
.artist-add-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.artist-add-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.artist-intel-btn {
  border-color: color-mix(in srgb, var(--grade-admin, #c0b19c) 55%, var(--border));
  color: var(--grade-admin, #c0b19c);
}

.artist-intel-btn:hover:not(:disabled) {
  border-color: var(--grade-admin, #c0b19c);
}

.artist-intel-btn.is-in-intel,
.artist-intel-btn.is-in-intel:disabled {
  opacity: 1;
  border-color: var(--border);
  color: var(--text-faint);
  background: transparent;
  cursor: default;
}

.artist-modal-section {
  margin-top: 18px;
}

.artist-modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.artist-modal-section-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: var(--fw-semi);
}

.artist-top-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.artist-top-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}

.artist-top-row:hover {
  background: var(--bg-elev);
}

.artist-top-rank {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.artist-top-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artist-top-name {
  font-size: 13px;
  font-weight: var(--fw-semi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-top-artists {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-top-artists .artist-link {
  color: inherit;
}

.artist-top-artists .artist-link:hover {
  color: var(--text);
}

.artist-top-dur {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.artist-modal-empty {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.artist-managed-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin: 0 0 10px;
}

.artist-managed-add input {
  min-width: 0;
  border: 1px solid var(--border-soft);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: var(--radius);
  font: inherit;
  font-size: 12px;
  padding: 8px 10px;
  outline: none;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.artist-managed-add input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.artist-managed-add button {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  font: inherit;
  font-size: 12px;
  font-weight: var(--fw-semi);
  padding: 0 12px;
  min-height: 34px;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.artist-managed-add button:hover {
  background: var(--bg-elev);
  border-color: var(--focus);
}

.artist-managed-add button:active:not(:disabled) {
  transform: scale(0.98);
}

.artist-managed-add button:disabled {
  opacity: 0.45;
  cursor: default;
}

.artist-managed-row {
  cursor: default;
}

.artist-managed-row.is-openable {
  cursor: pointer;
}

.artist-managed-row .artist-managed-remove {
  opacity: 0.55;
}

.artist-managed-row:hover .artist-managed-remove {
  opacity: 1;
}

.artist-modal #managed-songs-error {
  margin: 0 0 8px;
}

.artist-top-row.is-hidden {
  display: none;
}

.artist-top-row.has-manage {
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
}

.artist-top-add {
  appearance: none;
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  color: var(--text-muted);
  border-radius: 999px;
  font: inherit;
  font-size: 11px;
  font-weight: var(--fw-semi);
  padding: 3px 10px;
  cursor: pointer;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.artist-top-add:hover {
  color: var(--text);
  border-color: var(--focus);
  background: var(--bg-elev);
}

.artist-top-add:active:not(:disabled) {
  transform: scale(0.96);
}

.artist-top-add:disabled {
  opacity: 0.45;
  cursor: default;
}

.artist-top-managed {
  font-size: 11px;
  font-weight: var(--fw-semi);
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.artist-top-more {
  appearance: none;
  background: none;
  border: 0;
  padding: 8px 0 0;
  font: inherit;
  font-size: 12px;
  font-weight: var(--fw-semi);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-out);
}

.artist-top-more:hover {
  color: var(--text);
}

.artist-top-more.hidden {
  display: none;
}

.artist-discography-head {
  gap: 12px;
}

.artist-discography-sort {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 4px 22px 4px 8px;
  font: inherit;
  font-size: 12px;
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23999' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.artist-discography-sort:hover,
.artist-discography-sort:focus {
  border-color: var(--border);
  color: var(--text);
}

/* Shared modal motion (keyframes in motion.css) — same timing as the other modals */
.artist-modal:not(.hidden):not(.is-closing) .artist-modal-panel {
  animation: modalIn 0.2s var(--ease-out) both;
}

.artist-modal.is-closing .artist-modal-panel {
  animation: modalOut 0.14s var(--ease-move) both;
}

.artist-modal:not(.hidden):not(.is-closing) .artist-modal-backdrop {
  animation: fadeIn 0.16s var(--ease-soft) both;
}

.artist-modal.is-closing .artist-modal-backdrop {
  animation: fadeOut 0.12s var(--ease-move) both;
}

.artist-modal.is-closing {
  pointer-events: none;
}

@media (max-width: 720px) {
  .artist-modal-hero.playlist-embed {
    grid-template-columns: 1fr;
  }

  .artist-modal-cover {
    width: 120px;
    height: 120px;
  }
}
