/* ── Fixed Income Model Zoo — Cards ─────────────────────── */

/* ── Grid ── */
.zoo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 40px;
}

/* ── Sub-grids (grouped view) ── */
.zoo-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ── Card ── */
.zoo-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  text-decoration: none;
  color: inherit;
  position: relative;
}

.zoo-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--text-muted);
  text-decoration: none;
  color: inherit;
}

/* ── Thumbnail ── */
.card-thumb {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border-muted);
}

.card-thumb svg {
  width: 100%;
  height: 100%;
}

/* Hover animations for SVG thumbnails */
.zoo-card:hover .fi-node {
  animation: nodePulse 1.5s ease-in-out infinite;
}
.zoo-card:hover .fi-line {
  animation: lineFlow 1.2s ease-in-out infinite;
}
.zoo-card:hover .fi-area {
  animation: areaGlow 0.8s ease-in-out infinite alternate;
}

@keyframes nodePulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}
@keyframes lineFlow {
  0%   { stroke-dashoffset: 8; }
  100% { stroke-dashoffset: 0; }
}
@keyframes areaGlow {
  0%   { opacity: 0.15; }
  100% { opacity: 0.35; }
}

/* ── Body ── */
.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-year {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* ── Key Insight ── */
.card-insight {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Meta Row ── */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-muted);
}

/* Family badge */
.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  white-space: nowrap;
}

.badge-yc       { background: rgba(88,166,255,.15); color: var(--family-yield-curve); }
.badge-rd       { background: rgba(240,136,62,.15);  color: var(--family-rate-dynamics); }
.badge-fr       { background: rgba(163,113,247,.15); color: var(--family-forward-rates); }
.badge-vol      { background: rgba(248,81,73,.15);   color: var(--family-volatility); }
.badge-cr       { background: rgba(63,185,80,.15);   color: var(--family-credit-risk); }
.badge-mtg      { background: rgba(210,168,255,.15); color: var(--family-mortgage); }
.badge-inf      { background: rgba(227,179,65,.15);  color: var(--family-inflation); }

/* Subcategory badge */
.badge-sub {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid;
  white-space: nowrap;
}

/* Tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: auto;
}

.tag {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 1px 6px;
  border-radius: 8px;
}

/* Complexity dots */
.complexity {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: 4px;
}

.complexity-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.25;
}

.complexity-dot.active { opacity: 1; }

.complexity-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 2px;
}

/* ── Formula preview ── */
.card-formula {
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Coming Soon Overlay ── */
.card-coming-soon {
  opacity: 0.55;
  pointer-events: none;
}

.coming-soon-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: var(--radius-md);
}

/* ── Skeleton Loader ── */
.skeleton-card {
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
}

.skeleton-thumb {
  height: 180px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
}

.skeleton-line {
  height: 14px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
  margin: 12px 16px 0;
}

.skeleton-line.short { width: 60%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .zoo-grid,
  .zoo-subgrid {
    grid-template-columns: 1fr;
  }
  .card-thumb { height: 150px; }
}
