/* ============================================
   CARDS — Church, Timeline, Group Cards
   ============================================ */

/* ---- Church Card ---- */
.church-card {
  background: var(--bg-card);
  margin: 0.6rem 0.5rem;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  border: 1px solid rgba(0,0,0,0.05);
  position: relative;
  border-top: 2px solid var(--liturgical-color);
}

.church-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.church-card.has-event-now {
  border-left: 3px solid var(--liturgical-color);
}

.church-card.has-event-soon {
  border-left: 3px solid var(--sage);
}

/* Card entrance animation — only first 10 via nth-child, rest are static.
   NEVER animate all cards — 1,599 simultaneous CSS animations crash mobile Safari. */

.church-card:nth-child(-n+10), .timeline-entry:nth-child(-n+10) { animation: cardSlideIn 0.3s ease-out both; }
.church-card:nth-child(1), .timeline-entry:nth-child(1) { animation-delay: 0ms; }
.church-card:nth-child(2), .timeline-entry:nth-child(2) { animation-delay: 30ms; }
.church-card:nth-child(3), .timeline-entry:nth-child(3) { animation-delay: 60ms; }
.church-card:nth-child(4), .timeline-entry:nth-child(4) { animation-delay: 90ms; }
.church-card:nth-child(5), .timeline-entry:nth-child(5) { animation-delay: 120ms; }
.church-card:nth-child(6), .timeline-entry:nth-child(6) { animation-delay: 150ms; }
.church-card:nth-child(7), .timeline-entry:nth-child(7) { animation-delay: 180ms; }
.church-card:nth-child(8), .timeline-entry:nth-child(8) { animation-delay: 210ms; }
.church-card:nth-child(9), .timeline-entry:nth-child(9) { animation-delay: 240ms; }
.church-card:nth-child(10), .timeline-entry:nth-child(10) { animation-delay: 270ms; }

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* No animation on group cards (too many — crashed Safari in v1) */
.group-card { animation: none; }

/* Header (always visible) */
.church-header {
  padding: 1rem 1.25rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.church-name-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.church-name {
  font-family: 'Crimson Pro', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--charcoal);
  line-height: 1.3;
}

.church-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.distance-badge {
  font-size: 0.82rem;
  color: var(--sage);
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  background: var(--light-gold);
  border-radius: 12px;
}

.church-area {
  font-size: 0.85rem;
  color: var(--sage);
  margin-top: 0.25rem;
}

.church-next-service {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.35rem;
}

.church-next-service .service-now {
  color: var(--crimson);
  font-weight: 600;
}

.church-next-service .service-soon {
  color: var(--gold);
  font-weight: 500;
}

/* Details (expandable) */
.church-details {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.church-card.expanded .church-details {
  max-height: 2000px;
  opacity: 1;
}

.church-details-inner {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.75rem;
}

.church-address {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
}

/* Schedule section inside expanded card */
.schedule-section {
  margin-bottom: 0.75rem;
}

.schedule-day {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--crimson);
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.schedule-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.schedule-time {
  font-weight: 600;
  min-width: 4.5rem;
  color: var(--text-primary);
}

.schedule-type {
  color: var(--text-secondary);
}

.schedule-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---- Timeline Entry ---- */
.timeline-entry {
  background: var(--bg-card);
  margin: 0.5rem 0.5rem;
  border-radius: 14px;
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.05);
  border-top: 2px solid var(--liturgical-color);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.timeline-entry:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.timeline-time {
  font-size: 1rem;
  font-weight: 700;
  color: var(--crimson);
  min-width: 4rem;
  line-height: 1.3;
}

.timeline-info {
  flex: 1;
  min-width: 0;
}

.timeline-type {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-church {
  font-size: 0.82rem;
  color: var(--text-subtle);
  margin-top: 0.15rem;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ---- Group Card ---- */
.group-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--liturgical-color);
  transition: box-shadow 0.3s ease, transform 0.3s ease, border-color 0.8s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.group-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.group-name {
  font-family: 'Crimson Pro', serif;
  font-weight: 600;
  color: var(--crimson);
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
  line-height: 1.3;
}

.group-church {
  font-size: 0.82rem;
  color: var(--sage);
}

.group-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.5;
}

.group-meeting {
  font-size: 0.8rem;
  color: var(--text-subtle);
  margin-top: 0.4rem;
}

/* Mobile card adjustments */
@media (max-width: 600px) {
  .church-card {
    margin: 0.4rem;
    border-radius: 10px;
  }

  .church-header {
    padding: 0.85rem 1rem;
  }

  .church-name {
    font-size: 1.05rem;
  }

  .church-details {
    padding: 0 1rem 1rem;
  }

  .action-pill {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .timeline-entry {
    padding: 0.75rem;
    flex-wrap: wrap;
  }

  .timeline-time {
    font-size: 0.95rem;
  }
}

@media (max-width: 380px) {
  .timeline-time {
    min-width: 50px;
    font-size: 0.85rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .church-card, .timeline-entry, .group-card {
    animation: none !important;
    opacity: 1;
  }
}
