<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import { RELEASES, DESKTOP_SRC } from '../lib/links';

const { t } = useI18n();

const platforms = [
  { key: 'dlLinux', hint: 'dlLinuxHint' },
  { key: 'dlWin', hint: 'dlWinHint' },
  { key: 'dlMac', hint: 'dlMacHint' },
] as const;

const bullets = ['dlNoNode', 'dlBundled', 'dlAutoUpdate'] as const;
</script>

<template>
  <section id="download" class="mx-auto max-w-[1200px] scroll-mt-[84px] px-6 pb-[100px]">
    <div v-reveal class="mb-[40px] max-w-[720px]">
      <div class="mb-3 font-mono text-xs uppercase tracking-[0.12em] text-emerald-400">{{ t('dlKicker') }}</div>
      <h2 class="m-0 mb-4 text-[clamp(26px,3vw,38px)] font-semibold leading-[1.15] tracking-[-0.025em] text-zinc-50">
        {{ t('dlTitle') }}
      </h2>
      <p class="m-0 text-[16.5px] leading-[1.6] text-zinc-400">{{ t('dlBody') }}</p>
    </div>

    <div v-reveal class="grid gap-4 md:grid-cols-3">
      <div
        v-for="p in platforms"
        :key="p.key"
        class="flex flex-col gap-1 rounded-[14px] border border-zinc-800 bg-[#09090b] p-5 shadow-card"
      >
        <div class="flex items-center gap-2 text-zinc-100">
          <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-emerald-400" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline points="7 10 12 15 17 10" /><line x1="12" x2="12" y1="15" y2="3" /></svg>
          <span class="text-[15px] font-semibold">{{ t(p.key) }}</span>
        </div>
        <span class="pl-[26px] font-mono text-[12.5px] text-zinc-500">{{ t(p.hint) }}</span>
      </div>
    </div>

    <ul v-reveal class="mt-6 flex flex-wrap gap-x-6 gap-y-2">
      <li v-for="b in bullets" :key="b" class="flex items-center gap-2 text-[14px] text-zinc-300">
        <svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" class="text-emerald-400" aria-hidden="true"><path d="M20 6 9 17l-5-5" /></svg>
        {{ t(b) }}
      </li>
    </ul>

    <div v-reveal class="mt-7 flex flex-wrap items-center gap-3">
      <a
        :href="RELEASES"
        target="_blank"
        rel="noopener"
        class="inline-flex items-center gap-2 rounded-lg bg-emerald-500 px-4 py-2.5 text-[14.5px] font-semibold text-emerald-950 no-underline transition-colors hover:bg-emerald-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
      >
        {{ t('dlGet') }}
      </a>
      <a
        :href="DESKTOP_SRC"
        target="_blank"
        rel="noopener"
        class="inline-flex items-center gap-2 rounded-lg border border-zinc-800 px-4 py-2.5 text-[14.5px] font-medium text-zinc-300 no-underline transition-colors hover:border-emerald-500/50 hover:text-emerald-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
      >
        {{ t('dlSource') }}
      </a>
    </div>

    <p v-reveal class="mt-4 max-w-[720px] text-[13.5px] leading-[1.55] text-zinc-500">{{ t('dlNote') }}</p>
  </section>
</template>
