/* The public wiki (docs/design/wiki.md §10), over the site's style.css. Written by hand;
   the pages beside it are written by web/scripts/wiki-site.ts. */

.wiki-main {
  padding-top: 1rem;
  padding-bottom: 2.5rem;
}

.wiki-search {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}

.wiki-search input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--birch);
  color: var(--ink);
  font: inherit;
}

.wiki-search .play {
  flex: none;
  margin: 0;
  white-space: nowrap;
}

.wiki-layout {
  display: grid;
  gap: 1rem;
}

/* The sections: chips that scroll sideways on a phone, a column beside the page on a PC. */
.sections {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scrollbar-width: thin;
}

.sections a {
  display: inline-flex;
  flex: none;
  gap: 0.35rem;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border: 2px solid rgb(87 48 26 / 25%);
  border-radius: 999px;
  background: var(--birch);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}

.sections a[aria-current='page'] {
  border-color: var(--ink);
  background: var(--rye-light);
}

.sections img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.wiki-content {
  min-width: 0;
  padding: 1.2rem 1.1rem 1.4rem;
  border: 1px solid rgb(87 48 26 / 25%);
  border-radius: 6px;
  background: var(--birch);
}

@media (min-width: 760px) {
  .wiki-layout {
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: start;
  }

  .sections {
    flex-direction: column;
    overflow: visible;
  }

  .sections a {
    white-space: normal;
    border-radius: 10px;
  }

  .wiki-content {
    padding: 1.6rem 2rem 2rem;
  }
}

.wiki-page h1 {
  font-size: 1.8rem;
}

.wiki-page h2 {
  margin: 1.4rem 0 0.5rem;
  font-size: 1.15rem;
}

.wiki-page p,
.wiki-page ul {
  margin: 0 0 0.7rem;
}

.wiki-head {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.wiki-head .summary {
  margin: 0.3rem 0 0;
  opacity: 0.85;
}

.wiki-pic {
  flex: none;
  max-width: 96px;
  height: auto;
}

.note {
  padding: 0.55rem 0.8rem;
  border-left: 4px solid var(--rye);
  border-radius: 6px;
  background: rgb(249 202 108 / 22%);
}

.facts {
  display: grid;
  grid-template-columns: minmax(7rem, max-content) 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 2px solid rgb(87 48 26 / 18%);
  border-radius: 10px;
  background: #fff8ee;
}

.facts dt {
  font-weight: 700;
}

.facts dd {
  margin: 0;
}

.chips,
.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border: 2px solid rgb(87 48 26 / 20%);
  border-radius: 10px;
  background: #fff8ee;
  text-decoration: none;
}

.chip img {
  max-width: 28px;
  height: auto;
}

.chip small {
  font-size: 0.75rem;
  opacity: 0.7;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.5rem;
}

.tile {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 0.1rem 0.6rem;
  height: 100%;
  padding: 0.6rem;
  border: 2px solid rgb(87 48 26 / 20%);
  border-radius: 12px;
  background: #fff8ee;
  text-decoration: none;
}

.tile img {
  grid-row: span 2;
  max-width: 40px;
  height: auto;
}

.tile small {
  font-size: 0.8rem;
  line-height: 1.3;
  opacity: 0.8;
}

/* Wide tables scroll sideways inside their card, the first column standing still (§5). */
.table {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
  border: 2px solid rgb(87 48 26 / 25%);
  border-radius: 10px;
  background: #fff8ee;
}

.table table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88rem;
}

.table th,
.table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid rgb(87 48 26 / 12%);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.table td:last-child {
  min-width: 8rem;
  white-space: normal;
}

.table th:first-child,
.table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff8ee;
  box-shadow: 2px 0 0 rgb(87 48 26 / 12%);
}

.table th {
  background: var(--cream);
}

.table th:first-child {
  background: var(--cream);
}

.table th button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.table th button[data-down='1']::after {
  content: ' ▾';
}

.table th button[data-down='0']::after {
  content: ' ▴';
}

.table .num {
  text-align: right;
}

.cell-pic {
  max-width: 24px;
  height: auto;
  margin-right: 0.3rem;
  vertical-align: middle;
}

.taken {
  margin: 1.5rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

.wiki-results ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.wiki-results a {
  display: grid;
  gap: 0.1rem;
  margin-bottom: 0.4rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid rgb(87 48 26 / 20%);
  border-radius: 10px;
  background: var(--birch);
  text-decoration: none;
}

.wiki-results span {
  font-size: 0.88rem;
  opacity: 0.85;
}

.wiki-results mark {
  border-radius: 3px;
  background: rgb(249 202 108 / 70%);
  color: inherit;
}

/* A phone: the facts' labels and values share the width, and the play button sits below search. */
@media (max-width: 520px) {
  .facts {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 0.25rem 0.6rem;
  }

  .wiki-search {
    flex-wrap: wrap;
  }

  .wiki-search input {
    flex-basis: 100%;
  }

  .wiki-content {
    padding: 1rem 0.8rem 1.2rem;
  }

  .wiki-pic {
    max-width: 64px;
  }
}
