/* SelectDex: a private, compact index of MyDex profiles. */
.mydex-profile-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

#mydexProfile .mydex-profile-actions > [hidden] {
  display: none !important;
}

#mydexProfile .mydex-selectdex-open.rd-button,
#mydexProfile .mydex-selectdex-toggle.rd-button {
  width: auto;
  min-height: 42px;
  margin: 0;
  padding: 9px 18px;
  white-space: nowrap;
}

#mydexProfile .mydex-selectdex-toggle.is-selected {
  border-color: color-mix(in srgb, var(--rd-brass) 72%, var(--rd-line));
  color: var(--rd-heading);
  background: color-mix(in srgb, var(--rd-brass-soft) 72%, transparent);
}

.selectdex-page {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  padding-inline: 0;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

.selectdex-section {
  width: min(980px, calc(100% - 48px));
  margin: clamp(44px, 7vw, 92px) auto;
}

.selectdex-intro {
  max-width: 560px;
  margin: 0 auto clamp(26px, 4vw, 42px);
  text-align: center;
}

.selectdex-eyebrow {
  margin: 0 0 12px;
  color: var(--rd-brass-deep);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.selectdex-section > .selectdex-intro .rd-section-title {
  margin: 0;
}

.selectdex-lead {
  margin: 13px 0 0;
  color: var(--rd-muted);
  font-size: 15px;
  line-height: 1.7;
}

.selectdex-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 22px);
  align-items: stretch;
}

.selectdex-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  color: var(--rd-text);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.selectdex-card:hover,
.selectdex-card:focus-visible {
  border-color: color-mix(in srgb, var(--rd-brass) 65%, var(--rd-line));
  box-shadow: 0 16px 30px color-mix(in srgb, var(--rd-shadow) 26%, transparent);
  transform: translateY(-2px);
}

.selectdex-card:active {
  transform: translateY(0);
}

.selectdex-copy,
.selectdex-identity,
.selectdex-detail {
  display: grid;
  min-width: 0;
}

.selectdex-copy {
  z-index: 1;
  grid-row: 2;
  align-content: space-between;
  gap: 14px;
  min-height: 148px;
  padding: 18px;
  background: color-mix(in srgb, var(--rd-surface) 97%, var(--rd-brass-soft));
}

.selectdex-identity {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 9px;
}

.selectdex-avatar {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border-radius: 50%;
  color: var(--rd-heading);
  background: color-mix(in srgb, var(--rd-surface) 96%, var(--rd-brass-soft));
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.selectdex-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selectdex-name {
  min-width: 0;
  overflow: hidden;
  color: var(--rd-heading);
  font-family: Georgia, "Times New Roman", "Yu Mincho", serif;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selectdex-count {
  flex: 0 0 auto;
  color: var(--rd-text);
  font-size: 14px;
  line-height: 1.4;
  white-space: nowrap;
}

.selectdex-detail {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.selectdex-categories {
  display: flex;
  min-width: 0;
  gap: 5px;
  overflow: hidden;
}

.selectdex-category {
  min-width: 0;
  overflow: hidden;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--rd-line) 80%, transparent);
  border-radius: 999px;
  color: var(--rd-text);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selectdex-action {
  color: var(--rd-heading);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.selectdex-cover {
  grid-row: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 0;
  background: linear-gradient(145deg, color-mix(in srgb, var(--rd-brass-soft) 66%, transparent), color-mix(in srgb, var(--rd-surface) 80%, transparent));
}

.selectdex-cover.is-empty {
  background: color-mix(in srgb, var(--rd-brass-soft) 60%, transparent);
}

.selectdex-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.selectdex-card-placeholder {
  border: 1px solid var(--rd-line);
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--rd-surface) 68%, transparent) 42%, transparent 64%);
  background-size: 240% 100%;
  animation: raredex-placeholder-shimmer 1.4s ease-in-out infinite;
}

.selectdex-empty,
.selectdex-error {
  grid-column: 1 / -1;
  margin: 40px auto;
  text-align: center;
}

.selectdex-error .quiet-button {
  margin-top: 12px;
}

.theme-dim .selectdex-section,
[data-theme="moon"] .selectdex-section {
  color: var(--rd-text);
}

@media (max-width: 640px) {
  #mydexProfile .mydex-profile-actions {
    width: 100%;
  }

  #mydexProfile .mydex-profile-actions > .rd-button {
    max-width: 100%;
  }

  .selectdex-section {
    width: min(100% - 28px, 980px);
    margin: 34px auto 46px;
  }

  .selectdex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .selectdex-card {
    min-height: 0;
  }

  .selectdex-avatar {
    top: 10px;
    left: 10px;
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  .selectdex-name {
    font-size: clamp(14px, 4vw, 17px);
  }

  .selectdex-lead { font-size: 14px; }
  .selectdex-copy { min-height: 0; gap: 7px; padding: 10px; }
  .selectdex-count { font-size: 11px; }
  .selectdex-detail { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .selectdex-categories { gap: 3px; }
  .selectdex-category { max-width: 100%; padding: 2px 5px; font-size: 9px; }
  .selectdex-action { justify-self: end; font-size: 10px; }
}
