.library-page {
  --bg: #22201c;
  --surface: #2b2823;
}

:root[data-theme="light"] .library-page {
  --bg: #ece2cf;
  --surface: #e4d8c1;
}

.library-page .th-library-top .th-soft {
  background: radial-gradient(ellipse at 50% 6%, #4a4033, transparent 62%);
}

:root[data-theme="light"] .library-page .th-library-top .th-soft {
  background: radial-gradient(ellipse at 50% 6%, #d8c8af, transparent 62%);
}

.library-page .th-library-top .th-soft > span {
  display: none;
}

.library-page .th-library-intro {
  padding-top: 18px;
}

.library-page .th-library-intro .intro {
  margin-top: 7px;
}

.featured-listening {
  margin-top: 2px;
}

.featured-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-bottom: 4px;
}

.featured-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 14px;
  text-underline-offset: .24em;
}

.featured-nav a[hidden] {
  display: none;
}

.featured-covers {
  --featured-bg: linear-gradient(158deg, #39342c, #25231f);
  --featured-edge: #54483a;
  --featured-edge-hover: #a88a63;
  --featured-title: #f7ead5;
  --featured-copy: #e3d3bc;
  --featured-shadow: rgba(0, 0, 0, .25);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 1.35vw, 18px);
  margin: 0;
  padding: 0;
  list-style: none;
}

:root[data-theme="light"] .featured-covers {
  --featured-bg: linear-gradient(158deg, #f3e9d6, #e6d7bd);
  --featured-edge: #b5a488;
  --featured-edge-hover: #695339;
  --featured-title: #29241d;
  --featured-copy: #514538;
  --featured-shadow: rgba(69, 48, 27, .15);
}

.featured-covers a {
  display: flex;
  height: 100%;
  flex-direction: column;
  padding: 5px;
  border: 1px solid var(--featured-edge);
  border-radius: 12px;
  background: var(--featured-bg);
  box-shadow: 0 5px 10px -6px var(--featured-shadow);
  color: var(--featured-title);
  text-decoration: none;
}

.featured-covers a:hover {
  border-color: var(--featured-edge-hover);
}

:root[data-theme="light"] .featured-covers a:focus-visible {
  outline-color: var(--featured-edge-hover);
}

.featured-covers a:hover strong {
  text-decoration: underline;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
}

.featured-covers img {
  display: block;
  width: 100%;
  aspect-ratio: 1.47;
  object-fit: cover;
  border-radius: 7px;
  background: var(--surface);
}

.featured-covers .featured-lead {
  grid-column: 1 / -1;
}

.featured-lead img {
  aspect-ratio: 3.8;
  object-position: 62% 52%;
  grid-area: 1 / 1;
}

.featured-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: start;
  gap: 4px;
  padding: 9px clamp(4px, 1vw, 12px) 8px;
}

.featured-copy strong {
  font-size: clamp(16px, 1.7vw, 23px);
  line-height: 1.25;
  font-weight: 500;
  text-wrap: pretty;
}

.featured-meta,
.featured-opening {
  color: var(--featured-copy);
  font-size: 14px;
  line-height: 1.4;
}

.featured-meta {
  margin-top: auto;
  padding-top: 3px;
  font-size: 13px;
}

.featured-opening {
  text-wrap: pretty;
}

.featured-covers .featured-lead a {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.featured-lead .featured-copy {
  display: grid;
  grid-area: 1 / 1;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  align-self: end;
  column-gap: 8px;
  padding: clamp(28px, 5vw, 64px) clamp(8px, 1.5vw, 20px) 12px;
  border-radius: 0 0 7px 7px;
  background: linear-gradient(transparent, #18110bd9 50%, #18110bf5);
  color: #fff3de;
}

.featured-lead strong {
  grid-area: 1 / 1;
  font-size: clamp(21px, 3.1vw, 38px);
  font-weight: 400;
}

.featured-lead .featured-opening {
  grid-area: 2 / 1 / 3 / -1;
  color: #f0e4d3;
}

.featured-lead .featured-meta {
  grid-area: 1 / 2;
  margin: 0;
  padding: 0;
  color: #f0e4d3;
}

.library-page .th-shelf .th-row strong {
  font-weight: 500;
  line-height: 1.3;
}

@media (max-width: 720px) {
  .featured-covers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .featured-lead img {
    aspect-ratio: 1.89;
  }
}

@media (max-width: 365px) {
  .library-page .th-library-intro .intro {
    font-size: 15px;
  }

  .library-page .th-nav {
    gap: 10px;
  }

  .library-page .th-brand {
    letter-spacing: .22em;
  }
}

.library-page .th-filter-status:not(.has-results-status) {
  min-height: 0;
  margin: 0;
}

.lib-filter-options > summary {
  min-height: 44px;
  width: fit-content;
  padding: 11px 10px 11px 0;
  color: var(--text);
  cursor: pointer;
}

.lib-filter-options .th-label {
  margin-top: 10px;
}

.library-page .th-filter-status {
  margin-top: 6px;
  font-size: 14px;
}

.library-page .th-filter-status button {
  min-height: 44px;
}

.library-page .th-filter-status p {
  margin: 0;
}

.library-browse-active .lib-back {
  margin-top: 12px;
}

.library-browse-active .th-filter {
  margin-top: 4px;
}

.library-browse-active .th-shelf {
  padding-top: 28px;
}

.library-page .th-shelf .th-row {
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 11px 13px;
}

.library-page .th-shelf .th-row::before {
  width: 34px;
  height: 34px;
}

.library-page .th-shelf .th-row-photo {
  grid-template-columns: 96px minmax(0, 1fr) auto;
}

.library-page .th-shelf .th-row-photo::before {
  display: none;
}

.row-photo {
  grid-area: 1 / 1 / span 3;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 7px;
}

.library-page .th-shelf .th-row .len {
  grid-row: 1;
  align-self: baseline;
  color: var(--muted);
  font-size: 13px;
}

.library-page .th-shelf .th-row .line,
.library-page .th-shelf .th-row .starts {
  grid-column: 2 / -1;
}

@media (max-width: 600px) {
  .library-browse-active .th-library-intro {
    padding-bottom: 12px;
  }

  .library-browse-active .th-shelf {
    padding-top: 18px;
  }

  .library-browse-active .th-shelf-head {
    gap: 12px;
  }

  .library-page.library-browse-active .th-shelf-title.lib-lit {
    min-height: 0;
    padding: 12px 14px;
  }

  .library-page.library-browse-active .th-shelf-title .lib-count {
    position: static;
    display: inline-block;
    margin-top: 6px;
  }

  .library-page.library-browse-active .th-shelf-title p {
    margin-top: 4px;
  }

  .library-page .th-shelf .th-row {
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 10px;
  }

  .library-page .th-shelf .th-row-photo {
    grid-template-columns: clamp(55px, 17vw, 80px) minmax(0, 1fr);
  }

  .row-photo {
    grid-row: 1 / span 4;
    align-self: start;
  }

  .library-page .th-shelf .th-row .len {
    grid-column: 2;
    grid-row: 2;
  }
}
