:root {
  --bg: #111827;      /* fondo principal oscuro medio */
  --bg-alt: #020617;  /* secciones alternas más oscuras */
  --surface: #1f2937; /* tarjetas */
  --surface-soft: #111827;
  --accent: #4f46e5;  /* acento violeta/azulado */
  --accent-soft: rgba(79, 70, 229, 0.15);
  --text: #e5e7eb;
  --text-soft: #9ca3af;
  --border-subtle: #1f2937;
  --error: #f97373;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.45);
  --max-width: 1120px;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #111827, #020617 60%);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout base */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

.section-alt {
  background: radial-gradient(circle at top left, #020617, #020617 40%, #030712);
}

/* Topbar / nav */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 40%;
  background: radial-gradient(circle at 30% 0%, #6366f1, #4f46e5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: white;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
}

.logo-text {
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.98rem;
  color: #e5e7eb;
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav a {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text-soft);
  padding: 0.25rem 0;
  position: relative;
  transition: color 0.2s ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #ec4899);
  transition: width 0.2s ease;
}

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

.nav a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

/* Estilos para la imagen de perfil redondeada en el hero */
.hero-profile-img {
  width: 150px;             /* Ajusta el tamaño horizontal a tu gusto */
  height: 150px;            /* Debe ser igual al width para que sea un círculo perfecto */
  object-fit: cover;        /* Asegura que la imagen no se estire si no es cuadrada */
  border-radius: 50%;       /* Este es el truco para que sea redonda */
  
  /* Estilos opcionales para un acabado más profesional */
  border: 4px solid #fff;     /* Un borde blanco sutil */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Una sombra muy suave */
  
  margin-bottom: 1.5rem;    /* Espacio entre la imagen y el texto siguiente */
  display: block;           /* Asegura que ocupe su propia línea si es necesario */
}

/* Ajuste opcional para móviles: centrar la imagen si el texto está centrado */
@media (max-width: 768px) {
  .hero-profile-img {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Hero */
.hero {
  padding: 4.5rem 0 4rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2.4fr);
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 1rem;
}

.accent {
  color: #a5b4fc;
}

.hero-subtitle {
  color: var(--text-soft);
  max-width: 32rem;
  font-size: 0.98rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin: 1.8rem 0 1.3rem;
}

.hero-meta {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* Hero card */
.hero-card {
  background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.14), rgba(15, 23, 42, 0.95));
  border-radius: 24px;
  padding: 1.8rem 1.7rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.3);
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: -60%;
  background: radial-gradient(circle at top, rgba(129, 140, 248, 0.13), transparent 60%);
  opacity: 0.7;
  pointer-events: none;
}

.hero-card > * {
  position: relative;
  z-index: 1;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a5b4fc;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(129, 140, 248, 0.5);
  margin-bottom: 1rem;
}

.hero-card h2 {
  font-size: 1.3rem;
  margin: 0 0 0.6rem;
}

.hero-card p {
  margin: 0 0 0.9rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.hero-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem;
  font-size: 0.9rem;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 0.55rem 1.3rem;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background-image: linear-gradient(120deg, #6366f1, #4f46e5);
  color: white;
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.35);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 40px rgba(79, 70, 229, 0.45);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.4);
}

.btn.ghost:hover {
  background: rgba(15, 23, 42, 0.85);
}

.btn.full {
  width: 100%;
}

/* Secciones genéricas */
.section-header {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.6rem;
  margin: 0 0 0.6rem;
}

.section-header p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* Proyectos */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: linear-gradient(145deg, var(--surface), var(--surface-soft));
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.3rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.65);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.18), transparent 60%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.project-card:hover::before {
  opacity: 1;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.project-tag {
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.project-year {
  opacity: 0.7;
}

.project-card h3 {
  margin: 0.3rem 0;
  font-size: 1.1rem;
}

.project-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.project-meta {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0.6rem;
  display: grid;
  gap: 0.2rem;
  font-size: 0.86rem;
  color: var(--text-soft);
}

.project-link {
  margin-top: auto;
  font-size: 0.86rem;
  color: #a5b4fc;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-link::after {
  content: "↗";
  font-size: 0.8rem;
}

/* CV */
.cv-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr);
  gap: 2.3rem;
}

.timeline {
  display: grid;
  gap: 1.3rem;
  border-left: 1px solid rgba(148, 163, 184, 0.35);
  padding-left: 1.1rem;
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.6rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.4);
}

.timeline-item h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.timeline-meta {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  color: var(--text-soft);
}

.timeline-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

.cv-side {
  display: grid;
  gap: 1.1rem;
}

.cv-block {
  background: rgba(15, 23, 42, 0.9);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 1rem 1.1rem;
}

.cv-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.82rem;
}

.tag-list li {
  padding: 0.22rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
}

/* Contacto */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr);
  gap: 2.2rem;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0.7rem;
  font-size: 0.9rem;
}

.contact-label {
  display: inline-block;
  width: 4.3rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-soft);
}

.contact-list a {
  color: #a5b4fc;
  text-decoration: none;
}

.contact-form {
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 1.4rem 1.3rem;
  box-shadow: var(--shadow-soft);
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-soft);
}

.field input,
.field textarea {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  padding: 0.55rem 0.7rem;
  background: rgba(15, 23, 42, 0.95);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

.field input:focus,
.field textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.7);
  background: #020617;
}

/* Footer */
.footer {
  padding: 1.8rem 0 2.2rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: #020617;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.footer-note {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-card {
    order: -1;
  }

  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cv-grid,
  .contact-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    padding-inline: 1rem;
  }

  .nav {
    position: absolute;
    inset-inline: 1rem;
    top: 3.1rem;
    background: rgba(15, 23, 42, 0.98);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    flex-direction: column;
    padding: 0.7rem 0.9rem;
    gap: 0.5rem;
    transform-origin: top;
    transform: scaleY(0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .nav-open {
    opacity: 1;
    pointer-events: auto;
    transform: scaleY(1);
  }

  .nav-toggle {
    display: block;
  }

  .hero {
    padding-top: 3.2rem;
  }

  .hero h1 {
    font-size: 2.1rem;
  }

  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .container {
    padding-inline: 1.1rem;
  }

  .section {
    padding: 3.2rem 0;
  }

  .hero-card {
    padding: 1.5rem 1.3rem;
  }

  .contact-form {
    padding: 1.2rem 1.1rem;
  }
}
