/* Reusable pieces shared by several pages. */

/* ---- sections ------------------------------------------------------------ */

.section + .section {
  margin-top: 64px;
}

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.section__head h2 {
  font-size: var(--step-2);
}

.section__head p {
  color: var(--dust);
  font-size: 0.875rem;
}

.prose {
  max-width: 40em;
  color: var(--bone-2);
}

.prose p + p {
  margin-top: 0.8em;
}

.note {
  color: var(--dust);
  font-size: var(--step--1);
}

.empty {
  padding: 40px 0;
  color: var(--bone-2);
}

.empty button {
  margin-top: 12px;
}

/* ---- filters --------------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 20px;
}

.toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.toolbar__label {
  color: var(--dust);
  font-size: var(--step--1);
  margin-right: 4px;
}

.toolbar__spacer {
  flex: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: none;
  color: var(--bone-2);
  font-size: 0.875rem;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.pill:hover {
  border-color: var(--bone-2);
  color: var(--bone);
}

.pill[aria-pressed='true'],
.pill[aria-current='true'] {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--night);
}

.pill .num {
  font-size: 0.8125rem;
  opacity: 0.6;
}

.pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rarity, var(--tone, var(--bone)));
}

.input,
.select {
  height: 36px;
  padding: 0 12px;
  background: rgba(235, 230, 215, 0.04);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  outline: none;
}

.input:focus,
.select:focus {
  border-color: var(--bone-2);
}

.input::placeholder {
  color: var(--dust);
}

.select {
  padding-right: 32px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--dust) 50%),
    linear-gradient(135deg, var(--dust) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.select option {
  background: var(--night-2);
}

.button {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--radius);
  background: none;
  color: var(--bone);
  font-size: 0.9375rem;
}

.button:hover {
  border-color: var(--bone-2);
  background: var(--night-3);
}

/* ---- item chips --------------------------------------------------------------- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: rgba(235, 230, 215, 0.03);
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
}

a.chip-item:hover {
  border-color: var(--rule-2);
  background: var(--night-3);
}

.chip-item__img {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 2px;
  background: linear-gradient(0deg, color-mix(in srgb, var(--rarity, transparent) 28%, transparent), transparent 75%),
    var(--night-3);
  box-shadow: inset 0 -2px 0 var(--rarity, var(--rule-2));
}

.chip-item__img:empty {
  width: 6px;
  background: var(--rule-2);
  box-shadow: none;
}

.chip-item__img img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.chip-item__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-item__qty {
  color: var(--dust);
  flex-shrink: 0;
}

img.is-broken {
  visibility: hidden;
}

/* ---- item tiles --------------------------------------------------------------- */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.item-tile {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--night-2);
  color: inherit;
  text-align: left;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 0.12s;
}

.item-tile:hover {
  border-color: var(--rule-2);
}

.item-tile:hover .item-tile__img img {
  transform: translateY(-3px);
}

/* Rarity sits at the base of the icon, the way the game's inventory shows it. */
.item-tile__img {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse 80% 60% at 50% 105%, color-mix(in srgb, var(--rarity) 42%, transparent), transparent),
    var(--night-3);
  border-bottom: 3px solid var(--rarity);
}

.item-tile__img img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
  transition: transform 0.2s var(--ease);
}

.item-tile__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.item-tile__name {
  font-weight: 500;
  line-height: 1.3;
}

.item-tile__meta {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--dust);
  font-size: var(--step--1);
}

/* ---- tags --------------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--bone-2);
  font-size: var(--step--1);
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}

a.tag:hover {
  border-color: var(--bone-2);
  color: var(--bone);
}

.tag--rarity {
  color: var(--rarity);
  border-color: color-mix(in srgb, var(--rarity) 45%, transparent);
}

.tag--tone {
  color: var(--tone);
  border-color: color-mix(in srgb, var(--tone) 45%, transparent);
}

/* ---- detail drawer ---------------------------------------------------------------- */

.drawer {
  margin: 0 0 0 auto;
  width: min(540px, 100%);
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--rule-2);
  background: var(--night-2);
  color: var(--bone);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer[open] {
  animation: drawer-in 0.26s var(--ease);
}

.drawer::backdrop {
  background: rgba(10, 4, 14, 0.62);
}

@keyframes drawer-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}

.drawer__close {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 12px 12px 0;
  pointer-events: none;
}

.drawer__close button {
  pointer-events: auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--rule-2);
  border-radius: 50%;
  background: var(--night-2);
  display: grid;
  place-items: center;
}

.drawer__close button:hover {
  border-color: var(--bone-2);
}

.detail__head {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 20px;
  align-items: start;
  padding: 0 24px 24px;
  margin-top: -20px;
}

.detail__img {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: radial-gradient(ellipse 80% 60% at 50% 105%, color-mix(in srgb, var(--rarity, var(--rule)) 45%, transparent), transparent),
    var(--night-3);
  border-bottom: 3px solid var(--rarity, var(--rule-2));
}

.detail__img img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.detail__head h2 {
  font-size: var(--step-2);
  padding-right: 32px;
}

.detail__alt {
  margin-top: 2px;
  color: var(--dust);
}

.detail__head .tags {
  margin-top: 12px;
}

.detail__desc {
  padding: 0 24px 20px;
  color: var(--bone-2);
}

.detail__section {
  padding: 18px 24px;
  border-top: 1px solid var(--rule);
}

.detail__section h3 {
  margin-bottom: 12px;
  color: var(--dust);
  font-size: 0.875rem;
  font-weight: 500;
}

.detail__section h4 {
  margin: 14px 0 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bone-2);
}

.detail__section h4:first-of-type {
  margin-top: 0;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
}

.facts div {
  padding: 14px 24px;
}

.facts div + div {
  border-left: 1px solid var(--rule);
}

.facts dt {
  color: var(--dust);
  font-size: var(--step--1);
}

.facts dd {
  margin: 2px 0 0;
  font-size: var(--step-1);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.stat-list {
  display: grid;
  grid-template-columns: 1fr auto;
  margin: 0;
}

.stat-list dt,
.stat-list dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px dashed var(--rule);
}

.stat-list dt {
  color: var(--bone-2);
}

.stat-list dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-list a {
  width: max-content;
  max-width: 100%;
}

.link-list .note {
  margin-left: 8px;
}

/* ---- disclosure rows --------------------------------------------------------------- */

.rows {
  border-top: 1px solid var(--rule);
}

.section__head + .rows,
.section__head + .news-list {
  border-top: 0;
}

.row {
  border-bottom: 1px solid var(--rule);
}

.row > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 40px 1fr auto 16px;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
  cursor: pointer;
}

.row > summary::-webkit-details-marker {
  display: none;
}

.row > summary:hover {
  background: rgba(235, 230, 215, 0.025);
}

.row > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--dust);
  border-bottom: 1.5px solid var(--dust);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s var(--ease);
}

.row[open] > summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.row__index {
  color: var(--dust);
  font-size: var(--step--1);
  text-align: right;
}

.row__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row__title strong {
  font-weight: 500;
  font-size: 1.0625rem;
}

.row__title span {
  color: var(--dust);
  font-size: var(--step--1);
}

.row__side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.row__body {
  display: grid;
  gap: 20px;
  padding: 4px 36px 28px 60px;
}

.row__body h3 {
  margin-bottom: 8px;
  color: var(--dust);
  font-size: 0.875rem;
  font-weight: 500;
}

.row.is-target > summary {
  background: rgba(245, 214, 61, 0.06);
}

.objectives {
  display: grid;
  gap: 6px;
}

.objectives li {
  position: relative;
  padding-left: 20px;
}

.objectives li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--tone, var(--dust));
  border-radius: 1px;
}

@media (max-width: 640px) {
  .row > summary {
    grid-template-columns: 28px 1fr 16px;
    gap: 12px;
  }

  .row__side {
    display: none;
  }

  .row__body {
    padding: 4px 4px 24px 40px;
  }

  .detail__head {
    grid-template-columns: 80px 1fr;
    padding: 0 16px 20px;
  }

  .detail__desc,
  .detail__section,
  .facts div {
    padding-left: 16px;
    padding-right: 16px;
  }
}
