.feed {
  padding-bottom: 48px;
}

.chips-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.chips {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.sort {
  flex: none;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-2);
  font-size: 13px;
}

.feed-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 24px 0;
}

.feed-head h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feed-head p {
  color: var(--text-2);
  font-size: 13px;
}

.head-actions {
  margin-left: auto;
}

.head-reset {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--pill);
  background: var(--bg);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.head-reset:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 24px 16px;
  max-width: 1760px;
  padding: 16px 24px 0;
}

.grid .empty {
  grid-column: 1 / -1;
}

/* First-paint placeholders, replaced as soon as feed.json arrives. */
.is-skeleton {
  pointer-events: none;
}

.sk-thumb {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

.sk-body {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding-top: 12px;
}

.sk-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.sk-text {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-top: 2px;
}

.sk-line {
  height: 12px;
  border-radius: 4px;
}

.sk-short {
  width: 68%;
}

.sk-tiny {
  width: 42%;
  height: 10px;
}

.sk-thumb,
.sk-avatar,
.sk-line {
  background: linear-gradient(
    90deg,
    var(--bg-chip) 25%,
    #e8e8e8 37%,
    var(--bg-chip) 63%
  );
  background-size: 400% 100%;
  animation: sk-shimmer 1.4s ease infinite;
}

@keyframes sk-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .sk-thumb,
  .sk-avatar,
  .sk-line {
    animation: none;
  }
}

.card {
  position: relative;
  margin: -8px;
  padding: 8px;
  border-radius: var(--radius);
}

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

.card-link {
  display: block;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  background: #e8eaed;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-fallback {
  display: grid;
  place-items: center;
}

.thumb-fallback span {
  color: #9aa0a6;
  font-size: 34px;
  font-weight: 600;
}

.badge {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.badge-visited {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(15, 15, 15, 0.72);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  font-weight: 500;
}

.card-save {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.72);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease);
}

.card-save svg path {
  fill: none;
}

.card:hover .card-save,
.card:focus-within .card-save,
.card-save.is-on {
  opacity: 1;
}

.card-save:hover {
  background: rgba(15, 15, 15, 0.9);
}

.card-save.is-on {
  background: var(--brand-mark);
  color: #fff;
}

.card-save.is-on svg path {
  fill: currentColor;
}

.card-body {
  display: flex;
  gap: 12px;
  padding-top: 12px;
}

.card-text {
  min-width: 0;
}

.card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  word-break: break-word;
}

.card-channel {
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-2);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta {
  color: var(--text-2);
  font-size: 14px;
}

.sentinel {
  height: 1px;
}

.empty {
  max-width: 560px;
  margin: 72px auto;
  padding: 0 24px;
  text-align: center;
}

.empty h2 {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
}

.empty p {
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.empty .btn {
  margin-top: 18px;
}

.loading {
  padding: 48px 24px;
  color: var(--text-2);
}

@media (max-width: 640px) {
  .chips-bar {
    padding: 8px 12px;
  }

  .feed-head {
    padding: 8px 12px 0;
  }

  .grid {
    grid-template-columns: 1fr;
    padding: 12px 12px 0;
  }

  .card {
    margin: 0;
    padding: 0;
  }

  .card-save {
    top: 8px;
    right: 8px;
    opacity: 1;
  }

  .card:hover {
    background: transparent;
  }

  .card-title {
    font-size: 15px;
  }
}
