html:has(body.publications-page) {
  overflow-x: hidden;
}

body {
  font-family: var(--font-main);
  color: var(--text-main);
  overflow-x: clip;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 5%;
}

.relative-z {
  position: relative;
  z-index: 10;
}

.color-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  z-index: -1;
  filter: blur(80px);
  opacity: 0.15;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  animation: drift 15s infinite alternate ease-in-out;
}

.purple-blob {
  width: 50vw;
  height: 50vw;
  background: var(--brand-purple);
  top: -10%;
  left: -10%;
}

.cyan-blob {
  width: 40vw;
  height: 40vw;
  background: var(--brand-cyan);
  bottom: 0;
  right: -10%;
  animation-delay: -5s;
}

.magenta-blob {
  width: 45vw;
  height: 45vw;
  background: var(--brand-magenta);
  top: 30%;
  left: 30%;
  animation-delay: -10s;
}

.publications-page .publications-archive-section {
  padding: 0 0 150px 0;
  position: relative;
  z-index: 10;
}

.publications-page .page-hero-section {
  padding: 160px 0 90px;
  position: relative;
  overflow: hidden;
}

.publications-page .page-hero-section::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 20%;
  width: 560px;
  height: 560px;
  transform: translateX(-50%);
  filter: blur(80px);
  pointer-events: none;
}

.publications-page .glass-pill-white {
  background: rgba(255, 255, 255, 0.82);
}

.publications-page .hero-title-white {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.publications-page .hero-subtitle-white {
  margin-left: auto;
  margin-right: auto;
}


.publications-page .publications-archive-inner {
  position: relative;
  overflow: hidden;
}

.publications-page .publications-archive-inner::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -120px;
  width: 260px;
  height: 260px;
  background: transparent;
  pointer-events: none;
}

/* --- Filter Tabs --- */
.publications-page .filter-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.publications-page .tab-btn {
  padding: 12px 30px;
  border-radius: 100px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--text-muted-light);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.publications-page .tab-btn.active {
  background: var(--brand-purple);
  color: #fff;
  border-color: var(--brand-purple);
  box-shadow: 0 15px 30px rgba(91, 33, 182, 0.2);
  transform: translateY(-2px);
}

.publications-page .publications-empty-state {
  display: none;
  text-align: center;
  padding: 60px 20px;
  color: rgba(15, 23, 42, 0.55);
  font-size: 1rem;
}

.publications-page .publications-empty-state.visible {
  display: block;
}

/* Grid: 2 book cards per row on desktop/tablet, 1 per row on mobile.
   Equal card height comes from the grid row stretching every card to the
   tallest sibling, combined with each .book-card being a flex column. */
.publications-page .publications-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 20px;
  align-items: stretch;
}

/* --- Book card --- */
.publications-page .book-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease;
}

.publications-page .book-card:hover,
.publications-page .book-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.16);
}

/* Row 1: two cover images side by side, equal width/height */
.publications-page .book-card-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.publications-page .book-card-images img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  /* background: #f1f5f9; */
  border-radius: 12px;
  display: block;
  cursor: pointer;
}

/* Row 2: title, capped at 2 lines */
.publications-page .book-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 10px;
  color: #000000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Row 3: description, capped at 4 lines, grows to push buttons to the bottom.
   Wrapped with its own Read More toggle, independent of the exam list's. */
.publications-page .book-card-desc-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  margin: 0 0 20px;
}

.publications-page .book-card-desc {
  font-size: 0.95rem;
  line-height: 1.65;
  color: rgba(15, 23, 42, 0.65);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.publications-page .book-card-desc-wrap.is-expanded .book-card-desc {
  -webkit-line-clamp: unset;
  overflow: visible;
}

/* Moved (in JS) to be the last inline child of .book-card-desc, right after
   the (JS-truncated, word-safe) text, so it sits on the same line as the
   dots with normal inline spacing — the truncation itself already reserves
   enough room for this button to fit on that line. */
.publications-page .btn-read-more-desc {
  display: inline;
  margin-left: 4px;
  padding: 0;
  border: none;
  background: none;
  color: var(--brand-cyan);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.publications-page .btn-read-more-desc:hover,
.publications-page .btn-read-more-desc:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Tagline pill, shown below the description */
.publications-page .book-card-pill {
  display: inline-block;
  align-self: flex-start;
  margin: 0 0 14px;
  padding: 8px 16px;
  border-radius: 100px;
  background: rgb(99 0 255 / 8%);
  color: var(--brand-purple);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.4;
}

/* Exam list: tags with a Read More toggle for the overflow */
.publications-page .book-card-exams {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
}

.publications-page .exam-tag {
  padding: 5px 12px;
  border-radius: 100px;
background: rgb(99 0 255 / 8%);  color: rgba(15, 23, 42, 0.7);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.publications-page .exam-tag-extra {
  display: none;
}

.publications-page .book-card-exams.is-expanded .exam-tag-extra {
  display: inline-block;
}

.publications-page .btn-read-more {
  padding: 5px 4px;
  border: none;
  background: none;
  color: var(--brand-cyan);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.publications-page .btn-read-more:hover,
.publications-page .btn-read-more:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* Row 4: Preview / Download buttons, equal width */
.publications-page .book-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.publications-page .book-card-actions .btn-preview,
.publications-page .book-card-actions .btn-download {
  flex: 1 1 140px;
  text-align: center;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease,
    color 0.25s ease;
}

.publications-page .btn-preview {
  background: transparent;
  border-color: var(--brand-cyan)!important;
  color: var(--brand-cyan);
}

.publications-page .btn-preview:hover,
.publications-page .btn-preview:focus-visible {
  background: var(--brand-cyan);
  color: #ffffff;
  transform: translateY(-2px);
  outline: none;
}

.publications-page .btn-download {
  background: var(--brand-purple);
  color: #ffffff;
}

.publications-page .btn-download:hover,
.publications-page .btn-download:focus-visible {
  background: var(--brand-magenta);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(91, 33, 182, 0.3);
  outline: none;
}

.publications-page .publications-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 5, 20, 0.95);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.35s ease;
}

.publications-page .publications-lightbox.active {
  opacity: 1;
  pointer-events: auto;
}

.publications-page .lightbox-close {
  position: absolute;
  top: 28px;
  right: 28px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.55);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  cursor: pointer;
}

.publications-page .lightbox-close:hover {
  color: var(--brand-cyan);
  border-color: var(--brand-cyan);
}

.publications-page .lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.55);
  color: #ffffff;
  display: none;
  place-items: center;
  font-size: 1.15rem;
  cursor: pointer;
}

.publications-page .lightbox-nav.visible {
  display: grid;
}

.publications-page .lightbox-prev {
  left: 28px;
}

.publications-page .lightbox-next {
  right: 28px;
}

.publications-page .lightbox-nav:hover,
.publications-page .lightbox-nav:focus-visible {
  color: var(--brand-cyan);
  border-color: var(--brand-cyan);
  outline: none;
}

@media (max-width: 680px) {
  .publications-page .lightbox-prev {
    left: 12px;
  }

  .publications-page .lightbox-next {
    right: 12px;
  }

  .publications-page .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
}

.publications-page .lightbox-content {
  width: min(92%, 1200px);
  height: 88vh;
  padding: 1rem;
  overflow: auto;
  text-align: center;
  touch-action: pan-x pan-y;
  scrollbar-width: none;
}

.publications-page .lightbox-content::-webkit-scrollbar {
  display: none;
}

/* Inline-block + full-height pseudo-element centers the image without
   the flex/grid "can't scroll to the clipped start edge" overflow bug,
   so a zoomed-in image can be panned to reveal every edge. */
.publications-page .lightbox-content::after {
  content: "";
  display: inline-block;
  height: 100%;
  vertical-align: middle;
}

.publications-page .lightbox-content img {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 22px;
  box-shadow: 0 48px 120px rgba(0, 0, 0, 0.55);
  transition: width 0.15s ease-out, height 0.15s ease-out;
  cursor: zoom-in;
}

.publications-page .lightbox-content.is-zoomed img {
  cursor: grab;
}

.publications-page .lightbox-content.is-dragging img {
  cursor: grabbing;
}

.publications-page .section-desc {
  margin-top: 1rem;
}

/* Tablet: drop to 2 cards per row, tighten spacing */
@media (max-width: 900px) {
  .publications-page .page-hero-section {
    padding: 140px 0 80px;
  }

  .publications-page .publications-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }

  .publications-page .book-card {
    padding: 20px;
  }

  .publications-page .book-card-images img {
    height: 180px;
  }
}

/* Mobile: 1 card per row */
@media (max-width: 680px) {
  .publications-page .publications-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  /* A subtle brand-color wash + a stronger shadow sets each card apart
     from the page and its neighbors now that they're stacked in a single
     column. */
  .publications-page .book-card {
    background: white;
    box-shadow: 0 10px 30px rgba(13, 33, 78, 0.336);
    padding: 28px;
  }

  .publications-page .page-hero-section {
    padding: 100px 0 48px;
  }

  .publications-page .publications-archive-section {
    padding: 0 0 40px 0;
  }

  .publications-page .book-card-images img {
    height: 200px;
  }

  .publications-page .book-card-title,
  .publications-page .book-card-desc {
    text-align: center;
  }

  .publications-page .book-card-desc-wrap {
    align-items: center;
  }

  .publications-page .book-card-pill {
    align-self: center;
    text-align: center;
  }

  .publications-page .book-card-actions .btn-preview,
  .publications-page .book-card-actions .btn-download {
    flex: 1 1 100%;
  }

  .publications-page .lightbox-content {
    max-height: 80vh;
    padding: 0.75rem;
  }

  .publications-page .lightbox-close {
    top: 20px;
    right: 20px;
  }
}

@media (max-width: 380px) {
  .publications-page .book-card-images {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .publications-page .book-card-images img {
    height: 140px;
  }
}
