/* WordPress compatibility and PHP-theme components. */
:root {
  --wp-admin--admin-bar--height: 0px;
}

html {
  scroll-behavior: smooth;
}

body.admin-bar .site-header {
  top: 32px;
}

.card-hub-mark {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #fff;
  font-size: 1rem;
}

.wp-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.wp-card {
  position: relative;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: inherit;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.wp-card:hover,
.wp-card:focus-visible {
  transform: translateY(-4px);
  border-color: rgb(132 92 255 / 70%);
  box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
}

.wp-card__image {
  display: grid;
  width: 100%;
  aspect-ratio: .74;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 25%, rgb(132 92 255 / 35%), transparent 45%),
    #121624;
  font-size: 3rem;
}

.wp-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wp-card.is-locked .wp-card__image img {
  filter: grayscale(1) brightness(.38);
}

.manage-page {
  min-height: calc(100vh - 68px);
  padding: 58px 0 90px;
  background: var(--bg);
}

.manage-page__hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.manage-page__hero h1 {
  margin-bottom: 12px;
}

.manage-page__hero p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.manage-channel-select {
  width: min(320px, 100%);
  flex: 0 0 auto;
}

.manage-loading {
  display: flex;
  min-height: 260px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
}

.manage-view {
  margin-top: 18px;
}

.manage-toolbar__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.manage-toolbar__actions .search-field {
  width: min(320px, 100%);
}

.manage-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.manage-card {
  min-width: 0;
  overflow: hidden;
}

.manage-card__art {
  display: grid;
  width: 100%;
  aspect-ratio: .74;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 50% 30%, var(--accent-soft), transparent 48%),
    var(--surface-alt);
  color: var(--accent-hover);
  font-size: 3rem;
}

.manage-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manage-card__body {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 14px;
}

.manage-card__body strong,
.manage-card__body small,
.manage-card__body code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manage-card__body small {
  color: var(--muted);
}

.manage-card__body code {
  justify-self: start;
}

.manage-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.manage-list-card {
  min-width: 0;
  padding: 20px;
}

.manage-list-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.manage-list-card__heading > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.manage-list-card__heading small {
  color: var(--muted);
}

.manage-editor {
  max-width: 100vw;
  max-height: 100dvh;
}

.manage-editor .modal__surface {
  display: flex;
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
}

.manage-editor .modal__header,
.manage-editor .modal__footer {
  flex: 0 0 auto;
}

.manage-editor .modal__body {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.manage-editor .form-grid {
  padding-top: 22px;
}

.field--wide {
  grid-column: 1 / -1;
}

.analytics-top {
  display: grid;
  gap: 0;
  margin-top: 16px;
  padding: 20px;
}

.analytics-top > article {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.analytics-top small {
  color: var(--muted);
}

.wp-card__body {
  display: grid;
  padding: .9rem;
  gap: .3rem;
}

.wp-card__body strong,
.wp-card__body small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wp-card__body small {
  color: var(--muted);
}

.wp-card__count {
  position: absolute;
  top: .7rem;
  right: .7rem;
  min-width: 2rem;
  padding: .25rem .5rem;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 999px;
  background: rgb(7 9 16 / 82%);
  color: #fff;
  text-align: center;
  backdrop-filter: blur(12px);
}

.collection-meta {
  display: flex;
  margin-bottom: 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.collection-meta strong {
  color: var(--text);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.leaderboard-table th {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.leaderboard-rank {
  width: 4rem;
  color: #a78bfa;
  font-weight: 800;
}

.settings-card {
  padding: clamp(1.2rem, 3vw, 2rem);
}

.settings-card + .settings-card {
  margin-top: 1rem;
}

.settings-card > header,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.form-actions {
  margin-top: 1rem;
}

.connection-list {
  display: grid;
  gap: .75rem;
}

.connection-item {
  display: flex;
  padding: 1rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.prose-content {
  max-width: 900px;
  margin: 3rem auto;
  padding: clamp(1.4rem, 4vw, 3rem);
}

.prose-content h1 {
  margin-top: .4rem;
}

.modal[open] {
  display: grid;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100dvh;
  padding: min(4vw, 2rem);
  place-items: center;
}

.modal .modal__surface {
  display: flex;
  width: min(920px, 100%);
  max-width: 100%;
  max-height: calc(100dvh - min(8vw, 4rem));
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.modal .modal__header,
.modal .modal__footer {
  flex: 0 0 auto;
}

.modal .modal__body {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

@media (max-width: 782px) {
  body.admin-bar .site-header {
    top: 46px;
  }
}

@media (max-width: 640px) {
  .manage-page {
    padding-top: 34px;
  }

  .manage-page__hero,
  .manage-list-card__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .manage-channel-select,
  .manage-toolbar__actions,
  .manage-toolbar__actions .button,
  .manage-toolbar__actions .search-field {
    width: 100%;
  }

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

  .manage-list-card {
    padding: 16px;
  }

  .manage-list-card .form-grid {
    grid-template-columns: 1fr;
  }

  .manage-editor {
    width: 100vw;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100dvh;
    margin: 0;
  }

  .manage-editor .modal__surface {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    border-radius: 0;
  }

  .manage-editor .modal__footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .manage-editor .modal__footer > span {
    display: none;
  }

  .wp-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
  }

  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) {
    display: none;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: .75rem .5rem;
  }

  .modal[open] {
    padding: 0;
    place-items: stretch;
  }

  .modal .modal__surface {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
