/* Design batch 8 (PO 2026-10-24) — shared card styles.
   .hf-*  「大家在聊」 community feed cards (home + browse.html?type=community)
   .gc-*  interest-group cards (home 「找到你的同好」 + groups.html) */

/* ── feed grid: 2 columns on phones, 4 from 769px ── */
.hf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: stretch; }
@media (min-width: 769px) { .hf-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; } }

.hf-card {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border-radius: 1rem; background: #ffffff; border: 1px solid #e3eaf3; color: #0f172a; text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hf-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 64, 175, 0.12); }
.hf-card .hf-card__link { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: stretch; height: 100%; padding: 0; gap: 0; color: inherit; text-decoration: none; }
.hf-card__link:focus-visible, .hf-card:focus-visible { outline: 3px solid var(--color-primary, #2563eb); outline-offset: 2px; }

/* cover: first image (feed-media-preview fills .post-card__media) over a colour block */
.hf-card__cover, .hf-card .post-card__media { grid-area: 1 / 1; aspect-ratio: 4 / 3; width: 100%; }
.hf-card__cover { display: flex; align-items: center; padding: 0.875rem 0.875rem 1rem; }
.hf-card__quote {
  margin: 0; color: var(--hf-ink, #0f172a); font-size: 1rem; font-weight: 800; line-height: 1.4; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.hf-card .post-card__media { position: relative; z-index: 1; overflow: hidden; margin: 0; border-radius: 0; background: #e2e8f0; }
.hf-card .post-card__media[hidden] { display: none; }
.hf-card .post-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* batch 9 (PO 2026-10-25): the older home rule `.home-community .post-card__media { height: 6rem }`
   (4.5rem on phones) cut the photo to a strip — the cover photo must fill the whole 4:3 block. */
.hf-card .post-card__media, .home-community .hf-card .post-card__media { height: auto; min-height: 0; max-height: none; align-self: stretch; }
.hf-card .post-card__media .post-card__media-image { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: cover; }
.hf-card__badge {
  grid-area: 1 / 1; align-self: start; justify-self: start; z-index: 2; margin: 0.5rem;
  padding: 0.2rem 0.55rem; border-radius: 999px; background: #f97316; color: #fff; font-size: 0.6875rem; font-weight: 800;
  box-shadow: 0 2px 6px rgba(249, 115, 22, 0.35);
}
.hf-card__body { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.625rem 0.75rem 0.75rem; }
.hf-card__title {
  margin: 0; font-size: 0.875rem; font-weight: 700; line-height: 1.4; color: #0f172a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.hf-card__foot { margin-top: auto; display: flex; align-items: center; gap: 0.375rem; min-width: 0; font-size: 0.75rem; color: #64748b; }
.hf-card__avatar { flex: 0 0 auto; width: 1.375rem; height: 1.375rem; display: grid; place-items: center; border-radius: 50%; background: var(--hf-chip, #e2e8f0); color: var(--hf-ink, #334155); }
.hf-card__avatar--anon { background: #e2e8f0; color: #94a3b8; }
.hf-card__chip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.125rem 0.5rem; border-radius: 999px; background: var(--hf-chip, #f1f5f9); color: var(--hf-ink, #334155); font-weight: 700; }
.hf-card__count { margin-left: auto; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.2rem; }
/* 2026-10-27: 0 replies → show the post date instead of "0"; same-text title hidden (cover shows it) */
.hf-card__time { margin-left: auto; flex: 0 0 auto; white-space: nowrap; font-size: 0.6875rem; color: #94a3b8; }
.hf-card__count[data-count="0"] { display: none; }
.hf-card__count:not([data-count="0"]) + .hf-card__time { display: none; }
.hf-card--same-title .hf-card__quote { display: none; }
.hf-card__cover-icon { font-size: 2.5rem; line-height: 1; justify-self: center; align-self: center; }
.hf-card--same-title .hf-card__cover { display: grid; place-items: center; }

/* pinned 本周话题 */
.hf-card--topic {
  justify-content: space-between; gap: 0.75rem; padding: 1rem; border: 0;
  background: radial-gradient(circle at 85% 12%, rgba(255, 255, 255, 0.28), transparent 45%), linear-gradient(150deg, #2563eb, #7c3aed);
  color: #ffffff; box-shadow: 0 10px 24px rgba(79, 70, 229, 0.28);
}
.hf-topic__label { align-self: flex-start; padding: 0.2rem 0.6rem; border-radius: 999px; background: rgba(255, 255, 255, 0.2); font-size: 0.75rem; font-weight: 800; }
.hf-topic__text { margin: 0; font-size: 1.125rem; font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.hf-topic__cta { align-self: flex-start; padding: 0.375rem 0.875rem; border-radius: 999px; background: #ffffff; color: #4338ca; font-size: 0.8125rem; font-weight: 800; }

/* compose / see-all helper cards that complete the last row */
.hf-card--filler { justify-content: center; align-items: flex-start; gap: 0.375rem; padding: 1rem; border: 1.5px dashed #c7d6ee; background: #f8fbff; box-shadow: none; }
.hf-filler__icon { font-size: 1.75rem; }
.hf-filler__title { font-size: 0.9375rem; font-weight: 800; color: #1e3a8a; }
.hf-filler__sub { font-size: 0.75rem; color: #64748b; line-height: 1.4; }

@media (max-width: 768px) {
  .hf-grid { gap: 0.625rem; }
  .hf-card__quote { font-size: 0.9375rem; }
  .hf-topic__text { font-size: 1rem; }
  .hf-card--topic, .hf-card--filler { padding: 0.875rem; }
}

/* tabs */
.hf-tabs { display: flex; gap: 0.5rem; padding: 0.125rem 0 0.25rem; }
.hf-tab {
  flex: 0 0 auto; min-height: 2.25rem; padding: 0 1rem; border: 1px solid #d9e3f0; border-radius: 999px; background: #ffffff;
  color: #334155; font: inherit; font-size: 0.875rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.hf-tab:hover { border-color: #93c5fd; color: #1d4ed8; }
.hf-tab--active { background: #0f172a; border-color: #0f172a; color: #ffffff; }
.hf-tab--active:hover { color: #ffffff; }

/* ── interest-group cards ── */
.gc-row { display: flex; gap: 0.875rem; padding: 0.25rem 0.125rem 0.5rem; }
.gc-row > .gc { flex: 0 0 15rem; }
.gc {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: 1.125rem; background: #ffffff;
  border: 1px solid #e3eaf3; color: #0f172a; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gc:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 64, 175, 0.12); }
.gc__cover { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; text-decoration: none; }
.gc__emoji { font-size: 3rem; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.18)); }
.gc__live {
  position: absolute; top: 0.5rem; left: 0.5rem; display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.55rem; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: #065f46; font-size: 0.6875rem; font-weight: 800;
}
.gc__dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
.gc__body { flex: 1; display: flex; flex-direction: column; gap: 0.375rem; padding: 0.75rem 0.875rem 0.875rem; }
.gc__name { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.3; }
.gc__name a { color: inherit; text-decoration: none; }
.gc__meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.75rem; color: #64748b; }
.gc__today--on { color: #047857; font-weight: 700; }
.gc__preview {
  margin: 0; font-size: 0.8125rem; line-height: 1.45; color: #475569; min-height: 2.9em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gc__preview--msg { color: #1e293b; font-style: italic; }
.gc__actions { margin-top: auto; padding-top: 0.25rem; display: flex; gap: 0.5rem; }
.gc__btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 2.25rem; padding: 0 0.875rem;
  border: 1px solid #d9e3f0; border-radius: 999px; background: #ffffff; color: #1d4ed8; font: inherit; font-size: 0.8125rem; font-weight: 800;
  text-decoration: none; cursor: pointer;
}
.gc__btn--primary { background: #2563eb; border-color: #2563eb; color: #ffffff; }
.gc__btn--primary:hover { background: #1d4ed8; }
.gc--inactive { opacity: 0.6; }
.gc--new {
  align-items: center; justify-content: center; gap: 0.375rem; padding: 1.25rem 1rem; text-align: center; text-decoration: none;
  border: 1.5px dashed #c7d6ee; background: #f8fbff; box-shadow: none;
}
.gc__plus { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 50%; background: #dbeafe; color: #1d4ed8; font-size: 1.5rem; font-weight: 800; }
.gc__newtitle { font-size: 0.9375rem; color: #0f172a; }
.gc__newcta { font-size: 0.8125rem; font-weight: 800; color: #2563eb; }

/* groups.html grid: 2 columns on phones, 3 from 640px (the request card fills the last row) */
.grp__list.gc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; padding: 0; list-style: none; }
@media (min-width: 640px) { .grp__list.gc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
.gc-grid__item { display: flex; min-width: 0; }
.gc-grid__item > .gc { flex: 1; }
@media (max-width: 639px) {
  .gc-grid .gc__emoji { font-size: 2.5rem; }
  .gc-grid .gc__body { padding: 0.625rem 0.75rem 0.75rem; }
  .gc-grid .gc__name { font-size: 0.9375rem; }
}

@media (prefers-reduced-motion: reduce) { .hf-card, .gc { transition: none; } .hf-card:hover, .gc:hover { transform: none; } }
.gc-grid__item--wide > .gc--new { flex-direction: row; gap: 0.75rem; padding: 1rem; }
.gc-grid__item--new .gc__newcta { margin-left: 0.25rem; }
.hf-card--filler.hf-card--wide { align-items: center; text-align: center; }
