/* The homepage's loot showcase: a member's soft reserve page drawn in HTML
   (their priority, reserves used and item cards with who else reserved them)
   and the guild's loot history over the window's lower corner. */

@layer layout {
  /* The Blackwing Lair banner is already loaded for the Discord post. */
  .loot-showcase {
    --showcase-art: url("/assets/banners/blackwing-lair-6229c0c0.webp");
  }

  .lp-page {
    display: grid;
    gap: 10px;
    padding: 18px 20px 20px;
    font-size: 12px;
  }

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

  .lp-title {
    margin-top: -6px;
    font-size: 20px;
    font-weight: 700;
  }

  .lp-when {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    color: var(--text-secondary);
  }

  .lp-open {
    padding: 1px 8px;
    border: 1px solid var(--success-border);
    border-radius: 999px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 10px;
    font-weight: 600;
  }

  .lp-status {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2px 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
  }

  .lp-status p:nth-child(2) {
    grid-column: 1;
    color: var(--text-secondary);
    font-size: 11px;
  }

  .lp-used {
    grid-row: 1 / span 2;
    grid-column: 2;
    display: grid;
    justify-items: end;
    color: var(--text-secondary);
  }

  .lp-used-count {
    color: var(--accent);
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
  }

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

  .lp-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .lp-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
  }

  .lp-item.is-mine {
    border-color: var(--accent-border);
    background: var(--bg-warm);
  }

  .lp-page img,
  .lp-history img {
    flex: none;
    border-radius: 5px;
  }

  .lp-item-text {
    display: grid;
    flex: 1;
    gap: 1px;
    min-width: 0;
  }

  .lp-item-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .lp-item-title {
    font-weight: 700;
  }

  .lp-item-name .lp-item-title {
    font-size: 12px;
    line-height: 1.3;
  }

  .lp-history-item .lp-item-title {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  /* Item quality colours, as the dashboard's loot pages show them (loot.css). */
  .lp-page .is-epic,
  .lp-history .is-epic {
    color: #b878ff;
  }

  .lp-page .is-rare,
  .lp-history .is-rare {
    color: #3d9bff;
  }

  .lp-yours {
    flex: none;
    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;
  }

  .lp-reservers {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 8px;
    margin-top: 3px;
    font-size: 10px;
    font-weight: 600;
  }

  /* The reserver viewing the page, ringed; a reserve that no longer counts,
     struck through. */
  .lp-reservers .is-you {
    padding: 0 5px;
    border: 1px solid currentColor;
    border-radius: 999px;
  }

  .lp-reservers .is-gone {
    opacity: 0.6;
    text-decoration: line-through;
  }

  .lp-action {
    flex: none;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 600;
  }

  .lp-action.is-remove {
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--danger);
  }

  /* The loot history, over the window's lower left corner. */
  .loot-showcase .showcase-visual {
    margin-bottom: 136px;
  }

  .lp-history {
    position: absolute;
    bottom: -156px;
    left: -40px;
    width: min(400px, 82%);
    padding: 12px 14px;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--overlay-shadow);
  }

  .lp-history-title {
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .lp-history ol {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .lp-history li {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 0;
  }

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

  .lp-history-item {
    display: grid;
    flex: 1;
    min-width: 0;
    line-height: 1.35;
  }

  .lp-delivery {
    flex: none;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
  }

  .lp-delivery.is-delivered {
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    color: var(--success);
  }

  .lp-delivery.is-waiting {
    border: 1px solid var(--warning-border);
    color: var(--warning);
  }
}

@layer responsive {
  /* Stacked under its copy, there is no gap beside the window: the history
     tucks in under its corner. */
  @media (max-width: 1100px) {
    .loot-showcase .showcase-visual {
      margin-bottom: 0;
    }

    .lp-history {
      position: relative;
      bottom: auto;
      left: auto;
      width: auto;
      margin: -24px 16px 0;
    }
  }

  @media (max-width: 600px) {
    .lp-items {
      grid-template-columns: minmax(0, 1fr);
    }

    .lp-history {
      margin-inline: 8px;
    }
  }

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

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

    .lp-used {
      grid-row: auto;
      grid-column: auto;
      justify-items: start;
    }
  }
}
