/* web/hud/armory_stage.css
   The Armory (web/hud/armory_stage.js), a tool on the Stage (web/hud/stage.css): its header
   row, the numbers block's cards across both columns (web/hud/armory_block.js,
   armory_defenses.js), then the tabs -- Equipment, Echo Loadout, All Gear -- on the left and what
   the open tab's choice could take on the right (web/hud/armory_columns.js, armory_gear.js), every
   piece with its ⋯ (web/hud/armory_menu.js), each column scrolling on its own, and the whole
   Armory scrolling when the block and the columns do not both fit. Every size
   scales from --am-size: Armory text size, or on Automatic the panels' Text size. Values are
   the Stage's own ink, never white, zeros dimmed; a card is headed in the colour of the panel
   it extends, Character blue or Equipment orange; a change is green when better, red when worse. */

.am {
  --am-size: var(--armory-size, var(--panel-base, var(--mono-size)));
  --am-good: #7fd18e; --am-bad: #e88080; --am-zero: #5d6375; --am-quiet: #8a8f9e;
  --am-gear: #ffaa66; --am-load: #cc99ff; --am-char: #aaddff; --am-gambits: #e6a03c;
  display: flex; flex-direction: column; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
  font: var(--am-size)/1.45 var(--mono); color: var(--stage-ink);
}
.am button { font: inherit; color: inherit; }
.am button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.am .up { color: var(--am-good); }
.am .down { color: var(--am-bad); }

/* ---- the header row: which Echo or build, the job in hand, its actions ------------ */
.am-who { flex: none; position: relative; padding: .6em 1em .5em; border-bottom: 1px solid var(--line); }
.am-whorow { display: flex; align-items: center; gap: .6em; flex-wrap: wrap; }
.am-pick {
  display: inline-flex; align-items: center; gap: .3em; padding: .3em .75em; cursor: pointer;
  border: 1px solid var(--cell-edge); border-radius: 6px; background: var(--cell);
}
.am-pick b { font-weight: 700; color: var(--stage-ink); }
.am-job { color: var(--pn-soft); font-size: .88em; }
.am-job.self { color: var(--stage-armory); font-weight: 600; }
.am-acts { display: inline-flex; gap: .4em; flex-wrap: wrap; margin-left: auto; }
.am-act {
  font-size: .82em !important; background: #1b1e26; border: 1px solid #2c303b; border-radius: 6px;
  padding: .25em .7em; cursor: pointer;
}
.am-act.primary { border-color: var(--stage-armory); color: var(--stage-armory) !important; }
.am-act:disabled { opacity: .45; cursor: default; }
.am-manage, .am-name { display: flex; align-items: center; gap: .4em; flex-wrap: wrap; margin-top: .45em; font-size: .9em; }
.am-name input {
  flex: 0 1 16em; min-width: 0; background: var(--cell); border: 1px solid var(--cell-edge);
  border-radius: 5px; color: var(--ink); font: inherit; padding: .2em .5em;
}
.am-menu {
  position: absolute; z-index: 20; left: 1em; top: 2.7em; min-width: 16em; max-height: 60vh; overflow-y: auto;
  background: #15171e; border: 1px solid var(--cell-edge); border-radius: 8px; box-shadow: 0 10px 30px #000a;
  padding: .35em; display: grid; gap: 1px;
}
.am-mh { font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: .5em .6em .2em; }
.am-menu button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1em;
  text-align: left; background: transparent; border: 0; border-radius: 5px; padding: .35em .6em; cursor: pointer;
}
.am-menu button:hover { background: #1f2229; }
.am-menu button small { flex: none; font-size: .85em; color: var(--dim); white-space: nowrap; }
.am-menu button[aria-current="true"] {
  background: color-mix(in srgb, var(--stage-armory) 14%, transparent); color: var(--stage-armory);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--stage-armory) 60%, transparent);
}
.am-sep { height: 1px; background: var(--line); margin: .3em .2em; }

/* ---- the numbers block: cards --------------------------------------------------- */
/* Values sit beside their labels, never pushed to a card's far edge; a change colours a
   number in place, so no card moves. Defenses and Proficiency share a row when it is wide
   enough, and Proficiency goes under when not. */
.am-block { flex: none; padding: .55em 1em .6em; border-bottom: 1px solid var(--line); container-type: inline-size; }
.am-block > * + * { margin-top: .45em; }
.am-card {
  --tc: var(--am-char); min-width: 0; box-sizing: border-box; padding: .3em .5em .4em;
  background: #15171c; border: 1px solid #262a33; border-radius: 6px;
}
.am-card.am-eq { --tc: var(--am-gear); }
.am-card h6 {
  margin: 0 0 .3em; padding: 0 0 .2em; font: 700 .95em var(--mono); letter-spacing: .02em; color: var(--tc);
  border-bottom: 1px solid color-mix(in srgb, var(--tc) 28%, transparent);
}
.am-block b { font-weight: 600; color: var(--stage-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.am-block b.zero { color: var(--am-zero); font-weight: 400; }
.am-trow { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .45em; }
.am-trow > .am-card { flex: 1 1 auto; }
.am-sl { display: grid; grid-template-columns: max-content max-content; column-gap: .75em; line-height: 1.4; }
.am-sl > span { color: var(--dim); white-space: nowrap; }
.am-sl > b { text-align: right; }
.am-gl { display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-start; gap: .1em 1.4em; line-height: 1.4; }
.am-gt { white-space: nowrap; color: var(--stage-ink); }
.am-gt.sk { color: var(--am-load); }
.am-gt.gained { color: var(--am-good); }
.am-gt.lost { color: var(--am-bad); text-decoration: line-through; }
.am-gl .none { color: var(--am-zero); }
.am-prrow { display: flex; flex-direction: column; gap: .45em; }
@container (min-width: 52em) {
  .am-prrow { flex-direction: row; align-items: stretch; }
  .am-prrow > .am-def { flex: none; }
  .am-prrow > .am-profs { flex: 1 1 18em; }
}
.am-dtab { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3em 1.2em; }
.am-dgrp { display: grid; grid-template-columns: repeat(4, max-content); column-gap: .6em; align-content: start; line-height: 1.4; }
.am-dh {
  align-self: end; padding-bottom: .1em; text-align: right; font: 600 .72em var(--mono); color: var(--pn-label);
  text-transform: uppercase; letter-spacing: .05em;
}
.am-dn { color: var(--dim); white-space: nowrap; }
.am-dn.head { color: var(--stage-ink); font-weight: 600; }
.am-dgrp b { text-align: right; }
.am-dgrp .am-solo { border-top: 1px solid #2c303b; margin-top: .2em; padding-top: .15em; }
.am-prof { min-width: 0; }
.am-pl { display: flex; gap: .55em; align-items: baseline; line-height: 1.4; }
.am-pl + .am-pl { border-top: 1px solid #2c303b; margin-top: .15em; padding-top: .15em; }
.am-pl .am-letter { flex: none; width: 1em; }
.am-pn { min-width: 0; color: #cfd3dc; }
.am-pn .trained { color: var(--am-good); }
.am-pn small { color: var(--am-quiet); }
.am-pn .up, .am-pn .down { font-weight: 600; }

/* ---- the columns ---------------------------------------------------------------- */
/* The columns keep 22em; when the block and they do not both fit, the whole Armory scrolls. */
.am-cols { flex: 1 1 auto; min-height: 22em; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.am-col {
  min-width: 0; overflow-x: hidden; overflow-y: auto; padding: .5em .6em .8em;
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
.am-left { border-right: 1px solid var(--line); }
.am-sect { --tc: var(--stage-ink); margin-bottom: .6em; }
.am-sect.am-gear { --tc: var(--am-gear); }
.am-sect.am-load { --tc: var(--am-load); }
.am-sect h5 {
  margin: 0 0 .3em; padding: .3em .2em .25em; font: 700 1em var(--mono); color: var(--tc);
  border-bottom: 1px solid color-mix(in srgb, var(--tc) 28%, transparent);
  display: flex; align-items: center; gap: .4em;
}
.am-letter { font-weight: 700; font-size: .9em; text-align: center; }
.am-dot { color: var(--am-zero); }
.am-letter.moved { outline: 1px solid var(--am-good); outline-offset: 1px; border-radius: 3px; }
.am-letter.moved.worse { outline-color: var(--am-bad); }
.am-row {
  display: grid; grid-template-columns: 1.1em 22px minmax(0, 1fr); gap: .5em; align-items: center;
  width: 100%; box-sizing: border-box; padding: .2em .35em; border: 1px solid transparent; border-radius: 5px;
  background: transparent; cursor: pointer; text-align: left;
}
.am-row:hover { background: #1c1f27; }
.am-row[aria-pressed="true"], .am-row.on {
  border-color: color-mix(in srgb, var(--tc) 70%, transparent); background: color-mix(in srgb, var(--tc) 9%, transparent);
}
.am-nm { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-nm.empty { color: var(--am-zero); font-style: italic; }
.am-nm.gone { color: var(--pn-faint); text-decoration: line-through; }
.am-row .gear-icon.am-dim { opacity: .4; }
.am-row.am-lo { grid-template-columns: 5.6em minmax(0, 1fr); }
.am-lab { color: var(--pn-label); font-size: .88em; }
.am-row.fixed { cursor: default; opacity: .75; }
.am-row.fixed:hover { background: transparent; }
.am-row.fixed .am-nm.empty { font-style: normal; }
.am-opt {
  display: grid; grid-template-columns: 1.1em 22px minmax(0, 1fr); gap: .5em; align-items: center;
  width: 100%; box-sizing: border-box; padding: .35em .5em; margin-bottom: .3em; cursor: pointer; text-align: left;
  border: 1px solid #262a33; border-radius: 6px; background: #15171c;
}
.am-opt.plain, .am-opt.am-remove { grid-template-columns: minmax(0, 1fr); }
.am-opt:hover:not(:disabled):not(.off) { border-color: #3a3f4c; }
.am-opt[aria-pressed="true"] { border-color: var(--stage-armory); background: #18201a; }
.am-opt.worn { background: #18201a; }
.am-opt.on { border-color: var(--stage-armory); }
.am-opt:disabled, .am-opt.off { cursor: default; opacity: .55; }
.am-note { margin: .3em .5em; color: var(--dim); }

/* A piece's row: what a click picks, then its ⋯ (web/hud/armory_menu.js), faint until pointed at. */
.am-row.am-pc, .am-opt.am-pc { grid-template-columns: minmax(0, 1fr) 1.6em; gap: 0; padding: 0; cursor: default; }
.am-hit {
  display: grid; grid-template-columns: 1.1em 22px minmax(0, 1fr); gap: .5em; align-items: center; min-width: 0;
  width: 100%; box-sizing: border-box; background: transparent; border: 0; border-radius: 5px; text-align: left; cursor: pointer;
}
.am-row.am-pc > .am-hit { padding: .2em .35em; }
.am-opt.am-pc > .am-hit { padding: .35em .5em; }
.am-hit:disabled { cursor: default; }
.am .am-dots {
  align-self: stretch; padding: 0; border: 0; border-radius: 4px; background: none; line-height: 1;
  color: var(--am-quiet); opacity: .45; cursor: pointer;
}
.am-pc:hover .am-dots, .am .am-dots:focus-visible, .am .am-dots[aria-expanded="true"] { opacity: 1; }
.am .am-dots:hover { background: #262a33; color: var(--stage-ink); }

/* ---- the tabs: Equipment, Echo Loadout, All Gear ----------------------------------- */
/* Each a small card with rounded top corners; the open one tinted in its colour with a
   coloured top edge, opening into its list. They wrap when the column is narrow. */
.am-tabs { display: flex; flex-wrap: wrap; gap: .15em; margin: 0 0 .5em; border-bottom: 1px solid #2c303b; }
.am .am-tab {
  --tc: var(--stage-ink); position: relative; font: 700 .9em var(--mono); white-space: nowrap; cursor: pointer;
  background: #15171c; border: 1px solid #262a33; border-bottom: 0; border-radius: 6px 6px 0 0;
  padding: .3em .38em .25em; color: var(--dim);
}
.am .am-tab.gear, .am .am-tab.all { --tc: var(--am-gear); }
.am .am-tab.load { --tc: var(--am-load); }
.am .am-tab.gam { --tc: var(--am-gambits); }
.am .am-tab:hover { color: color-mix(in srgb, var(--tc) 65%, #c9ccd6); background: #1b1e26; }
.am .am-tab[aria-selected="true"] {
  color: var(--tc); background: color-mix(in srgb, var(--tc) 12%, #15171c);
  border-color: color-mix(in srgb, var(--tc) 55%, #262a33); box-shadow: inset 0 2px 0 var(--tc);
}
.am .am-tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: color-mix(in srgb, var(--tc) 12%, #15171c);
}

/* ---- All Gear (web/hud/armory_gear.js) ------------------------------------------- */
.am-allg { position: relative; }
.am .am-cog {
  position: absolute; top: .15em; right: .1em; z-index: 1; padding: 0 .3em; border: 0; border-radius: 4px;
  background: none; color: var(--am-quiet); line-height: 1.3; cursor: pointer;
}
.am .am-cog:hover, .am .am-cog[aria-expanded="true"] { color: var(--stage-ink); background: #262a33; }
.am-vopts { display: flex; flex-wrap: wrap; gap: .3em .9em; margin: .15em 2em .35em 0; font-size: .85em; }
.am-vopts label { display: flex; gap: .35em; align-items: center; color: var(--pn-label); }
.am-vopts select {
  font: inherit; background: #1b1e26; color: var(--ink); border: 1px solid #2c303b; border-radius: 4px; padding: 0 2px;
}
.am-fold > summary {
  cursor: pointer; color: var(--pn-label); font: 600 .78em var(--mono); text-transform: uppercase;
  letter-spacing: .06em; padding: .5em 2em .3em 0;
}
.am-fold > summary small { margin-left: .4em; color: var(--am-zero); }
.am-lv, .am-qty { color: #6b7180; font-size: .8em; white-space: nowrap; }
.am-lv { margin-left: .45em; }
.am-sect h5.am-phead { flex-wrap: wrap; row-gap: .3em; }
.am-phead .am-pname { display: inline-flex; flex: 1 1 9em; gap: .4em; align-items: center; min-width: 0; }
.am-phead .am-pname .am-nm { color: var(--stage-ink); }
.am .am-phead .am-act { font-size: .8em; padding: .15em .8em; }
.am-phead .am-dots { align-self: center; width: 1.6em; height: 1.4em; }
.am .am-act.cant { opacity: .45; cursor: not-allowed; }
.am-pcard {
  margin: .3em 0 .6em; padding: .55em .7em; border: 1px solid #3a3f4b; border-radius: 6px;
  background: var(--tip-bg, #12141a); color: var(--pn-text); line-height: 1.45;
}
.am-pcard .tap-card { padding: 0; overflow: visible; max-height: none; white-space: normal; }

/* ---- the ⋯ menu's own parts (web/hud/armory_menu.js), in the click menu ------------ */
.bm-menu .mi.am-sub, .bm-menu .am-subnote { padding-left: 1.5em; }
.bm-menu .mi.am-sub .bm-name { flex: none; }
.bm-menu .mi.am-sub .bm-meta {
  flex: 0 1 auto; min-width: 0; margin-left: auto; padding-left: 1.2em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bm-input.am-bid { align-items: center; flex-wrap: wrap; padding-left: 1.5em; }
.am-bid-label { color: var(--pn-label); font-size: .85em; white-space: nowrap; }
.bm-input.am-bid input { flex: 0 1 5em; }
.am-bid select {
  font: inherit; font-size: .9em; background: var(--cell); color: var(--ink);
  border: 1px solid var(--cell-edge); border-radius: 4px; padding: 1px 4px;
}
/* The Gambits tab (web/hud/armory_gambits.js): the panel's board in the amber of its panel, and the
   picked cell's choices in the click menu's look, laid in the column rather than floated. */
.am .gb, .am-sect.am-gam { --tc: var(--am-gambits); --pn-text: var(--stage-ink); }
.am .gb-cell.on { border-color: var(--tc); }
.am .gb-switch { margin-bottom: .5em; }
.am-gb-menu.menu.bm-menu {
  position: static; display: block; max-width: none; min-width: 0; box-shadow: none; background: none;
  border: 0; padding: 0; font-size: 1em; max-height: none; overflow: visible;
}
.am-gb-menu .mhead { white-space: normal; }
.am-lock { margin: .2em .3em .5em; color: var(--warn); font-size: .9em; }
.am-refusal { flex: none; margin: 0; padding: 0 1em; color: var(--warn); font-size: .88em; }
.am-refusal:not(:empty) { padding: .4em 1em; border-top: 1px solid var(--line); }
