/* ============================================================
   ESTILOS PERSONALIZADOS — Portafolio Profesional
   Complementan a Tailwind CSS (CDN). Aquí vive todo lo que
   Tailwind no cubre cómodamente: animaciones, timeline,
   scrollbar, componentes reutilizables.
   ============================================================ */

/* ------------------------------------------------------------
   SCROLLBAR personalizada (Chrome / Edge / Safari)
   ------------------------------------------------------------ */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #09090b;
}
::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: #34d399;
}

/* ------------------------------------------------------------
   FONDO con cuadrícula sutil (efecto "blueprint" tecnológico)
   ------------------------------------------------------------ */
.bg-grid {
  background-image:
    linear-gradient(rgba(63, 63, 70, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 63, 70, 0.18) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
}

/* ------------------------------------------------------------
   NAVEGACIÓN
   ------------------------------------------------------------ */

/* Estado del navbar al hacer scroll (lo aplica main.js) */
#navbar.scrolled {
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid #27272a;
}

/* Subrayado animado de los enlaces de escritorio */
.nav-link {
  position: relative;
  padding-bottom: 4px;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: #34d399;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}
.nav-link.active {
  color: #34d399;
}

/* Líneas del botón hamburguesa con animación a "X" */
.hamburger-line {
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.hamburger-line:nth-child(1) { transform: translateY(-7px); }
.hamburger-line:nth-child(3) { transform: translateY(7px); }

#menu-btn.open .hamburger-line:nth-child(1) { transform: rotate(45deg); }
#menu-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
#menu-btn.open .hamburger-line:nth-child(3) { transform: rotate(-45deg); }

/* Menú móvil abierto (la clase la alterna main.js) */
#mobile-menu.open {
  max-height: 32rem;
}

/* ------------------------------------------------------------
   HERO
   ------------------------------------------------------------ */

/* Degradado en el nombre */
.text-gradient {
  background: linear-gradient(120deg, #34d399 0%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Cursor parpadeante del efecto "máquina de escribir" */
.typed-cursor {
  color: #34d399;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* Anillo decorativo giratorio alrededor de la foto */
.animate-spin-slow {
  animation: spin 20s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------
   ANIMACIONES DE ENTRADA AL SCROLL (Intersection Observer)
   main.js añade la clase .visible cuando el elemento entra
   en pantalla. --delay permite escalonar elementos.
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s ease var(--delay, 0s),
    transform 0.7s ease var(--delay, 0s);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Respeto a usuarios con movimiento reducido (accesibilidad) */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .animate-spin-slow,
  .typed-cursor {
    animation: none;
  }
}

/* ------------------------------------------------------------
   SOBRE MÍ — Tarjetas de estadísticas
   ------------------------------------------------------------ */
.stat-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.stat-card:hover {
  border-color: rgba(52, 211, 153, 0.4);
  transform: translateY(-4px);
}
/* El "+" después del número contador */
.stat-card span[data-count]::after {
  content: '+';
}

/* ------------------------------------------------------------
   HABILIDADES — Filtros y tarjetas
   ------------------------------------------------------------ */
.filter-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.825rem;
  font-weight: 600;
  color: #a1a1aa;
  border: 1px solid #27272a;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
}
.filter-btn:hover {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.4);
}
.filter-btn.filter-active {
  background: #34d399;
  color: #09090b;
  border-color: #34d399;
}

.skill-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  padding: 1.5rem 1.25rem;
  transition: all 0.3s ease;
}
.skill-card:hover {
  border-color: rgba(52, 211, 153, 0.45);
  transform: translateY(-5px);
  box-shadow: 0 12px 32px -12px rgba(52, 211, 153, 0.18);
}
/* Estado oculto al filtrar (lo aplica main.js) */
.skill-card.hidden-skill {
  display: none;
}

/* ------------------------------------------------------------
   EXPERIENCIA — Línea de tiempo vertical
   ------------------------------------------------------------ */
.timeline {
  padding-left: 1.75rem;
}
/* Línea vertical continua */
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, #34d399, #27272a 85%);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  padding-bottom: 2.5rem;
}
.timeline-item:last-child {
  padding-bottom: 0;
}

/* Punto sobre la línea */
.timeline-dot {
  position: absolute;
  left: -1.75rem;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  background: #09090b;
  border: 2.5px solid #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  margin-left: 0;
  transform: translateX(-0.5px);
}

.timeline-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.85rem;
  padding: 1.5rem;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.timeline-card:hover {
  border-color: rgba(52, 211, 153, 0.35);
  transform: translateX(6px);
}

/* Tags de tecnologías dentro de la timeline */
.tech-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: #34d399;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 9999px;
  padding: 0.25rem 0.7rem;
}

/* ------------------------------------------------------------
   CERTIFICACIONES — Tarjetas, badges y modal
   ------------------------------------------------------------ */
.cert-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.85rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}
.cert-card:hover {
  border-color: rgba(52, 211, 153, 0.45);
  transform: translateY(-5px);
  box-shadow: 0 12px 32px -12px rgba(52, 211, 153, 0.18);
}

/* Badge: certificación completada */
.badge-done {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 9999px;
  padding: 0.25rem 0.7rem;
}
/* Badge: certificación en curso */
.badge-progress {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 9999px;
  padding: 0.25rem 0.7rem;
}

/* Botón "Ver Certificado" — abre el modal */
.cert-view-btn {
  margin-top: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.25);
  cursor: pointer;
  transition: all 0.3s ease;
}
.cert-view-btn:hover {
  background: #34d399;
  color: #09090b;
  box-shadow: 0 8px 20px -8px rgba(52, 211, 153, 0.5);
}

/* Modal visible (la clase la alterna main.js) */
#cert-modal.open {
  display: flex;
}
/* Animación de entrada del modal */
.animate-modal-in {
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ------------------------------------------------------------
   EVENTOS — Tarjetas y badges de rol
   ------------------------------------------------------------ */
.event-card {
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.85rem;
  overflow: hidden;
  transition: all 0.3s ease;
}
.event-card:hover {
  border-color: rgba(52, 211, 153, 0.45);
  transform: translateY(-5px);
  box-shadow: 0 12px 32px -12px rgba(52, 211, 153, 0.18);
}
.event-card:hover img {
  transform: scale(1.06);
}

/* Badges según el rol en el evento */
.badge-speaker,
.badge-organizer,
.badge-attendee {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 9999px;
  padding: 0.3rem 0.75rem;
}
.badge-speaker {
  color: #a78bfa; /* violeta — ponente */
  background: rgba(167, 139, 250, 0.1);
  border: 1px solid rgba(167, 139, 250, 0.25);
}
.badge-organizer {
  color: #22d3ee; /* cian — organizador */
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.badge-attendee {
  color: #34d399; /* esmeralda — asistente */
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
}

/* ------------------------------------------------------------
   CONTACTO — Items y formulario
   ------------------------------------------------------------ */
.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.75rem;
  transition: all 0.3s ease;
}
.contact-item:hover {
  border-color: rgba(52, 211, 153, 0.45);
  transform: translateX(6px);
}
.contact-icon {
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 0.6rem;
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  font-size: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #a1a1aa;
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  background: #18181b;
  border: 1px solid #27272a;
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #e4e4e7;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.form-input::placeholder {
  color: #52525b;
}
.form-input:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

/* ------------------------------------------------------------
   BOTÓN "VOLVER ARRIBA" — estado visible (lo aplica main.js)
   ------------------------------------------------------------ */
#back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ------------------------------------------------------------
   CHATBOT FLOTANTE — panel, burbujas y "escribiendo..."
   (la clase .open la alterna main.js)
   ------------------------------------------------------------ */
#chat-panel {
  display: none;
}
#chat-widget.open #chat-panel {
  display: flex;
  animation: modalIn 0.3s ease;
}

/* Burbujas de mensaje */
.chat-msg {
  max-width: 85%;
  padding: 0.6rem 0.9rem;
  border-radius: 0.9rem;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-msg-bot {
  align-self: flex-start;
  background: #27272a;
  color: #e4e4e7;
  border-bottom-left-radius: 0.25rem;
}
.chat-msg-user {
  align-self: flex-end;
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #d1fae5;
  border-bottom-right-radius: 0.25rem;
}

/* Indicador "escribiendo..." */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0.85rem 0.95rem;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: #71717a;
  animation: typingDot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-4px); opacity: 1; }
}
