.archives-page {
  background:
    radial-gradient(circle at 50% 0, rgb(80 44 18 / 19%), transparent 32rem),
    linear-gradient(180deg, #080706, #020303 72%);
}

.archives-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, var(--content-max));
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(20px + env(safe-area-inset-top))
    calc(10px + env(safe-area-inset-right))
    calc(18px + env(safe-area-inset-bottom))
    calc(10px + env(safe-area-inset-left));
  overflow: hidden;
  border-inline: 1px solid rgb(216 187 128 / 15%);
  background:
    linear-gradient(180deg, rgb(0 0 0 / 12%), rgb(0 0 0 / 72%)),
    repeating-linear-gradient(90deg, rgb(52 31 16 / 12%) 0 1px, transparent 1px 31px),
    linear-gradient(90deg, #080604, #120b07 50%, #080604);
  box-shadow: 0 0 50px #000;
}

.archives-shell::before {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: -1;
  border: 1px solid rgb(216 187 128 / 25%);
  pointer-events: none;
}

.archives-header {
  position: relative;
  display: grid;
  justify-items: center;
  min-height: clamp(170px, 25svh, 240px);
  align-content: start;
  padding-top: 8px;
  text-align: center;
}

.asset-slot--archive-crest {
  width: clamp(44px, 10vw, 70px);
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  filter: drop-shadow(0 5px 11px rgb(0 0 0 / 58%));
}

.archives-brand {
  margin: 9px 0 0;
  color: var(--muted);
  font: clamp(11px, 2.8vw, 16px)/1 Georgia, serif;
  letter-spacing: .2em;
}

.archives-header h1 {
  margin: 4px 0 0;
  color: var(--paper);
  font: 500 clamp(38px, 12vw, 76px)/.95 Georgia, "Times New Roman", serif;
  letter-spacing: .08em;
  text-shadow: 0 3px 16px #000;
}

.archives-header h1::after {
  content: "";
  display: block;
  width: min(58vw, 260px);
  height: 1px;
  margin: 10px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.archives-message {
  margin: 12px 0 0;
  color: var(--gold);
  font-size: clamp(9px, 2.65vw, 14px);
  letter-spacing: .08em;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.shelf {
  --shelf-accent: #671322;
  --shelf-glow: rgb(103 19 34 / 28%);
  --shelf-books-image: url("../assets/official/ui/archives-main-spines.webp");
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(52px, 1fr) auto auto;
  min-width: 0;
  min-height: clamp(205px, 27svh, 300px);
  overflow: hidden;
  padding: 14px 10px 11px;
  border: 1px solid rgb(216 187 128 / 38%);
  background:
    linear-gradient(180deg, rgb(4 4 4 / 30%), rgb(2 3 3 / 85%)),
    radial-gradient(circle at 40% 10%, var(--shelf-glow), transparent 58%);
  box-shadow:
    inset 0 0 0 5px rgb(0 0 0 / 42%),
    inset 0 0 34px #000,
    0 8px 16px rgb(0 0 0 / 34%);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, filter .16s ease, box-shadow .16s ease;
}

.shelf:hover,
.shelf:focus-visible {
  border-color: rgb(216 187 128 / 68%);
  filter: brightness(1.06);
  box-shadow:
    inset 0 0 0 5px rgb(0 0 0 / 42%),
    inset 0 0 34px #000,
    0 10px 20px rgb(0 0 0 / 42%),
    0 0 0 2px rgb(216 187 128 / 22%);
  outline: none;
}

.shelf::before,
.shelf::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.shelf::before {
  inset: 0;
  z-index: 4;
  box-sizing: border-box;
  border: 12px solid transparent;
  border-image: url("../assets/official/ui/archives-shelf-frame.png") 82 / 12px stretch;
}

.shelf::after {
  right: 0;
  bottom: 35px;
  left: 0;
  height: 8px;
  border-block: 1px solid rgb(216 187 128 / 25%);
  background: #170f09 url("../assets/official/ui/shelf-board.webp") center / 100% 100% no-repeat;
  box-shadow: 0 5px 10px #000;
}

.shelf--sub {
  --shelf-accent: #173a53;
  --shelf-glow: rgb(23 58 83 / 28%);
  --shelf-books-image: url("../assets/official/ui/archives-sub-spines.webp");
}

.shelf--if {
  --shelf-accent: #164531;
  --shelf-glow: rgb(22 69 49 / 28%);
  --shelf-books-image: url("../assets/official/ui/archives-if-empty-shelf.webp");
}

.shelf--artbook {
  --shelf-accent: #47204f;
  --shelf-glow: rgb(71 32 79 / 28%);
  --shelf-books-image: url("../assets/official/ui/archives-artbook-spines.webp");
}

.shelf__banner {
  position: absolute;
  top: 12px;
  left: 14px;
  width: 22px;
  height: 72px;
  background: linear-gradient(180deg, var(--shelf-accent), #17070a);
  clip-path: polygon(0 0, 100% 0, 100% 88%, 50% 100%, 0 88%);
  box-shadow: 0 5px 8px #000;
}

.shelf__heading {
  position: relative;
  z-index: 1;
  min-height: 88px;
  padding: 12px 2px 0 34px;
  text-align: center;
}

.shelf__heading h2 {
  margin: 0;
  color: var(--paper);
  font: 500 clamp(18px, 6vw, 36px)/.96 Georgia, "Times New Roman", serif;
  letter-spacing: .04em;
  text-shadow: 0 2px 8px #000;
}

.shelf__heading p {
  margin: 7px 0 0;
  color: var(--gold);
  font-size: clamp(7px, 2vw, 11px);
  letter-spacing: .06em;
}

.shelf__books {
  position: relative;
  align-self: end;
  height: clamp(60px, 11svh, 104px);
  margin: 0 5px;
  border-bottom: 7px solid #1b100a;
  background:
    linear-gradient(180deg, rgb(0 0 0 / 2%), rgb(0 0 0 / 18%)),
    var(--shelf-books-image) center bottom / cover no-repeat;
  box-shadow: inset 0 0 18px #000, 0 6px 9px #000;
}

.shelf__books::before {
  content: "";
  position: absolute;
  inset: 9px 0 8px;
  background: linear-gradient(180deg, rgb(216 187 128 / 5%), transparent 34%, rgb(0 0 0 / 16%));
  opacity: .55;
}

.shelf__books--artbook {
  background:
    linear-gradient(180deg, rgb(0 0 0 / 2%), rgb(0 0 0 / 18%)),
    var(--shelf-books-image) center bottom / cover no-repeat;
}

.shelf__description {
  position: relative;
  z-index: 1;
  min-height: 43px;
  margin: 9px 5px 0;
  color: var(--paper);
  font-size: clamp(8px, 2.15vw, 12px);
  line-height: 1.65;
  text-align: center;
}

.shelf__status {
  position: relative;
  z-index: 1;
  min-height: 16px;
  margin: 2px 4px 7px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font: 8px/1.4 "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif;
  text-align: center;
}

.new-marker {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 9px;
  padding: 8px 7px 13px;
  background: #68131b;
  color: var(--gold-bright);
  font: 10px/1 Georgia, serif;
  letter-spacing: .12em;
  clip-path: polygon(0 0, 100% 0, 100% 86%, 50% 100%, 0 86%);
}

.phase-note {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.archives-error {
  margin: 14px 10px 0;
  color: #e6b2aa;
  font-size: 11px;
  text-align: center;
}

@media (max-width: 350px) {
  .archives-shell {
    padding-inline: 7px;
  }

  .archive-grid {
    gap: 5px;
  }

  .shelf {
    min-height: 196px;
    padding-inline: 7px;
  }

  .shelf__heading {
    padding-left: 26px;
  }

  .shelf__banner {
    left: 10px;
    width: 18px;
  }

  .archives-message {
    letter-spacing: .035em;
  }

  .shelf__description {
    line-height: 1.48;
  }
}

@media (min-width: 700px) {
  .archives-shell {
    padding-inline: 18px;
  }

  .archive-grid {
    gap: 12px;
  }

  .shelf {
    min-height: 360px;
    padding: 22px 18px 16px;
  }

  .shelf__banner {
    left: 24px;
    width: 30px;
    height: 96px;
  }

  .shelf__heading {
    min-height: 118px;
    padding-left: 42px;
  }

}
