/* Leonida Waypoint — database viewing layer (dbview).
   Mirrors the GTABase database browsing pattern with our own furniture:
   a filter toolbar (search, facet pills, sort, result count, grid/list
   toggle) over a card grid, grouped row lists for the grouped indexes,
   and a per-entry detail view opened from any card. Colors and type come
   from the site variables in styles.css; layout language follows the
   weapons filter block in wiki.css. */

/* ---------- toolbar ---------- */
.dbv-tools { margin: 18px 0 26px; }
.dbv-filterbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.dbv-field { display: block; flex: 1 1 260px; max-width: 430px; }
.dbv-field > span:first-child {
  display: block; font-size: 12.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}
.dbv-searchwrap { position: relative; display: block; }
.dbv-searchwrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); pointer-events: none;
}
.dbv-searchwrap input {
  width: 100%; font: inherit; font-size: 15.5px; padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink);
}
.dbv-searchwrap input:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.dbv-selfield { flex: 0 1 220px; }
.dbv-selfield select {
  width: 100%; font: inherit; font-size: 15px; padding: 10px 10px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink);
}
.dbv-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.dbv-pill {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.dbv-pill .dbv-n { opacity: .65; font-weight: 500; margin-left: 2px; }
.dbv-pill:hover { border-color: var(--pink); color: var(--pink-deep); }
.dbv-pill.is-on { background: var(--pink); border-color: var(--pink); color: #fff; }
.dbv-pill.is-on .dbv-n { opacity: .85; }
.dbv-pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dbv-sortrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px;
}
.dbv-sort { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.dbv-sort select {
  font: inherit; font-size: 14.5px; padding: 7px 9px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink);
}
.dbv-dir, .dbv-viewbtn {
  font: inherit; cursor: pointer; min-width: 38px; min-height: 38px;
  border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--bg-2); color: var(--ink); font-size: 16px; line-height: 1;
}
.dbv-dir:hover, .dbv-viewbtn:hover { border-color: var(--pink); color: var(--pink-deep); }
.dbv-dir:focus-visible, .dbv-viewbtn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dbv-viewbtn.is-on { background: var(--night); border-color: var(--night); color: var(--gold); }
.dbv-count { margin: 0 auto; font-size: 15px; font-weight: 700; color: var(--ink); }
.dbv-view { display: inline-flex; gap: 6px; }
.dbv-noresults { font-size: 15.5px; color: var(--ink-soft); margin: 10px 0 0; }

/* ---------- card grid ---------- */
.dbv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.dbv-card {
  display: flex; flex-direction: column; gap: 5px;
  padding: 14px 15px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-2); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}
.dbv-card:hover { border-color: var(--pink); }
.dbv-card:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dbv-card[hidden] { display: none; }
.dbv-card .dbv-pic { margin: -14px -15px 8px; }
.dbv-card .dbv-pic img { display: block; width: 100%; height: auto; border-radius: 14px 14px 0 0; }
.dbv-card .dbv-pic figcaption { font-size: 11.5px; color: var(--ink-soft); padding: 6px 15px 0; }
.dbv-card .dbv-nopic {
  margin: -14px -15px 8px; aspect-ratio: 16 / 9; border-radius: 14px 14px 0 0;
  background: linear-gradient(135deg, var(--night) 0%, var(--night-2) 70%);
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
.dbv-card .dbv-nopic span {
  font-family: "Barlow Condensed", sans-serif; font-size: 17px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold);
  text-align: center; opacity: .85;
}
.dbv-name {
  font-family: "Barlow Condensed", sans-serif; font-size: 21px; font-weight: 600;
  line-height: 1.15; margin: 0; color: var(--ink);
}
.dbv-line {
  margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--teal);
}
.dbv-snippet {
  margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dbv-status { margin: 0; }
.dbv-src { margin: auto 0 0; padding-top: 6px; font-size: 12.5px; line-height: 1.45; color: var(--ink-soft); }

/* list view */
.dbv-grid.dbv-as-list { grid-template-columns: 1fr; }
.dbv-grid.dbv-as-list .dbv-card { flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
.dbv-grid.dbv-as-list .dbv-name { flex: 1 1 220px; }
.dbv-grid.dbv-as-list .dbv-line { order: 2; }
.dbv-grid.dbv-as-list .dbv-status { order: 3; margin: 0; }
.dbv-grid.dbv-as-list .dbv-src { order: 4; margin: 0; padding: 0; flex: 1 1 200px; text-align: right; }
.dbv-grid.dbv-as-list .dbv-pic, .dbv-grid.dbv-as-list .dbv-nopic { display: none; }
.dbv-grid.dbv-as-list .dbv-snippet { display: none; }

/* ---------- grouped rows (characters, missions, strangers, side missions) ---------- */
.dbv-rows { display: flex; flex-direction: column; gap: 10px; }
.dbv-row {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-2); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}
.dbv-row:hover { border-color: var(--pink); }
.dbv-row:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dbv-row .dbv-thumb { flex: 0 0 176px; margin: 0; }
.dbv-row .dbv-thumb img { display: block; width: 100%; height: auto; border-radius: 9px; }
.dbv-row .dbv-thumb figcaption { display: none; }
.dbv-row .dbv-rowmain { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dbv-row .dbv-num {
  font-family: "Barlow Condensed", sans-serif; font-size: 21px; font-weight: 600; color: var(--teal);
}
.dbv-rowhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.dbv-rowhead .dbv-name { flex: 0 1 auto; }
.dbv-rowhead .dbv-status { margin-left: auto; }

/* ---------- detail view ---------- */
/* While the detail view is open it replaces the page body: every sibling
   after the mount (page head + article layout) is hidden. The class-based
   force is needed because .article-layout carries an author display rule
   that overrides the UA [hidden] style. */
#dbv-detail:not([hidden]) ~ * { display: none !important; }
.dbv-detail { margin: 6px 0 10px; }
.dbv-back {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  padding: 9px 16px; border-radius: 999px; margin-bottom: 18px;
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.dbv-back:hover { border-color: var(--pink); color: var(--pink-deep); }
.dbv-back:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.dbv-dname {
  font-family: "Barlow Condensed", sans-serif; font-size: 40px; font-weight: 700;
  line-height: 1.05; margin: 0 0 8px; color: var(--ink);
}
.dbv-dchip { margin: 0 0 14px; }
.dbv-dpic { margin: 0 0 18px; }
.dbv-dpic img { display: block; width: 100%; height: auto; border-radius: 14px; }
.dbv-dpic figcaption { font-size: 12.5px; color: var(--ink-soft); padding-top: 7px; }
.dbv-ddesc { font-size: 16.5px; line-height: 1.65; max-width: 72ch; }
.dbv-dinfo-h {
  font-family: "Barlow Condensed", sans-serif; font-size: 25px; font-weight: 700;
  margin: 26px 0 10px; color: var(--ink);
}
.dbv-dinfo {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: var(--bg-2); max-width: 760px;
}
.dbv-dinfo .dbv-drow { display: flex; gap: 14px; padding: 10px 15px; }
.dbv-dinfo .dbv-drow + .dbv-drow { border-top: 1px solid var(--line); }
.dbv-dinfo dt {
  flex: 0 0 190px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-soft); padding-top: 2px;
}
.dbv-dinfo dd { margin: 0; font-size: 15.5px; font-weight: 600; }
.dbv-dextra { margin: 20px 0 0; }
.dbv-dextra a {
  display: inline-block; font-weight: 700; font-size: 15.5px;
  padding: 11px 20px; border-radius: 999px;
  background: var(--pink); color: #fff; text-decoration: none;
}
.dbv-dextra a:hover { background: var(--pink-deep); }
.dbv-dsrc { margin: 20px 0 0; font-size: 13.5px; color: var(--ink-soft); }
.dbv-more-h {
  font-family: "Barlow Condensed", sans-serif; font-size: 25px; font-weight: 700;
  margin: 30px 0 12px; color: var(--ink);
}
.dbv-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.dbv-more .dbv-card { box-shadow: none; }
.dbv-more .dbv-name { font-size: 18px; }

/* Pin deep-link landing flash + Show on map (Nov 20, 2026) */
@keyframes dbvFlashPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 46, 136, 0); }
  15% { box-shadow: 0 0 0 3px var(--pink), 0 0 22px 5px rgba(255, 46, 136, .45); }
  70% { box-shadow: 0 0 0 3px var(--pink), 0 0 14px 3px rgba(255, 46, 136, .25); }
  100% { box-shadow: 0 0 0 0 rgba(255, 46, 136, 0); }
}
.dbv-card.dbv-flash, .dbv-row.dbv-flash { animation: dbvFlashPulse 2.4s ease-out 1; }
.dbv-showmap-row { margin: 0 0 16px; }
.dbv-showmap {
  font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg-2); color: var(--ink);
}
.dbv-showmap:hover { border-color: var(--pink); color: var(--pink-deep); }
.dbv-showmap:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

@media (max-width: 700px) {
  .dbv-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
  .dbv-name { font-size: 19px; }
  .dbv-count { order: 3; width: 100%; text-align: center; margin: 2px 0 0; }
  .dbv-view { margin-left: auto; }
  .dbv-row { flex-direction: column; gap: 10px; }
  .dbv-row .dbv-thumb { flex: none; width: 100%; }
  .dbv-dname { font-size: 32px; }
  .dbv-dinfo dt { flex-basis: 128px; }
}

/* Side Missions detail enrichment (Nov 21, 2026): stable More grid with the
   current card highlighted, and per-activity individual lists. */
.dbv-dname:focus { outline: none; }
.dbv-more .dbv-card.is-current {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px var(--pink), var(--shadow);
}
.dbv-items-note {
  font-size: 15px; line-height: 1.6; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); padding: 12px 15px; max-width: 760px;
}
.dbv-items { list-style: none; margin: 0; padding: 0; max-width: 860px; display: flex; flex-direction: column; gap: 8px; }
.dbv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2);
}
.dbv-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; }
.dbv-item-name { font-weight: 700; font-size: 15.5px; }
.dbv-item-area { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--teal); }
.dbv-item-desc { flex: 1 1 100%; font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); }
.dbv-item-map {
  font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; flex: 0 0 auto;
  padding: 7px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
}
.dbv-item-map:hover { border-color: var(--pink); color: var(--pink-deep); }
.dbv-item-map:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Side Missions filters (Nov 21, 2026): the index toolbar over the
   grouped rows, and the filter row atop long detail lists. Rows and
   items carry author display rules, so [hidden] needs an explicit win. */
.dbv-row[hidden], .dbv-item[hidden] { display: none; }
.dbv-itemtools {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  margin: 0 0 14px; max-width: 860px;
}
.dbv-itemtools .dbv-field { flex: 1 1 240px; max-width: 400px; }
.dbv-itemcount {
  margin: 0 0 0 auto; padding-bottom: 11px;
  font-size: 15px; font-weight: 700; color: var(--ink);
}
