.pdf-preview-grid__heading { margin-bottom: 24px; }
.pdf-preview-grid__heading > :first-child { margin-top: 0; }
.pdf-preview-grid__heading > :last-child { margin-bottom: 0; }

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(var(--pdf-cols, 4), minmax(0, 1fr));
  gap: 24px;
}

@media (max-width: 900px) {
  .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .pdf-grid { grid-template-columns: 1fr; }
}

.pdf-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

/* Cards share the row's title/thumb/date tracks, so a long title pushes the whole row down
   instead of misaligning its own thumbnail. Browsers without subgrid keep the flex layout. */
@supports (grid-template-rows: subgrid) {
  .pdf-card {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    row-gap: 0;
  }
}

/* .pdf-card's display would otherwise override the UA [hidden] rule */
.pdf-card[hidden] { display: none; }

.pdf-card__thumb {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  position: relative;
  aspect-ratio: 8.5 / 11;           /* US Letter; use 1 / 1.414 for A4 */
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.pdf-card:hover .pdf-card__thumb,
.pdf-card:focus-visible .pdf-card__thumb {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}

.pdf-card__thumb img,
.pdf-card__canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.pdf-card__canvas { opacity: 0; transition: opacity .3s ease; }
.pdf-card.is-rendered .pdf-card__canvas { opacity: 1; }

.pdf-card__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: .1em;
  color: #9ca3af;
}
.pdf-card.is-rendered .pdf-card__placeholder { display: none; }

.pdf-card__title {
  margin: 10px 0 10px;
  line-height: 1.3;
  text-transform: capitalize;
}

.pdf-card__date {
  margin: 0;
  font-size: .85rem;
  color: #6b7280;
  min-height: 1.2em;
}

/* Tabs */
.pdf-tabs {
  --pdf-tabs-color: #4b5563;
  --pdf-tabs-active-color: #111827;
  --pdf-tabs-border: #e5e7eb;
}

.pdf-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 24px;
  border-bottom: 1px solid var(--pdf-tabs-border);
}

.pdf-tabs__tab {
  appearance: none;
  margin: 0 0 -1px;
  padding: 10px 16px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  font: inherit;
  color: var(--pdf-tabs-color);
  cursor: pointer;
}

.pdf-tabs__tab:hover { color: var(--pdf-tabs-active-color); }

.pdf-tabs__tab[aria-selected="true"] {
  color: var(--pdf-tabs-active-color);
  border-bottom-color: currentColor;
  font-weight: 600;
}

.pdf-tabs__tab:focus-visible {
  outline: 2px solid var(--pdf-tabs-active-color);
  outline-offset: 2px;
}