/* ===================================================================
   Sunday Service Archive (sunday-archive.html, Scott 15 Nov 2026)

   A big player at the top (the same .video-embed as watch.html), then a
   carousel of every past service, one year at a time. The carousel is a
   native horizontal scroller with snap points rather than a transform
   track, so a phone swipes it and a trackpad scrolls it with no extra code;
   the arrow buttons just page it. Cards reuse the indigo media-card look
   from watch.html's carousels.
   =================================================================== */

/* ── Top: title, player, what is playing, slides ─────────────────── */

/* No eyebrow above the title, and a tighter gap under the header (Scott,
   15 Nov 2026), so the title sits close to the top of the screen. */
.sa-top {
  padding-top: calc(var(--header-total) + var(--space-6));
  padding-bottom: var(--space-12);
}

.sa-top__head {
  text-align: center;
  margin-bottom: var(--space-6);
}

.sa-top__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin-bottom: var(--space-2);
}

.sa-top__lead {
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto;
}

.sa-stage {
  max-width: 1080px;
  margin-inline: auto;
}

.sa-now {
  margin: var(--space-4) 0 0;
  font-weight: 600;
  color: var(--color-indigo);
}

.sa-now[hidden] { display: none; }

.sa-now__label {
  display: inline-block;
  margin-right: var(--space-2);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--color-gold);
  color: var(--color-indigo-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0.12em;
}

/* The slides line borrows .slides-link from components.css; this is only
   the "none for this service" wording. */
.sa-slides--none {
  color: var(--color-text-muted);
  font-style: italic;
}

.sa-slides[hidden] { display: none; }

.sa-back {
  margin: var(--space-6) 0 0;
  font-size: 0.95rem;
}

/* ── The archive: carousel, then heading, years and count ────────── */

/* The carousel opens the section (Scott, 15 Nov 2026), so it sits a little
   closer to the player than a full section gap. */
.sa-past { padding-top: var(--space-12); }

.sa-past__head {
  margin-top: var(--space-12);
  margin-bottom: var(--space-6);
}

.sa-years {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.sa-year {
  min-width: 4.5rem;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-indigo);
  border-radius: var(--radius-full);
  background: var(--color-white);
  color: var(--color-indigo);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.sa-year:hover { background: var(--color-cream-dark); }

.sa-year[aria-pressed="true"] {
  background: var(--color-indigo);
  color: var(--color-white);
}

.sa-year:focus-visible,
.sa-card__play:focus-visible,
.sa-card__slides:focus-visible,
.sa-carousel__btn:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

.sa-count {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: 0 0 var(--space-6);
  min-height: 1.4em;
}

.sa-carousel {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  /* Scrolled to when a year is picked from the buttons below it. */
  scroll-margin-top: calc(var(--header-total) + var(--space-4));
}

.sa-scroller {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: var(--space-6);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  /* Match the side padding below, or the first card snaps 4px in and the
     "Newer" arrow never reads as being at the start. */
  scroll-padding-inline: var(--space-1);
  scrollbar-width: none;
  /* Room for the lift on hover and the gold "now playing" ring. */
  padding: var(--space-2) var(--space-1) var(--space-3);
}

.sa-scroller::-webkit-scrollbar { display: none; }

.sa-carousel__btn {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-gold);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.sa-carousel__btn svg { width: 24px; height: 24px; }

.sa-carousel__btn:hover { background: var(--color-gold-dark); transform: scale(1.08); }

.sa-carousel__btn:disabled { opacity: 0.35; cursor: default; transform: none; }

.sa-carousel__message {
  padding: var(--space-10) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

/* ── A card ──────────────────────────────────────────────────────── */

/* Four across on a wide screen (Scott, 15 Nov 2026). */
.sa-card {
  flex: 0 0 calc((100% - 3 * var(--space-6)) / 4);
  min-width: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--color-indigo);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

/* Lift only, no drop shadow: the scroller clips anything outside its padding,
   and a clipped shadow shows as a pale box with hard edges under the card. */
.sa-card:hover {
  transform: translateY(-4px);
}

/* The 3px ring fits inside the scroller's 4px side padding. */
.sa-card[aria-current="true"] {
  box-shadow: 0 0 0 3px var(--color-gold);
}

.sa-card__play {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

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

.sa-card__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sa-card__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.sa-card__icon svg {
  width: 20px;
  height: 20px;
  margin-left: 3px;
  fill: var(--color-indigo-dark);
}

.sa-card:hover .sa-card__icon {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(201, 149, 42, 0.6);
}

.sa-card__badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: none;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  background: var(--color-gold);
  color: var(--color-indigo-dark);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sa-card[aria-current="true"] .sa-card__badge { display: inline-block; }

/* A Sunday with slides but no recording in the playlist: same card, nothing
   to play, so no lift and no pointer. */
.sa-card--slides-only:hover { transform: none; }

.sa-card--slides-only .sa-card__play { cursor: default; }

.sa-card__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-indigo-mid);
}

.sa-card__empty {
  padding: 0 var(--space-4);
  text-align: center;
  color: var(--color-cream);
  font-size: var(--text-sm);
}

.sa-card__text {
  display: block;
  padding: var(--space-3) var(--space-4) var(--space-3);
}

.sa-card__date {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-gold-light);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sa-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.35;
}

/* Sits at the bottom of every card that has a deck, so a row of cards keeps
   its slides links level. */
.sa-card__slides {
  margin: auto var(--space-4) var(--space-4);
  align-self: flex-start;
  padding-top: var(--space-1);
  color: var(--color-white);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.sa-card__slides:hover { border-bottom-color: currentColor; }

/* The PDF tag from .slides-link, lightened for the dark card. */
.sa-card__slides .slides-link__tag {
  color: var(--color-gold-light);
  border-color: var(--color-gold-light);
}

.sa-card__size {
  color: var(--color-slate-light);
  font-weight: 400;
  font-size: 0.8rem;
}

.sa-note {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin: var(--space-8) 0 0;
}

/* ── Narrower screens ────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .sa-card { flex-basis: calc((100% - 2 * var(--space-6)) / 3); }
}

@media (max-width: 820px) {
  .sa-card { flex-basis: calc((100% - var(--space-6)) / 2); }
}

/* A phone shows one card and the edge of the next, which says "swipe". */
@media (max-width: 560px) {
  .sa-carousel { gap: var(--space-2); }
  .sa-scroller { gap: var(--space-4); }
  .sa-card { flex-basis: 82%; }
  .sa-carousel__btn { width: 36px; height: 36px; }
  .sa-carousel__btn svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sa-card,
  .sa-card__icon { transition: none; }
  .sa-card:hover { transform: none; }
}
