/* Mu Next Wiki — item & monster database. Loaded after wiki.css; reuses its
   tokens, masthead, footer, plates and search results. The layout is the
   atlas's: a filter rail, the list, and a detail column that stays put. */

.db-body { min-height: 100vh; display: flex; flex-direction: column; }
.db-body .footer { margin-top: auto; }

.db { width: min(1400px, 100% - 2 * var(--gutter)); margin: 26px auto 44px; }

.db__crumb { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.04em; color: var(--muted); }
.db__crumb a { color: var(--blue); text-decoration: none; }
.db__crumb a:hover { text-decoration: underline; }
.db__crumb span { margin: 0 4px; color: var(--blue-soft); }
.db__head h1 { margin: 0; font-size: clamp(30px, 3.4vw, 44px); letter-spacing: var(--track-display); line-height: 1.05; }
.db__lede { margin: 8px 0 22px; max-width: 70ch; font-size: 16.5px; line-height: 1.55; color: var(--muted); }
.db__lede a { color: var(--blue); }

.db__grid {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 336px;
  gap: 18px;
  align-items: start;
}

/* --- Filter rail ----------------------------------------------------------- */
.filters {
  position: sticky; top: 76px;
  background: var(--plate); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px); overflow-y: auto;
  padding: 6px;
}
.filters h3 {
  margin: 0; padding: 12px 10px 6px;
  font-family: 'Jost', sans-serif; font-weight: 400; font-size: 11px; letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--muted);
}
.filters h3:first-child { padding-top: 8px; }
.filters button, .filters label.opt {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%;
  border: 0; background: none; border-radius: 3px; padding: 6px 10px;
  font-family: 'Jost', sans-serif; font-size: 14.5px; color: var(--text); text-align: left; cursor: pointer;
  transition: background 0.15s var(--ease);
}
.filters button:hover, .filters label.opt:hover { background: var(--plate-warm); color: var(--blue); }
.filters button.is-on { background: rgba(33, 57, 113, 0.07); color: var(--blue-deep); font-weight: 500; }
.filters button small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filters label.opt input { accent-color: var(--blue); margin: 0 6px 0 0; }
.filters label.opt span:first-of-type { flex: 1; }
.filters .range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center; padding: 4px 10px 8px; }
.filters .range input, .filters select {
  width: 100%; min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 3px;
  font: 14px 'Jost', sans-serif; color: var(--text); background: var(--plate); font-variant-numeric: tabular-nums;
}
.filters .range span { font-size: 12px; color: var(--muted); }
.filters select { margin: 2px 0 6px; padding-right: 26px; }
.filters .selectwrap { padding: 0 10px; }
.filters__reset { margin: 8px 0 4px; }
.filters__reset button { justify-content: center; color: var(--blue); font-size: 13px; letter-spacing: 0.04em; }

/* Class chips: the seven classes as a row of toggles. */
.classes { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 10px 8px; }
.classes button {
  width: auto; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 11.5px; letter-spacing: 0.06em; color: var(--muted);
}
.classes button.is-on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 400; }

/* --- The list ------------------------------------------------------------- */
.board { background: var(--plate); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-sm); overflow: hidden; }
.board__bar {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px;
  padding: 12px 16px 10px; border-bottom: 1px solid var(--line);
}
.board__title { margin: 0; font-size: 17px; letter-spacing: var(--track-display); }
.board__meta { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board__sort { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.board__sort select { padding: 4px 24px 4px 8px; border: 1px solid var(--line); border-radius: 3px; font: 13px 'Jost', sans-serif; color: var(--text); background: var(--plate); }

.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th {
  padding: 8px 12px; text-align: left; font-weight: 400; font-size: 11px; letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line); background: rgba(33, 57, 113, 0.03); white-space: nowrap;
}
.list td { padding: 7px 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.list tbody tr { cursor: pointer; transition: background 0.12s var(--ease); }
.list tbody tr:hover { background: var(--plate-warm); }
.list tbody tr.is-on { background: rgba(33, 57, 113, 0.07); }
.list tbody tr:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list .name { font-weight: 500; color: var(--blue-deep); }
.list .name small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.list .dim { color: var(--muted); }
.list .cls { white-space: nowrap; letter-spacing: 0.04em; font-size: 11.5px; }
.list .cls b { font-weight: 500; color: var(--blue); }
.list .cls i { font-style: normal; color: rgba(91, 100, 116, 0.35); }
.list .src { font-size: 12px; color: var(--muted); }
.list .src b { font-weight: 400; color: var(--ok); }
.list__empty { padding: 28px 16px; color: var(--muted); font-size: 15px; }
.list__more { display: block; width: 100%; padding: 12px; border: 0; border-top: 1px solid var(--line); background: var(--plate-warm); font: 14px 'Jost', sans-serif; color: var(--blue); cursor: pointer; }
.list__more:hover { background: rgba(33, 57, 113, 0.07); }

/* The item tile: its icon when we have one, otherwise the inventory
   footprint it occupies — an honest drawing rather than a placeholder. */
.tile {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  background: rgba(33, 57, 113, 0.05); border: 1px solid var(--line-soft); border-radius: 3px;
  vertical-align: middle;
}
.tile img { max-width: 36px; max-height: 36px; object-fit: contain; }
.tile svg { width: 34px; height: 34px; }
.tile svg rect { fill: rgba(33, 57, 113, 0.14); stroke: var(--blue-soft); stroke-width: 1; }
.tile--big { width: 84px; height: 84px; }
.tile--big img { max-width: 76px; max-height: 76px; }
.tile.is-crisp img { image-rendering: pixelated; }
.inline-icon { max-width: 20px; max-height: 22px; object-fit: contain; vertical-align: -5px; margin-right: 7px; }
.results a.has-icon { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; align-items: center; }
.results a.has-icon .results__t, .results a.has-icon .results__s { grid-column: 2; }
.results__icon { grid-column: 1; grid-row: 1 / span 2; max-width: 28px; max-height: 30px; object-fit: contain; }
.tile--big svg { width: 68px; height: 68px; }
.mob-mark { width: 12px; height: 12px; border-radius: 50%; background: #ff5252; display: inline-block; vertical-align: -1px; margin-right: 8px; }
.mob-mark--npc { background: #5ec8ff; }
.mob-mark--trap { background: #8892a0; border-radius: 2px; }
.mob-mark--boss { border-radius: 2px; transform: rotate(45deg); }

/* --- Detail column -------------------------------------------------------- */
.detail {
  position: sticky; top: 76px;
  background: var(--plate); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 100px); overflow-y: auto;
}
.detail__empty { padding: 26px 18px; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.detail__head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.detail__head h2 { margin: 0; font-size: 20px; letter-spacing: var(--track-display); line-height: 1.15; text-wrap: balance; }
.detail__sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.03em; }
.detail__sub b { font-weight: 500; color: var(--blue); }
.detail__nav { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); }
.detail__nav button, .detail__nav a { border: 0; background: none; padding: 4px 6px; font: 13px 'Jost', sans-serif; color: var(--blue); cursor: pointer; text-decoration: none; border-radius: 3px; }
.detail__nav button:hover, .detail__nav a:hover { background: var(--plate-warm); }
.detail__nav button:disabled { color: var(--muted); opacity: 0.5; cursor: default; }
.detail__close { display: none; }
.detail h3 {
  margin: 0; padding: 12px 18px 4px;
  font-family: 'Jost', sans-serif; font-weight: 400; font-size: 11px; letter-spacing: var(--track-micro); text-transform: uppercase; color: var(--muted);
}
.detail .rows { padding: 2px 18px 10px; }
.detail .row { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.detail .row:first-child { border-top: 0; }
.detail .row span:last-child { font-family: 'Constantine', serif; font-size: 14px; letter-spacing: var(--track-display); color: var(--blue-deep); font-variant-numeric: tabular-nums; text-align: right; }
.detail .row span:last-child.plain { font-family: 'Jost', sans-serif; letter-spacing: 0; }
.detail .row small { font-family: 'Jost', sans-serif; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.detail ul.src { list-style: none; margin: 0; padding: 2px 18px 12px; }
.detail ul.src li { padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.4; }
.detail ul.src li:first-child { border-top: 0; }
.detail ul.src li a { color: var(--blue); text-decoration: none; }
.detail ul.src li a:hover { text-decoration: underline; }
.detail ul.src li .pct { float: right; margin-left: 10px; font-family: 'Constantine', serif; letter-spacing: var(--track-display); color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.detail ul.src li small { display: block; font-size: 12px; color: var(--muted); }
.detail .chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 18px 12px; }
.detail .chip { padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: 11.5px; letter-spacing: 0.06em; color: var(--muted); }
.detail .chip.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.detail .chip.is-link { color: var(--blue); text-decoration: none; }
.detail .chip.is-link:hover { background: var(--plate-warm); }
.detail .note { margin: 6px 18px 14px; }
.detail .foot { padding: 10px 18px 16px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.detail .foot a { color: var(--blue); }
.detail .ancient { padding: 2px 18px 12px; font-size: 14px; line-height: 1.5; }
.detail .ancient b { font-weight: 500; color: var(--ink-gold); }

.detail .resist { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 2px 18px 12px; }
.detail .resist div { text-align: center; padding: 7px 4px; border: 1px solid var(--line-soft); border-radius: 3px; }
.detail .resist b { display: block; font-family: 'Constantine', serif; font-weight: 400; font-size: 16px; color: var(--blue-deep); letter-spacing: var(--track-display); }
.detail .resist small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* --- Motion: the detail settles in when a row is chosen ------------------- */
@media (prefers-reduced-motion: no-preference) {
  .detail__body { animation: settle 0.35s var(--ease) both; }
  @keyframes settle { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 1180px) {
  .db__grid { grid-template-columns: 200px minmax(0, 1fr); }
  .detail {
    position: fixed; inset: auto 0 0 0; top: auto; z-index: 60;
    max-height: 78vh; border-radius: 10px 10px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); transition: transform 0.3s var(--ease);
  }
  .detail.is-open { transform: none; }
  .detail__close { display: inline-block; }
  .list .src, .list th.src { display: none; }
}
@media (max-width: 760px) {
  .db { margin-top: 18px; }
  .db__grid { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; max-height: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .filters h3 { grid-column: 1 / -1; }
  .filters .cats { display: contents; }
  .filters__reset { grid-column: 1 / -1; }
  .list .cls, .list th.cls, .list .req, .list th.req { display: none; }
  .list td, .list th { padding-left: 10px; padding-right: 10px; }
}
