/* The homepage's roster showcase: the Members page's Roster tab drawn in HTML,
   one member opened, and the Ranks card over the window's corner. */

@layer layout {
  .roster-showcase {
    --showcase-art: url("/assets/banners/naxxramas-thumb-c7832485.webp");
  }

  /* The dashboard's select arrow (dashboard/css/forms.css), for the dropdowns. */
  .rp-page {
    --rp-chevron:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23bfb8b0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

    display: grid;
    gap: 12px;
    padding: 18px 20px 20px;
    font-size: 12px;
  }

  .rp-eyebrow {
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .rp-title {
    margin-top: -8px;
    font-size: 18px;
    font-weight: 700;
  }

  .rp-tabs {
    display: flex;
    gap: 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
  }

  .rp-tabs span {
    padding-bottom: 8px;
  }

  .rp-tabs .is-active {
    margin-bottom: -1px;
    border-bottom: 2px solid var(--accent);
    color: var(--text-primary);
    font-weight: 600;
  }

  .rp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .rp-search,
  .rp-select,
  .rp-button {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 11px;
    font-style: normal;
  }

  .rp-search {
    flex: 1 1 140px;
  }

  .rp-select,
  .rp-rank {
    padding-right: 26px;
    background: var(--bg-secondary) var(--rp-chevron) no-repeat right 8px center;
    color: var(--text-secondary);
  }

  .rp-button {
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: 600;
  }

  .rp-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 11px;
  }

  .rp-table {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
  }

  .rp-head,
  .rp-row {
    display: grid;
    grid-template-columns: minmax(0, 2.3fr) minmax(0, 1.5fr) 80px 88px 44px;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
  }

  .rp-head {
    padding-block: 9px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .rp-head .is-sorted {
    color: var(--accent);
  }

  .rp-row {
    border-top: 1px solid var(--border);
  }

  .rp-row.is-open {
    background: var(--bg-elevated);
  }

  .rp-member {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
  }

  .rp-page img {
    flex: none;
    border-radius: 4px;
  }

  .rp-member > span {
    display: grid;
    min-width: 0;
    margin-left: 6px;
    line-height: 1.3;
  }

  .rp-member .preview-character,
  .rp-member small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .rp-page small {
    color: var(--text-muted);
    font-size: 10px;
  }

  .rp-optional .preview-character {
    font-size: 11px;
  }

  .rp-none {
    color: var(--text-muted);
  }

  .rp-rank {
    justify-self: start;
    padding-block: 4px;
    padding-left: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
  }

  .rp-rate {
    display: grid;
  }

  .rp-rate-value {
    font-weight: 700;
  }

  /* The streak has its own column; on phones it moves under the rate. */
  .rp-rate small {
    display: none;
  }

  /* The opened row: the characters and the note, as cards. */
  .rp-details {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
    gap: 10px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg-inset);
  }

  .rp-card {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
  }

  .rp-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .rp-card-title span {
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    letter-spacing: 0;
  }

  .rp-card ul {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .rp-card li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
  }

  .rp-card li + li {
    border-top: 1px solid var(--border);
  }

  .rp-card li > span {
    display: grid;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
  }

  .rp-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .rp-badge {
    padding: 0 5px;
    border: 1px solid var(--success-border);
    border-radius: 4px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 10px;
    font-style: normal;
    font-weight: 600;
  }

  .rp-card .rp-button {
    flex: none;
    min-height: 22px;
    padding: 0 8px;
    font-size: 10px;
  }

  .rp-note {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.5;
  }

  /* The Ranks card, a strip over the window's bottom edge. */
  .rp-ranks {
    position: absolute;
    right: 24px;
    bottom: -34px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--overlay-shadow);
  }

  .rp-ranks .rp-card-title {
    margin: 0;
    color: var(--accent);
  }

  .rp-ranks ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .rp-ranks li {
    display: flex;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 5px;
    background: var(--bg-card);
    font-size: 11px;
  }

  .rp-ranks small {
    color: var(--text-muted);
    font-size: 10px;
  }

  .rp-ranks .is-hidden {
    color: var(--text-muted);
  }
}

@layer responsive {
  /* Too narrow for the strip to sit across the window: it follows it. */
  @media (max-width: 760px) {
    .rp-ranks {
      position: static;
      flex-wrap: wrap;
      margin-top: 12px;
    }
  }

  /* Phones get the dashboard's phone roster: member, rank and rate, the
     streak under the rate. */
  @media (max-width: 600px) {
    .rp-head,
    .rp-row {
      grid-template-columns: minmax(0, 1fr) 76px 86px;
    }

    .rp-optional,
    .rp-count,
    .rp-member img:first-child {
      display: none;
    }

    .rp-rate small {
      display: block;
    }

    .rp-details {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  @media (max-width: 400px) {
    .rp-page {
      padding: 14px 12px 16px;
    }

    .rp-head,
    .rp-row {
      grid-template-columns: minmax(0, 1fr) 70px 86px;
      gap: 6px;
      padding-inline: 8px;
    }

    .rp-head {
      letter-spacing: 0.02em;
    }

    .rp-card .rp-button {
      display: none;
    }
  }
}
