/*
 * The wiki: its front page, an article's layout, and the search box.
 *
 * It sits on top of style.css and uses its colours and faces, so a wiki page looks like the rest of the site.
 * The pages themselves are written by wiki/build.py; nothing here is page-specific. As everywhere on this
 * site, no inline styles: _headers drops them.
 */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wrap.wiki { max-width: 1240px; }

/* ---------------------------------------------------------------- the bar and the search box */

.wiki-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 22px 0 6px;
}

.wiki-home {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  color: var(--gold);
  text-decoration: none;
  flex: none;
}

.wiki-search {
  position: relative;
  flex: 1;
  max-width: 620px;
}

/* A magnifying glass drawn in CSS: img-src is 'self' only, so a data: icon would be dropped. */
.wiki-search::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 23px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--dim);
  border-radius: 50%;
  transform: translateY(-62%);
  pointer-events: none;
}

.wiki-search::after {
  content: "";
  position: absolute;
  left: 26px;
  top: 23px;
  width: 7px;
  height: 2px;
  border-radius: 1px;
  background: var(--dim);
  transform: translateY(5px) rotate(45deg);
  pointer-events: none;
}

.wiki-q {
  width: 100%;
  height: 46px;
  font: inherit;
  font-size: 16.5px;
  color: var(--ink);
  background: linear-gradient(180deg, #171c25, #10141b);
  border: 1px solid var(--edge-dark);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(134, 145, 166, 0.2), 0 2px 0 rgba(0, 0, 0, 0.35);
  padding: 0 46px 0 42px;
  appearance: none;
}

.wiki-q::placeholder { color: var(--dim); }
.wiki-q::-webkit-search-cancel-button { display: none; }

.wiki-q:focus-visible {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: inset 0 1px 0 rgba(251, 191, 36, 0.3), 0 0 0 3px rgba(251, 191, 36, 0.18);
}

.wiki-key {
  position: absolute;
  right: 12px;
  top: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 20px;
  min-width: 22px;
  text-align: center;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.wiki-q:focus-visible ~ .wiki-key { display: none; }

.wiki-hits {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: linear-gradient(180deg, #232a37, #1b212c);
  border: 1px solid var(--edge-dark);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(134, 145, 166, 0.25), 0 18px 44px rgba(0, 0, 0, 0.6);
}

.wiki-hits li { max-width: none; }

.hit {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.hit:hover,
.wiki-hits .on .hit { background: rgba(251, 191, 36, 0.12); color: var(--ink); }

.hit-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.hit-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16.5px;
}

.hit-sec { color: var(--muted); font-size: 15px; }

.hit-cat {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.hit-snip {
  display: block;
  margin-top: 2px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--muted);
}

mark {
  background: rgba(251, 191, 36, 0.26);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

.hit-none { padding: 10px 12px; color: var(--muted); font-size: 15px; }

.hit-more a {
  display: block;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  font-size: 14.5px;
  text-decoration: none;
}

.hit-more.on a { color: var(--gold); }

/* ---------------------------------------------------------------- the front page */

.wiki-hero {
  margin: 30px 0 6px;
}

.wiki-hero h1 { margin: 0 0 8px; }
.wiki-hero .lede { margin: 0 0 18px; }
.wiki-hero .wiki-search { max-width: 720px; }
.wiki-hero .wiki-q { height: 54px; font-size: 18px; }
.wiki-hero .wiki-search::before,
.wiki-hero .wiki-search::after { top: 27px; }
.wiki-hero .wiki-key { top: 16px; }
.wiki-tip { margin: 12px 0 0; }

.wiki-cat h2 { margin-top: 38px; }
.wiki-cat > .small { margin: -6px 0 14px; }

.wiki-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wiki-cards li { max-width: none; }

.wiki-cards a {
  display: block;
  height: 100%;
  padding: 14px 16px 15px;
  border: 1px solid var(--edge-dark);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(74, 82, 98, 0.92), rgba(59, 66, 81, 0.92));
  box-shadow: inset 0 1px 0 var(--panel-top), 0 2px 0 rgba(0, 0, 0, 0.3);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.wiki-cards a:hover { transform: translateY(-2px); border-color: var(--gold-deep); color: var(--ink); }
.wiki-cards h3 { margin: 0 0 4px; font-size: 17.5px; color: var(--gold); }
.wiki-cards p { margin: 0; font-size: 14.5px; line-height: 1.45; color: var(--muted); }

.wiki-results { margin: 20px 0 0; }
.wiki-results h2 { margin-top: 18px; }

.wiki-found {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 820px;
}

.wiki-found li { max-width: none; border-bottom: 1px solid var(--line); }
.wiki-found .hit { padding: 13px 10px; }
.wiki-found .hit-title { font-size: 18.5px; color: var(--water); }
.wiki-found .hit:hover .hit-title { color: var(--gold); }
.wiki-found .hit-snip { font-size: 15.5px; }

/* ---------------------------------------------------------------- an article */

.wiki-grid {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 38px;
  align-items: start;
  margin-top: 14px;
}

.wiki-side {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  padding: 2px 8px 20px 0;
  font-size: 14.5px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.wiki-side h2 {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  border: 0;
  padding: 0;
  margin: 18px 0 4px;
}

.wiki-side h2:first-child { margin-top: 0; }
.wiki-side ul { list-style: none; margin: 0; padding: 0; }
.wiki-side li { max-width: none; }

.wiki-side a {
  display: block;
  padding: 3px 9px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}

.wiki-side a:hover { color: var(--ink); border-left-color: var(--line); }
.wiki-side a.here { color: var(--gold); border-left-color: var(--gold); background: rgba(251, 191, 36, 0.07); }

.wiki-article { min-width: 0; }
.wiki-article h1 { margin: 4px 0 8px; font-size: clamp(30px, 5vw, 42px); }
.wiki-article > .lede { margin: 0 0 18px; }
.wiki-article h2 { scroll-margin-top: 84px; }
.wiki-article h3 { scroll-margin-top: 84px; }
.wiki-article table { font-size: 15px; }

.crumbs { margin: 0; font-size: 14px; color: var(--dim); }
.crumbs a { color: var(--dim); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }

.infobox {
  float: right;
  width: 300px;
  margin: 0 0 20px 30px;
  padding: 14px 16px 6px;
  border: 1px solid var(--edge-dark);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--panel) 0, #424a59 62%, #3b4251 100%);
  box-shadow: inset 0 1px 0 var(--panel-top), 0 3px 0 rgba(0, 0, 0, 0.35), 0 12px 28px rgba(0, 0, 0, 0.3);
  font-size: 15px;
}

.infobox h2 {
  font-size: 18px;
  margin: 0 0 10px;
  padding-bottom: 8px;
  text-align: center;
}

.infobox dl { margin: 0; }

.infobox dt {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cfd6e3;
  opacity: 0.8;
}

.infobox dd { margin: 0 0 10px; line-height: 1.5; overflow-wrap: anywhere; }
.infobox code { background: rgba(0, 0, 0, 0.3); }

.toc {
  display: inline-block;
  min-width: 220px;
  margin: 0 0 6px;
  padding: 12px 22px 12px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(14, 17, 23, 0.55);
  font-size: 15px;
}

.toc h2 {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 0;
  padding: 0;
  margin: 0 0 4px;
}

.toc ol { margin: 0; padding-left: 20px; }
.toc li { max-width: none; }
.toc a { text-decoration: none; }

ol.cols { columns: 2; column-gap: 34px; }
ol.cols li { break-inside: avoid; }

.seealso {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seealso li { max-width: none; }

.seealso a {
  display: block;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(14, 17, 23, 0.5);
  text-decoration: none;
  font-size: 15px;
}

.seealso a:hover { border-color: var(--gold-deep); }

/* A wide table starts under the infobox, not squeezed beside it. */
.wiki-article .scroller { clear: both; }

/* ---------------------------------------------------------------- Pokémon: the grid and one Pokémon's page */

.types { display: inline-flex; gap: 5px; flex-wrap: wrap; vertical-align: middle; }

.type {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.6;
  color: #10141b;
  background: var(--t, #9aa3b5);
  white-space: nowrap;
}

.type-normal { --t: #b8b8a0; } .type-fire { --t: #f5924d; } .type-water { --t: #6aa6f8; } .type-grass { --t: #74cf6a; }
.type-electric { --t: #f6d54a; } .type-ice { --t: #8fdcdc; } .type-fighting { --t: #e0685f; } .type-poison { --t: #c07fd0; }
.type-ground { --t: #dcbb6c; } .type-flying { --t: #a9a3f3; } .type-psychic { --t: #f77a9c; } .type-bug { --t: #b3c43c; }
.type-rock { --t: #c8b060; } .type-ghost { --t: #9585c5; } .type-dragon { --t: #8f72f7; } .type-dark { --t: #8f7868; }
.type-steel { --t: #b9b9d2; } .type-fairy { --t: #f2a6c2; }

.tier-chip {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 10px;
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  font-size: 13px;
  color: var(--gold);
  vertical-align: middle;
}

.dexno { color: var(--dim); font-size: 0.55em; font-weight: 500; }

.mon-art { display: flex; justify-content: center; gap: 10px; margin: 0 0 10px; }
.mon-sprite { width: 96px; height: 96px; image-rendering: pixelated; }
.hidden-ab { color: var(--dim); font-style: normal; }

.stat-bar { width: min(100%, 260px); height: 10px; vertical-align: middle; }

.wiki-article .count {
  margin-left: 4px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 400;
  color: var(--dim);
  vertical-align: 2px;
  white-space: nowrap;
}

/* One way a Pokémon spawns: the line says how rare and when, and opens to the biomes. */
.spawn {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(27, 32, 41, 0.7);
}

.spawn > summary {
  padding: 9px 14px;
  cursor: pointer;
  line-height: 1.5;
}

.spawn > summary:hover { color: var(--gold); }
.spawn[open] > summary { border-bottom: 1px solid var(--line); }
.spawn .scroller { margin: 0; padding: 0 6px 6px; clear: none; max-height: 420px; overflow-y: auto; }

.bucket {
  display: inline-block;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.7;
  color: #10141b;
  background: var(--b, #cbd5e1);
}

.bucket-common { --b: #cbd5e1; }
.bucket-uncommon { --b: #86efac; }
.bucket-rare { --b: #7dd3fc; }
.bucket-ultrarare { --b: #d8b4fe; }
.bucket-boss { --b: #fca5a5; }

.dex-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 18px 0 14px;
  clear: both;
}

.dex-tools input[type="search"],
.dex-tools select {
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  background: linear-gradient(180deg, #171c25, #10141b);
  border: 1px solid var(--edge-dark);
  border-radius: 9px;
  padding: 8px 12px;
}

.dex-tools input[type="search"] { flex: 1; min-width: 180px; max-width: 320px; }
.dex-tools label { color: var(--muted); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.dex-tools output { color: var(--dim); font-size: 14.5px; margin-left: auto; }

.dex-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
}

.dex-grid li { max-width: none; }

.mon-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--edge-dark);
  border-radius: 10px;
  background: rgba(27, 32, 41, 0.82);
  color: var(--ink);
  text-decoration: none;
}

.mon-card:hover { border-color: var(--gold-deep); color: var(--ink); }
.mon-card img, .mon-blank { flex: none; width: 56px; height: 56px; image-rendering: pixelated; }
.mon-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mon-name { font-family: var(--display); font-weight: 600; font-size: 15.5px; }
.mon-no { color: var(--dim); font-size: 12.5px; }
.mon-card .type { font-size: 10.5px; padding: 0 7px; }

/* ---------------------------------------------------------------- narrower windows */

@media (max-width: 980px) {
  .wiki-grid { grid-template-columns: minmax(0, 1fr); }
  .wiki-side { display: none; }
}

@media (max-width: 720px) {
  .infobox { float: none; width: auto; margin: 0 0 18px; }
  .wiki-bar { gap: 12px; }
  .wiki-key { display: none; }
  .wiki-q { padding-right: 14px; }
  ol.cols { columns: 1; }
  .hit-cat { display: none; }
}
