.library-page {
  max-width: none;
  margin: 0;
  padding: 0 0 64px;
  background: #ffffff;
}

.public-catalog-shell {
  padding-top: var(--nav-height);
}

.catalog-hero {
  min-height: 330px;
  padding: 74px 24px 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(28, 9, 9, .72), rgba(28, 9, 9, .67)),
    url("../img/lanhs-library.png") center / cover no-repeat;
}

.catalog-hero-content {
  width: min(100%, 820px);
}

.catalog-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #ffdf72;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.catalog-hero h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
  font-weight: 900;
}

.catalog-hero p {
  max-width: 620px;
  margin: 10px auto 22px;
  color: rgba(255, 255, 255, .88);
  font-size: 15px;
  line-height: 1.65;
}

.catalog-hero-search {
  width: min(100%, 700px);
  min-height: 54px;
  margin: 0 auto;
  padding: 7px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(12, 5, 5, .26);
}

.catalog-search {
  min-width: 0;
  min-height: 40px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8b7472;
}

.catalog-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #2c2020;
  font: inherit;
  font-size: 13px;
}

.catalog-search input::placeholder {
  color: #9b8a88;
}

.catalog-submit,
.filter-form button,
.btn-read,
.btn-details {
  min-height: 40px;
  height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.catalog-submit,
.filter-form button,
.btn-read {
  border: 0;
  background: #9e111b;
  color: #ffffff;
}

.catalog-submit:hover,
.filter-form button:hover,
.btn-read:hover {
  background: #7e0f17;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-details {
  border: 1px solid #ead8d4;
  background: #ffffff;
  color: #9e111b;
}

.btn-details:hover {
  border-color: #efb8ae;
  background: #fff5f3;
  color: #7e0f17;
  transform: translateY(-1px);
}

.catalog-popular {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
  font-weight: 800;
}

.catalog-popular a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color .18s ease;
}

.catalog-popular a:hover {
  color: #ffdf72;
}

.catalog-layout {
  width: min(100% - 40px, 1240px);
  margin: 32px auto 0;
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.catalog-filters {
  position: sticky;
  top: calc(var(--nav-height, 76px) + 22px);
  padding: 20px;
  border: 1px solid #ead8d4;
  border-radius: 8px;
  background: #fbfbfb;
}

.filter-head {
  margin-bottom: 18px;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eee0dd;
}

.filter-head h2 {
  margin: 0;
  color: #211817;
  font-size: 15px;
  font-weight: 900;
}

.filter-head a {
  color: #b71922;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.filter-head a:hover {
  text-decoration: underline;
}

.filter-form {
  display: grid;
  gap: 18px;
}

.filter-form label {
  display: grid;
  gap: 8px;
  color: #3d2928;
  font-size: 11px;
  font-weight: 900;
}

.filter-form select,
.catalog-sort select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #ead8d4;
  border-radius: 7px;
  background-color: #ffffff;
  color: #3d2928;
  font: inherit;
  font-size: 12px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding: 0 34px 0 11px;
  line-height: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, #8f1118 50%),
    linear-gradient(135deg, #8f1118 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.filter-form button {
  width: 100%;
  margin-top: 2px;
}

.catalog-results {
  min-width: 0;
}

.catalog-results-head {
  min-height: 40px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.catalog-count {
  margin: 0;
  color: #5f5150;
  font-size: 12px;
  font-weight: 800;
}

.catalog-sort label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #625452;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.catalog-sort select {
  width: 170px;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.book-card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #ead8d4;
  background: #ffffff;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.book-card:hover {
  transform: translateY(-3px);
  border-color: #efb8ae;
  box-shadow: 0 12px 24px rgba(58, 23, 20, .1);
}

.book-cover-link {
  display: block;
  text-decoration: none;
}

.book-cover {
  width: 100%;
  height: 220px;
  position: relative;
  overflow: hidden;
  background: #fff1ee;
}

.book-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff8f6;
}

.no-cover i {
  color: rgba(143, 17, 24, .28);
  font-size: 42px;
}

.book-cover-badge,
.book-pdf-tag {
  position: absolute;
  z-index: 2;
  max-width: calc(100% - 24px);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 900;
}

.book-cover-badge {
  left: 10px;
  top: 10px;
  padding: 5px 8px;
  background: #9e111b;
  color: #ffffff;
}

.book-pdf-tag {
  right: 10px;
  bottom: 10px;
  padding: 5px 8px;
  background: rgba(24, 19, 19, .8);
  color: #ffffff;
}

.catalog-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
}

.btn-fav {
  width: 36px;
  height: 36px;
  border: 1px solid #ead8d4;
  border-radius: 7px;
  background: #ffffff;
  color: #b71922;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.btn-fav:hover {
  transform: translateY(-1px);
  border-color: #efb8ae;
  background: #fff5f3;
}

.btn-fav.saved {
  background: #9e111b;
  border-color: #9e111b;
  color: #ffffff;
}

.book-body {
  flex: 1;
  padding: 13px;
  display: flex;
  flex-direction: column;
}

.book-meta-row {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-meta-row span {
  padding: 3px 6px;
  border-radius: 7px;
  background: #fff1ee;
  color: #9e111b;
  font-size: 9px;
  font-weight: 900;
}

.book-title {
  margin-bottom: 5px;
  color: #171313;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
}

.book-author {
  margin-bottom: 12px;
  color: #645554;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.book-actions {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.book-actions .btn-read,
.book-actions .btn-details {
  min-height: 36px;
  height: 36px;
  padding: 0 11px;
  font-size: 11px;
}

.empty-library {
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.empty-box {
  width: min(100%, 520px);
  padding: 44px 34px;
  border: 1px solid #ead8d4;
  border-radius: 8px;
  background: #ffffff;
}

.empty-icon {
  width: 74px;
  height: 74px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff1ee;
  color: #b71922;
  font-size: 34px;
}

.empty-box h3 {
  margin: 0;
  color: #171313;
  font-size: 22px;
  font-weight: 900;
}

.empty-box p {
  margin: 10px 0 0;
  color: #645554;
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .catalog-filters {
    position: static;
  }

  .filter-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .filter-form button {
    margin-top: 0;
  }
}

@media (max-width: 768px) {
  .public-catalog-shell {
    padding-top: var(--nav-height);
  }

  .catalog-hero {
    min-height: 300px;
    padding: 52px 18px 42px;
  }

  .catalog-hero-search {
    grid-template-columns: 1fr;
    padding: 8px;
  }

  .catalog-submit {
    width: 100%;
  }

  .catalog-layout {
    width: min(100% - 28px, 1240px);
    margin-top: 24px;
    gap: 22px;
  }

  .filter-form {
    grid-template-columns: 1fr;
  }

  .catalog-results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .catalog-sort,
  .catalog-sort label,
  .catalog-sort select {
    width: 100%;
  }

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

  .book-cover {
    height: 190px;
  }

  .book-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .books-grid {
    grid-template-columns: 1fr;
  }

  .book-cover {
    height: 230px;
  }
}
