{{ define "timeline/fragments/announcements" }}
  <div class="border border-gray-200 dark:border-gray-700 rounded-sm divide-y divide-gray-200 dark:divide-gray-700">
    <h3 class="text-base dark:text-white hidden md:flex items-center gap-2 px-4 py-2 bg-white/50 dark:bg-gray-800/50">
      {{ i "megaphone" "size-4 flex-shrink-0" }}
      Announcements
    </h3>
    <div class="flex flex-col p-0 bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700">
      {{ template "microvmAnnouncement" . }}
      {{ if .RecentBlogPosts }}
        {{ template "recentBlogPosts" . }}
      {{ end }}
    </div>
  </div>
{{ end }}

{{ define "recentBlogPosts" }}
  <div class="flex flex-col hidden md:block">
    {{ range .RecentBlogPosts }}
      <a href="https://blog.tangled.org/{{ .Slug }}" class="text-sm no-underline hover:no-underline hover:bg-gray-100/50 dark:hover:bg-gray-700/50 overflow-hidden p-4 flex flex-col gap-0.5">
        <span class="truncate text-sm text-gray-500 dark:text-gray-400">{{ .Date.Format "January 2, 2006" }}</span>
        <span class="truncate dark:text-white">{{ .Title }}</span>
        {{ if .Subtitle }}<span class="line-clamp-1 text-sm text-gray-500 dark:text-gray-400">{{ .Subtitle }}</span>{{ end }}
      </a>
    {{ end }}
  </div>
{{ end }}

{{ define "microvmAnnouncement" }}
<div class="relative overflow-hidden bg-gradient-to-b from-orange-50 to-orange-100 dark:from-orange-800/30 dark:to-orange-900/45 p-4">
  <div class="relative z-10 flex flex-col gap-4">
    <div class="flex flex-col gap-2">
    <p class="font-semibold text-orange-600 dark:text-orange-100 mb-1">MicroVM-powered CI</p>
    <p class="text-orange-600/75 dark:text-orange-100/75 text-sm">
      Spindles now support a new engine: <span class="font-mono">microvm</span>!
      <br/>
      You can now build containers, run services like Postgres, or use non-NixOS images on CI.
    </p>
    </div>
    <div class="mt-3">
      <a class="no-underline inline-flex items-center gap-1 text-sm font-medium text-orange-600 dark:text-orange-100 hover:text-orange-800 dark:hover:text-orange-100 hover:underline" href="https://blog.tangled.org/spindle-microvm/">
        Read more {{ i "arrow-right" "size-4" }}
      </a>
    </div>
  </div>
  <div class="pointer-events-none absolute -bottom-8 -right-16 size-48
    [--ci-gradient-from:theme(colors.orange.100)] dark:[--ci-gradient-from:color-mix(in_oklab,theme(colors.orange.600)_5%,transparent)]
    [--ci-gradient-to:theme(colors.orange.200)] dark:[--ci-gradient-to:color-mix(in_oklab,theme(colors.orange.800)_15%,transparent)]"
       style="background: linear-gradient(to bottom, var(--ci-gradient-from), var(--ci-gradient-to));
              -webkit-mask: url('/static/icons/cpu.svg') center/contain no-repeat;
              mask: url('/static/icons/cpu.svg') center/contain no-repeat;"></div>
</div>
{{ end }}

{{ define "vouchAnnouncement" }}
<div class="relative overflow-hidden bg-gradient-to-b from-indigo-50 to-indigo-100 dark:from-indigo-900 dark:to-indigo-950 rounded-sm p-4">
  <div class="relative z-10">
    <p class="font-semibold text-indigo-800 dark:text-indigo-100 mb-1">Build a web of trust</p>
    <p class="text-indigo-700 dark:text-indigo-300">
    Vouch for trustworthy users that make open-source a better place. Visit a user's
    profile to vouch for them.
    </p>

    <div class="mt-3 flex items-center justify-between">
      <a class="mt-3 no-underline inline-flex items-center gap-1 text-sm font-medium text-indigo-700 dark:text-indigo-200 hover:text-indigo-900 dark:hover:text-indigo-100 hover:underline" href="https://blog.tangled.org/vouching">
        Read more
      </a>
      {{ if and .LoggedInUser .VouchSuggestions }}
      <a class="md:hidden mt-3 no-underline inline-flex items-center gap-1 text-sm font-medium text-indigo-700 dark:text-indigo-200 hover:text-indigo-900 dark:hover:text-indigo-100 hover:underline" href="/{{ .LoggedInUser.Did }}?tab=vouches">
        View suggestions {{ i "arrow-right" "size-3.5" }}
      </a>
      {{ end }}
    </div>

  </div>

  <div class="pointer-events-none absolute -bottom-8 -right-16 size-48 
    [--shield-gradient-from:theme(colors.indigo.100)] dark:[--shield-gradient-from:theme(colors.indigo.800)]
    [--shield-gradient-to:theme(colors.indigo.200)] dark:[--shield-gradient-to:theme(colors.indigo.900)]"
       style="background: linear-gradient(to bottom, var(--shield-gradient-from), var(--shield-gradient-to));
              -webkit-mask: url('/static/icons/shield-plus.svg') center/contain no-repeat;
              mask: url('/static/icons/shield-plus.svg') center/contain no-repeat;"></div>
</div>
{{ end }}
