/**
 * Algo Ebooks — catalog list + details page.
 */

.ebooks-v2 .ebooks-body {
  padding: 2.5rem 0 4.5rem;
}

.ebooks-soon {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 800px) {
  .ebooks-soon {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.ebooks-soon-copy {
  max-width: 36rem;
  color: #5a6578;
  font-size: 1.05rem;
  line-height: 1.7;
}

.ebooks-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0 0;
}

.ebooks-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: #0e2742;
  color: #fff !important;
  font-weight: 650;
  font-size: 0.92rem;
  line-height: 1;
  text-decoration: none;
  border: 1px solid #0e2742;
  white-space: nowrap;
}

.ebooks-btn:hover {
  background: #163655;
  color: #fff !important;
}

.ebooks-btn--ghost {
  background: #fff;
  color: #0e2742 !important;
  border-color: #d7e2ee;
}

.ebooks-btn--ghost:hover {
  background: #f4f8fd;
  color: #0e2742 !important;
}

.ebooks-book {
  position: relative;
  width: 180px;
  height: 240px;
  margin: 0 auto;
  transform: rotate(-8deg);
  filter: drop-shadow(0 22px 40px rgba(14, 39, 66, 0.18));
}

.ebooks-book-spine {
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 16px;
  border-radius: 4px 0 0 4px;
  background: #0a1c30;
}

.ebooks-book-pages {
  position: absolute;
  inset: 10px 0 10px 14px;
  border-radius: 0 8px 8px 0;
  background: repeating-linear-gradient(90deg, #f7f4ee 0 3px, #efe9dc 3px 4px);
}

.ebooks-book-cover {
  position: absolute;
  inset: 0 0 0 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem 1rem;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(160deg, #245fba 0%, #0e2742 70%);
  color: #fff;
}

.ebooks-book-cover em {
  font-style: normal;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.ebooks-book-cover small {
  margin-top: 0.4rem;
  opacity: 0.7;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.ebooks-crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: #7a8696;
}

.ebooks-crumb a {
  color: #3b7ddd;
  text-decoration: none;
}

.ebooks-crumb a:hover {
  text-decoration: underline;
}

.ebooks-hero--detail.algo-banner {
  padding-bottom: 2.25rem;
}

.ebooks-catalog {
  padding: 0.5rem 0 3.5rem;
}

.ebooks-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1.25rem;
}

.ebooks-count {
  margin: 0;
  color: #5a6578;
  font-size: 0.92rem;
  font-weight: 650;
}

.ebooks-filters {
  display: inline-flex;
  padding: 0.22rem;
  border: 1px solid #e6edf5;
  border-radius: 999px;
  background: #fff;
  gap: 0.15rem;
}

.ebooks-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.1rem;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  color: #5a6578 !important;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.ebooks-filter span {
  min-width: 1.35rem;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: #f4f8fd;
  color: #0e2742;
  font-size: 0.74rem;
  text-align: center;
}

.ebooks-filter:hover {
  color: #0e2742 !important;
}

.ebooks-filter.is-active {
  background: #0e2742;
  color: #fff !important;
}

.ebooks-filter.is-active span {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ebooks-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ebooks-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 1rem 1.15rem;
  align-items: center;
  padding: 1rem 1.1rem;
  border: 1px solid #e6edf5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(14, 39, 66, 0.04);
}

.ebooks-row.is-hidden {
  display: none;
}

@media (min-width: 760px) {
  .ebooks-row {
    grid-template-columns: 72px minmax(0, 1fr) auto;
  }
}

.ebooks-row-cover {
  display: block;
  width: 72px;
  height: 96px;
  overflow: hidden;
  border-radius: 6px 9px 9px 6px;
  background: #eef3f9;
  box-shadow: 0 8px 16px rgba(14, 39, 66, 0.12);
}

.ebooks-row-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ebooks-row-fallback {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #9ec5e8 0%, #0e2742 80%);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 800;
}

.ebooks-row-badge {
  display: inline-flex;
  margin: 0 0 0.35rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ebooks-row-badge--free {
  background: #e8f6ee;
  color: #1f7a46;
}

.ebooks-row-badge--paid {
  background: #e8f0fb;
  color: #2b6cb8;
}

.ebooks-row-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.ebooks-row-title a {
  color: #0e2742;
  text-decoration: none;
}

.ebooks-row-title a:hover {
  color: #3b7ddd;
}

.ebooks-row-desc {
  margin: 0.35rem 0 0;
  color: #5a6578;
  font-size: 0.92rem;
  line-height: 1.5;
}

.ebooks-row-aside {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
}

@media (min-width: 760px) {
  .ebooks-row-aside {
    align-items: flex-end;
    min-width: 220px;
  }
}

.ebooks-row-price {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0e2742;
}

.ebooks-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ebooks-empty {
  margin: 2rem 0 0;
  color: #5a6578;
  text-align: center;
}

.ebook-detail {
  padding: 0 0 2rem;
}

.ebook-detail-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
  padding: 0 0 1.25rem;
}

@media (min-width: 860px) {
  .ebook-detail-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 3rem;
  }
}

.ebook-detail-cover {
  margin: 0;
  padding: 0.9rem;
  border: 1px solid #e6edf5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(14, 39, 66, 0.08);
}

.ebook-detail-cover img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px 12px 12px 8px;
  background: #fff;
}

.ebook-detail-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 280px);
  aspect-ratio: 3 / 4;
  border-radius: 8px 14px 14px 8px;
  background: linear-gradient(160deg, #9ec5e8 0%, #0e2742 80%);
  color: #fff;
  font-size: 4rem;
  font-weight: 800;
}

.ebook-detail-price {
  margin: 0 0 1.1rem;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #0e2742;
}

.ebook-detail-points {
  margin: 0 0 1.4rem;
  padding: 0;
  list-style: none;
}

.ebook-detail-points li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.45rem;
  color: #243447;
  line-height: 1.5;
  border-bottom: 1px solid #eef3f8;
}

.ebook-detail-points li:last-child {
  border-bottom: 0;
}

.ebook-detail-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #3b7ddd;
}

.ebook-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.ebook-detail-note {
  margin: 0.9rem 0 0;
  max-width: 42ch;
  color: #5a6578;
  font-size: 0.88rem;
  line-height: 1.55;
}

.ebooks-longform {
  padding: 0 0 4.5rem;
}

.ebooks-longform-inner {
  max-width: 42rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid #e6edf5;
  border-radius: 18px;
  background: #fff;
  color: #243447;
  font-size: 1.05rem;
  line-height: 1.75;
}

.ebooks-longform-inner h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0e2742;
}

.ebooks-longform-inner p:first-of-type {
  margin-top: 0;
}
