<template>
  <div class="landing">

    <!-- ── Navbar ── -->
    <nav class="nav" :class="{ 'nav--solid': scrolled }">
      <div class="nav__inner">
        <img src="/titulosib.png" alt="SIB" class="nav__logo" />
        <div class="nav__right">
          <button class="nav__link" @click="scrollToInstall">{{ t('landing.hero.howToInstall') }}</button>
          <button class="cta-pill cta-pill--sm" @click="launchApp">
            {{ t('landing.hero.launchApp') }} <span>↗</span>
          </button>
        </div>
      </div>
    </nav>

    <!-- ── Hero ── -->
    <header class="hero">
      <!-- Background photo -->
      <div class="hero__photo">
        <img src="/landing-bg-bus.png" alt="" />
        <div class="hero__photo-scrim"></div>
      </div>

      <!-- Diagonal accent slash -->
      <div class="hero__slash"></div>

      <!-- Live badge -->
      <div class="hero__badge" data-aos="fade-right">
        <span class="hero__badge-dot"></span>
        <span>{{ t('landing.hero.live') || 'EN VIVO' }}</span>
      </div>

      <!-- Main copy — left-aligned, huge -->
      <div class="hero__copy">
        <h1 class="hero__h1" data-aos="fade-up">
          <span class="hero__h1-outline">{{ t('landing.hero.titleLine1') || 'SABÉS' }}</span>
          <span class="hero__h1-solid">{{ t('landing.hero.titleLine2') || 'DÓNDE' }}</span>
          <span class="hero__h1-outline">{{ t('landing.hero.titleLine3') || 'ESTÁ' }}</span>
          <span class="hero__h1-accent">{{ t('landing.hero.titleLine4') || 'TU BUS.' }}</span>
        </h1>
        <p class="hero__tagline" data-aos="fade-up" data-aos-delay="150">
          {{ t('landing.hero.tagline') || 'GPS en tiempo real · Ofertas locales · Sin descarga' }}
        </p>
        <div class="hero__actions" data-aos="fade-up" data-aos-delay="280">
          <button class="cta-pill cta-pill--lg" @click="launchApp">
            {{ t('landing.hero.launchApp') }} <span class="cta-pill__arrow">↗</span>
          </button>
          <button class="ghost-btn" @click="scrollToInstall">
            {{ t('landing.hero.howToInstall') }}
          </button>
        </div>
      </div>

      <!-- Vertical route indicator — decorative -->
      <div class="hero__route" aria-hidden="true">
        <div class="hero__route-dot hero__route-dot--top"></div>
        <div class="hero__route-line"></div>
        <div class="hero__route-dot hero__route-dot--bottom"></div>
      </div>
    </header>

    <!-- ── Ticker ── -->
    <div class="ticker" aria-hidden="true">
      <div class="ticker__track">
        <span v-for="i in 8" :key="i" class="ticker__item">
          GPS EN VIVO <em>·</em> SIN DESCARGA <em>·</em> OFERTAS LOCALES <em>·</em>
        </span>
      </div>
    </div>

    <!-- ── Features ── -->
    <section class="feats">
      <div class="feats__inner">

        <!-- Label col -->
        <div class="feats__label" data-aos="fade-right">
          <span class="tag">{{ t('landing.features.sectionTag') || 'FUNCIONALIDADES' }}</span>
          <h2 class="feats__h2">
            {{ t('landing.features.heading1') || 'Todo lo' }}<br>
            <em>{{ t('landing.features.heading2') || 'que necesitás' }}</em>
          </h2>
        </div>

        <!-- Items col -->
        <div class="feats__list">
          <div class="feat" data-aos="fade-up" data-aos-delay="0">
            <div class="feat__num">01</div>
            <div class="feat__body">
              <h3>{{ t('landing.features.realtime') || 'Tiempo real' }}</h3>
              <p>{{ t('landing.features.realtimeDesc') || 'GPS de cada bus, actualizado al segundo.' }}</p>
            </div>
            <span class="material-icons feat__icon">explore</span>
          </div>
          <div class="feat" data-aos="fade-up" data-aos-delay="80">
            <div class="feat__num">02</div>
            <div class="feat__body">
              <h3>{{ t('landing.features.localOffers') || 'Ofertas locales' }}</h3>
              <p>{{ t('landing.features.localOffersDesc') || 'Descuentos de negocios cerca de tu parada.' }}</p>
            </div>
            <span class="material-icons feat__icon">local_offer</span>
          </div>
          <div class="feat" data-aos="fade-up" data-aos-delay="160">
            <div class="feat__num">03</div>
            <div class="feat__body">
              <h3>{{ t('landing.features.noDownload') || 'Sin Play Store' }}</h3>
              <p>{{ t('landing.features.noDownloadDesc') || 'Instalás como PWA directo desde el navegador.' }}</p>
            </div>
            <span class="material-icons feat__icon">phonelink_setup</span>
          </div>
        </div>

      </div>
    </section>

    <!-- ── Install ── -->
    <section id="install-guide" class="install">
      <div class="install__bg">
        <img src="/landing-install-bg.png" alt="" />
        <div class="install__bg-scrim"></div>
      </div>

      <div class="install__inner">
        <div class="install__header" data-aos="fade-up">
          <span class="tag tag--yellow">{{ t('landing.install.sectionTag') || 'INSTALACIÓN' }}</span>
          <h2 class="install__h2">
            {{ t('landing.install.heading1') || 'En menos de' }}<br>
            <em>{{ t('landing.install.heading2') || '30 segundos' }}</em>
          </h2>
        </div>

        <div class="install__cols">
          <div class="install-card" data-aos="fade-up" data-aos-delay="0">
            <div class="install-card__platform">
              <span class="material-icons">apple</span> iOS · Safari
            </div>
            <ol class="steps">
              <li>{{ t('landing.install.iosStep1') || 'Abrí esta página en Safari' }}</li>
              <li>{{ t('landing.install.iosStep2') || 'Tocá el botón Compartir ↑' }}</li>
              <li>{{ t('landing.install.iosStep3') || 'Elegí "Agregar a inicio"' }}</li>
            </ol>
          </div>
          <div class="install-card" data-aos="fade-up" data-aos-delay="100">
            <div class="install-card__platform">
              <span class="material-icons">android</span> Android · Chrome
            </div>
            <ol class="steps">
              <li>{{ t('landing.install.androidStep1') || 'Abrí esta página en Chrome' }}</li>
              <li>{{ t('landing.install.androidStep2') || 'Tocá el menú ⋮ arriba' }}</li>
              <li>{{ t('landing.install.androidStep3') || 'Elegí "Instalar aplicación"' }}</li>
            </ol>
          </div>
        </div>

        <div class="install__cta" data-aos="fade-up" data-aos-delay="180">
          <button class="cta-pill cta-pill--lg" @click="launchApp">
            {{ t('landing.hero.launchApp') }} <span class="cta-pill__arrow">↗</span>
          </button>
        </div>
      </div>
    </section>

    <!-- ── Footer ── -->
    <footer class="footer">
      <img src="/titulosib.png" alt="SIB" class="footer__logo" />
      <p class="footer__copy">{{ t('landing.footer.rights') || '© 2025 SIB · Todos los derechos reservados' }}</p>
    </footer>

  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'

const router = useRouter()
const { t } = useI18n()
const scrolled = ref(false)

const handleScroll = () => { scrolled.value = window.scrollY > 50 }

onMounted(() => {
  window.addEventListener('scroll', handleScroll)
  const isStandalone = window.matchMedia('(display-mode: standalone)').matches
    || (window.navigator as any).standalone === true
  if (isStandalone) router.replace('/splash')
})
onUnmounted(() => window.removeEventListener('scroll', handleScroll))

const launchApp = () => router.push('/splash')
const scrollToInstall = () => document.getElementById('install-guide')?.scrollIntoView({ behavior: 'smooth' })
</script>

<style scoped>
/* ══ TOKENS ══════════════════════════════════════════════ */
.landing {
  --y:   #fee715;
  --y10: rgba(254,231,21,.10);
  --y20: rgba(254,231,21,.20);
  --ink: #060606;
  --off: #0e0e0e;
  --dim: rgba(255,255,255,.40);
  --hr:  rgba(255,255,255,.07);

  background: var(--ink);
  color: #fff;
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ══ NAV ═════════════════════════════════════════════════ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: 72px; display: flex; align-items: center; padding: 0 32px;
  transition: background .25s, border-color .25s;
}
.nav--solid {
  background: rgba(6,6,6,.90);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--hr);
}
.nav__inner {
  max-width: 1280px; margin: 0 auto; width: 100%;
  display: flex; justify-content: space-between; align-items: center;
}
.nav__logo { height: 40px; width: auto; object-fit: contain; }
.nav--solid .nav__logo { height: 32px; }
.nav__right { display: flex; align-items: center; gap: 24px; }
.nav__link {
  background: none; border: none; color: var(--dim);
  font-family: inherit; font-size: 1rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
  transition: color .2s;
}
.nav__link:hover { color: #fff; }

/* ══ CTA PILL ════════════════════════════════════════════ */
.cta-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--y); color: #000;
  font-family: inherit; font-weight: 800; text-transform: uppercase;
  letter-spacing: .06em; border: none; cursor: pointer;
  border-radius: 4px;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s;
}
.cta-pill--sm { font-size: .85rem; padding: 9px 20px; }
.cta-pill--lg { font-size: 1.15rem; padding: 18px 42px; }
.cta-pill__arrow { display: inline-block; transition: transform .2s; }
.cta-pill:hover { transform: translateY(-3px); box-shadow: 0 18px 44px rgba(254,231,21,.28); }
.cta-pill:hover .cta-pill__arrow { transform: translate(3px,-3px); }

.ghost-btn {
  background: none;
  border: 1.5px solid var(--hr);
  color: var(--dim);
  font-family: inherit; font-size: 1rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  padding: 17px 36px; border-radius: 4px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.ghost-btn:hover { border-color: rgba(255,255,255,.3); color: #fff; }

/* ══ HERO ════════════════════════════════════════════════ */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: flex-end;
  padding: 0 6vw 100px;
  overflow: hidden;
}

/* Photo bg */
.hero__photo { position: absolute; inset: 0; }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; filter: saturate(.5); }
.hero__photo-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(6,6,6,.92) 40%, rgba(6,6,6,.35) 100%),
    linear-gradient(to top,  rgba(6,6,6,.9)  0%,  transparent 50%);
}

/* Diagonal slash accent */
.hero__slash {
  position: absolute; bottom: -2px; right: -2px;
  width: 55vw; height: 45vh;
  background: var(--y);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  opacity: .06;
  pointer-events: none;
}

/* Live badge */
.hero__badge {
  position: absolute; top: 110px; left: 6vw; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--y20);
  background: var(--y10);
  color: var(--y);
  font-size: .72rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase;
  padding: 7px 16px; border-radius: 2px;
}
.hero__badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--y);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity:1; }  50% { opacity:.25; }
}

/* Copy */
.hero__copy { position: relative; z-index: 2; max-width: 860px; }

.hero__h1 {
  display: flex; flex-direction: column;
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: clamp(5rem, 14vw, 13rem);
  font-weight: 800;
  line-height: .88;
  letter-spacing: -.02em;
  text-transform: uppercase;
  margin-bottom: 32px;
}
.hero__h1-outline {
  -webkit-text-stroke: 2px rgba(255,255,255,.25);
  color: transparent;
}
.hero__h1-solid { color: #fff; }
.hero__h1-accent {
  color: var(--y);
  -webkit-text-stroke: 0;
}

.hero__tagline {
  font-size: clamp(.85rem, 1.8vw, 1.1rem);
  font-weight: 500;
  color: var(--dim);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 48px;
}

.hero__actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* Route indicator (decorative) */
.hero__route {
  position: absolute; right: 8vw; bottom: 90px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 0;
}
.hero__route-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--y); border: 2px solid var(--ink);
}
.hero__route-line {
  width: 2px; height: 80px;
  background: linear-gradient(to bottom, var(--y), rgba(254,231,21,.1));
}
.hero__route-dot--bottom { background: rgba(254,231,21,.25); }

/* ══ TICKER ══════════════════════════════════════════════ */
.ticker {
  overflow: hidden;
  background: var(--y);
  color: #000;
  padding: 14px 0;
  border-top: none;
}
.ticker__track {
  display: flex; gap: 0;
  animation: ticker 22s linear infinite;
  white-space: nowrap;
}
.ticker__item {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 1rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  padding: 0 40px; flex-shrink: 0;
}
.ticker__item em { font-style: normal; opacity: .5; }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ══ FEATURES ════════════════════════════════════════════ */
.feats { padding: 120px 6vw; }
.feats__inner {
  max-width: 1280px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 2fr; gap: 80px; align-items: start;
}
.feats__label { position: sticky; top: 120px; }

.tag {
  display: inline-block;
  font-size: .7rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--dim);
  border: 1px solid var(--hr); padding: 5px 12px; border-radius: 2px;
  margin-bottom: 28px;
}
.tag--yellow { color: var(--y); border-color: var(--y20); }

.feats__h2 {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  font-weight: 800; line-height: .95;
  letter-spacing: -.02em; text-transform: uppercase;
}
.feats__h2 em { font-style: normal; color: var(--y); }

.feats__list { display: flex; flex-direction: column; gap: 0; }

.feat {
  display: grid; grid-template-columns: 72px 1fr 48px;
  align-items: center; gap: 28px;
  padding: 40px 0;
  border-bottom: 1px solid var(--hr);
  transition: background .2s;
}
.feat:first-child { border-top: 1px solid var(--hr); }
.feat:hover { background: rgba(255,255,255,.02); }

.feat__num {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 2.6rem; font-weight: 800;
  color: rgba(255,255,255,.08); letter-spacing: -.03em;
}
.feat__body h3 {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 1.6rem; font-weight: 700;
  letter-spacing: -.01em; text-transform: uppercase; margin-bottom: 6px;
}
.feat__body p { font-family: 'DM Sans', sans-serif; font-size: .95rem; color: var(--dim); line-height: 1.6; }
.feat__icon { font-size: 28px; color: var(--y); opacity: .5; }
.feat:hover .feat__icon { opacity: 1; }

/* ══ INSTALL ═════════════════════════════════════════════ */
.install {
  position: relative; padding: 130px 6vw; overflow: hidden;
}
.install__bg { position: absolute; inset: 0; }
.install__bg img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.2) brightness(.25); }
.install__bg-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(6,6,6,.65), rgba(6,6,6,.95));
}

.install__inner { position: relative; z-index: 1; max-width: 1000px; margin: 0 auto; }
.install__header { margin-bottom: 64px; }
.install__h2 {
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: clamp(2.8rem, 5vw, 4.5rem);
  font-weight: 800; line-height: .95; letter-spacing: -.02em; text-transform: uppercase;
}
.install__h2 em { font-style: normal; color: var(--y); }

.install__cols {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px; margin-bottom: 64px;
}

.install-card {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--hr); border-radius: 6px; padding: 44px 40px;
  transition: border-color .3s;
}
.install-card:hover { border-color: var(--y20); }

.install-card__platform {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Barlow Condensed', 'Arial Narrow', Arial, sans-serif;
  font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--y); margin-bottom: 32px;
}
.install-card__platform .material-icons { font-size: 24px; }

.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li {
  counter-increment: s;
  position: relative; padding-left: 48px;
  margin-bottom: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem; color: rgba(255,255,255,.6); line-height: 1.55;
}
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--y10); border: 1px solid var(--y20);
  color: var(--y); font-size: .8rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.steps li:last-child { margin-bottom: 0; }

.install__cta { text-align: center; }

/* ══ FOOTER ══════════════════════════════════════════════ */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 48px 6vw;
  border-top: 1px solid var(--hr);
  flex-wrap: wrap; gap: 20px;
}
.footer__logo { height: 28px; opacity: .4; transition: opacity .3s; }
.footer__logo:hover { opacity: 1; }
.footer__copy { font-family: 'DM Sans', sans-serif; font-size: .82rem; color: rgba(255,255,255,.2); }

/* ══ RESPONSIVE — MOBILE FIRST ═══════════════════════════ */

/* ── Tablet ─────────────────────────────────────── 768px+ */
@media (min-width: 768px) {
  /* Nav */
  .nav { padding: 0 32px; }
  .nav__logo { height: 40px; }
  .nav__link { display: block; }

  /* Hero */
  .hero { padding: 0 6vw 100px; align-items: flex-end; }
  .hero__badge { top: 110px; left: 6vw; }
  .hero__copy { max-width: 700px; }
  .hero__h1 { font-size: clamp(5rem, 11vw, 10rem); }
  .hero__tagline { font-size: 1rem; }
  .hero__actions { flex-direction: row; flex-wrap: wrap; }
  .hero__route { display: flex; }

  /* Features */
  .feats { padding: 120px 6vw; }
  .feats__inner { grid-template-columns: 1fr 2fr; gap: 80px; }
  .feats__label { position: sticky; top: 120px; }
  .feat { grid-template-columns: 72px 1fr 48px; gap: 28px; }
  .feat__icon { display: block; }

  /* Install */
  .install { padding: 130px 6vw; }
  .install__cols { grid-template-columns: repeat(2, 1fr); }
  .install-card { padding: 44px 40px; }

  /* Footer */
  .footer { flex-direction: row; text-align: left; }
}

/* ── Desktop ────────────────────────────────────── 1024px+ */
@media (min-width: 1024px) {
  .hero__h1 { font-size: clamp(7rem, 13vw, 13rem); }
  .feats__h2 { font-size: 4.5rem; }
  .install__h2 { font-size: 4.5rem; }
}

/* ── Base mobile styles (aplican a todos) ──────── < 768px */
@media (max-width: 767px) {
  /* Nav */
  .nav { padding: 0 18px; height: 62px; }
  .nav__logo { height: 32px; }
  .nav--solid .nav__logo { height: 28px; }
  .nav__link { display: none; }
  .nav__right { gap: 12px; }
  .cta-pill--sm { font-size: .8rem; padding: 8px 16px; }

  /* Hero */
  .hero {
    padding: 80px 18px 72px;
    align-items: flex-start;
    min-height: 100svh;        /* usa svh en mobile para respetar la barra del browser */
    justify-content: flex-end;
  }
  .hero__badge {
    top: 80px; left: 18px;
    font-size: .68rem; padding: 6px 13px;
  }
  .hero__copy { max-width: 100%; width: 100%; }
  .hero__h1 {
    font-size: clamp(3.4rem, 17vw, 5.5rem);
    margin-bottom: 20px;
    line-height: .9;
  }
  .hero__h1-outline { -webkit-text-stroke: 1.5px rgba(255,255,255,.22); }
  .hero__tagline {
    font-size: .75rem; letter-spacing: .1em;
    margin-bottom: 32px;
  }
  .hero__actions { flex-direction: column; gap: 12px; width: 100%; }
  .cta-pill--lg { width: 100%; justify-content: center; font-size: 1rem; padding: 16px 24px; }
  .ghost-btn { width: 100%; text-align: center; font-size: .9rem; padding: 14px 24px; }
  .hero__route { display: none; }
  .hero__slash { width: 70vw; height: 30vh; }

  /* Ticker */
  .ticker { padding: 11px 0; }
  .ticker__item { font-size: .85rem; padding: 0 28px; }

  /* Features */
  .feats { padding: 64px 18px; }
  .feats__inner {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .feats__label { position: static; }
  .feats__h2 { font-size: clamp(2.2rem, 9vw, 3.2rem); }
  .feats__list { gap: 0; }
  .feat {
    grid-template-columns: 44px 1fr;
    gap: 16px;
    padding: 28px 0;
  }
  .feat__num { font-size: 2rem; }
  .feat__body h3 { font-size: 1.3rem; }
  .feat__body p { font-size: .9rem; }
  .feat__icon { display: none; }

  /* Install */
  .install { padding: 64px 18px; }
  .install__header { margin-bottom: 44px; }
  .install__h2 { font-size: clamp(2.2rem, 9vw, 3.2rem); }
  .install__cols {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 44px;
  }
  .install-card { padding: 28px 22px; }
  .install-card__platform { font-size: 1rem; margin-bottom: 24px; }
  .steps li { font-size: .92rem; padding-left: 42px; margin-bottom: 16px; }
  .steps li::before { width: 26px; height: 26px; font-size: .75rem; }
  .install__cta .cta-pill--lg { width: 100%; justify-content: center; }

  /* Footer */
  .footer {
    padding: 36px 18px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }
  .footer__logo { height: 26px; }
  .footer__copy { font-size: .78rem; }
}
</style>