.community-distribution {
  max-width: 960px;
}

.community-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.community-eyebrow {
  margin: 0 0 4px;
  color: #888;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.community-head h1 {
  margin: 0;
  color: #222;
  font-size: 28px;
  line-height: 1.3;
}

.community-lead {
  margin: 5px 0 0;
  color: #777;
  font-size: 13px;
}

.community-official {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid #dedede;
  border-radius: 12px;
  background: #fff;
  transition: box-shadow .2s, transform .15s;
}

.community-official:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .07);
}

.community-official-cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 9px;
  background: #ececec;
}

.community-official-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-official-copy {
  min-width: 0;
}

.community-official-kicker {
  display: block;
  margin-bottom: 4px;
  color: #555;
  font-size: 11px;
  font-weight: 700;
}

.community-official h2 {
  margin: 0;
  color: #222;
  font-size: 18px;
  line-height: 1.4;
}

.community-official-copy > p {
  margin: 6px 0 10px;
  color: #777;
  font-size: 12px;
  line-height: 1.6;
}

.community-meta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: #999;
  font-size: 10px;
}

.community-official-badge {
  align-self: flex-start;
  padding: 4px 9px;
  border: 1px solid #e1c45d;
  border-radius: 999px;
  background: #fff8dc;
  color: #6c5200;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.community-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px;
  margin-bottom: 11px;
}

.community-search,
.community-sort {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d0d0d0;
  border-radius: 9px;
  background: #fff;
  color: #333;
  font: inherit;
}

.community-search {
  padding: 0 15px;
  font-size: 14px;
}

.community-sort {
  padding: 0 12px;
  font-size: 12px;
}

.community-search:focus,
.community-sort:focus {
  outline: none;
  border-color: #333;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
}

.community-category-chips,
.community-tag-cloud {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.community-category-chips {
  margin-bottom: 17px;
}

.community-chip {
  padding: 6px 12px;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fff;
  color: #666;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: transform .14s ease, background-color .18s ease, border-color .18s ease, color .18s ease;
}

.community-chip:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
}

.community-chip:active {
  transform: translateY(0) scale(.97);
}

.community-chip.is-active {
  border-color: #333;
  background: #333;
  color: #fff;
}

.community-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 214px;
  gap: 18px;
  align-items: start;
}

.community-section-title {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}

.community-section-title h2 {
  margin: 0;
  font-size: 17px;
}

.community-section-title span {
  color: #999;
  font-size: 11px;
}

.community-items {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.community-item-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  background: #fff;
  transition: box-shadow .2s, transform .15s;
}

.community-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
}

.community-item-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #ededed;
}

.community-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .28s ease;
}

.community-item-card:hover .community-item-cover img {
  transform: scale(1.025);
}

.community-item-no-image {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 12px;
}

.community-item-body {
  padding: 11px;
}

.community-item-title {
  display: block;
  overflow: hidden;
  color: #222;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-item-summary {
  display: -webkit-box;
  min-height: 3em;
  margin: 5px 0 9px;
  overflow: hidden;
  color: #888;
  font-size: 11px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #999;
  font-size: 10px;
}

.community-item-author {
  min-width: 0;
  overflow: hidden;
  color: #666;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-item-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.community-item-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f1f1;
  color: #777;
  font-size: 9px;
}

.community-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.community-panel {
  padding: 13px;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  background: #fff;
}

.community-panel h3 {
  margin: 0 0 8px;
  color: #333;
  font-size: 12px;
}

.community-filter-row {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid #eee;
  background: transparent;
  color: #777;
  font: inherit;
  font-size: 10px;
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, padding-left .16s ease, background-color .16s ease;
}

.community-filter-row:first-child {
  border-top: 0;
}

.community-filter-row:hover {
  padding-left: 4px;
  color: #444;
}

.community-filter-row.is-active {
  color: #222;
  font-weight: 700;
}

.community-recent-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #eee;
  transition: background-color .16s ease, transform .16s ease;
}

.community-recent-item:first-child {
  border-top: 0;
}

.community-recent-item:hover {
  background: #fafafa;
  transform: translateX(2px);
}

.community-recent-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: #ececec;
}

.community-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-recent-copy {
  min-width: 0;
}

.community-recent-copy strong,
.community-recent-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-recent-copy strong {
  color: #444;
  font-size: 10px;
}

.community-recent-copy small,
.community-recent-arrow {
  color: #999;
  font-size: 9px;
}

.community-recent-arrow {
  transition: transform .16s ease;
}

.community-recent-item:hover .community-recent-arrow {
  transform: translateX(3px);
}

/* The author display rule must not override the HTML hidden attribute. */
.community-load-sentinel[hidden] {
  display: none;
}

/* .btn sets display:inline-flex; do not show a hidden pagination fallback. */
.community-load-more[hidden] {
  display: none;
}

.community-load-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 13px;
  border: 1px dashed #ddd;
  border-radius: 10px;
  color: #999;
  font-size: 10px;
}

.community-load-more {
  width: 100%;
  margin-top: 12px;
}

#communityEmpty {
  padding: 50px 16px;
}

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

  .community-side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .community-panel:last-child {
    grid-column: 1 / -1;
  }

  .community-official {
    grid-template-columns: 240px minmax(0, 1fr) auto;
  }
}

@media (max-width: 620px) {
  .community-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .community-submit-button {
    display: none;
  }

  .community-head h1 {
    font-size: 24px;
  }

  .community-official {
    position: relative;
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 10px;
  }

  .community-official-badge {
    position: absolute;
    top: 20px;
    right: 20px;
  }

  .community-official-copy {
    padding: 0 2px 2px;
  }

  .community-search-row {
    grid-template-columns: 1fr;
  }

  .community-items,
  .community-side {
    grid-template-columns: 1fr;
  }

  .community-panel:last-child {
    grid-column: auto;
  }
}

/* Keep existing cards visible while a search/filter refresh is in flight. */
.community-items.is-refreshing { opacity: .75; transition: opacity .15s ease; }
.community-chip:focus-visible { outline: 2px solid #333; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .community-items.is-refreshing { transition: none !important; }
  .community-chip,
  .community-item-card,
  .community-item-cover img,
  .community-filter-row,
  .community-recent-item,
  .community-recent-arrow {
    transition: none !important;
    transform: none !important;
  }
}
