/* Shared styles for the public community listing pages, /stories and /routes (#4688). */

.community-page {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.community-page *,
.community-page *::before,
.community-page *::after {
  box-sizing: inherit;
}

.community-head__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.community-title {
  margin: 0;
  font: var(--text-h1-bold);
  color: var(--color-neutral-900);
}

.community-intro {
  max-width: 70ch;
  margin: 12px 0 0;
  font: var(--text-body-regular);
  color: var(--color-neutral-800);
}

.community-page a.button-ps {
  text-decoration: none;
}

/* ---- Toolbar: search + sort + live count -------------------------------------------------------------------- */

.community-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 24px 0 16px;
}

.community-search {
  flex: 1 1 220px;
  max-width: 360px;
  padding: 8px 12px;
  font: var(--text-body-regular);
  color: var(--color-neutral-900);
  background: var(--color-neutral-white);
  border: 1px solid var(--color-neutral-400);
  border-radius: 8px;
}

.community-sort-label {
  margin: 0;
  font: var(--text-small-medium);
  color: var(--color-neutral-800);
}

.community-sort {
  padding: 8px 12px;
  font: var(--text-body-regular);
  color: var(--color-neutral-900);
  background: var(--color-neutral-white);
  border: 1px solid var(--color-neutral-400);
  border-radius: 8px;
}

.community-count {
  margin-left: auto;
  font: var(--text-small-regular);
  color: var(--color-neutral-700);
}

/* ---- Card grid ----------------------------------------------------------------------------------------------- */

.community-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.community-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-neutral-white);
  border: 1px solid var(--color-neutral-200);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}

/* The display: flex above beats the UA stylesheet's [hidden] rule, so search filtering needs its own. */
.community-card[hidden] {
  display: none;
}

/* Flat filled tags — borderless so they don't read as clickable buttons (our buttons carry borders/outlines). The
   type chip's background is tinted with the label type's canonical color by StoryListPage.js (backend-sourced). */
.community-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-width: 0; /* Lets the chip shrink inside the one-line footer so its text can ellipsize. */
  padding: 2px 10px;
  font: var(--text-caption-medium);
  color: var(--color-neutral-800);
  background: var(--color-neutral-100);
  border-radius: 999px;
}

.community-chip__icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.community-chip__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-empty {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  padding: 64px 24px;
  margin-top: 24px;
  font: var(--text-subtitle-regular);
  color: var(--color-neutral-800);
  text-align: center;
  background: var(--color-neutral-100);
  border-radius: 12px;
}

.community-empty p {
  margin: 0;
}

.community-no-results {
  padding: 32px 0;
  font: var(--text-body-regular);
  color: var(--color-neutral-700);
  text-align: center;
}

.community-cap-note {
  margin: 24px 0 0;
  font: var(--text-small-regular);
  color: var(--color-neutral-600);
  text-align: center;
}

/* ---- Story cards --------------------------------------------------------------------------------------------- */

/* Unlike the base community card, story cards can't clip overflow: the footer's share popover (#4722) opens upward
   and a short, photoless card would cut it off. The photo rounds its own top corners instead (11px = the card's
   12px radius minus its 1px border). */
.story-card {
  overflow: visible;
}

/* The whole card opens its label (StoryListPage adds the class once the handler is wired, so a card without JS never
   claims to be clickable). Lifts on hover so the click target is discoverable before the pointer reaches a control;
   the inner controls keep their own hover states on top. */
.story-card--clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.story-card--clickable:hover {
  border-color: var(--color-neutral-400);
  box-shadow: 0 3px 10px rgb(0 0 0 / 12%);
}

/* Keyboard parity: "View label" is the card's focusable entry point, so its focus ring lights the whole card up the
   same way hovering does. */
.story-card--clickable:focus-within {
  border-color: var(--color-neutral-400);
  box-shadow: 0 3px 10px rgb(0 0 0 / 12%);
}

@media (prefers-reduced-motion: reduce) {
  .story-card--clickable {
    transition: none;
  }
}

.story-card__photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 11px 11px 0 0;
}

.story-card__body {
  position: relative;
  z-index: 0; /* Own stacking context so the quote-mark pseudo can sit behind the text but above the card. */
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

/* Oversized ghosted quote mark behind the story's opening words: marks it as someone's first-person account.
   On the body, not the (overflow-hidden) text element, so it can't clip or inflate the text's scrollHeight —
   which the read-more overflow check measures. Serif deliberately: no design-system token has a serif face,
   and the classic testimonial glyph needs one. */
.story-card__body::before {
  content: "\201c";
  position: absolute;
  top: 2px;
  left: 8px;
  z-index: -1;
  font: 700 56px/1 Georgia, serif;
  color: var(--color-neutral-100);
}

.story-card__text {
  max-height: 110px; /* 5 lines of --text-body-regular (22px line-height); the read-more toggle lifts it. */
  margin: 0;
  overflow: hidden;
  font: var(--text-body-regular);
  color: var(--color-neutral-900);
  white-space: pre-line; /* Story text is plain text; keep the author's paragraph breaks. */
}

.story-card__text.is-expanded {
  max-height: none;
}

.story-card__read-more {
  align-self: flex-start;
  padding: 0;
  font: var(--text-small-medium);
  color: var(--color-asphalt-400);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
}

/* The byline and location rows lead with a 16px icon, flush with the story text's left edge (as is the type chip's
   pill edge below them). */
.story-card__byline {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  font: var(--text-small-regular);
  color: var(--color-neutral-700);
}

.story-card__byline-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.story-card__author {
  font: var(--text-small-medium);
  color: var(--color-neutral-800);
}

/* One combined place line: "address · neighborhood", or just the neighborhood when the address is unknown.
   Links to the label on the LabelMap. The left margin matches the type chip's padding so the two icons align. */
.story-card__location {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: -4px 0 0; /* Pulls against the body's 8px gap: byline + location read as one tight meta cluster. */
  font: var(--text-small-regular);
  color: var(--color-neutral-700);
  text-decoration: none;
}

.story-card__location:hover {
  color: var(--color-asphalt-400);
}

.story-card__location:hover .story-card__location-text {
  text-decoration: underline;
}

.story-card__location-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.story-card__location-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Single line always: chips ellipsize (see .community-chip) rather than wrapping under the button. */
.story-card__foot {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 12px;
}

.story-card__label-link {
  flex-shrink: 0;
  margin-left: auto;
}

/* The share chip (#4722) sits at the footer's end; .label-detail__share supplies the popover's positioning anchor
   and share-widget.css the pill + popover look. */
.story-card__share {
  flex-shrink: 0;
}

/* ---- Route cards --------------------------------------------------------------------------------------------- */

.route-card__thumb-link {
  display: block;
}

.route-card__thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-bottom: 1px solid var(--color-neutral-200);
}

.route-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.route-card__name {
  margin: 0;
  font: var(--text-title-bold);
  color: var(--color-neutral-900);
  overflow-wrap: anywhere; /* User-supplied names can be one long token. */
}

.route-card__desc {
  margin: 0;
  font: var(--text-body-regular);
  color: var(--color-neutral-800);
  overflow-wrap: anywhere;
}

.route-card__meta,
.route-card__usage {
  margin: 0;
  font: var(--text-small-regular);
  color: var(--color-neutral-700);
}

.route-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
