/* ── Feed view container ── */
#feed-view {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.feed-spacer {
  flex-shrink: 0;
}

#feed-cards {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Feed card ── */
.feed-card {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  scroll-margin-top: 64px;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

/* ── Content wrapper (truncation) ── */
.feed-card-content {
  position: relative;
  overflow: hidden;
}

.feed-card.expanded .feed-card-content {
  max-height: none !important;
}

.feed-card.truncated:not(.expanded) {
  cursor: pointer;
  border-bottom: 3px solid var(--color-accent);
  box-shadow: var(--shadow-card), 0 3px 10px rgba(79, 70, 229, 0.15);
}

.feed-card.truncated:not(.expanded) .feed-card-content::after {
  content: 'Tap to read more';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5rem;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, var(--color-card) 70%);
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 0.6rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: 0.01em;
}

/* ── Breadcrumb / meta ── */
.feed-card-meta {
  padding: 1.1rem 1.75rem 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

/* ── Title ── */
.feed-card-title {
  padding: 0.35rem 1.75rem 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--color-text);
  word-break: break-word;
}

/* ── Tags ── */
.feed-card-tags {
  padding: 0 1.75rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ── Insight ── */
.feed-card-insight {
  margin: 0 1.25rem 1rem;
  padding: 0.9rem 1.2rem;
  background: var(--color-insight-bg);
  border-left: 3px solid var(--color-insight-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.98rem;
  line-height: 1.7;
  font-style: italic;
  color: var(--color-text);
}

/* ── Body ── */
.feed-card-body {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--color-text);
}

.feed-card-body p { margin-bottom: 0.7rem; }
.feed-card-body p:last-child { margin-bottom: 0; }
.feed-card-body ul,
.feed-card-body ol { margin: 0.2rem 0 0.7rem 1.25rem; }
.feed-card-body li { margin-bottom: 0.35rem; line-height: 1.6; }
.feed-card-body strong { font-weight: 600; }
.feed-card-body em { font-style: italic; }
.feed-card-body code {
  background: var(--color-tag-bg);
  border: 1px solid var(--color-border);
  padding: 0.1em 0.3em;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.feed-card-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.feed-card-body table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 0.7rem; font-size: 0.88rem; }
.feed-card-body th,
.feed-card-body td { text-align: left; padding: 0.5rem 0.7rem; border: 1px solid var(--color-border); line-height: 1.5; }
.feed-card-body th { background: var(--color-tag-bg); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-text-muted); }

.feed-card-body .card-subheading { font-size: 0.92rem; font-weight: 600; margin: 1rem 0 0.25rem; color: var(--color-text); }
.feed-card-body .card-subheading:first-child { margin-top: 0; }

/* ── Reflect section (hidden until revealed) ── */
.feed-card-reflect {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  background: var(--color-reflect-bg);
  border-top: 0 solid var(--color-border);
  transition: max-height 0.45s ease, opacity 0.35s ease, padding 0.35s ease, border-top-width 0s linear 0.35s;
  padding: 0 1.75rem;
}

.feed-card.revealed .feed-card-reflect {
  max-height: 2000px;
  opacity: 1;
  padding: 1.1rem 1.75rem;
  border-top-width: 1px;
  transition: max-height 0.45s ease, opacity 0.35s ease, padding 0.35s ease, border-top-width 0s linear 0s;
}

/* ── Tap hint ── */
.feed-card-hint {
  padding: 0.6rem 1.75rem;
  font-size: 0.78rem;
  color: var(--color-accent);
  font-weight: 500;
  text-align: center;
  border-top: 1px solid var(--color-border);
  cursor: pointer;
  transition: opacity 0.25s ease, max-height 0.25s ease, padding 0.25s ease;
  max-height: 3rem;
}

.feed-card.truncated:not(.expanded) .feed-card-hint {
  max-height: 0;
  padding: 0;
  border-top-color: transparent;
  overflow: hidden;
  opacity: 0;
}

.feed-card.revealed .feed-card-hint {
  opacity: 0;
  max-height: 0;
  padding: 0 1.75rem;
  border-top-color: transparent;
  overflow: hidden;
}

/* ── Sentinel ── */
.feed-sentinel {
  height: 1px;
  flex-shrink: 0;
}

/* ── Empty state ── */
.feed-empty {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ── Images ── */
.feed-card-body .card-image { margin: 0.6rem 0; text-align: center; }
.feed-card-body .card-image img,
.feed-card-body .card-inline-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* ── Loading indicator ── */
.feed-loading {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-light);
  font-size: 0.85rem;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .feed-card {
    border-radius: var(--radius-md);
    scroll-margin-top: 52px;
  }

  .feed-card-meta {
    padding: 0.85rem 1rem 0;
    font-size: 0.74rem;
  }

  .feed-card-title {
    padding: 0.3rem 1rem 0.6rem;
    font-size: 1.1rem;
  }

  .feed-card-tags {
    padding: 0 1rem 0.6rem;
  }

  .feed-card-insight {
    margin: 0 0.75rem 0.85rem;
    padding: 0.75rem 0.95rem;
    font-size: 0.92rem;
  }

  .feed-card-body {
    padding: 0.85rem 1rem;
  }

  .feed-card-reflect {
    padding: 0 1rem;
  }

  .feed-card.revealed .feed-card-reflect {
    padding: 0.85rem 1rem;
  }

  .feed-card-hint {
    padding: 0.5rem 1rem;
  }
}
