/* /feed/ — merged activity stream from people you follow + crews
   you're in. Two card shapes for two classes of item:
     - capture/drive/route have a photo → hero-on-top "story" card,
       sibling to the /stories/ landing aesthetic.
     - event/rsvp have no photo → compact icon-row card, accent-tinted
       so they still read as actionable inside the photo stream.
   All kinds share .feed-card chrome; the per-kind class (set on the
   <li> by feed.js as feed-item-<kind>) switches the grid template. */

.feed-page {
  max-width: 640px;
  margin: 0 auto;
}

.feed-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 20px;
}

.feed-item {
  margin: 0;
}

.feed-card {
  display: grid;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color 140ms ease, transform 140ms ease;
}

a.feed-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* --- Photo-led kinds: hero image edge-to-edge across the card top,
       body + timestamp share a row underneath. The .feed-thumb element
       carries either a real <img> or a gradient .feed-thumb-empty div
       — both get the same hero treatment so empty captures still feel
       like a card and not a broken thumbnail. */

.feed-item-capture .feed-card,
.feed-item-drive .feed-card,
.feed-item-route .feed-card,
.feed-item-story .feed-card {
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "hero hero"
    "body time";
}

.feed-item-capture .feed-thumb,
.feed-item-drive .feed-thumb,
.feed-item-route .feed-thumb,
.feed-item-story .feed-thumb {
  grid-area: hero;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--panel-2);
}

.feed-thumb-empty {
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--panel) 100%);
}

/* Drives and routes are text-first: an empty hero block adds a tall
   gradient slab that buries the action line. Captures keep the
   placeholder since they are fundamentally photo posts. The hero row
   collapses to 0 once the only element in the "hero" grid area is
   display:none. */
.feed-item-drive .feed-thumb-empty,
.feed-item-route .feed-thumb-empty {
  display: none;
}

.feed-item-capture .feed-body,
.feed-item-drive .feed-body,
.feed-item-route .feed-body,
.feed-item-story .feed-body {
  grid-area: body;
  padding: 14px 18px 16px;
  min-width: 0;
}

.feed-item-capture .feed-time,
.feed-item-drive .feed-time,
.feed-item-route .feed-time,
.feed-item-story .feed-time {
  grid-area: time;
  padding: 16px 18px 0 8px;
  align-self: start;
}

/* --- Icon kinds (event, rsvp): no photo, so render a compact horizontal
       row with a tinted square icon. Event icon picks up the accent so
       calendar items stand out in a stream of photos. */

.feed-item-event .feed-card,
.feed-item-rsvp .feed-card {
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
}

.feed-item-event .feed-thumb-icon,
.feed-item-rsvp .feed-thumb-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.feed-item-event .feed-thumb-icon {
  background: rgba(255, 86, 48, 0.14);
  border-color: rgba(255, 86, 48, 0.32);
  color: var(--accent);
}

/* --- Typography --- */

.feed-body {
  min-width: 0;
}

.feed-action {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  overflow-wrap: anywhere;
}

.feed-actor {
  font-weight: 600;
  color: var(--text);
}

.feed-subject {
  font-weight: 500;
  color: var(--text);
}

.feed-caption {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
}

.feed-meta {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.feed-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* --- Empty / error / load-more --- */

.feed-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

.feed-empty p {
  margin: 0 0 8px;
}

.feed-empty a {
  color: var(--accent);
  text-decoration: none;
}

.feed-empty a:hover {
  text-decoration: underline;
}

.feed-loadmore {
  margin-top: 24px;
  text-align: center;
}

.feed-loadmore button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 24px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.feed-loadmore button:hover {
  border-color: var(--accent);
}

.feed-loadmore button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 700px) {
  /* Edge-to-edge stacked bands, matching /stories/ and /browse/ on
     mobile — cards lose side borders + rounding so they read as one
     continuous scrollable list, with alternating panel shades for
     rhythm. The hover-lift is suppressed since touch has no hover and
     the lift was bleeding into the band above on overscroll. */
  .feed-list {
    gap: 0;
    margin-left: -16px;
    margin-right: -16px;
  }

  .feed-card {
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .feed-item + .feed-item .feed-card {
    border-top: none;
  }

  .feed-item:nth-child(even) .feed-card {
    background: var(--panel-2);
  }

  a.feed-card:hover {
    transform: none;
  }

  /* On phones stack the timestamp under the body on photo cards so
     the action line gets the full width (a 12px timestamp eating a
     column on a 360px screen pushed the verb to wrap). */
  .feed-item-capture .feed-card,
  .feed-item-drive .feed-card,
  .feed-item-route .feed-card,
  .feed-item-story .feed-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "body"
      "time";
  }

  .feed-item-capture .feed-time,
  .feed-item-drive .feed-time,
  .feed-item-route .feed-time,
  .feed-item-story .feed-time {
    padding: 0 18px 14px;
  }
}
