<script setup lang="ts">
// Generic compact card of the Fil: icon container, title (optionally a link),
// meta line (slot #meta), body (default slot), inline actions (slot #actions).
defineProps<{
  title: string
  icon?: string
  tint?: string
  to?: string
}>()
</script>

<template>
  <!-- ld-v2 -->
  <article class="ld-card feed-item">
    <div v-if="icon" class="feed-item__stamp" :style="tint ? { color: tint } : undefined">
      <UIcon :name="icon" />
    </div>
    <div class="feed-item__body">
      <NuxtLink v-if="to" :to="to" class="feed-item__title feed-item__title--link">
        {{ title }}
      </NuxtLink>
      <span v-else class="feed-item__title">{{ title }}</span>
      <div v-if="$slots.meta" class="feed-item__meta">
        <slot name="meta" />
      </div>
      <slot />
      <div v-if="$slots.actions" class="feed-item__actions">
        <slot name="actions" />
      </div>
    </div>
  </article>
</template>

<style scoped>
.feed-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
}
.feed-item__stamp {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--r-icon);
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: 1.125rem;
  color: var(--mood-accent);
}
.feed-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.feed-item__title {
  font-size: 0.9688rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--mood-text);
  overflow-wrap: anywhere;
}
.feed-item__title--link { text-decoration: none; }
.feed-item__title--link:hover { color: var(--mood-accent); }
.feed-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--mood-text-muted);
}
.feed-item__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.125rem;
}
</style>
