/* ══════════════════════════════════════════════════════
   CATALOG ARCHIVE + PDF READER
   ══════════════════════════════════════════════════════ */

.catalog-archive,
.catalog-single {
  padding: 72px 32px 96px;
  max-width: 1440px;
  margin: 0 auto;
}

/* ── Archive grid ──────────────────────────────────── */

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 28px;
}

.catalog-card-link {
  display: block;
}

.catalog-cover {
  position: relative;
  aspect-ratio: 3 / 4.2;
  overflow: hidden;
  background: var(--gray-light);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s;
}

.catalog-card:hover .catalog-cover {
  transform: translateY(-6px);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.2);
}

.catalog-cover-img,
.catalog-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.catalog-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(0, 0, 0, 0.25);
}

.catalog-cover-placeholder svg {
  width: 44%;
  height: 44%;
}

/* Spine hint, so a flat cover still reads as a book */
.catalog-cover::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0));
  pointer-events: none;
  z-index: 2;
}

.catalog-year {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: var(--red);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 7px 12px;
  border-radius: 999px;
}

.catalog-read {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 12px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.catalog-read svg {
  width: 18px;
  height: 18px;
}

.catalog-card:hover .catalog-read,
.catalog-card-link:focus-visible .catalog-read {
  transform: translateY(0);
}

.catalog-card-body {
  padding-top: 18px;
}

.catalog-title {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0;
  transition: color 0.3s;
}

.catalog-card:hover .catalog-title {
  color: var(--red);
}

.catalog-meta {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ── PDF reader ────────────────────────────────────── */

.pdf-reader {
  background: #14141a;
  border-radius: 8px;
  overflow: hidden;
}

.pdf-reader.is-fullscreen {
  border-radius: 0;
  display: flex;
  flex-direction: column;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdf-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transition: background 0.25s, transform 0.25s;
}

.pdf-btn svg {
  width: 20px;
  height: 20px;
}

.pdf-btn:hover,
.pdf-btn:focus-visible {
  background: var(--red);
  transform: translateY(-1px);
}

.pdf-btn.is-active {
  background: var(--red);
}

.pdf-btn--download {
  width: auto;
  padding: 0 18px;
}

.pdf-btn-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pdf-pageinfo {
  min-width: 92px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pdf-stage {
  position: relative;
  min-height: 60vh;
  padding: 28px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
}

.pdf-reader.is-fullscreen .pdf-stage {
  flex: 1;
  min-height: 0;
  align-items: center;
}

.pdf-canvas-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
}

.pdf-page {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.pdf-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.pdf-status.is-error {
  color: #ff7d97;
}

.pdf-status a {
  color: var(--red);
  text-decoration: underline;
}

.catalog-back {
  margin-top: 40px;
  text-align: center;
}

/* ── Responsive ────────────────────────────────────── */

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

@media (max-width: 860px) {
  .catalog-archive,
  .catalog-single {
    padding: 56px 20px 72px;
  }

  .pdf-stage {
    padding: 18px 10px;
    min-height: 50vh;
  }

  /* Two-page spread is unreadable on a phone */
  #pdfSpread {
    display: none;
  }
}

@media (max-width: 640px) {
  .catalog-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 16px;
  }

  .catalog-title {
    font-size: 16px;
  }

  .pdf-btn-label {
    display: none;
  }

  .pdf-btn--download {
    width: 42px;
    padding: 0;
  }

  /* The hover reveal never fires on touch — keep the label visible */
  .catalog-read {
    position: static;
    transform: none;
    background: transparent;
    color: var(--red);
    padding: 10px 0 0;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .catalog-cover,
  .catalog-read,
  .pdf-btn {
    transition: none;
  }
}
