/* ==========================================================================
   The Reading Room — Library card
   Card, institution status badges and series tag. Uses tokens.css only.
   Needs the .visually-hidden helper from base.css.
   ========================================================================== */

.library-card {
  display: grid;
  grid-template-columns: var(--card-thumb-width) minmax(0, 1fr);
  gap: var(--card-gap);
  padding: var(--card-padding);
  background: var(--color-parchment);
  border: var(--border-hairline);
  border-top: var(--border-accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-base) var(--ease-standard);
}

.library-card:hover,
.library-card:focus-within {
  box-shadow: var(--shadow-hover);
}

/* Thumbnail */
.library-card__thumb {
  margin: 0;
  align-self: start;
}

.library-card__thumb img,
.library-card__placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border: var(--border-strong);
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-parchment-deep);
}

.library-card__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--color-walnut);
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 11px,
      rgba(110, 74, 46, 0.10) 11px 12px
    ),
    var(--color-parchment-deep);
}

.library-card__placeholder svg {
  width: 32px;
  height: 32px;
}

.library-card__placeholder span {
  font-family: var(--font-label);
  font-size: 0.625rem;
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-align: center;
  line-height: var(--leading-snug);
}

/* Body */
.library-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.library-card__eyebrow {
  margin: 0;
  font-family: var(--font-meta);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-eyebrow);
}

.library-card__eyebrow .sep {
  margin: 0 0.4em;
  color: var(--color-gold);
}

.library-card__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  color: var(--color-heading);
}

.library-card__title a {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(var(--color-gold), var(--color-gold));
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--duration-base) var(--ease-standard),
              color var(--duration-base) var(--ease-standard);
}

.library-card__title a:hover {
  color: var(--color-crimson);
  background-size: 100% 1px;
}

.library-card__title a:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--focus-ring);
}

/* Metadata table — JFK Library format */
.library-card__meta {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-meta);
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
}

.library-card__meta tr {
  border-top: var(--border-hairline);
}

.library-card__meta tr:last-child {
  border-bottom: var(--border-hairline);
}

.library-card__meta th,
.library-card__meta td {
  padding: var(--space-2) 0;
  text-align: left;
  vertical-align: top;
}

.library-card__meta th {
  width: 11.5rem;
  padding-right: var(--space-4);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
}

.library-card__meta td {
  font-weight: var(--weight-regular);
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.library-card__description {
  margin: 0;
  max-width: var(--measure);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
}

/* Footer: holdings + series */
.library-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: var(--space-1);
}

.library-card__holdings {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Institution status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.3em 0.65em;
  border: var(--border-width) solid;
  border-radius: var(--radius-md);
  font-family: var(--font-label);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
  line-height: 1.2;
  white-space: nowrap;
}

.status-badge svg {
  width: 0.95em;
  height: 0.95em;
  flex: none;
}

.status-badge--digitized {
  background: var(--color-status-digitized-bg);
  border-color: var(--color-status-digitized-border);
  color: var(--color-status-digitized-text);
}

.status-badge--progress {
  background: var(--color-status-progress-bg);
  border-color: var(--color-status-progress-border);
  border-style: dashed;
  color: var(--color-status-progress-text);
}

.status-badge--pending {
  background: var(--color-status-pending-bg);
  border-color: var(--color-status-pending-border);
  color: var(--color-status-pending-text);
}

/* Series tag */
.series-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.95em;
  border-radius: var(--radius-pill);
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  font-family: var(--font-tag);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

a.series-tag:hover { background: var(--color-navy-light); }
a.series-tag:focus-visible { outline: none; box-shadow: var(--focus-ring); }


/* ---------- Narrow screens ---------- */
@media (max-width: 560px) {
  .library-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .library-card__placeholder span {
    font-size: 0.5625rem;
    letter-spacing: var(--tracking-wide);
  }

  .library-card__meta tr { display: block; padding: var(--space-2) 0; }
  .library-card__meta th,
  .library-card__meta td { display: block; width: auto; padding: 0; }
  .library-card__meta th { margin-bottom: 2px; }

  .library-card__footer { align-items: flex-start; flex-direction: column; }
}
