/* The Crafting page (js/views/crafting.js): the crafting board, crafters and
   the skill-up planner. It borrows the Auction House's table (.ah-table:
   sticky sort heads, rows that open their details, cards on phones), the
   Market's cards and item rows (.mk-card, .mk-mat), the Professions tab's
   fields (.pf-*) and the character window's bookmark tabs (.charwin-tab);
   what is its own is here. */

.cr-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.cr-tabs {
  padding: 0;
}

.cr-tab-short {
  display: none;
}

/* Phones: the four tabs in one row, with their short names. */
@media (max-width: 560px) {
  .cr-tabs {
    flex-wrap: nowrap;
    gap: 0.25rem;
  }

  .cr-tab {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    padding: 0.35rem 0.4rem 0.4rem;
    letter-spacing: 0.04em;
  }

  .cr-tab-long {
    display: none;
  }

  .cr-tab-short {
    display: inline;
  }
}

.cr-page {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.cr-page:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
}

.cr-controls .cr-levels {
  flex: 0 1 auto;
}

.cr-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem 1rem;
}

.cr-count {
  padding-bottom: 0;
}

.cr-note,
.cr-foot {
  font-size: var(--fs-small);
  font-style: italic;
  color: var(--text-muted);
}

.cr-foot {
  padding-top: 0.6rem;
  border-top: 1px dotted rgba(212, 175, 55, 0.22);
}

.cr-loading {
  min-height: 30vh;
}

/* --- the recipe table (on .ah-table) ------------------------------------------ */

.cr-table-wrap {
  min-width: 0;
}

.cr-th-text {
  display: flex;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold);
}

.cr-c-skill,
.cr-c-cost,
.cr-c-sell,
.cr-c-profit {
  text-align: right;
  white-space: nowrap;
}

.cr-c-skill .ah-sort,
.cr-c-cost .ah-sort,
.cr-c-sell .ah-sort,
.cr-c-profit .ah-sort {
  justify-content: flex-end;
}

.cr-row > .cr-c-cost,
.cr-row > .cr-c-sell,
.cr-row > .cr-c-profit {
  font-size: var(--fs-small);
}

.cr-row > .cr-c-who {
  min-width: 9rem;
  font-size: var(--fs-small);
}

.cr-who {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.cr-more-names,
.cr-may {
  color: var(--text-faint);
}

.cr-may {
  display: block;
  font-style: italic;
}

.cr-source {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.25rem;
  color: var(--text-muted);
}

.cr-skill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.05rem;
}

/* Orange (learn) › yellow › green › grey, each a coloured dot and its skill. */
.cr-scale {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.15rem 0.3rem;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.cr-scale-arrow {
  opacity: 0.7;
}

.cr-scale-unknown {
  font-style: italic;
}

.cr-scale-part {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.cr-scale .pf-dot,
.cr-band .pf-dot {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
}

/* A material a vendor always sells (js/materials.js): its price is the vendor's. */
.cr-reagent {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cr-vendor-note {
  display: inline-block;
  padding: 0 0.35rem;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--text-muted);
}

.cr-money {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
}

.cr-bound {
  font-weight: 700;
  color: var(--text-muted);
}

.cr-sell {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.cr-sell-note {
  font-size: var(--fs-label);
  font-style: italic;
  color: var(--text-faint);
}

.cr-profit {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
}

.cr-profit .money-num {
  color: var(--text-ok);
}

.cr-loss .money-num,
.cr-sign {
  color: var(--text-bad);
}

.cr-sign {
  font-weight: 700;
}

.cr-ah-link {
  font-weight: 700;
}

.cr-detail {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Phones: a card per recipe (the Auction House's), the money in three columns. */
@media (max-width: 720px) {
  .cr-table .ah-th.cr-c-who {
    display: none;
  }

  .cr-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cr-row > td {
    min-width: 0;
  }

  .cr-row > .cr-c-who {
    grid-row: 2;
    grid-column: 1 / 3;
    min-width: 0;
  }

  .cr-row > .cr-c-skill {
    grid-row: 2;
    grid-column: 3;
  }

  .cr-row > .cr-c-cost {
    grid-row: 3;
    grid-column: 1;
  }

  .cr-row > .cr-c-sell {
    grid-row: 3;
    grid-column: 2;
  }

  .cr-row > .cr-c-profit {
    grid-row: 3;
    grid-column: 3;
  }

  .cr-skill,
  .cr-sell {
    align-items: flex-start;
  }

  .cr-row .money {
    flex-wrap: wrap;
  }
}

/* --- crafters ------------------------------------------------------------------- */

.cr-crafter {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.cr-crafter-head {
  font-size: var(--fs-lead);
}

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

.cr-card {
  gap: 0.9rem;
}

.cr-prof .prof-head {
  font-size: var(--fs-body);
}

.cr-high-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 0.8rem 1.2rem;
}

.cr-high {
  min-width: 0;
}

.cr-high-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.cr-all-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  list-style: none;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-gold);
}

.cr-all-head::-webkit-details-marker {
  display: none;
}

/* A chevron that turns when the list opens (the marker is gone with display: flex). */
.cr-all-head::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--gold-bright);
  border-bottom: 2px solid var(--gold-bright);
  rotate: -45deg;
  transition: rotate var(--t-fast);
}

.cr-all-recipes[open] > .cr-all-head::before {
  rotate: 45deg;
}

.cr-all-head:hover {
  color: var(--text-gold-bright);
}

.cr-all-head:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.cr-all-recipes[open] > .cr-all-head {
  margin-bottom: 0.5rem;
}

.cr-plan-button {
  align-self: flex-start;
}

/* --- the skill-up planner ------------------------------------------------------------ */

.cr-start-field {
  flex: 0 1 8rem;
}

.cr-start {
  display: flex;
  align-items: center;
  min-height: 2.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.cr-target {
  max-width: 9rem;
}

.cr-plan {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.cr-summary {
  padding: 0.85rem 1rem 0.9rem;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--tint-gold), rgba(0, 0, 0, 0.2));
}

.cr-summary-lead {
  font-size: var(--fs-lead);
  font-weight: 700;
  color: var(--text-gold-bright);
}

.cr-summary-range {
  margin-right: 0.15rem;
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.cr-summary-money {
  margin-top: 0.3rem;
  font-size: var(--fs-text);
  line-height: 1.7;
  color: var(--text);
}

.cr-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  counter-reset: cr-step;
}

/* Each step: a numbered medallion, the skill range and colours, what to make. */
.cr-step {
  position: relative;
  min-width: 0;
  padding: 0.65rem 0.85rem 0.75rem 3.1rem;
  border: 1px solid rgba(212, 175, 55, 0.18);
  border-left: 3px solid var(--gold-mid);
  border-radius: var(--radius-sm);
  background: #1c1624;
}

.cr-step::before {
  content: counter(cr-step);
  counter-increment: cr-step;
  position: absolute;
  top: 0.6rem;
  left: 0.65rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: #0d0a12;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 800;
  color: var(--text-gold-bright);
}

.cr-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.8rem;
}

.cr-step-range {
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-strong);
}

.cr-step-bands {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem;
  font-size: var(--fs-small);
}

.cr-arrow {
  color: var(--text-faint);
}

.cr-band {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 700;
}

.cr-band-o { color: var(--text-diff-optimal); }
.cr-band-m { color: var(--text-diff-medium); }
.cr-band-e { color: var(--text-diff-easy); }
.cr-band-t { color: var(--text-diff-trivial); }

.cr-step-what {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
  font-size: var(--fs-text);
  color: var(--text);
}

.cr-step-name {
  font-weight: 700;
  color: var(--quality-color);
  overflow-wrap: anywhere;
}

.cr-step-mats,
.cr-get {
  margin-top: 0.25rem;
  font-size: var(--fs-small);
  color: var(--text);
  overflow-wrap: anywhere;
}

.cr-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(212, 175, 55, 0.22);
}

.cr-get-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.cr-get-item {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--tint-row);
}

.cr-get-name {
  font-size: var(--fs-text);
}

.cr-get-item .cr-get {
  margin-top: 0.1rem;
}

/* "Can't get it" / "Use it again": a small pill at the end of a step's head
   and of a recipe's name line; the recipes left out sit dimmed in their list. */
.cr-get-name,
.cr-skip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.3rem 0.6rem;
}

.cr-skip-head {
  align-items: center;
}

.cr-get-title {
  flex: 1 1 auto;
  min-width: 0;
}

.cr-skip-head .ah-block-title {
  margin-bottom: 0;
}

.cr-skip {
  flex: none;
  min-height: 1.9rem;
  padding: 0.15rem 0.7rem;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 999px;
  background: #0d0a12;
  font-family: inherit;
  font-size: var(--fs-label);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-muted);
  cursor: pointer;
}

.cr-skip:hover {
  border-color: var(--gold);
  color: var(--text-strong);
}

.cr-step-head .cr-skip {
  margin-left: auto;
}

.cr-skipped {
  border-left: 3px solid rgba(212, 175, 55, 0.22);
}

.cr-skipped .cr-step-name {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}

/* --- gear up (js/views/gearup.js) ----------------------------------------------------- */

.gu-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 0.9rem 1.4rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--gold-line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--tint-gold), rgba(0, 0, 0, 0.2));
}

.gu-head {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  grid-column: 1 / -1;
  min-width: 0;
}

.gu-who {
  font-size: var(--fs-lead);
  line-height: 1.35;
}

.gu-who .ah-crafter {
  font-family: var(--font-display);
  font-weight: 800;
}

.gu-who-sub {
  font-size: var(--fs-text);
  color: var(--text-muted);
}

.gu-role {
  font-size: var(--fs-small);
  color: var(--text);
}

.gu-role-tag {
  font-weight: 800;
  color: var(--text-gold);
}

.gu-profs {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.gu-also {
  font-size: var(--fs-small);
  color: var(--text-muted);
}

.gu-worn {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12.5rem), 1fr));
  gap: 0.35rem 0.8rem;
  align-content: start;
  min-width: 0;
}

.gu-slot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.gu-slot .item-tile {
  overflow: visible;
}

.gu-slot .item-tile-img {
  border-radius: 4px;
}

.gu-slot-words {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.gu-slot-name {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--quality-color);
  overflow-wrap: anywhere;
}

.gu-slot-label,
.gu-slot-none {
  font-size: var(--fs-label);
  color: var(--text-faint);
}

.gu-slot-none {
  font-style: italic;
}

.gu-slot-ilvl {
  position: absolute;
  right: -0.4rem;
  bottom: -0.4rem;
  min-width: 1.35rem;
  padding: 0 0.2rem;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  background: #0d0a12;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  color: var(--text-strong);
}

.gu-glyph {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.gu-glyph .slot-glyph {
  width: 70%;
  height: 70%;
  stroke: var(--quality-color);
}

.gu-slot-empty .item-tile {
  border-style: dashed;
  opacity: 0.6;
}

.gu-summary .cr-note {
  margin-top: 0.35rem;
}

.gu-c-skill,
.gu-c-level,
.gu-c-mats,
.gu-c-total {
  text-align: right;
  white-space: nowrap;
}

.gu-row > .gu-c-vs,
.gu-row > .gu-c-recipe,
.gu-row > .gu-c-mats,
.gu-row > .gu-c-total {
  font-size: var(--fs-small);
}

.gu-row > .gu-c-vs {
  min-width: 9rem;
}

.gu-need,
.gu-vs,
.gu-recipe {
  display: inline-flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.3;
}

.gu-need {
  align-items: flex-end;
}

.gu-num {
  font-family: var(--font-display);
  font-size: var(--fs-text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.gu-ok {
  font-weight: 700;
  color: var(--text-ok);
}

.gu-ahead {
  color: var(--text-warn);
}

.gu-sub {
  font-size: var(--fs-label);
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.gu-maybe {
  font-style: italic;
}

.gu-up {
  font-weight: 700;
  color: var(--text-ok);
}

.gu-same {
  color: var(--text-muted);
}

.gu-bop {
  display: inline-block;
  padding: 0 0.35rem;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: var(--text-gold);
}

.gu-price {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.gu-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 0.6rem 1.2rem;
}

.gu-stats {
  min-width: 0;
  padding: 0.55rem 0.75rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--tint-row);
}

.gu-stats-title {
  margin-bottom: 0.25rem;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 800;
  color: var(--text-gold);
  overflow-wrap: anywhere;
}

.gu-stat-lines {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.gu-stat {
  font-size: var(--fs-small);
  color: var(--text);
}

.gu-stat-equip {
  color: var(--text-ok);
}

.gu-stat-none {
  font-style: italic;
  color: var(--text-faint);
}

.gu-score {
  margin-top: 0.3rem;
  font-size: var(--fs-label);
  color: var(--text-muted);
}

/* Narrower: the character panel in one column. */
@media (max-width: 900px) {
  .gu-hero {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones: a card per piece; skill, level and the comparison, then the money. */
@media (max-width: 720px) {
  /* the heads aren't sort buttons here: each card's cells carry their labels */
  .gu-table > thead {
    display: none;
  }

  .gu-worn {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.6rem;
  }

  .gu-row > .gu-c-skill {
    grid-row: 2;
    grid-column: 1;
  }

  .gu-row > .gu-c-level {
    grid-row: 2;
    grid-column: 2;
  }

  .gu-row > .gu-c-vs {
    grid-row: 2;
    grid-column: 3;
    min-width: 0;
  }

  .gu-row > .gu-c-recipe {
    grid-row: 3;
    grid-column: 1;
  }

  .gu-row > .gu-c-mats {
    grid-row: 3;
    grid-column: 2;
  }

  .gu-row > .gu-c-total {
    grid-row: 3;
    grid-column: 3;
  }

  .gu-need {
    align-items: flex-start;
  }

  .gu-hero {
    padding: 0.75rem 0.75rem 0.85rem;
  }
}
