/* /sermons/ page: the card grid. (The video lightbox overlay it shares
   with /resources/ lives in lightbox.css.)
   Loaded only on /sermons/ via the extra_css block in templates/sermons.html.
   The .sermons-filter search box is styled in base.css. */

/* ---- Card grid ---- */
.sermons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin: 20px 0 8px;
}

.sermon-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-rule);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  text-decoration: none;
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.sermon-card[hidden] {
  display: none;
}

/* The card sits inside .prose, whose links are underlined and brand-coloured.
   Reset that for the whole-card link; the title and meta set their own colour.
   Higher specificity than `.prose a` so it wins. */
.prose a.sermon-card,
.prose a.sermon-card:hover,
.prose a.sermon-card:focus-visible {
  text-decoration: none;
  color: var(--color-text);
}

.sermon-card:hover,
.sermon-card:focus-visible {
  border-color: var(--color-brand);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  outline: none;
}

.sermon-card:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.sermon-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.sermon-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  /* hqdefault is 4:3 with letterbox bars; cover crops them to a clean 16:9 */
  object-fit: cover;
}

.sermon-card__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sermon-card:hover .sermon-card__play,
.sermon-card:focus-visible .sermon-card__play {
  opacity: 1;
  transform: scale(1.08);
}

.sermon-card__play svg {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.4));
}

.sermon-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 14px;
}

.sermon-card__title {
  font-weight: var(--weight-bold);
  line-height: 1.25;
  color: var(--color-heading);
}

.sermon-card__meta {
  font-size: 14px;
  line-height: 1.35;
  color: #555;
}

@media (prefers-reduced-motion: reduce) {
  .sermon-card,
  .sermon-card__play {
    transition: none;
  }
}
