:root {
  --bg: #0b0710;
  --bg-2: #120b18;
  --panel: rgba(22, 15, 30, 0.72);
  --panel-2: rgba(33, 23, 44, 0.84);
  --text: #f2fff6;
  --muted: #bcacc8;
  --accent: #ffffff;
  --accent-2: #ea62ff;
  --gold: #ffd166;
  --border: rgba(176, 112, 255, 0.18);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(153, 70, 255, 0.16), transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(133, 34, 238, 0.13), transparent 28%),
    linear-gradient(180deg, var(--bg), var(--bg-2) 48%, #08050a);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

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

img {
  max-width: 100%;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  z-index: 50;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.page-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(circle, rgba(144, 70, 255, 0.2), transparent 65%);
  filter: blur(12px);
  transform: translate(-50%, -50%);
}

.hero {
  min-height: 100vh;
  padding: 28px 8% 80px;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(45deg, rgba(184, 70, 255, 0.14) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(211, 34, 238, 0.1) 25%, transparent 25%);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.navbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(12, 7, 16, 0.72);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: .4px;
  color: var(--accent);
}

.logo-img {
  width: 30px;
  height: 30px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .92rem;
}

.nav-links a {
  padding: 9px 12px;
  border-radius: 12px;
  transition: .25s ease;
}

.nav-links a:hover {
  color: #0c0610;
  background: var(--accent);
  box-shadow: 0 0 30px rgba(153, 70, 255, 0.34);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: center;
  gap: 42px;
  min-height: calc(100vh - 120px);
}

.tag,
.section-tag {
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-size: .78rem;
  margin-bottom: 14px;
}

h1 {
  font-size: clamp(3rem, 7vw, 6.6rem);
  line-height: .96;
  letter-spacing: -4px;
  max-width: 960px;
}

.hero-text {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.12rem;
  margin: 26px 0 34px;
}

.hero-buttons,
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.btn,
.contact-links a {
  position: relative;
  overflow: hidden;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  font-weight: 900;
  transition: .25s ease;
  isolation: isolate;
}

.btn::before,
.contact-links a::before,
.project-card::before,
.skill-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: .25s ease;
  z-index: -1;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,.28), transparent);
  transform: translateX(-100%);
}

.btn:hover::before,
.contact-links a:hover::before,
.project-card:hover::before,
.skill-card:hover::before {
  opacity: 1;
  transform: translateX(100%);
}

.primary {
  background: linear-gradient(135deg, var(--accent), #ea62ff);
  color: #0d0610;
  border-color: transparent;
  box-shadow: 0 14px 42px rgba(175, 70, 255, 0.25);
}

.secondary,
.contact-links a {
  background: rgba(255,255,255,.045);
}

.btn:hover,
.contact-links a:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(203, 70, 255, 0.55);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 42px;
  max-width: 690px;
}

.stats div {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(10px);
}

.stats strong {
  display: block;
  color: var(--accent-2);
  font-size: 1.45rem;
}

.stats span {
  color: var(--muted);
  font-size: .86rem;
}

.hero-card {
  position: relative;
  min-height: 410px;
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(212, 70, 255, 0.26);
  background: linear-gradient(180deg, rgba(30, 18, 37, 0.88), rgba(16, 9, 20, 0.72));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto -40px -80px -40px;
  height: 190px;
  background: radial-gradient(circle, rgba(238, 34, 214, 0.22), transparent 70%);
}

.hero-card h2 {
  font-size: 2rem;
}

.hero-card p {
  color: var(--muted);
  margin: 8px 0 24px;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.mini-grid span {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 800;
  text-align: center;
}

.section {
  padding: 96px 8%;
  border-top: 1px solid rgba(255,255,255,.07);
  position: relative;
}

.section h2 {
  font-size: clamp(2.1rem, 4vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 28px;
}

.about {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 50px;
  align-items: start;
}

.about p:last-child,
.contact p,
.heading-note,
.section-intro {
  color: var(--muted);
  font-size: 1.05rem;
}

.section-intro {
  max-width: 900px;
  margin-bottom: 26px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}

.skills-grid,
.projects-grid,
.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.skill-card,
.project-card,
.timeline div {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: 0 12px 50px rgba(0,0,0,.18);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.skill-card {
  padding: 24px;
  min-height: 210px;
}

.skill-card:hover,
.project-card:hover,
.timeline div:hover {
  transform: translateY(-8px);
  border-color: rgba(163, 70, 255, 0.58);
  box-shadow: 0 22px 70px rgba(212, 70, 255, 0.1);
}

.skill-card span {
  color: var(--accent-2);
  font-weight: 900;
}

.skill-card h3,
.project-card h3,
.timeline h3 {
  font-size: 1.18rem;
  margin: 12px 0 8px;
}

.skill-card p,
.project-card p,
.timeline p {
  color: var(--muted);
}

.project-card {
  min-height: 260px;
  padding: 24px;
  cursor: pointer;
}

.portada {
  width: 100%;
  max-width: 220px;
  height: 130px;
  display: block;
  margin: 0 auto 18px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.04);
}

.project-card span {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-size: .84rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.timeline div {
  padding: 28px;
}

.timeline span {
  width: 18px;
  height: 18px;
  display: inline-block;
  border-radius: 4px;
  margin-bottom: 20px;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(184, 70, 255, 0.55);
  transform: rotate(45deg);
}

.contact {
  text-align: center;
}

.contact p {
  max-width: 720px;
  margin: 0 auto 28px;
}

.contact-links {
  justify-content: center;
}

footer {
  padding: 32px 8%;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid rgba(255,255,255,.07);
}

/* IMPORTANTE:
   Por defecto todo queda visible.
   Solo se oculta para animación cuando JavaScript funciona.
   Así GitHub Pages no deja los proyectos invisibles si script.js falla.
*/
.reveal {
  opacity: 1;
  visibility: visible;
  transform: none;
}

body.js-enabled .reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity .75s ease, transform .75s ease;
}

body.js-enabled .reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.tilt-card {
  transform-style: preserve-3d;
}

@media (max-width: 920px) {
  .hero-content,
  .about {
    grid-template-columns: 1fr;
  }

  .hero-content {
    padding-top: 70px;
  }

  .hero-card {
    max-width: 520px;
  }
}

@media (max-width: 680px) {
  .navbar {
    align-items: flex-start;
    flex-direction: column;
    top: 8px;
  }

  h1 {
    letter-spacing: -2px;
  }

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

  .section-heading {
    display: block;
  }
}

@media (max-width: 768px) {
  .logo-img {
    width: 20px;
    height: 20px;
  }

  body {
    overflow-x: hidden;
  }

  .hero {
    padding: 20px;
    min-height: auto;
  }

  .navbar {
    position: relative;
    top: 0;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 18px;
  }

  .logo {
    font-size: 1.5rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
  }

  .hero-content {
    display: flex;
    flex-direction: column-reverse;
    gap: 40px;
    min-height: auto;
    text-align: center;
    padding-top: 40px;
  }

  .hero-left {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  h1 {
    font-size: 2.8rem;
    line-height: 1.05;
    letter-spacing: -1px;
  }

  .hero-text {
    font-size: 1rem;
    max-width: 100%;
  }

  .hero-buttons {
    justify-content: center;
    width: 100%;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  .hero-card {
    width: 100%;
    max-width: 380px;
    min-height: auto;
    margin: auto;
  }

  .stats {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .about {
    display: flex;
    flex-direction: column;
    gap: 30px;
    text-align: center;
  }

  .section {
    padding: 70px 20px;
  }

  .section h2 {
    font-size: 2rem;
    text-align: center;
  }

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

  .project-card {
    width: 100%;
    min-height: auto;
  }

  .portada {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 14px;
  }

  .contact-links {
    flex-direction: column;
    align-items: center;
  }

  .contact-links a {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }
}