/* Site-wide tweaks to the theme. */

/* Use more of a wide screen (theme default is 61rem). */
.md-grid {
  max-width: 90rem;
}

/* Link cards: one fixed width on every page, at most 4 per row (fewer when the
   screen is narrower). Every card matches the tallest one. */
.md-typeset .grid.cards {
  --card-width: 15rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-width)), var(--card-width)));
  grid-auto-rows: 1fr;
  max-width: calc(4 * var(--card-width) + 3 * 0.4rem);
}

/* Inside a game, show only that game's section in the left navigation. (The
   Games index hides its navigation entirely; its cards list the games.) */
.md-nav--primary [data-md-level="1"] > .md-nav__list > .md-nav__item--section:has(~ .md-nav__item--section.md-nav__item--active),
.md-nav--primary [data-md-level="1"] > .md-nav__list > .md-nav__item--section.md-nav__item--active ~ .md-nav__item--section {
  display: none;
}

/* Narrower left navigation on desktop (theme default is 12.1rem). */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    width: 10rem;
  }
}

/* Pages keep their tags (the Tags page uses them), but don't show the tag
   chips at the bottom of each page. */
.md-content .md-typeset nav.md-tags {
  display: none !important;
}

/* Tighter text spacing than the theme default. */
.md-typeset {
  line-height: 1.45;
}

.md-typeset p,
.md-typeset ul,
.md-typeset ol,
.md-typeset table:not([class]) {
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

.md-typeset ul li,
.md-typeset ol li {
  margin-bottom: 0.15em;
}

.md-typeset h2 {
  margin: 1.2em 0 0.4em;
}

.md-typeset h3 {
  margin: 1em 0 0.3em;
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  padding: 0.5em 1em;
}

/* Highlight table rows that contain a .permanent marker. */
.md-typeset tr:has(.permanent) {
  background-color: rgba(229, 57, 53, 0.12);
}

[data-md-color-scheme="slate"] .md-typeset tr:has(.permanent) {
  background-color: rgba(239, 83, 80, 0.2);
}

/* Final Fantasy Resonance item names; click one to preview the item. */
.md-typeset .ffr-itemref {
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
}

.ffr-itempop {
  position: absolute;
  z-index: 10;
  width: min(20rem, calc(100vw - 16px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.6rem 0.7rem;
  font-size: 0.7rem;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.3rem;
  box-shadow: var(--md-shadow-z2);
}

.ffr-itempop[hidden] {
  display: none;
}

.ffr-itempop p {
  margin: 0.4em 0;
}

.ffr-itempop-close {
  float: right;
  padding: 0 0.2rem;
  color: var(--md-default-fg-color--light);
  background: none;
  border: 0;
  cursor: pointer;
}

.ffr-itempop-name {
  font-weight: 700;
  font-size: 0.8rem;
}

.ffr-itempop-type,
.ffr-itempop-stats {
  color: var(--md-default-fg-color--light);
}

.ffr-itempop-where {
  margin-top: 0.4em;
}

.ffr-itempop-link {
  margin-bottom: 0;
}
