/* Community hub (/community and its sections) on tablets and phones: a compact hero, sections
   as a swipeable row of chips, news-style list cards and tidy sidebar blocks. Desktop is untouched. */

@media (max-width: 991.98px) {
  /* Counts in one row */
  .community-hero__stats {
    flex: 1 1 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
  }
}

@media (max-width: 767.98px) {
  /* ---------- Hero ---------- */
  .community-hero {
    padding: 14px 12px 16px;
  }

  /* The site header already links home: keep just the breadcrumb */
  .community-hero .community-portal-nav__back,
  .community-hero .community-portal-nav__links {
    display: none;
  }

  .community-hero .community-portal-nav {
    margin-bottom: .55rem;
  }

  .community-hero .community-portal-nav__breadcrumb {
    margin: 0;
    font-size: .76rem;
  }

  .community-hero__top {
    gap: .85rem;
  }

  .community-hero__copy {
    flex-basis: 100%;
  }

  .community-hero__title {
    margin-bottom: .2rem;
    font-size: 1.65rem;
  }

  .community-hero__subtitle {
    font-size: .86rem;
    line-height: 1.45;
  }

  .community-hero__profile {
    gap: .8rem;
  }

  .community-hero__avatar,
  .community-author-avatar.community-hero__avatar {
    width: 3.4rem;
    height: 3.4rem;
    font-size: 1.1rem;
  }

  .community-hero__stats {
    gap: 0;
    min-width: 0;
    padding: .55rem .25rem;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 14px;
    background: rgba(8, 32, 38, .38);
    backdrop-filter: blur(6px);
  }

  .community-hero__stat-block {
    padding: 0 .3rem;
    text-align: center;
  }

  .community-hero__stat-block + .community-hero__stat-block {
    border-left: 1px solid rgba(255, 255, 255, .18);
  }

  .community-hero__stat-block i {
    display: none;
  }

  .community-hero__stat-value {
    font-size: 1.15rem;
  }

  .community-hero__stat-label {
    margin-top: .1rem;
    font-size: .64rem;
    line-height: 1.25;
  }

  .community-hero__actions {
    gap: .45rem;
    margin-top: .75rem;
  }

  .community-hero__ghost,
  .community-hero__stat {
    padding: .4rem .75rem;
    font-size: .76rem;
  }

  /* ---------- Sections: one swipeable row of chips ---------- */
  .community-hub-sections-bar {
    padding: .9rem 0 .2rem;
  }

  .community-hub-sections-bar .community-hub-nav__intro {
    margin-bottom: 0;
    padding: 0 12px;
  }

  .community-hub-sections-bar .community-hub-nav__title {
    margin-bottom: .55rem;
    font-size: 1.05rem;
  }

  .community-hub-sections-bar .community-hub-sections {
    display: flex;
    gap: .5rem;
    margin: 0;
    padding: .15rem 12px .45rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding: 0 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .community-hub-sections-bar .community-hub-sections::-webkit-scrollbar {
    display: none;
  }

  .community-hub-sections-bar .community-hub-section-card {
    flex: 0 0 auto;
    gap: .45rem;
    padding: .35rem .8rem .35rem .35rem;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(15, 47, 85, .05);
    scroll-snap-align: start;
  }

  .community-hub-sections-bar .community-hub-section-card:hover {
    transform: none;
  }

  .community-hub-sections-bar .community-hub-section-card.is-active {
    background: color-mix(in srgb, var(--hub-accent, #1f66b4) 10%, #fff);
  }

  .community-hub-sections-bar .community-hub-section-card__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    font-size: .8rem;
  }

  .community-hub-sections-bar .community-hub-section-card__label {
    font-size: .8rem;
    white-space: nowrap;
  }

  .community-hub-sections-bar .community-hub-section-card__tagline {
    display: none;
  }

  /* ---------- Feed ---------- */
  .community-shell {
    padding-top: .9rem;
    padding-bottom: 2rem;
  }

  .community-hub-posts-heading h2 {
    font-size: 1.1rem;
  }

  /* ---------- Sidebar blocks under the feed ---------- */
  .community-hub-sidebar__card {
    padding: 1rem;
  }

  .community-topic-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
  }

  .community-topic-chip {
    min-height: 1.9rem;
    padding: .25rem .7rem;
  }

  .community-highlights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1.25rem;
  }

  .community-highlight {
    flex-direction: column;
    gap: .45rem;
    padding: .85rem;
    border: 1px solid #e2ebf4;
    border-radius: 14px;
    background: #fff;
  }

  .community-highlight h3 {
    font-size: .88rem;
  }

  .community-highlight p {
    font-size: .74rem;
  }
}

/* ---------- Phones: post cards as a news-style list (picture beside the text) ---------- */
@media (max-width: 575.98px) {
  #communityPostsGrid {
    --bs-gutter-y: .7rem;
  }

  /* Colour only on the left edge */
  #communityPostsGrid .community-post-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    border-top: 1px solid #e2ebf4;
    border-left: 3px solid var(--type-color);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(18, 57, 95, .05);
  }

  #communityPostsGrid .community-post-card:hover {
    transform: none;
  }

  #communityPostsGrid .community-post-card__media-link {
    height: 100%;
    min-height: 124px;
  }

  #communityPostsGrid .community-post-card__image,
  #communityPostsGrid .community-post-card__placeholder {
    position: absolute;
    inset: 0;
    height: 100%;
    aspect-ratio: auto;
  }

  #communityPostsGrid .community-post-card__placeholder {
    font-size: 1.4rem;
  }

  #communityPostsGrid .community-post-card__media-overlay,
  #communityPostsGrid .community-post-card__spotlight-badges {
    display: none;
  }

  #communityPostsGrid .community-post-card__video-badge {
    top: .4rem;
    right: .4rem;
    width: 1.6rem;
    height: 1.6rem;
    font-size: .7rem;
  }

  #communityPostsGrid .community-post-card__audio-badge {
    top: auto;
    bottom: .4rem;
  }

  #communityPostsGrid .community-post-card__body {
    gap: .3rem;
    padding: .65rem .75rem .7rem;
  }

  /* Only the section label; the full set of tags is on the post */
  #communityPostsGrid .community-post-card__meta-row {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  #communityPostsGrid .community-post-card__meta-row > :not(:first-child),
  #communityPostsGrid .community-post-card__meta-row ~ .community-post-card__meta-row {
    display: none;
  }

  #communityPostsGrid .community-post-card__title {
    font-size: .9rem;
    line-height: 1.35;
  }

  #communityPostsGrid .community-post-card__title a {
    -webkit-line-clamp: 3;
  }

  #communityPostsGrid .community-post-card__excerpt,
  #communityPostsGrid .community-post-card__location {
    display: none;
  }

  #communityPostsGrid .community-post-card__footer {
    gap: .35rem;
    padding-top: .45rem;
  }

  #communityPostsGrid .community-post-card__byline {
    font-size: .7rem;
  }

  #communityPostsGrid .community-post-card__stats {
    gap: .4rem .6rem;
    font-size: .7rem;
  }

  #communityPostsGrid .community-post-card__save,
  #communityPostsGrid .community-post-card__share-btn {
    height: 1.6rem;
    min-width: 1.6rem;
    font-size: .68rem;
  }
}

/* ---------- Section pages (Knowledge & News, Stories, …) ---------- */
@media (max-width: 991.98px) {
  /* Posts first; the section's link panels move below the posts and side blocks */
  .community-news-portal__layout > .community-news-sidebar {
    order: 3;
  }
}

@media (max-width: 767.98px) {
  /* The section has its own heading below, so the hub banner keeps just its title */
  .community-hub--news .community-hero__stats,
  .community-hub--news .community-hero__actions {
    display: none;
  }

  /* The breadcrumb already links home and to the hub */
  .community-news-main__header .community-portal-nav__links {
    display: none;
  }
}

@media (max-width: 575.98px) {
  /* Post list: picture beside the text */
  .community-news-list-item {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: .75rem;
    padding: .65rem;
  }

  .community-news-list-item__thumb-link {
    height: 100%;
  }

  .community-news-list-item__thumb,
  .community-news-list-item__thumb--placeholder {
    height: 100%;
    min-height: 96px;
    border-radius: 10px;
  }

  .community-news-list-item__title {
    font-size: .92rem;
  }

  .community-news-list-item__excerpt {
    display: none;
  }

  .community-news-list-item__meta {
    gap: .25rem .6rem;
    font-size: .7rem;
  }
}
