:root {
  --bg: #0a0e1a;
  --bg-soft: #10162a;
  --card-bg: #131a30;
  --border: #232b45;
  --text-main: #e8ecf7;
  --text-muted: #93a0c2;
  --accent: #6366f1;
  --accent-2: #ec4899;
  --accent-3: #22d3ee;
  --gradient: linear-gradient(120deg, var(--accent) 0%, var(--accent-2) 100%);
  --mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

a {
  color: inherit;
}

/* BACKGROUND GLOW */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px circle at 15% 10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(500px circle at 85% 25%, rgba(236, 72, 153, 0.14), transparent 60%),
    radial-gradient(500px circle at 50% 90%, rgba(34, 211, 238, 0.10), transparent 60%);
}

/* NAVBAR */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 26, 0.75);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--text-main);
}

.logo span {
  color: var(--accent-2);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 4px;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: width 0.25s ease;
}

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

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* HEADER / HERO */
header {
  padding: 7rem 0 5rem;
}

.eyebrow {
  font-family: var(--mono);
  color: var(--accent-3);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.header-info h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  font-family: var(--mono);
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
  min-height: 1.5em;
}

.tagline::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-3);
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.contact-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact-bar a {
  text-decoration: none;
  transition: color 0.25s ease;
}

.contact-bar a:hover {
  color: var(--accent-3);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.btn-outline,
.btn-solid {
  border-radius: 8px;
  padding: 10px 18px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.25s ease;
  display: inline-block;
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.btn-outline:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

.btn-solid {
  background: var(--gradient);
  color: white;
  border: none;
}

.btn-solid:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

/* SECCIONES GENERALES */
section {
  margin-bottom: 6rem;
  scroll-margin-top: 5rem;
}

h2 {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 2rem;
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}

.section-index {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--accent-2);
  font-weight: 500;
}

/* REVEAL ANIMATION */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ABOUT */
.about-text {
  color: var(--text-muted);
  max-width: 70ch;
  font-size: 1.05rem;
}

/* SKILLS */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.skill-category {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.skill-category:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.skill-category h3 {
  font-size: 1rem;
  color: var(--accent-3);
  margin-bottom: 0.5rem;
}

.skill-category p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* PROJECTS GRID */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.75rem;
}

.project-card {
  background: var(--card-bg);
  padding: 1.75rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  padding: 1px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

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

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.project-type {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-3);
}

.badge-status {
  background: rgba(236, 72, 153, 0.15);
  color: #f9a8d4;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
}

.project-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.project-desc {
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  font-size: 0.92rem;
}

.project-details {
  list-style: none;
  margin-bottom: 1.4rem;
  flex-grow: 1;
}

.project-details li {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-left: 16px;
  position: relative;
}

.project-details li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-2);
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1.2rem;
}

.tech-tag {
  font-family: var(--mono);
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
}

.card-link {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent-3);
  align-self: flex-start;
  transition: transform 0.2s ease;
}

.card-link:hover {
  transform: translateX(3px);
}

/* EDUCATION */
.edu-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
}

.edu-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.edu-header span {
  font-family: var(--mono);
  color: var(--accent-3);
  font-size: 0.85rem;
}

.edu-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.edu-card p strong {
  color: var(--text-main);
}

/* CONTACT */
.contact-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem;
  text-align: left;
}

.contact-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 60ch;
}

/* FOOTER */
footer {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* BACK TO TOP */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
  z-index: 90;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent-3);
}

/* RESPONSIVE */
@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(10, 14, 26, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    gap: 1.25rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
  }

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

  header {
    padding: 4.5rem 0 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
