/* ═══════════════════════════════════════════════════════════════════
   style.css — Estilos base del portafolio

   TAREA COMPLEMENTARIA:
   Estos estilos son funcionales pero intencionalmente simples.
   Tu reto es mejorar la interfaz. Algunas ideas:
     - Animaciones de entrada al hacer scroll
     - Transiciones y efectos hover más elaborados
     - Paleta de colores propia (modifica las variables de :root)
     - Modo claro / oscuro con prefers-color-scheme
     - Tipografía más expresiva
     - Versión responsive más detallada (tablet, desktop grande)
   ═══════════════════════════════════════════════════════════════════ */


/* ── Variables CSS ───────────────────────────────────────────────────
   Modifica estos valores para cambiar el tema completo del sitio.
   ─────────────────────────────────────────────────────────────── */
:root {
  /* Colores */
  --color-bg:           #0f172a;
  --color-surface:      #1e293b;
  --color-border:       #334155;
  --color-primary:      #6366f1;
  --color-primary-dark: #4f46e5;
  --color-text:         #e2e8f0;
  --color-text-muted:   #94a3b8;

  /* Tipografía */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Layout */
  --max-width:      1100px;
  --nav-height:     64px;
  --section-pad:    80px 24px;
  --radius:         8px;
}


/* ── Reset básico ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius);
}


/* ── Navegación ───────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--nav-height);
  background-color: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-mono);
  color: var(--color-primary);
  font-size: 1.05rem;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
}

/* Menú desplegable en móvil */
.nav-mobile {
  display: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px 24px;
  background-color: rgba(15, 23, 42, 0.97);
  border-top: 1px solid var(--color-border);
}

.nav-mobile.open {
  display: flex;
}

.nav-mobile a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.nav-mobile a:hover {
  color: var(--color-text);
}


/* ── Botones ──────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 11px 28px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}


/* ── Secciones ────────────────────────────────────────────────────── */
.section {
  padding: var(--section-pad);
  padding-top: 80px;
}

/* La primera sección necesita compensar la navbar fija */
#inicio {
  padding-top: 0;
}

.section-alt {
  background-color: var(--color-surface);
}

.section-title {
  text-align: center;
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 48px;
}

/* Línea decorativa bajo el título */
.section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background-color: var(--color-primary);
  margin: 10px auto 0;
  border-radius: 2px;
}


/* ── Hero ─────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.hero-content {
  max-width: 640px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  color: var(--color-primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--color-text-muted);
  margin-bottom: 20px;
  min-height: 2rem; /* evita salto de layout durante el tipeo */
}

.hero-subtitle span {
  color: var(--color-primary);
  font-weight: 500;
}

.hero-description {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}


/* ── Sobre mí ─────────────────────────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: start;
  max-width: 760px;
  margin: 0 auto;
}

.about-avatar {
  width: 180px;
  height: 180px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}

.about-bio p {
  color: var(--color-text-muted);
  margin-bottom: 14px;
  line-height: 1.8;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.skill-tag {
  padding: 5px 14px;
  border-radius: 4px;
  background-color: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.8rem;
  font-weight: 500;
}


/* ── Proyectos ────────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.project-card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--color-primary);
}

.project-icon {
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.project-title {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.project-description {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.7;
  flex: 1;
  margin-bottom: 16px;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tech-tag {
  padding: 3px 10px;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.project-links {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

.project-links a {
  color: var(--color-primary);
}

.project-links a:hover {
  text-decoration: underline;
}

.project-links a.secondary {
  color: var(--color-text-muted);
}


/* ── Formulario de contacto ───────────────────────────────────────── */
.contact-wrapper {
  max-width: 540px;
  margin: 0 auto;
}

.contact-description {
  text-align: center;
  color: var(--color-text-muted);
  margin-bottom: 36px;
}

#contact-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  outline: none;
}

.form-input::placeholder {
  color: #475569;
}

.form-input:focus {
  border-color: var(--color-primary);
}

.form-input.error {
  border-color: #f87171;
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

.field-error {
  display: none;
  font-size: 0.78rem;
  color: #f87171;
}

.field-error.visible {
  display: block;
}

.form-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}


/* ── Spinner de carga ─────────────────────────────────────────────── */
.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner.visible {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ── Alertas de resultado ─────────────────────────────────────────── */
.alert {
  display: none;
  margin-top: 20px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  text-align: center;
}

.alert.visible {
  display: block;
}

.alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}


/* ── Animación reveal al hacer scroll ────────────────────────────────
   JavaScript agrega .reveal a cada sección y luego .visible cuando
   entra al viewport (Intersection Observer en main.js).
   ─────────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  padding: 32px 24px;
  border-top: 1px solid var(--color-border);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.footer-name {
  color: var(--color-primary);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 10px;
}

.footer-links a:hover {
  color: var(--color-text);
}


/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: block;
  }

  .hero-title {
    font-size: 2.4rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .skills-list {
    justify-content: center;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

}
