.community-directory-page {
  background: #f3f8f5;
}

.community-directory {
  width: min(1240px, calc(100% - 40px));
  min-height: calc(100vh - var(--topbar-height));
  margin: 0 auto;
  padding: 0 0 64px;
}

.community-directory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 12px 4px;
}

.community-directory-summary {
  display: flex;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.community-create-club {
  flex: 0 0 auto;
  margin: 0;
}

.community-create-club svg,
.community-directory-filters svg,
.community-directory-sort svg {
  width: 17px;
  height: 17px;
}

.community-directory-tools {
  position: sticky;
  z-index: 12;
  top: calc(var(--topbar-height) + 8px);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(22, 117, 74, 0.22);
  border-radius: 8px;
  background: rgba(248, 252, 250, 0.96);
  box-shadow: 0 12px 28px rgba(15, 35, 26, 0.08);
  backdrop-filter: blur(12px);
}

.community-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-height: 48px;
  padding: 0 8px 0 15px;
  border: 1px solid #a9c9b9;
  border-radius: 6px;
  background: #fff;
  color: #476156;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.community-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 117, 74, 0.12);
}

.community-search > svg {
  width: 20px;
  height: 20px;
}

.community-search input {
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.community-search input::placeholder {
  color: #718078;
}

.community-search button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.community-search button:hover {
  background: #edf5f1;
  color: var(--accent);
}

.community-search button[hidden],
.community-directory-filters button[hidden] {
  display: none;
}

.community-search button svg {
  width: 18px;
  height: 18px;
}

.community-directory-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.community-directory-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 3px;
  padding: 3px;
  border: 1px solid #c8dcd2;
  border-radius: 7px;
  background: #eaf3ee;
}

.community-directory-tabs button {
  min-height: 36px;
  padding: 7px 14px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3c5e4e;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.community-directory-tabs button span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 11px;
  background: rgba(22, 117, 74, 0.1);
  font-size: 12px;
}

.community-directory-tabs button.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(15, 35, 26, 0.12);
}

.community-directory-sort {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 8px 0 11px;
  border: 1px solid #c8dcd2;
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
}

.community-directory-sort select {
  min-width: 148px;
  height: 36px;
  padding: 0 24px 0 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
}

.community-directory-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.community-directory-filters button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid #c8dcd2;
  border-radius: 5px;
  background: #fff;
  color: #365748;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.community-directory-filters button:hover,
.community-directory-filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: #dff0e7;
  color: var(--accent);
}

.community-directory-filters .community-directory-reset {
  border-color: transparent;
  background: transparent;
  color: #a33b34;
}

.community-directory-result-bar {
  min-height: 42px;
  padding: 16px 4px 8px;
}

.community-directory-result-bar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

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

.community-directory-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #c8dcd2;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(21, 54, 39, 0.04);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.community-directory-card:hover,
.community-directory-card:focus-within {
  border-color: #76ae91;
  box-shadow: 0 10px 25px rgba(21, 54, 39, 0.11);
  transform: translateY(-2px);
}

.community-directory-card-link {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 15px;
  min-height: 100%;
  padding: 18px;
  color: inherit;
  text-decoration: none;
}

.community-person-avatar,
.community-club-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #b9d1c5;
  border-radius: 7px;
  background: #dcece4;
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
}

.community-person-avatar {
  width: 88px;
  height: 88px;
}

.community-person-avatar img,
.community-club-avatar img,
.community-avatar-stack img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-directory-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.community-directory-card-heading {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  padding-right: 32px;
}

.community-directory-card-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
}

.community-directory-card-heading > svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 3px;
  color: #6d8d7d;
  opacity: 0;
  transform: translate(-3px, 3px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.community-directory-card:hover .community-directory-card-heading > svg,
.community-directory-card:focus-within .community-directory-card-heading > svg {
  opacity: 1;
  transform: translate(0, 0);
}

.community-directory-description {
  display: -webkit-box;
  min-width: 0;
  margin-top: 5px;
  overflow: hidden;
  color: #5d7167;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-directory-description--muted {
  color: #829087;
}

.community-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.community-role-list > span {
  padding: 3px 7px;
  border: 1px solid #d7b35a;
  border-radius: 4px;
  background: #fff8df;
  color: #70510b;
  font-size: 11px;
  font-weight: 800;
}

.community-directory-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 14px;
  color: #365748;
  font-size: 12px;
  font-weight: 700;
}

.community-directory-stats > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.community-directory-stats svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
}

.community-nearest-trip {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #e0ebe5;
  color: #3f5e50;
}

.community-nearest-trip > svg {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: #1e69a7;
}

.community-nearest-trip > span {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
}

.community-nearest-trip small {
  grid-column: 1 / -1;
  color: #6f8178;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.community-nearest-trip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-nearest-trip time {
  color: #1e69a7;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.community-member-clubs {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 15px;
}

.community-member-clubs small {
  min-width: 0;
  overflow: hidden;
  color: #687a71;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-avatar-stack {
  display: flex;
  flex: 0 0 auto;
  padding-left: 7px;
}

.community-avatar-stack > span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  margin-left: -7px;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #dcece4;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.community-invite-action {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: #c8dcd2;
  background: rgba(255, 255, 255, 0.94);
}

.community-invite-action svg {
  width: 17px;
  height: 17px;
}

.community-club-card-link {
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 0;
}

.community-club-media {
  position: relative;
  display: block;
  min-height: 210px;
  overflow: hidden;
  background: #d7e8df;
}

.community-club-media > img,
.community-club-cover-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 210px;
  place-items: center;
  object-fit: cover;
}

.community-club-cover-placeholder {
  color: #628071;
  background: #ccdfd5;
}

.community-club-cover-placeholder svg {
  width: 42px;
  height: 42px;
}

.community-club-avatar {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 62px;
  height: 62px;
  border: 3px solid #fff;
  box-shadow: 0 3px 14px rgba(11, 31, 22, 0.22);
  font-size: 20px;
}

.community-club-card .community-directory-card-body {
  padding: 18px 18px 16px 0;
}

.community-directory-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #6c7f75;
  text-align: center;
}

.community-directory-empty[hidden] {
  display: none;
}

.community-directory-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 5px;
  color: #719483;
}

.community-directory-empty strong {
  color: var(--ink);
  font-size: 18px;
}

.community-directory-empty span {
  font-size: 13px;
}

.community-directory-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 22px;
}

.community-directory-more-wrap[hidden] {
  display: none;
}

.community-invite-modal .about-modal-panel {
  max-height: min(760px, calc(100dvh - 32px));
  overflow-y: auto;
}

.community-invite-form {
  margin-top: 14px;
}

@media (max-width: 920px) {
  .community-directory-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .community-directory {
    width: min(100% - 24px, 620px);
    padding: 0 0 42px;
  }

  .community-directory-head {
    align-items: center;
    padding: 12px 2px;
  }

  .community-create-club span {
    display: none;
  }

  .community-create-club {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
  }

  .community-directory-tools {
    top: calc(var(--topbar-height) + 6px);
    padding: 10px;
  }

  .community-directory-control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .community-directory-tabs {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .community-directory-tabs button {
    min-width: 0;
    padding-inline: 7px;
  }

  .community-directory-sort {
    width: 100%;
  }

  .community-directory-sort select {
    width: 100%;
  }

  .community-directory-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .community-directory-filters button {
    flex: 0 0 auto;
  }
}

@media (max-width: 520px) {
  .community-directory-card-link {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .community-person-avatar {
    width: 66px;
    height: 66px;
    font-size: 22px;
  }

  .community-directory-card-heading strong {
    font-size: 16px;
  }

  .community-directory-stats {
    gap: 7px 10px;
  }

  .community-nearest-trip {
    grid-column: 1 / -1;
  }

  .community-club-card-link {
    grid-template-columns: 104px minmax(0, 1fr);
    padding: 0;
  }

  .community-club-media,
  .community-club-media > img,
  .community-club-cover-placeholder {
    min-height: 190px;
  }

  .community-club-avatar {
    left: 10px;
    bottom: 10px;
    width: 52px;
    height: 52px;
  }

  .community-club-card .community-directory-card-body {
    padding: 14px 12px 14px 0;
  }

  .community-nearest-trip > span {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-nearest-trip time {
    margin-top: 2px;
  }

  .community-member-clubs small {
    display: none;
  }
}
