/* =============================================================
   ebooks.css — Ebooks listing page
   Base: 19px → scaled via global.css media queries
   Design: Figma node 6333-16374 "Ebooks"
   Card size/grid intentionally matches life-at-tis.css (.lat-grid,
   .lat-img-wrapper) → 4 cards per row on desktop.
   Reuses: cs-pagination-* , ct-info-header, hero-glow from global.css
   ============================================================= */

/* ── 1. Page Section ─────────────────────────────────────── */

.eb-section {
  padding-top: 9.474rem;     /* clears navbar — same as gallery */
  padding-bottom: 5.263rem;
}

/* ── 2. Header ───────────────────────────────────────────── */

.eb-section .eb-header {
  position: relative;
  z-index: 100;
}

.eb-title {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 3.75rem;        /* 60px / 19 */
  line-height: 1.12;         /* 67px / 60px */
  color: var(--base-dark);
  text-align: center;
}

/* ── 3. Grid (same as .lat-grid) ─────────────────────────── */

.eb-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.947rem;
  row-gap: 3.1758rem;
  margin-top: 2.8rem;        /* header already has 3.579rem bottom margin */
  margin-bottom: 4.211rem;
}

/* ── 4. Card ─────────────────────────────────────────────── */

.eb-card {
  display: flex;
  flex-direction: column;
  gap: 0.947rem;
  min-width: 0;
  max-width: 100%;
}

/* Cover — same height as .lat-img-wrapper, Figma radius 6px */
.eb-card-media {
  position: relative;
  width: 100%;
  height: 20.579rem;
  overflow: hidden;
  border-radius: 0.316rem;   /* 6px / 19 */
  background-color: #dfdfdf; /* Figma placeholder grey */
}

body.dark-theme .eb-card-media {
  background-color: var(--bg-light);
}

.eb-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.eb-card:hover .eb-card-img {
  transform: scale(1.05);
}

/* Text */
.eb-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.137rem;             /* 14px / 19 */
  flex: 1;                   /* pushes the button to the card bottom */
}

.eb-card-title {
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 1.053rem;       /* Figma 24px, scaled for 4-up card width */
  line-height: 1.35;
  color: var(--base-dark);
  /* display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; */
  overflow: hidden;
}

.eb-card-desc {
  font-family: var(--font-primary);
  font-weight: 300;
  font-size: 0.842rem;       /* Figma 20px, scaled */
  line-height: 1.4;
  color: var(--text-sub);    /* #363434-ish in light, muted in dark */
  word-break: break-word;
}

/* Fallback line-clamp before JS initializes or when JS is disabled */
.eb-card:not(.is-ready) .eb-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Read More / Less toggle button */
.eb-read-more-btn {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin-left: 0.2rem;
  font-family: var(--font-primary);
  font-size: 0.842rem;
  font-weight: 500;
  color: #888888;
  cursor: pointer;
  transition: color 0.2s ease;
}

.eb-read-more-btn:hover {
  color: #555555;
  text-decoration: underline;
}

body.dark-theme .eb-read-more-btn {
  color: #98a2b3;
}

body.dark-theme .eb-read-more-btn:hover {
  color: #ffffff;
}

.eb-read-more-btn:focus-visible {
  outline: 2px solid var(--primary-blue, #084B81);
  outline-offset: 2px;
  border-radius: 2px;
}

/* When card is expanded, allow normal flow */
.eb-card.expanded .eb-card-desc {
  display: block;
}

/* Reset margin for any paragraphs inside description to allow inline flow */
.eb-card-desc p {
  display: inline;
  margin: 0;
}


/* Buy now button — Figma "Component 17" */
.eb-buy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.789rem;          /* 53px / 19 */
  border-radius: 1.579rem;   /* 30px */
  background-color: #008dff; /* --blue-dark-mode in Figma */
  color: #ffffff;
  font-family: var(--font-primary);
  font-weight: 400;
  font-size: 0.842rem;       /* 16px */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.eb-buy-btn:hover,
.eb-buy-btn:focus-visible {
  background-color: #0a7fe6;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 141, 255, 0.35);
  color: #ffffff;
}

/* ── 5. Pagination ───────────────────────────────────────── */

.eb-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.053rem;
  border-top: 0.053rem solid #eaecf0;
}

body.dark-theme .eb-pagination {
  border-top-color: var(--border-gray);
}

/* ── 6. Responsive (mirrors life-at-tis.css breakpoints) ── */

@media (max-width: 1200px) {
  .eb-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .eb-section {
    padding-top: 7.5rem;
    padding-bottom: 4rem;
  }

  .eb-title {
    font-size: 2.316rem;
  }

  .eb-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.842rem;
    row-gap: 2.5rem;
  }
}

@media (max-width: 575px) {
  .eb-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .eb-card-media {
    height: 24rem;
  }

  .eb-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }

  .cs-pagination-pages {
    order: -1;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
  }
}