/*
 * components.css
 * Componentes del portafolio de Froylan Díaz
 * Depende de: tokens.css, base.css
 *
 * ÍNDICE
 * 1.  Barra de progreso
 * 2.  Header / Nav
 * 3.  Botones
 * 4.  Chips
 * 5.  Hero
 * 6.  Propuesta de valor
 * 7.  Sobre mí
 * 8.  Servicios
 * 9.  Trabajo seleccionado (carrusel)
 * 10. CTA fija inferior
 * 11. Footer
 * 12. Animaciones de aparición
 */


/* ══════════════════════════════════════════════════
   1. BARRA DE PROGRESO
   ══════════════════════════════════════════════════ */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--yellow);
  z-index: var(--z-sticky);
  transition: width 80ms linear;
  pointer-events: none;
}


/* ══════════════════════════════════════════════════
   2. HEADER / NAV
   ══════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 3px; /* debajo de la barra de progreso */
  z-index: var(--z-sticky);
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

/* Identidad: avatar + nombre + estado */
.header-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--black);
}
.header-identity:hover { opacity: 1; }

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
}

.header-name {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--black);
  white-space: nowrap;
}

.header-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  display: none; /* visible en ≥768px */
}
.header-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: #34A853; /* verde disponible */
  margin-right: var(--space-2);
  vertical-align: middle;
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

/* Nav links */
.header-nav {
  display: none; /* visible en ≥768px */
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.header-nav a {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--black);
  text-decoration: none;
  transition: color var(--transition-fast);
}
.header-nav a:hover { color: var(--blue-text); }
.header-nav a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 2px;
}

/* Botones header */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.lang-btn:hover {
  color: var(--black);
  border-color: var(--black);
}

/* Responsive header */
@media (min-width: 768px) {
  .header-status { display: inline; }
  .header-nav    { display: flex; }
}


/* ══════════════════════════════════════════════════
   3. BOTONES
   ══════════════════════════════════════════════════ */

/* Base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: 1;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
}
.btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.btn:active { opacity: 1;    transform: translateY(0); }
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Primario: negro/blanco — 18.1:1 ✓ */
.btn-primary {
  background: var(--black);
  color: var(--white);
}

/* WhatsApp */
.btn-whatsapp {
  background: #25D366;
  color: var(--white);
  font-weight: var(--weight-bold);
}
.btn-whatsapp:hover { opacity: 0.9; }

/* Fantasma */
.btn-ghost {
  background: transparent;
  color: var(--black);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: rgba(17,17,17,0.04); }

/* Tamaño grande */
.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}


/* ══════════════════════════════════════════════════
   4. CHIPS
   ══════════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
}

/* Amarillo/negro — 11.3:1 ✓ */
.chip-yellow  { background: var(--yellow); color: var(--black); }
/* Azul claro */
.chip-blue    { background: rgba(66,133,244,0.12); color: var(--blue-text); }
/* Neutro */
.chip-neutral { background: var(--surface-raised); color: var(--black); border: 1px solid var(--border); }


/* ══════════════════════════════════════════════════
   5. HERO
   ══════════════════════════════════════════════════ */
.hero {
  padding-block: var(--space-20) var(--space-16);
  padding-bottom: var(--space-24);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  align-items: center;
}

/* Columna de texto */
.hero-text {}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-4);
}

.hero-headline {
  font-size: clamp(var(--text-4xl), 6vw, var(--text-6xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  color: var(--black);
  margin-bottom: var(--space-6);
}

/* La palabra de acento en azul — solo a este tamaño es válido */
.hero-headline .accent {
  color: var(--blue);
}

.hero-sub {
  font-size: var(--text-lg);
  color: var(--muted);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-8);
  max-width: 48ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

.hero-scroll {
  display: block;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-top: var(--space-12);
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%       { transform: translateY(4px); opacity: 1; }
}

/* Columna de tarjetas */
.hero-cards {
  position: relative;
  display: none; /* visible en ≥1024px */
}

/* Efecto stack: 3 capas */
.cards-stack {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
}

.stack-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

/* Tarjeta de fondo — más pequeña y desplazada */
.stack-card--back2 {
  position: absolute;
  bottom: -18px;
  left: 18px;
  right: 18px;
  height: 120px;
  background: var(--surface-raised);
  border-color: var(--border);
  box-shadow: none;
  z-index: 1;
  transform: rotate(-1.5deg);
}

.stack-card--back1 {
  position: absolute;
  bottom: -9px;
  left: 9px;
  right: 9px;
  background: var(--white);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  transform: rotate(-0.5deg);
}

.stack-card--front {
  position: relative;
  z-index: 3;
  transform: rotate(0.5deg);
  transition: transform var(--transition-slow);
}
.stack-card--front:hover { transform: rotate(0deg) translateY(-4px); }

.stack-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}

.stack-card-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}

.stack-card-body {
  padding: var(--space-5) var(--space-6);
}

.stack-card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--black);
  margin-bottom: var(--space-2);
}

.stack-card-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Hero responsive */
@media (min-width: 1024px) {
  .hero-inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
  }
  .hero-cards { display: block; }
  .hero-scroll { display: none; } /* en desktop no hace falta */
}


/* ══════════════════════════════════════════════════
   6. PROPUESTA DE VALOR
   ══════════════════════════════════════════════════ */
.value-section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
}

.value-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
}

.value-headline {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.02em;
  max-width: 22ch;
}

.value-principles {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.principle {
  border-left: 3px solid var(--border);
  padding-left: var(--space-5);
  transition: border-color var(--transition-base);
}
.principle:first-child { border-left-color: var(--blue); }
.principle:last-child  { border-left-color: var(--yellow); }

.principle-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--black);
  margin-bottom: var(--space-2);
}

.principle-desc {
  font-size: var(--text-base);
  color: var(--muted);
  max-width: 45ch;
}

@media (min-width: 768px) {
  .value-inner {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}


/* ══════════════════════════════════════════════════
   7. SOBRE MÍ (tarjeta en home)
   ══════════════════════════════════════════════════ */
.about-section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
}

.about-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.about-header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.about-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.about-meta {}

.about-name {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--black);
  margin-bottom: var(--space-1);
}

.about-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}

.about-bio {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: var(--leading-normal);
  max-width: 60ch;
}

.about-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

@media (min-width: 768px) {
  .about-card {
    flex-direction: row;
    align-items: center;
    gap: var(--space-10);
  }
  .about-header { flex-direction: column; align-items: flex-start; }
  .about-content { flex: 1; }
}


/* ══════════════════════════════════════════════════
   8. SERVICIOS (cómo puedo ayudarte)
   ══════════════════════════════════════════════════ */
.services-section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: var(--space-10);
}

.section-label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
  margin-bottom: var(--space-3);
  display: block;
}

.section-title {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-4xl));
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.02em;
}

.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

.service-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.service-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.service-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  font-size: 20px;
}

.service-icon--xr  { background: rgba(66,133,244,0.10); }
.service-icon--ux  { background: rgba(244,180,0,0.12); }
.service-icon--web { background: rgba(52,168,83,0.10); }

.service-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--black);
  margin-bottom: var(--space-3);
}

.service-desc {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: var(--leading-normal);
  max-width: 38ch;
}

@media (min-width: 640px) {
  .services-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .services-grid { grid-template-columns: 1fr 1fr 1fr; }
}


/* ══════════════════════════════════════════════════
   9. TRABAJO SELECCIONADO
   ══════════════════════════════════════════════════ */
.work-section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--border);
  padding-bottom: calc(var(--space-24) + 60px); /* espacio para CTA fija */
}

.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

/* Tarjeta de caso */
.case-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.case-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.case-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Caso destacado */
.case-card--featured {
  border: 2px solid var(--blue); /* excepción permitida: acento del caso destacado */
}

.case-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.case-card-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--muted);
}

.case-card-body {
  padding: var(--space-6);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.case-card-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

.case-card-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--black);
  line-height: var(--leading-snug);
}

.case-card-desc {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: var(--leading-normal);
  flex: 1;
}

.case-card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
}

/* Tarjeta próximamente */
.case-card--soon {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}
.case-card--soon:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .work-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  .work-grid { grid-template-columns: 1fr 1fr 1fr; }
}


/* ══════════════════════════════════════════════════
   10. CTA FIJA INFERIOR
   ══════════════════════════════════════════════════ */
.cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background: rgba(250, 250, 247, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--container-pad);
}

.cta-bar-inner {
  max-width: var(--container-xl);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.cta-bar-text {
  display: none;
}

.cta-bar-tagline {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--black);
}

.cta-bar-sub {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: var(--space-1);
}

@media (min-width: 640px) {
  .cta-bar-text { display: block; }
}


/* ══════════════════════════════════════════════════
   11. FOOTER
   ══════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-8);
  padding-bottom: calc(var(--space-8) + 60px); /* espacio para CTA fija */
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  text-align: center;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}


/* ══════════════════════════════════════════════════
   12. ANIMACIONES DE APARICIÓN
   JS agrega .is-visible cuando el elemento entra en viewport
   ══════════════════════════════════════════════════ */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity var(--duration-slow) var(--ease-out),
    transform var(--duration-slow) var(--ease-out);
}

.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delays escalonados para grupos de elementos */
.fade-up:nth-child(2) { transition-delay: 80ms; }
.fade-up:nth-child(3) { transition-delay: 160ms; }
.fade-up:nth-child(4) { transition-delay: 240ms; }

/* Respetar prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
