/* Inventory rows and item inspection. Loaded after the reading and armory styles. */
#gear-items.gear-slot-table {
  --gear-ink: #e6d9b9;
  --gear-muted: #a7b1b7;
  --gear-metal: #7b7666;
  --gear-well: #10171d;
  display: block;
  width: 100%;
  min-width: 0;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid #4b514f;
  background: #10171d;
  box-shadow: inset 0 1px #b8ac7920;
}

#gear-items .gear-slot-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid #3c4648;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
#gear-items .gear-slot-row:last-child { border-bottom: 0; }
#gear-items .slot-unique { flex: 1 1 220px; align-self: center; max-width: 440px; color: #a7b1b7; font-size: 12px; line-height: 1.6; }
#gear-items .gear-slot-row:nth-child(even) { background: #182026; }
#gear-items .slot-heading {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 7px;
  padding: 24px 18px;
  border-right: 1px solid #424b4c;
  background: #080e1233;
}
#gear-items .slot-heading h4 {
  margin: 0;
  color: #e1d5b8;
  font: 500 19px/1.3 var(--display, Georgia, serif);
  overflow-wrap: anywhere;
}
#gear-items .slot-heading small {
  display: block;
  color: #a8b0ad;
  font: 400 11px/1.5 var(--sans, 'Segoe UI', sans-serif);
  text-transform: none;
  letter-spacing: 0;
}
#gear-items .gear-options {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  align-content: flex-start;
  gap: 12px 14px;
  min-width: 0;
  padding: 16px 18px;
}

.gear-choice,
.game-item-tooltip { --quality: #ffffff; --quality-text: #ededeb; }
.gear-choice[data-quality='uncommon'],
.game-item-tooltip[data-quality='uncommon'] { --quality: #1eff00; --quality-text: #80df67; }
.gear-choice[data-quality='rare'],
.game-item-tooltip[data-quality='rare'] { --quality: #0070dd; --quality-text: #75bdff; }
.gear-choice[data-quality='epic'],
.game-item-tooltip[data-quality='epic'] { --quality: #a335ee; --quality-text: #c88cff; }

#gear-items .gear-choice {
  position: relative;
  display: flex;
  flex: 0 0 142px;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: 142px;
  min-width: 0;
  min-height: 155px;
  max-width: none;
  padding: 8px 7px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  box-shadow: none;
  color: #c3c8c6;
  font: 400 12px/1.4 var(--sans, 'Segoe UI', sans-serif);
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}
#gear-items .gear-choice:hover {
  border-color: #727469;
  background: #26333d;
}
#gear-items .gear-choice:active { background: #111c26; box-shadow: inset 0 2px 7px #0009; }
#gear-items .gear-choice:focus-visible {
  outline: 3px solid #b1dbff;
  outline-offset: 3px;
  background: #26333d;
}
#gear-items .gear-choice[aria-expanded='true'],
#gear-items .gear-choice[aria-pressed='true'] {
  border-color: #e2c67e;
  background: #293039;
  box-shadow: inset 0 -2px #b49451;
}
#gear-items .gear-choice[data-primary='true'] .choice-tag {
  color: #ecd291;
  border-color: #8f794e;
  background: #322d21;
}
#gear-items .gear-choice.is-owned .item-art::before {
  border-color: #c2d58e;
  box-shadow: 0 0 8px #92b26b55;
}

/* The authentic 68px frame covers a 56px icon at 6,6. Never inherit details img sizing. */
#gear-items .item-art,
#gear-dialog .item-art {
  position: relative;
  display: block;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  max-width: none;
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #05090d;
  overflow: visible;
  isolation: isolate;
}
#gear-items .item-art::before,
#gear-dialog .item-art::before {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 3px;
  border: 2px solid var(--quality, #a69d82);
  border-radius: 3px;
  box-shadow: 0 0 7px #000b;
  pointer-events: none;
}
#gear-items .item-art::after,
#gear-dialog .item-art::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 68px;
  height: 68px;
  background: url('assets/ui/wowhead-icon-frame.png') center / 68px 68px no-repeat;
  pointer-events: none;
}
#gear-items .item-art > img,
#gear-dialog .item-art > img {
  position: absolute;
  z-index: 0;
  top: 6px;
  left: 6px;
  display: block;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  max-width: none;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#gear-items .choice-name {
  display: block;
  width: 100%;
  color: var(--quality-text);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-wrap: balance;
  text-shadow: 0 1px 1px #000;
}
#gear-items .choice-stats {
  display: block;
  width: 100%;
  color: #bac6ba;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
#gear-items .choice-tag {
  display: block;
  max-width: 100%;
  padding: 2px 6px;
  margin-top: auto;
  border: 1px solid #505a60;
  border-radius: 2px;
  background: #192229;
  color: #b9c4ca;
  font-size: 10px;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}
#gear-items .slot-empty {
  align-self: center;
  margin: 0;
  padding: 16px 8px;
  color: #a7b1b7;
  font-size: 13px;
  line-height: 1.6;
}

#gear-dialog {
  box-sizing: border-box;
  width: min(940px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 0;
  border: 1px solid #827b69;
  border-radius: 3px;
  background: #161c24;
  color: #d4d5d3;
  box-shadow: 0 0 0 3px #101318, 0 0 0 4px #4c514e, 0 22px 80px #000c;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #6b716b #101720;
  scrollbar-width: thin;
}
#gear-dialog::backdrop { background: #05090de8; backdrop-filter: blur(3px); }
#gear-dialog .item-dialog-shell {
  position: relative;
  min-width: 0;
  padding: 14px 22px 24px;
  background: linear-gradient(#252b31 0, #171e26 74px, #121923 100%);
}
#gear-dialog-close {
  position: sticky;
  z-index: 5;
  top: 10px;
  float: right;
  display: grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  margin: 0 0 12px 12px;
  padding: 0;
  border: 1px solid #ab8d60;
  border-radius: 2px;
  background: linear-gradient(#803f38, #432020);
  box-shadow: inset 0 1px #b7836266, inset 0 -2px #200e0c;
  color: #ffebbc;
  font: 400 25px/1 var(--sans, 'Segoe UI', sans-serif);
  cursor: pointer;
}
#gear-dialog-close:hover { background: linear-gradient(#a35042, #642b25); border-color: #e3c789; }
#gear-dialog-close:focus-visible,
#gear-dialog a:focus-visible,
#gear-dialog input:focus-visible { outline: 3px solid #b1dbff; outline-offset: 4px; }
#gear-dialog-content { clear: both; min-width: 0; }
#gear-dialog .item-dialog-grid {
  display: grid;
  grid-template-columns: minmax(270px, .95fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 26px;
  min-width: 0;
}
#gear-dialog .game-item-tooltip {
  box-sizing: border-box;
  min-width: 0;
  margin: 0;
  padding: 16px 17px 20px;
  border: 5px solid transparent;
  border-image: url('assets/ui/wowhead-tooltip.png') 5 fill stretch;
  border-radius: 0;
  background: #070d29;
  box-shadow: 0 6px 22px #0006;
  color: #f2f2f1;
  font: 400 14px/1.5 var(--sans, 'Segoe UI', sans-serif);
  text-shadow: 0 1px 1px #0009;
}
#gear-dialog .game-item-tooltip h3 {
  margin: 0 0 7px;
  padding: 0;
  color: var(--quality-text);
  font: 600 21px/1.25 var(--sans, 'Segoe UI', sans-serif);
  overflow-wrap: anywhere;
}
#gear-dialog .game-item-tooltip h3.quality-uncommon { color: #80df67; }
#gear-dialog .game-item-tooltip h3.quality-rare { color: #75bdff; }
#gear-dialog .game-item-tooltip h3.quality-epic { color: #c88cff; }
#gear-dialog .game-item-tooltip p { max-width: 100%; margin: 3px 0; color: inherit; font-size: inherit; line-height: inherit; }
#gear-dialog .game-item-tooltip .item-type { margin: 4px 0 11px; color: #e4e5e8; }
#gear-dialog .game-item-tooltip .item-type small { color: #b4bdd2; }
#gear-dialog .game-item-tooltip .weapon-damage { margin: 10px 0; color: #fff; font-variant-numeric: tabular-nums; }
#gear-dialog .weapon-damage > div { display: flex; justify-content: space-between; gap: 14px; }
#gear-dialog .weapon-damage small { display: block; color: #c3cbe1; font-size: 12px; }
#gear-dialog .item-stat-lines { margin: 12px 0; }
#gear-dialog .item-stat-lines p { margin: 3px 0; }
#gear-dialog .item-stat-lines p.priority-stat { color: #bfe9a4; font-weight: 600; }
#gear-dialog .stat-priority-mark { color: #ffd769; margin-left: 6px; }
#gear-dialog .game-item-tooltip p.item-effect { margin: 10px 0 0; color: #74e568; }
#gear-dialog .game-item-tooltip .item-effect strong { color: inherit; }
#gear-dialog .game-item-tooltip .muted { color: #afb8ce; }

#gear-dialog .item-decision { min-width: 0; padding: 3px 0 0; font: 400 13px/1.75 var(--sans, 'Segoe UI', sans-serif); }
#gear-dialog .item-decision h4 { margin: 0 0 10px; color: #ead8aa; font: 500 23px/1.25 var(--display, Georgia, serif); }
#gear-dialog .item-decision p { margin: 0 0 14px; color: #c6ced0; }
#gear-dialog .item-decision strong { color: #e9e1ca; font-weight: 600; }
#gear-dialog .decision-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 13px 0;
  margin: 16px 0;
  border-top: 1px solid #475154;
  border-bottom: 1px solid #475154;
  color: #cae4b3;
  font-size: 13px;
  line-height: 1.5;
}
#gear-dialog .decision-stats > * { min-width: 0; margin: 0; overflow-wrap: anywhere; }
#gear-dialog .decision-stats .stat-up { color: #a6e28b; }
#gear-dialog .decision-stats .stat-down { color: #f3a091; }
#gear-dialog .decision-stats strong { color: #d8edbc; }
#gear-dialog .decision-stats dt { color: #a5b3b9; font-size: 11px; }
#gear-dialog .decision-stats dd { margin: 0; }
#gear-dialog .item-acquisition {
  margin: 17px 0;
  padding: 13px 15px;
  border: 1px solid #494e4c;
  border-left: 3px solid #a78e58;
  background: #0e151e;
  color: #d1d6d6;
}
#gear-dialog .item-acquisition > span { color: #cbb888; font-size: 11px; }
#gear-dialog .item-acquisition p { margin: 6px 0 0; color: #bdc6c9; font-size: 12px; line-height: 1.7; }
#gear-dialog .item-links { gap: 9px 18px; padding: 3px 0 17px; font-size: 12px; }
#gear-dialog .item-links a { color: #dbc890; text-decoration: underline; text-underline-offset: 4px; overflow-wrap: anywhere; }
#gear-dialog .item-links a:hover { color: #ffedb9; }
#gear-dialog .item-owned { min-height: 44px; gap: 11px; padding: 14px 0 0; border-top-color: #495552; color: #dce1ce; font-size: 13px; line-height: 1.5; }
#gear-dialog .item-owned input { flex: 0 0 20px; width: 20px; height: 20px; min-width: 20px; accent-color: #bca260; }
#gear-dialog .item-restrictions { padding-left: 18px; color: #cdbb9b; font-size: 12px; line-height: 1.65; }
#gear-dialog .item-route-note { color: #aab7c0; font-size: 12px; }

@media (max-width: 1000px) {
  #gear-items .gear-slot-row { grid-template-columns: 118px minmax(0, 1fr); }
  #gear-items .slot-heading { padding: 20px 14px; }
  #gear-items .slot-heading h4 { font-size: 18px; }
  #gear-items .gear-options { gap: 12px; padding: 14px; }
  #gear-items .gear-choice { flex-basis: 132px; width: 132px; }
}
@media (max-width: 700px) {
  #gear-items .gear-slot-row { grid-template-columns: 84px minmax(0, 1fr); }
  #gear-items .slot-heading { justify-content: flex-start; gap: 6px; padding: 25px 8px 16px; }
  #gear-items .slot-heading h4 { font: 500 12px/1.4 var(--sans, 'Segoe UI', sans-serif); }
  #gear-items .slot-heading small { font-size: 10px; line-height: 1.4; }
  #gear-items .gear-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 4px; padding: 12px 5px; }
  #gear-items .gear-choice { width: 100%; min-height: 150px; padding: 7px 3px 9px; gap: 6px; font-size: 11px; }
  #gear-items .choice-name { font-size: 11px; line-height: 1.4; }
  #gear-items .choice-stats { font-size: 10px; line-height: 1.5; }
  #gear-items .choice-tag { padding: 2px 4px; font-size: 9px; }
  #gear-items .slot-empty { grid-column: 1 / -1; padding: 12px 7px; font-size: 12px; }
  #gear-items .slot-unique { grid-column: 1 / -1; margin: 0; padding: 8px; font-size: 12px; }
  #gear-dialog { width: calc(100vw - 24px); max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  #gear-dialog .item-dialog-shell { padding: 10px 12px 20px; }
  #gear-dialog-close { top: 8px; margin-bottom: 10px; }
  #gear-dialog .item-dialog-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  #gear-dialog .game-item-tooltip { padding: 15px 14px 18px; font-size: 14px; }
  #gear-dialog .game-item-tooltip h3 { font-size: 21px; }
  #gear-dialog .item-decision { padding: 0 4px; font-size: 14px; }
  #gear-dialog .item-decision h4 { font-size: 24px; }
  #gear-dialog .decision-stats { font-size: 13px; }
}
@media (max-width: 359px) {
  #gear-items .gear-slot-row { grid-template-columns: 61px minmax(0, 1fr); }
  #gear-items .slot-heading { padding-left: 6px; padding-right: 6px; }
  #gear-items .slot-heading h4 { font-size: 12px; }
  #gear-items .gear-options { padding-left: 3px; padding-right: 3px; gap: 9px 2px; }
  #gear-items .gear-choice { padding-left: 1px; padding-right: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  #gear-items .gear-choice, #gear-dialog, #gear-dialog-close { animation: none; transition: none; scroll-behavior: auto; }
}
@media print {
  #gear-items.gear-slot-table { background: #fff; box-shadow: none; border-color: #888; }
  #gear-items .gear-slot-row { break-inside: avoid; grid-template-columns: 100px minmax(0, 1fr); border-color: #bbb; background: #fff; }
  #gear-items .slot-heading { background: #eee; border-color: #bbb; }
  #gear-items .slot-heading h4, #gear-items .slot-heading small,
  #gear-items .choice-name, #gear-items .choice-stats, #gear-items .choice-tag { color: #222; text-shadow: none; }
  #gear-items .gear-options { gap: 8px; padding: 10px; }
  #gear-items .gear-choice { flex-basis: 118px; width: 118px; min-height: 145px; border: 0; }
  #gear-items .choice-tag { background: transparent; border-color: #aaa; }
  #gear-dialog { display: none !important; }
}
