:root {
  --bg: #262223;
  --bg-hl: #1f1b1c;
  --fg: #ddd;
  --fg-dim: #aaa;
  --link: #edad2f;
}

html {
  background-color: var(--bg);
  color: var(--fg);
}

* {
  line-height: 1.5;
  font-family: sans-serif;
}

h1, .trait { 
  font-variant-caps: small-caps;
}

h1, h2, .type {
  margin-block-end: -0.2em;
}
h3 {
  margin-block-end: 0;
}
* {
  margin-block-start: 0;
}
p {
  text-align: justify;
  margin-block-end: 0.5em;
}

#content, #searchcontent {
  padding: 0 5%;
  margin: 0 auto;
  max-width: min(1280px, 100%);
}

.category {
  border-radius: 10px;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  border: 0.2em solid #d8c384;
}

.category-title {
  margin-left: 0.3em;
  color: #ddd;
}

.header {
  display: flex;
}

.nofw {
  flex-wrap: nowrap;
}

.fw {
  flex-wrap: wrap;
}

.header > a, .header > label {
  padding: 0.5em;
}
.header > * {
  flex-grow: 1;
}

.header {
  text-align: center;
  font-size: 130%;
  width: 100%;
}

.header {
  overflow-x: auto;
  overflow-y: hidden;
}

.traits {
  margin-bottom: 0.5em;
  /* without this, it clips */
  padding: 0.2em 0;
  line-height: 160%;
}

.traits-inline {
  font-size: 70%;
  vertical-align: middle;
}

.trait {
  border: 0.2em solid #d8c384;
  background: #5d0000;
  color: white;
  padding: 0.1em 0.5em;
  margin-right: -0.2em;
  font-weight: 700;
}

.trait.trait-size {
  background-color: #3b7b59;
}

.trait.trait-alignment {
  background-color: #576293;
}

.type, .lvl {
  float: right;
}

.rarity-rare {
  background-color: #002664;
}

.rarity-uncommon {
  background-color: #98513d;
}

.rarity-common {
  background-color: #5d0000;
}

.rarity-unique {
  background-color: #45166e;
}

a, .pseudolink {
  color: var(--link);
}
a.hoverlink, h1 > a {
  color: inherit;
  text-decoration: none;
}

/* foundry stuff */
a.inline-roll {
  color: inherit;
}

.actionimage {
  vertical-align: middle;
  height: 0.8em;
}

#gridlist {
  display: flex;
  flex-flow: wrap;
  justify-content: space-between;
}

#gridlist > span {
  min-width: 25em;
  max-width: 20%;
  overflow: hidden;
  padding: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#gridlist a, h2 a, .header a, .traits a, .traits-inline a {
  text-decoration: none;
}

#gridlist a:hover, h2 a:hover, h1 a:hover, .lt:hover, a.hoverlink:hover, .traits a:hover, .traits-inline a:hover, .header a:hover {
  text-decoration: underline;
}

#list > p {
  margin-bottom: 1em;
}

table {
  border-collapse: collapse;
  table-layout: fixed;
}
tr:nth-child(even), thead, div.pseudotr:nth-child(odd) {
  background: var(--bg-hl);
}
table.overview {
  min-width: 100%;
}
td {
  border: 1px solid var(--fg);
  text-align: right;
  padding: 0.2em 0.5em;
}
.traitcolumn {
  text-align: left;
}
td:first-child {
  text-align: left;
  width: 30%;
}

.searchresult {
  max-height: 20em;
  overflow-y: hidden;
  margin-bottom: 1em;
}

#searchwrapper {
  margin: 0.5em;
  border-bottom: 2px solid var(--link);
  opacity: 0.8;
  white-space: nowrap;
}
#searchwrapper:focus-within {
  opacity: 1;
}
#searchbox {
  width: 5em;
  color: inherit;
  background-color: inherit;
  font-size: inherit;
  border: none;
  font: 500 100% sans-serif;
  line-height: 1.5;
}
#searchbox:focus {
  outline: none;
}
#searchbox::placeholder {
  color: var(--link);
  opacity: 0.8;
}

/* because real tables can’t be collapsed we way I need */
.pseudotr {
  border-style: solid;
  border-color: var(--fg);
  border-width: 1px 1px 0 1px;
  padding: 0.3em 0.5em;
}
.pseudotr:last-of-type {
  border-width: 1px;
}

/* collapsibles without js from https://www.digitalocean.com/community/tutorials/css-collapsible */
input[type='checkbox'], input[type='radio'] {
  display: none;
}
.lt {
  display: block;
  cursor: pointer;
}
.cpc {
  display: none;
}
.toggle:checked + .cpc {
  display: block;
}
.toggle:checked + .cpc.header {
  display: flex;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f0edea;
    --bg-hl: #e6e3df;
    --fg: black;
    --fg-dim: #444;
    --link: #5d0000;
  }
  .actionimage {
    filter: invert(1);
  }
}
::-webkit-scrollbar {
  width: 0.6em;
  height: 0.3em;
}
::-webkit-scrollbar-track-piece {
  background: var(--bg-hl);
}
::-webkit-scrollbar-thumb {
  background: var(--fg-dim);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--link);
}
