/* feed.css — Home feed: filter/sort, feed list, story cards, read status, shared button/badge atoms. (split from design3.css) */

/* ===== Filter bar (Home page) ===== */
.filter-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-color);
}

.chip-scroll {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}

.chip:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.chip.active {
  background: var(--accent);
  color: #fff;
}

.chip-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.sort-control {
  position: relative;
  flex-shrink: 0;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 5px 10px;
  cursor: pointer;
  white-space: nowrap;
}

.sort-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sort-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.15s;
}

.sort-control.open .sort-caret {
  transform: rotate(180deg);
}

.sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  min-width: 120px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.sort-menu[hidden] {
  display: none;
}

.sort-option {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.sort-option:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sort-option.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ===== Feed ===== */
.feed {
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ===== Story Card ===== */
.story-card {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s;
  cursor: pointer;
  user-select: none;
}

.story-card:hover {
  background: var(--bg-hover);
}

/* Avatar */
.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  min-width: var(--avatar-size);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  user-select: none;
  flex-shrink: 0;
}

.avatar-sm {
  width: 36px;
  height: 36px;
  min-width: 36px;
  font-size: 13px;
}

/* Card body */
.card-body {
  flex: 1;
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.card-cat-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background-color: var(--text-secondary);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.story-cat-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  background-color: var(--text-primary);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.card-time {
  font-size: 14px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.card-pulse {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding-left: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.pulse-icon {
  width: 15px;
  height: 15px;
  background-color: currentColor;
  -webkit-mask: url('/static/assets/trending.svg') no-repeat center / contain;
  mask: url('/static/assets/trending.svg') no-repeat center / contain;
}

.card-badge-area {
  margin-left: auto;
  flex-shrink: 0;
}

/* Mini timeline inside card */
.mini-timeline {
  margin: 4px 0 0;
  padding-left: 4px;
}

.mini-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
  padding-bottom: 6px;
  padding-left: 18px;
}

/* Dot & connector */
.mini-event::before {
  content: '';
  position: absolute;
  width: var(--dot-size, 6px);
  height: var(--dot-size, 6px);
  left: calc(7px - var(--dot-size, 6px) / 2);
  top: calc(10px - var(--dot-size, 6px) / 2);
  border-radius: 50%;
  background: var(--text-tertiary);
}

.mini-event::after {
  content: '';
  position: absolute;
  left: 6px;
  top: calc(11px + var(--dot-size, 6px) / 2);
  bottom: -2px;
  width: 2px;
  background: var(--border-color);
}

.mini-event:last-child::after {
  display: none;
}

.mini-event-date {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 64px;
}

.mini-event-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Extra events: hidden by default, animated in ── */
.mini-event.extra {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding-bottom 0.3s ease;
}

.story-card.expanded .mini-event.extra {
  max-height: 60px;
  opacity: 1;
  padding-bottom: 6px;
}

/* ── Action buttons: hidden by default, slide in ── */
.card-actions-bar {
  display: flex;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease 0.05s, margin-top 0.3s ease;
}

.story-card.expanded .card-actions-bar {
  max-height: 50px;
  opacity: 1;
  margin-top: 10px;
}

.card-btn {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
}

.btn-follow {
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  background: transparent;
}

.btn-follow:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
}

.btn-follow.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
}

.btn-follow.active:hover {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
}

.tab-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.tab-empty-text {
  font-size: 15px;
  line-height: 1.5;
}

.btn-read-more {
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
}

.btn-read-more:hover {
  background: var(--text-secondary);
}

.btn-mark-read {
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: transparent;
}

.btn-mark-read:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-mark-read:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Icon inside buttons */
.btn-icon {
  width: 14px;
  height: 14px;
  fill: currentColor;
  vertical-align: -2px;
  margin-right: 2px;
}

/* Story page action bar */
.story-actions-bar {
  display: flex;
  gap: 8px;
  padding: 8px 0 2px;
}

/* Unread badge (pill) */
.unread-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 10px;
  line-height: 1.4;
}

.unread-badge.unread-new {
  background: var(--new-badge);
}

.unread-badge.caught-up {
  background: var(--text-tertiary);
  opacity: 0.6;
}

/* ===== Read Status on Cards ===== */
.story-card.status-caught-up {
  opacity: 0.55;
}

.story-card.status-caught-up:hover {
  opacity: 0.8;
}

.story-card.status-caught-up .card-name {
  font-weight: 500;
}

.story-card.status-has-updates {
  border-left: 3px solid var(--accent);
}

.story-card.status-unread .card-name {
  color: var(--text-primary);
}

.story-card.status-unread {
  border-left: 3px solid var(--new-badge);
}

