/* Homepage previews only. Keep directory cards and profile dashboards independent. */
#main-content .top-expertise-section #top-expert-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-auto-rows: auto;
  gap: 12px !important;
  align-items: stretch;
}

#top-expert-grid .featured-expert-card {
  --portrait-ink: #415778;
  --portrait-bg: #eaf0f7;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e0e5ec;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(32, 48, 73, .045);
  font-family: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
#top-expert-grid .featured-expert-card[data-expert-category="app"] { --portrait-ink: #386a62; --portrait-bg: #e6f1ed; }
#top-expert-grid .featured-expert-card[data-expert-category="ai"] { --portrait-ink: #6a5688; --portrait-bg: #f0eaf7; }
#top-expert-grid .featured-expert-card[data-expert-category="software"] { --portrait-ink: #456685; --portrait-bg: #e8eff6; }
#top-expert-grid .featured-expert-card:hover {
  transform: translateY(-2px);
  border-color: #bdc8d8;
  box-shadow: 0 12px 30px rgba(32, 48, 73, .11);
}
#top-expert-grid .featured-expert-card:focus-within { border-color: #8093af; }
#top-expert-grid .featured-expert-content { flex: 1; min-width: 0; padding: 14px 14px 8px; }
#top-expert-grid .featured-expert-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#top-expert-grid .featured-expert-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  overflow: hidden;
  border: 1px solid #e4eaf0;
  border-radius: 50%;
  color: var(--portrait-ink);
  background: var(--portrait-bg);
  box-shadow: none;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.5px;
}
#top-expert-grid .featured-expert-avatar img { width: 100%; height: 100%; object-fit: cover; }
#top-expert-grid .featured-expert-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 96px;
  color: #36634e;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}
#top-expert-grid .featured-expert-status > span { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: #35a475; }
#top-expert-grid .featured-expert-status.busy { color: #8c6c36; }
#top-expert-grid .featured-expert-status.busy > span { background: #bb9451; }
#top-expert-grid .featured-expert-identity { margin-top: 10px; }
#top-expert-grid .featured-expert-identity h3 {
  color: #1f2c42;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -.5px;
  overflow-wrap: anywhere;
}
#top-expert-grid .featured-expert-identity h3 a:hover { color: #415778; }
#top-expert-grid .featured-expert-identity p {
  min-height: 0;
  margin-top: 3px;
  color: #667085;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#top-expert-grid .featured-expert-skills {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: flex-start;
  gap: 6px;
  margin-top: 10px;
}
#top-expert-grid .featured-expert-skill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #46536a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}
#top-expert-grid .featured-expert-skill > span { min-width: 0; overflow-wrap: break-word; }
#top-expert-grid .featured-expert-skill .skill-icon,
#top-expert-grid .featured-expert-skill .featured-skill-icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  object-fit: contain;
  padding: 0;
  border: 0;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
}
#top-expert-grid .featured-skill-category { color: #64748b; }
#top-expert-grid .featured-expert-more { grid-column: 1 / -1; align-self: center; padding: 0; color: #617087; font-size: 12px; }
#top-expert-grid .featured-expert-more:hover { text-decoration: underline; }
#top-expert-grid .featured-expert-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px 10px;
  margin: 0 14px;
  padding: 6px 0;
  color: #67758a;
  font-size: 11px;
  line-height: 1.4;
}
#top-expert-grid .featured-expert-detail strong { color: #34445d; font-weight: 650; }
#top-expert-grid .featured-expert-demo { color: #64748b; }
#top-expert-grid .featured-expert-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px 12px 12px; }
#top-expert-grid .featured-expert-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 42px;
  padding: 8px;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  color: #35445c;
  font: 600 12px/1.35 "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease;
}
#top-expert-grid .featured-expert-action:hover { background: #edf2f8; border-color: #bbc7d8; }
#top-expert-grid .featured-expert-action-primary { color: #fff; background: #23344d; border-color: #23344d; }
#top-expert-grid .featured-expert-action-primary:hover { color: #fff; background: #16263d; border-color: #16263d; }
#top-expert-grid .featured-expert-portfolio { grid-column: 1 / -1; text-align: center; padding-top: 2px; color: #62718a; font-size: 11px; }
#top-expert-grid a:focus-visible, #top-expert-grid button:focus-visible { outline: 2px solid #8a9cb6; outline-offset: 3px; }
#top-expert-grid .featured-expert-card.is-flipping {
  pointer-events: none;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform, opacity;
  transition: none;
  /* Reuse the original directory flip and its navigation-completion event. */
  animation: expert-card-flip-open .56s cubic-bezier(.16, 1, .3, 1) both;
}
@media (max-width: 1100px) {
  #main-content .top-expertise-section #top-expert-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (max-width: 760px) {
  #main-content .top-expertise-section #top-expert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 540px) {
  #main-content .top-expertise-section #top-expert-grid { grid-template-columns: minmax(0, 1fr) !important; }
  #top-expert-grid .featured-expert-content { padding: 14px 16px 8px; }
  #top-expert-grid .featured-expert-identity { margin-top: 10px; }
  #top-expert-grid .featured-expert-identity p { min-height: 0; font-size: 13px; }
  #top-expert-grid .featured-expert-skills { margin-top: 10px; }
  #top-expert-grid .featured-expert-detail { margin-inline: 16px; }
  #top-expert-grid .featured-expert-action { min-height: 44px; font-size: 12px; }
  #top-expert-grid .featured-expert-actions { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  #top-expert-grid .featured-expert-card { transition: none; }
  #top-expert-grid .featured-expert-card:hover { transform: none; }
  #top-expert-grid .featured-expert-card.is-flipping { animation: expert-card-fade-open .18s ease forwards; }
}
