/* ===== Cards — Glassmorphism, анимации ===== */

.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  cursor: pointer;
  transition: transform 0.26s var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)), box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
  animation: cardFadeIn 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.card:hover {
  transform: translateY(-4px) scale(1.006);
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(212, 169, 78, 0.22),
    0 0 26px rgba(212, 169, 78, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-color: rgba(212, 169, 78, 0.34);
}
/* золотая линия-орнамент по верхнему краю карточки */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 169, 78, 0.35), transparent);
  opacity: 0.5;
  transition: opacity 0.25s;
}
.card:hover::after { opacity: 1; }

/* Source accent bar */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 3px 0 0 3px;
}
.card[data-source="urantia"]::before { background: var(--urantia); box-shadow: 0 0 8px var(--urantia-glow); }
.card[data-source="bible"]::before   { background: var(--bible); box-shadow: 0 0 8px var(--bible-glow); }
.card[data-source="quran"]::before   { background: var(--quran); box-shadow: 0 0 8px var(--quran-glow); }

/* Source glow on hover */
.card[data-source="urantia"]:hover { border-color: rgba(124, 156, 255, 0.3); box-shadow: 0 10px 36px rgba(0,0,0,0.38), 0 0 24px var(--urantia-glow); }
.card[data-source="bible"]:hover   { border-color: rgba(123, 216, 143, 0.3); box-shadow: 0 10px 36px rgba(0,0,0,0.38), 0 0 24px var(--bible-glow); }
.card[data-source="quran"]:hover   { border-color: rgba(224, 179, 102, 0.3); box-shadow: 0 10px 36px rgba(0,0,0,0.38), 0 0 24px var(--quran-glow); }

/* --- Cross-reference hover: highlight parallel passages in other columns --- */
.card.cross-active {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  z-index: 2;
}
.card.cross-hint {
  border-color: rgba(212, 169, 78, 0.45);
  box-shadow: 0 0 18px rgba(212, 169, 78, 0.16);
}
.card.cross-dim { opacity: 0.45; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12.5px;
}
.card-book {
  color: var(--muted);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sim {
  color: #d8c9a0;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 13px;
}
.card-exact {
  color: #0b0d12;
  background: var(--gold);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

/* --- Бар совпадения (sim) --- */
.sim-track {
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.07);
  margin: 0 0 12px;
  overflow: hidden;
  position: relative;
}
.sim-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(212, 169, 78, 0.55), var(--gold-bright));
  box-shadow: 0 0 6px rgba(212, 169, 78, 0.45);
  transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.card[data-source="urantia"] .sim-fill { background: linear-gradient(90deg, rgba(124, 156, 255, 0.5), #7c9cff); box-shadow: 0 0 6px rgba(124, 156, 255, 0.4); }
.card[data-source="bible"]   .sim-fill { background: linear-gradient(90deg, rgba(123, 216, 143, 0.5), #7bd88f); box-shadow: 0 0 6px rgba(123, 216, 143, 0.4); }
.card[data-source="quran"]   .sim-fill { background: linear-gradient(90deg, rgba(224, 179, 102, 0.5), #e0b366); box-shadow: 0 0 6px rgba(224, 179, 102, 0.4); }

.card-text {
  font-size: 14.5px;
  line-height: 1.72;
  color: #d6d4ce;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: all 0.3s ease;
}
.card:hover .card-text { color: #e8e6e0; }
.card-text.expanded {
  -webkit-line-clamp: unset;
  display: block;
}
.card-toggle {
  font-size: 12px;
  color: #8a90a3;
  cursor: pointer;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
  user-select: none;
}
.card-toggle svg { transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1); }
.card-toggle.expanded svg { transform: rotate(180deg); }
.card-toggle:hover { color: var(--gold); }
.empty-ico { display: block; margin: 0 auto 14px; filter: drop-shadow(0 0 14px rgba(212, 169, 78, 0.45)); animation: emptyFloat 3.2s ease-in-out infinite; }
@keyframes emptyFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* --- Skeleton loading --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--card-bg) 25%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--card-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  height: 104px;
  pointer-events: none;
}
.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.skeleton-line:first-child { width: 55%; }
.skeleton-line:nth-child(2) { width: 85%; }
.skeleton-line:nth-child(3) { width: 40%; }

/* --- Animations --- */
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.card:nth-child(4) { animation-delay: 0.18s; }
.card:nth-child(5) { animation-delay: 0.24s; }
.card:nth-child(6) { animation-delay: 0.30s; }
.card:nth-child(7) { animation-delay: 0.36s; }
.card:nth-child(8) { animation-delay: 0.42s; }

/* --- Фаза 6.5: контекст пассажа (соседние абзацы книги) --- */
.card-ctx-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 0 0 10px;
  padding: 3px 9px;
  font-size: 11.5px;
  color: var(--muted, #8892a8);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.card-ctx-btn:hover { color: var(--text, #e8ecf4); border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.06); }
.card-ctx-btn:disabled { opacity: 0.55; cursor: wait; }
.card-ctx-btn svg { flex: 0 0 auto; }

.card-ctx {
  margin: 10px 0 2px;
  padding: 2px 0 0 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
}
.ctx-block {
  display: flex;
  gap: 8px;
  padding: 6px 2px;
  font-size: 12.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}
.ctx-block + .ctx-block { border-top: 1px solid rgba(255, 255, 255, 0.05); }
.ctx-arrow {
  flex: 0 0 14px;
  color: var(--accent, #d4a94e);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.ctx-text { min-width: 0; }
.ctx-empty {
  padding: 8px 2px;
  font-size: 12px;
  color: var(--muted, #8892a8);
  font-style: italic;
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none !important; transition: none !important; }
}
