/* =============================================
   BODY-PROYECTOS — WEPY.AI  v4.1
   Auto-play showcase + word-by-word header
   + métricas con count-up
   ============================================= */


/* ─────────────────────────────────────────────
   KEYFRAMES
   ───────────────────────────────────────────── */
@keyframes proj-glow {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    }
  50%       { transform: translate(-50%, -50%) scale(1.15); }
}

@keyframes proj-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes proj-word-in {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes proj-fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%;   }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%;   }
}


/* ─────────────────────────────────────────────
   SECCIÓN BASE
   ───────────────────────────────────────────── */
.proyectos {
  background: #0F172A;
  overflow: hidden;
}


/* ─────────────────────────────────────────────
   ZONA 1: HEADER
   ───────────────────────────────────────────── */
.proyectos__header {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 120px var(--container-px, 24px) 60px;
  overflow: hidden;
}

.proyectos__glow {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.25) 0%, transparent 70%);
  filter: blur(80px);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: proj-glow 4s ease-in-out infinite;
}

.proyectos__header-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
  text-align: center;
}

/* Eyebrow */
.proyectos__eyebrow {
  display: inline-block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #7C3AED, #8B5CF6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 20px;
  opacity: 0;
}

/* Title — word spans */
.proyectos__title {
  font-family: 'Inter', sans-serif;
  font-size: clamp(40px, 6.5vw, 72px);
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
  /* Prevent word wrapping issues with inline spans */
  word-spacing: 0.12em;
}

.proj-word {
  display: inline-block;
  opacity: 0;
  /* animation set by JS */
}

/* "hablan" — gradient text + animated gradient */
.proj-word--accent {
  background: linear-gradient(90deg, #7C3AED, #8B5CF6);
  background-size: 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  /* animation: set by JS (proj-word-in + gradient-shift after entry) */
}

/* Subtitle */
.proyectos__subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 400;
  color: #6B7280;
  line-height: 1.6;
  max-width: 580px;
  margin: 0 auto;
  opacity: 0;
}


/* ─────────────────────────────────────────────
   ZONA 1.5: MARQUEE
   ───────────────────────────────────────────── */
.proyectos__marquee {
  width: 100%;
  height: 40px;
  background: rgba(124, 58, 237, 0.08);
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
}

.proyectos__marquee-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  width: max-content;
  animation: proj-marquee 18s linear infinite;
}

.proyectos__marquee-track span {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #8B5CF6;
  opacity: 0.6;
  padding: 0 10px;
}

.proyectos__sep {
  opacity: 1 !important;
  padding: 0 2px !important;
}


/* ─────────────────────────────────────────────
   ZONA 2: SHOWCASE + STAGE
   ───────────────────────────────────────────── */
.proyectos__stage {
  max-width: 1440px;
  margin: 0 auto;
  padding: 48px clamp(16px, 4vw, 48px) 0;
}

.proyectos__showcase {
  width: 100%;
  height: 75vh;
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  /* --proj-n set by JS */
}

.proyectos__track {
  display: flex;
  width: calc(var(--proj-n, 2) * 100%);
  height: 100%;
  transition: transform 700ms cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}


/* ─────────────────────────────────────────────
   TARJETA
   ───────────────────────────────────────────── */
.proyectos__card {
  width: calc(100% / var(--proj-n, 2));
  flex-shrink: 0;
  height: 100%;
  position: relative;
  overflow: hidden;
  cursor: default;
}

.proyectos__card--no-img {
  background: linear-gradient(135deg, #1E1035 0%, #2D1B69 50%, #1A2F4A 100%);
}

.proyectos__card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Overlay reposo: sutil oscurecimiento en borde inferior */
.proyectos__card-rest-ov {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.20) 0%, transparent 45%);
  opacity: 1;
  pointer-events: none;
}

/* Hover overlay 1: oscurecimiento para legibilidad */
.proyectos__card-dark-ov {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(10, 5, 30, 0.92) 0%,
    rgba(10, 5, 30, 0.60) 50%,
    rgba(10, 5, 30, 0.20) 100%
  );
  opacity: 0;
  transition: opacity 350ms ease;
  pointer-events: none;
}

/* Hover overlay 2: tinte violeta */
.proyectos__card-violet-ov {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.20) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 350ms ease;
  pointer-events: none;
}

/* Info block */
.proyectos__card-info {
  position: absolute;
  bottom: 48px;
  left: 48px;
  max-width: 560px;
  opacity: 0;
  transform: translateY(32px);
  /* transition set by JS on hover enter/leave */
}

.proyectos__card-pill {
  display: inline-flex;
  align-items: center;
  background: rgba(124, 58, 237, 0.30);
  border: 1px solid rgba(139, 92, 246, 0.55);
  border-radius: 100px;
  padding: 5px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: #8B5CF6;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  opacity: 0;
  /* transition set by JS */
}

.proyectos__card-name {
  font-family: 'Inter', sans-serif;
  font-size: clamp(40px, 4.5vw, 64px);
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-top: 10px;
  opacity: 0;
  /* transition set by JS with 60ms delay */
}

.proyectos__card-desc {
  font-family: 'Inter', sans-serif;
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.6;
  margin-top: 8px;
  opacity: 0;
  /* transition set by JS with 100ms delay */
}

.proyectos__card-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 13px 26px;
  border-radius: 100px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.40);
  color: #FFFFFF;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  transition: background 300ms ease, box-shadow 300ms ease, border-color 300ms ease, color 300ms ease;
  /* opacity transition set by JS with 140ms delay */
}

.proyectos__card-cta:hover {
  background: linear-gradient(135deg, #7C3AED, #8B5CF6);
  border-color: transparent;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.45);
  color: #FFFFFF;
}

.proyectos__card-cta--disabled {
  pointer-events: none;
  border-color: rgba(255, 255, 255, 0.20);
}


/* ─────────────────────────────────────────────
   INDICADORES
   ───────────────────────────────────────────── */
.proyectos__indicators {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
  padding-bottom: 48px;
}

.proyectos__ind {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: rgba(255, 255, 255, 0.30);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}

.proyectos__ind.is-active {
  color: #8B5CF6;
  border-color: rgba(139, 92, 246, 0.80);
  background: rgba(124, 58, 237, 0.15);
}

.proyectos__ind:focus-visible {
  outline: 2px solid #7C3AED;
  outline-offset: 3px;
}

/* Barra de progreso dentro del indicador */
.proyectos__ind-bar {
  width: 100%;
  height: 2px;
  background: rgba(139, 92, 246, 0.20);
  border-radius: 1px;
  overflow: hidden;
  display: block;
}

.proyectos__ind-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7C3AED, #8B5CF6);
  border-radius: 1px;
}


/* ─────────────────────────────────────────────
   ZONA 3: MÉTRICAS
   ───────────────────────────────────────────── */
.proyectos__metrics {
  background: #FFFFFF;
  padding: 88px clamp(20px, 5vw, 64px);
}

.proyectos__metrics-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.proyectos__metric {
  padding: 0 32px;
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  /* transition set by JS */
}

.proyectos__metric:not(:last-child) {
  border-right: 1px solid rgba(124, 58, 237, 0.15);
}

.proyectos__metric-num {
  font-family: 'Inter', sans-serif;
  font-size: clamp(48px, 5vw, 64px);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #7C3AED, #8B5CF6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin: 0;
}

.proyectos__metric-label {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #6B7280;
  margin-top: 6px;
  line-height: 1.4;
}


/* ─────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .proyectos__metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 48px 0;
  }

  .proyectos__metric:nth-child(2) {
    border-right: none;
  }

  .proyectos__metric:nth-child(1),
  .proyectos__metric:nth-child(3) {
    border-right: 1px solid rgba(124, 58, 237, 0.15);
  }
}

@media (max-width: 768px) {
  .proyectos__header {
    padding: 80px var(--container-px, 20px) 48px;
  }

  .proyectos__stage {
    padding: 32px 16px 0;
  }

  .proyectos__showcase {
    height: 65vh;
    border-radius: 12px;
  }

  .proyectos__card-info {
    bottom: 32px;
    left: 28px;
    right: 28px;
    max-width: 100%;
  }

  .proyectos__card-name {
    font-size: clamp(32px, 8vw, 44px);
  }

  /* Mobile: info always visible */
  .proyectos__card-dark-ov,
  .proyectos__card-violet-ov {
    opacity: 1 !important;
  }

  .proyectos__card-info {
    opacity: 1 !important;
    transform: translateY(0) !important;
    transition: none !important;
  }

  .proyectos__card-pill,
  .proyectos__card-name,
  .proyectos__card-desc,
  .proyectos__card-cta {
    opacity: 1 !important;
    transition: none !important;
  }

  .proyectos__card-cta--disabled {
    opacity: 0.55 !important;
  }
}

@media (max-width: 480px) {
  .proyectos__metrics-grid {
    grid-template-columns: 1fr;
    gap: 40px 0;
  }

  .proyectos__metric {
    border-right: none !important;
  }
}


/* ─────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .proyectos__glow            { animation: none; }
  .proyectos__marquee-track   { animation-play-state: paused; }
  .proyectos__track           { transition: none !important; }

  .proyectos__eyebrow,
  .proj-word,
  .proyectos__subtitle {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .proyectos__card-dark-ov,
  .proyectos__card-violet-ov {
    opacity: 1 !important;
    transition: none !important;
  }

  .proyectos__card-info,
  .proyectos__card-pill,
  .proyectos__card-name,
  .proyectos__card-desc,
  .proyectos__card-cta {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .proyectos__card-cta--disabled { opacity: 0.55 !important; }

  .proyectos__metric {
    opacity: 1 !important;
    transform: none !important;
  }
}
