/* The public Gear Optimizer (/gear-optimizer/, js/site/gear-optimizer.js). On top of style.css (its gear-* classes,
   cards, dialogs, chips) and content.css (the public site's shell). */

/* the page takes the header's whole width, not the public pages' reading column */
body[data-page="gear-optimizer"] main.front > #content,
body[data-page="gear-optimizer"] main.front > noscript {
  max-width: none;
}
.opt-intro {
  max-width: 820px;
  margin: -6px 0 18px;
  color: var(--muted);
}

.card-title {
  margin: 0 0 12px;
  font-size: 17px;
}
.opt-layout .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 12px;
  margin-bottom: 10px;
  align-items: end;
}
.opt-layout .form-grid.opt-grid4 {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}
.opt-layout .gear-form {
  max-height: none;
}
@media (min-width: 1100px) {
  /* the form is long: it scrolls on its own beside the answer */
  .opt-layout .gear-form {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: thin;
  }
}
.opt-sub {
  margin: 12px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 12px;
}
.opt-sub:first-of-type {
  margin-top: 0;
}
.opt-mode-row,
.opt-preset-row {
  margin: 4px 0 10px;
}
.opt-mode-row .seg,
.opt-preset-row .seg {
  display: flex;
  flex-wrap: wrap;
}
.opt-mode-row .seg button,
.opt-preset-row .seg button {
  flex: 1 1 auto;
}
.opt-preset-row .seg button + button {
  border-left: 1px solid var(--border-strong);
}
.opt-orbs {
  margin: 0 0 8px;
}
.opt-attrs > .check {
  margin: 4px 0 8px;
}
.opt-layout [hidden] {
  display: none !important;
}
.gear-checks .check {
  align-items: flex-start;
}
.gear-checks .check input {
  margin-top: 3px;
}

/* where a piece comes from */
.opt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0 2px;
}
.opt-chip {
  display: inline-block;
  max-width: 100%;
  padding: 1px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.opt-chip.exp {
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 650;
}
.opt-chip.boss {
  border-color: var(--rose);
  color: var(--rose-bright);
}
.opt-chip.quest {
  border-color: var(--good);
  color: var(--good);
}
.opt-chip.craft {
  color: var(--text);
}
.opt-chip.event,
.opt-chip.unlisted {
  border-color: var(--warn);
  color: var(--warn);
}

/* the slots */
.opt-slot.pinned {
  border-color: var(--gold);
}
.opt-slot.unmet {
  border-color: var(--bad);
}
.gear-status.opt-pin {
  background: var(--gold-wash);
  color: var(--gold);
}
.opt-warn {
  color: var(--bad);
}
.opt-slot-actions {
  display: flex;
  gap: 14px;
  margin-top: 6px;
}
.opt-alt {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.opt-alt .gear-piece {
  margin-top: 0 !important;
}
.opt-alt-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 10px;
  margin-left: 40px;
}
.opt-alt-foot .opt-chips {
  margin: 2px 0;
  min-width: 0;
}
.opt-mini {
  display: inline-flex;
  gap: 10px;
  font-size: 12px;
}
.opt-mini .btn.link,
.opt-slot-actions .btn.link {
  font-size: 13px;
}
.opt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.opt-list {
  margin: 0 0 10px;
  padding-left: 18px;
}
.opt-list li {
  margin: 3px 0;
}
.opt-dialog h4 {
  margin: 12px 0 6px;
  font-size: 14px;
  color: var(--gold);
}

/* the planned attributes */
.opt-plan {
  border-color: var(--gold);
  background: linear-gradient(0deg, var(--gold-wash), var(--gold-wash)), var(--surface);
}
.opt-plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 10px;
}
.opt-plan-attrs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.opt-attr .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.opt-attr .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.opt-kept p {
  margin: 0 0 6px;
}
.opt-kept .btn.link {
  font-weight: 600;
}

/* as you level */
.opt-path summary {
  cursor: pointer;
}
.opt-path-body {
  margin-top: 12px;
}
.opt-steps {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}
.opt-steps > li {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.opt-step-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-bottom: 6px;
}
.opt-step-level {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold);
  min-width: 82px;
}
.opt-step-head .gear-score {
  margin-left: auto;
}
.opt-step-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.opt-step-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.opt-step-slot {
  min-width: 82px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

@media (max-width: 640px) {
  .opt-alt-foot {
    margin-left: 0;
  }
  .opt-step-slot {
    min-width: 0;
    width: 100%;
  }
}

/* the form column is narrow: a long stat name ("Constitution") breaks as a word, not between two letters */
.opt-layout .gear-stat .check {
  overflow-wrap: normal;
  hyphens: auto;
}

.opt-jump {
  width: 100%;
  margin-bottom: 14px;
}
@media (min-width: 1100px) {
  .opt-jump {
    display: none;
  }
}

/* ---------------------------------------------------------------- builds: sharing, the build's card, publishing */
body[data-page="builds"] main.front > #content,
body[data-page="builds"] main.front > noscript {
  max-width: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.opt-sharebar {
  padding: 12px 14px;
}
.opt-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opt-share-field,
.opt-share-text {
  width: 100%;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.opt-share-text {
  resize: vertical;
}
.opt-share-note {
  margin: 8px 0 0;
  min-height: 0;
}
.opt-share-note:empty {
  display: none;
}
.opt-share-note.good {
  color: var(--good);
}
.opt-share-note.bad {
  color: var(--bad);
}

.opt-build {
  border-color: var(--border-strong);
}
.opt-build.verified,
.opt-card.verified {
  border-color: var(--gold);
  background: linear-gradient(0deg, var(--gold-wash), var(--gold-wash)), var(--surface);
}
.opt-build.share p {
  margin: 0;
}
.opt-build-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.opt-build-main {
  min-width: 0;
}
.opt-build-title {
  margin: 4px 0 2px;
  font-size: clamp(20px, 3vw, 26px);
  overflow-wrap: anywhere;
}
.opt-build-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.opt-badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.opt-badge.verified {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-wash);
}
.opt-badge.member {
  margin-left: 6px;
  border-color: var(--rose);
  color: var(--rose-bright);
}
.opt-badge.warn {
  border-color: var(--warn);
  color: var(--warn);
}
.opt-vote {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  line-height: 1.1;
  font-weight: 700;
}
.opt-vote .opt-vote-n {
  font-variant-numeric: tabular-nums;
}
.opt-vote.on {
  border-color: var(--rose);
  background: var(--rose-wash);
  color: var(--rose-bright);
}
.btn.small.opt-vote {
  flex-direction: row;
  gap: 6px;
  min-width: 0;
}
.opt-verified-note {
  margin: 10px 0 0;
  color: var(--gold);
}
.opt-build-notes {
  margin-top: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.opt-changed {
  margin: 10px 0 0;
  color: var(--warn);
}
.opt-build-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.opt-curator {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}
.opt-curator-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.opt-curator-row input {
  flex: 1 1 240px;
  min-width: 0;
}
.opt-form {
  display: grid;
  gap: 12px;
}
.opt-form textarea {
  width: 100%;
  resize: vertical;
}
.opt-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.opt-form [hidden] {
  display: none !important;
}
/* the honeypot: out of sight, out of the tab order */
.opt-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0;
}
.opt-form-dialog {
  width: min(640px, calc(100vw - 24px));
}

/* comparing */
.opt-compare .table-wrap {
  margin: 10px 0;
}
table.opt-cmp {
  width: 100%;
}
.opt-cmp .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.opt-cmp .plus {
  color: var(--good);
}
.opt-cmp .minus {
  color: var(--bad);
}
.opt-cmp-diff td {
  background: var(--rose-wash);
}
.opt-cmp-total td {
  font-weight: 700;
}
.opt-cmp .item-link .cell-sub {
  display: none;
}

/* ---------------------------------------------------------------- the Builds page */
.opt-builds-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.opt-tabs {
  display: flex;
  flex-wrap: wrap;
}
.opt-filters[hidden] {
  display: none;
}
.opt-builds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.opt-builds > .card,
.opt-builds > .notice {
  grid-column: 1 / -1;
}
.opt-builds > .opt-card {
  grid-column: auto;
  display: flex;
  flex-direction: column;
  margin: 0;
}
.opt-card.hidden-build {
  border-style: dashed;
}
.opt-card-title {
  margin: 6px 0 2px;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.opt-card-title a {
  color: inherit;
}
.opt-card-pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 34px;
  margin: 8px 0 4px;
}
.opt-card-piece.empty {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}
.opt-card-attrs {
  margin: 0 0 4px;
}
.opt-card-notes {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
  color: var(--muted);
}
.opt-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
}
@media (max-width: 640px) {
  .opt-builds {
    grid-template-columns: 1fr;
  }
}

/* how to get it all */
.opt-plan-card summary {
  cursor: pointer;
}
.opt-route {
  margin: 10px 0 8px;
  padding: 0;
  list-style: none;
  counter-reset: route;
}
.opt-route li {
  display: grid;
  grid-template-columns: 74px minmax(0, 15em) minmax(0, 1fr);
  gap: 4px 10px;
  align-items: baseline;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.opt-route .opt-chip {
  justify-self: start;
}
.opt-route-way {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.opt-route-pieces .btn.link {
  font-weight: 500;
}
@media (max-width: 640px) {
  .opt-route li {
    grid-template-columns: 74px minmax(0, 1fr);
  }
  .opt-route-pieces {
    grid-column: 1 / -1;
  }
}

.opt-filter-checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: -4px 0 14px;
}
.opt-badge.starter {
  border-color: var(--good);
  color: var(--good);
}

/* the town to align to (its +1 is the only way to 101) */
.opt-town {
  margin: -2px 0 10px;
  font-size: 14px;
}
.opt-town.on strong {
  color: var(--gold);
}
.opt-town-mark {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
}

/* choosing a piece yourself */
.opt-slot-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.opt-choose {
  min-height: 0;
  padding: 2px 10px;
}
.opt-alts {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.opt-alts-head {
  margin-bottom: 4px;
}
.opt-alts .opt-alt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  border-top: 0;
}
.opt-alts .opt-alt .item-link {
  min-width: 0;
}
.opt-all {
  margin-top: 6px;
  width: 100%;
}
.opt-picker {
  padding-top: 12px;
}
.opt-pick-now {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.opt-pick-cur {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.opt-pick-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}
.opt-pick-tools input {
  min-width: 0;
}
.opt-pick-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0 4px;
}
.opt-pick-count {
  margin: 6px 0;
}
.opt-pick-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.opt-pick-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
}
.opt-pick-row:first-child {
  border-top: 0;
}
.opt-pick-row:hover {
  background: var(--surface-2);
}
.opt-pick-row.current {
  background: var(--gold-wash);
}
.opt-pick-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.opt-pick-main:hover .item-name,
.opt-pick-main:focus-visible .item-name {
  color: var(--rose-bright);
  text-decoration: underline;
}
.opt-pick-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.opt-pick-text .opt-badge {
  margin-left: 6px;
}
.opt-pick-none {
  padding: 12px;
}
@media (max-width: 640px) {
  .opt-pick-tools {
    grid-template-columns: 1fr;
  }
  .opt-pick-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .opt-pick-row > .btn {
    display: none;
  }
}
