/* The homepage's crafting showcase: a server's crafters page drawn in HTML
   (profession chips, a search and recipes with who can craft them) and a
   character's card from the crafting page over the window's lower corner. */

@layer layout {
  .crafting-showcase {
    --showcase-art: url("/assets/banners/zul-gurub-thumb-3dc63787.webp");
  }

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

  .cp-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

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

  .cp-title {
    font-size: 20px;
    font-weight: 700;
  }

  .cp-button {
    flex: none;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    font-size: 11px;
    font-weight: 600;
  }

  .cp-page img,
  .cp-mine img {
    flex: none;
    border-radius: 4px;
  }

  /* The profession and Has crafters chips; the chosen one is warm, as on the
     page (crafting/crafting.css). */
  .cp-chips,
  .cp-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .cp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 11px;
  }

  .cp-chip.is-on {
    border-color: var(--accent-border);
    background: var(--bg-warm);
    color: var(--accent);
  }

  .cp-search {
    flex: 1;
    min-width: 120px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    font-size: 11px;
  }

  /* The typing cursor after the search word. */
  .cp-search::after {
    content: "";
    display: inline-block;
    width: 1px;
    height: 1.1em;
    margin-left: 1px;
    background: var(--accent);
    vertical-align: text-bottom;
  }

  .cp-section {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .cp-section span {
    margin-left: 4px;
    color: var(--text-muted);
  }

  .cp-recipes {
    display: grid;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    list-style: none;
  }

  .cp-recipe {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 4px 10px;
    padding: 10px 12px;
  }

  .cp-recipe + .cp-recipe {
    border-top: 1px solid var(--border);
  }

  .cp-recipe-text {
    display: grid;
    min-width: 0;
    line-height: 1.35;
  }

  .cp-recipe-text .cp-recipe-name {
    overflow: hidden;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .cp-recipe-text small::before {
    content: "▸ ";
  }

  .cp-skill {
    color: var(--text-secondary);
    font-size: 11px;
  }

  .cp-count {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    font-size: 11px;
    font-weight: 600;
  }

  .cp-count.is-open {
    border-color: var(--accent-border);
    color: var(--accent);
  }

  /* The opened recipe's crafters, under its name. */
  .cp-crafters {
    display: flex;
    grid-column: 2 / -1;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
  }

  .cp-crafters ul {
    display: grid;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .cp-crafters li {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .cp-crafters small {
    color: var(--text-secondary);
    font-size: 11px;
  }

  .cp-member {
    color: var(--text-muted);
    font-size: 11px;
  }

  .cp-copy {
    flex: none;
    color: var(--text-secondary);
    font-size: 11px;
  }

  /* The crafting page's character card, over the window's lower right corner. */
  .crafting-showcase .showcase-visual {
    margin-bottom: 150px;
  }

  .cp-mine {
    position: absolute;
    right: -40px;
    bottom: -170px;
    width: min(330px, 76%);
    padding: 12px 14px;
    border: 1px solid var(--border-warm);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--overlay-shadow);
    font-size: 12px;
  }

  .cp-character {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .cp-character-name {
    display: grid;
    flex: 1;
    line-height: 1.3;
  }

  .cp-character-name small {
    color: var(--text-muted);
    font-size: 10px;
  }

  .cp-profession {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 11px;
  }

  .cp-skill-level {
    margin-left: 2px;
    color: var(--text-primary);
    font-weight: 600;
  }

  .cp-ticks {
    display: grid;
    gap: 7px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
  }

  .cp-ticks li {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cp-ticks .cp-recipe-name {
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* A checkbox: empty, or ticked with the accent. A trainer recipe's is dimmed,
     as the page disables it. */
  .cp-box {
    flex: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--border-hover);
    border-radius: 3px;
    background: var(--bg-card);
  }

  .cp-box.is-ticked {
    border-color: var(--accent);
    background: var(--accent)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23171717' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-9'/%3E%3C/svg%3E")
      center / 11px no-repeat;
  }

  .cp-ticks .is-trainer .cp-box {
    opacity: 0.55;
  }

  .cp-tag {
    flex: none;
    padding: 0 5px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
  }
}

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

    .cp-mine {
      position: relative;
      right: auto;
      bottom: auto;
      width: auto;
      margin: -24px 16px 0;
    }
  }

  @media (max-width: 600px) {
    .cp-mine {
      margin-inline: 8px;
    }

    .cp-crafters {
      flex-direction: column;
      align-items: flex-start;
    }
  }

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

    .cp-head .cp-button {
      display: none;
    }

    .cp-recipe {
      grid-template-columns: 28px minmax(0, 1fr) auto;
    }

    .cp-skill {
      display: none;
    }

    .cp-character {
      flex-wrap: wrap;
    }
  }
}
