/* =========================================================
   Home — Community Section
   ========================================================= */

.home-community-section {
  margin-top: 28px;
}

.home-community-head {
  margin-bottom: 16px;
}

.home-community-head h2 {
  margin: 0;
  font-size: var(--font-subheading);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-community-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: var(--font-small);
  line-height: 1.45;
}

/* Grid */

.home-community-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* Cards */

.home-community-card {
  min-width: 0;
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.16s var(--ease),
    box-shadow 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.home-community-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(79, 70, 229, 0.4);
}

.home-community-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.home-community-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 800;
  font-size: 15px;
}

.home-community-badge {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.home-community-title {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: var(--font-subheading);
  font-weight: 700;
  cursor: pointer;
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: color 0.12s var(--ease);
}

.home-community-title:hover {
  color: var(--purple);
}

.home-community-subject {
  margin-top: 5px;
  color: var(--muted);
  font-size: var(--font-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-community-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--font-small);
  white-space: nowrap;
  overflow: hidden;
}

.home-community-meta span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-community-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.home-community-actions .btn {
  flex: 1;
  white-space: nowrap;
}

/* Empty state */

.home-community-empty {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.home-community-empty-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 800;
  font-size: 16px;
}

.home-community-empty strong {
  display: block;
  font-size: var(--font-small);
  font-weight: 650;
}

.home-community-empty p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--font-small);
  line-height: 1.45;
}

.home-community-empty .btn {
  margin-left: auto;
  flex: 0 0 auto;
}

/* Skeleton loading */

.skeleton-card {
  pointer-events: none;
}

.skeleton {
  border-radius: 7px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    #f8fafc 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: homeCommunitySkeleton 1.25s ease-in-out infinite;
}

.skeleton-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
}

.skeleton-title {
  height: 18px;
  width: 72%;
  margin-bottom: 10px;
}

.skeleton-line {
  height: 11px;
  width: 88%;
  margin-top: 7px;
}

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

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

/* Dark mode */

.dark .home-community-card:hover {
  border-color: rgba(99, 102, 241, 0.45);
}

.dark .home-community-card-icon,
.dark .home-community-empty-icon {
  background: #1e1b4b;
  color: #a5b4fc;
}

.dark .home-community-badge {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

.dark .skeleton {
  background: linear-gradient(
    90deg,
    #1a2740 25%,
    #24324b 50%,
    #1a2740 75%
  );
  background-size: 200% 100%;
}

/* Responsive */

@media (max-width: 1150px) {
  .home-community-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .home-community-grid {
    grid-template-columns: 1fr;
  }

  .home-community-empty {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .home-community-empty .btn {
    width: 100%;
    margin-left: 58px;
  }
}