/* ===================== VARIABLES ===================== */
:root {
  --bg-color: #0d1117;
  --card-bg: rgba(255, 255, 255, 0.05);
  --accent: #00d4ff;
  --accent-soft: rgba(0, 212, 255, 0.12);
  --text-color: #fff;
  --muted: #aaa;
  --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --font-display: 'Space Grotesk', var(--font-main);
  --border-radius: 16px;
  --shadow: 0 2px 16px 0 #00d4ff22;
  --header-h: 70px;
}

/* ===================== RESET Y BASE ===================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  font-family: var(--font-main);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0, 212, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(0, 212, 255, 0.06), transparent 60%),
    var(--bg-color);
  background-attachment: fixed;
  color: var(--text-color);
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: 0.2px;
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--accent);
  color: var(--bg-color);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: #243447;
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ===================== ACCESIBILIDAD ===================== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--accent);
  color: var(--bg-color);
  padding: 10px 16px;
  border-radius: 0 0 10px 0;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
}

/* ===================== HEADER ===================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 50px;
  height: var(--header-h);
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(10px);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.logo a {
  font-size: 1.4rem;
  text-decoration: none;
  color: var(--text-color);
  font-weight: bold;
  font-family: var(--font-display);
}

.logo span {
  color: var(--accent);
}
.logo span[aria-hidden="true"] {
  color: #fff;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 24px;
}

.nav-links li a {
  position: relative;
  text-decoration: none;
  color: var(--text-color);
  padding: 6px 2px;
  transition: color 0.3s;
}

.nav-links li a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.nav-links li a:hover,
.nav-links li a.active {
  color: var(--accent);
}

.nav-links li a.active::after {
  transform: scaleX(1);
}

.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  background: none;
  border: none;
  padding: 8px;
}

.hamburger span {
  height: 3px;
  width: 25px;
  background: var(--text-color);
  margin: 3px 0;
  border-radius: 5px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* ===================== HERO ===================== */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(var(--header-h) + 40px) 0 60px 0;
  gap: 40px;
  min-height: 100vh;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

.hero-content {
  max-width: 600px;
  animation: fadeInUp 1s ease-out;
}

.hero-content h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.hero-content h1 span {
  color: var(--accent);
}

.hero-content h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--muted);
  font-family: var(--font-main);
  font-weight: 400;
}

.hero-content p {
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.btn {
  background: var(--accent);
  color: var(--bg-color);
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  transition: transform 0.2s;
}

.btn:hover {
  transform: scale(1.05);
}

.hero-social-links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.hero-social-links a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 14px;
  transition: background 0.2s ease, transform 0.18s ease, border-color 0.2s ease;
}

.hero-social-links a:hover,
.hero-social-links a:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-3px);
}

.hero-social-links a .contact-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  transition: transform 0.18s ease;
}

.hero-social-links a:hover .contact-icon {
  transform: scale(1.12);
}

.hero-img {
  position: relative;
  width: 320px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.45s ease;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid var(--accent);
  box-shadow: 0 0 20px var(--accent);
  object-fit: cover;
  opacity: 0;
  transform: scale(0.96) translateY(4px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  will-change: opacity, transform;
}

.hero-img .hero-photo--real {
  opacity: 1 !important;
  transform: scale(1) translateY(0) !important;
  z-index: 2 !important;
}

.hero-img .hero-photo--avatar {
  opacity: 0 !important;
  transform: none !important;
  z-index: 1 !important;
}

.hero-img.show-avatar {
  transform: rotate(-2deg) scale(1.02);
}

.hero-img.show-avatar .hero-photo--real {
  opacity: 0 !important;
  transform: scale(1.05) translateY(-6px) !important;
}

.hero-img.show-avatar .hero-photo--avatar {
  opacity: 1 !important;
  transform: scale(1) translateY(0) !important;
  z-index: 3 !important;
}

/* ===================== SECCIONES GENÉRICAS ===================== */
section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 100px 0 60px 0;
}

section h2 {
  text-align: center;
  margin-bottom: 50px;
  font-size: 2rem;
}

/* ===================== PROYECTOS ===================== */
.projects {
  text-align: center;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  justify-items: center;
  align-items: stretch;
}

.project-card {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  width: 100%;
  max-width: 300px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.project-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.project-link:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.project-img-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3/2;
  min-height: 150px;
  max-width: 300px;
  max-height: 200px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border: 1px solid var(--accent);
  overflow: hidden;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.project-card:hover .project-img {
  transform: scale(1.05);
}

.project-tech {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 10px 0 0 0;
}
.tech-icon {
  display: inline-flex;
  align-items: center;
  height: 24px;
  width: 24px;
}
.tech-icon img {
  height: 24px;
  width: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 2px #00d4ff44);
}

/* ===================== VIDEOS ===================== */
.videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.video-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
}

.video-card:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.video-card iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  border: none;
  display: block;
}

.video-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
}

/* ===================== PUBLICACIONES ===================== */
.publications {
  text-align: center;
}

.publications-list {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.publication-item {
  display: block;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid rgba(0, 212, 255, 0.2);
  transition: border-color 0.3s ease, background 0.3s ease, transform 0.3s ease;
}

.publication-item:hover,
.publication-item:focus-visible {
  border-color: var(--accent);
  background: rgba(0, 212, 255, 0.05);
  transform: translateY(-2px);
}

.publication-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.publication-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.publication-content h3 {
  font-size: 1.2rem;
  color: var(--accent);
  line-height: 1.4;
  margin-bottom: 6px;
}

.publication-meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.publication-abstract {
  font-size: 0.95rem;
  color: #ddd;
  line-height: 1.6;
  margin-top: 8px;
  text-align: justify;
}

.publication-keywords {
  font-size: 0.85rem;
  color: #a0d4ff;
  line-height: 1.5;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 212, 255, 0.1);
}

/* ===================== FOOTER ===================== */
footer {
  text-align: center;
  padding: 24px 20px;
  background: linear-gradient(135deg, #0d1117 0%, #0a1929 50%, #1a3a52 100%);
  border-top: 1px solid rgba(0, 212, 255, 0.1);
}

footer p {
  color: #ddd;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
}

.footer-privacy {
  margin-top: 8px;
}

.footer-privacy a {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-privacy a:hover,
.footer-privacy a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

/* ===================== VOLVER ARRIBA ===================== */
.go-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-color);
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 212, 255, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.go-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* ===================== REVEAL ON SCROLL ===================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===================== ANIMACIONES ===================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-img {
    transition: none;
  }
  .hero-photo {
    transition: none;
    transform: none !important;
  }
  .hero-img.show-avatar {
    transform: none;
  }
  .hero-img.show-avatar .hero-photo--real,
  .hero-img.show-avatar .hero-photo--avatar,
  .hero-photo--real {
    transform: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  section {
    padding: 80px 20px 48px 20px;
  }
  .project-grid,
  .videos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hero {
    flex-direction: column;
    padding: calc(var(--header-h) + 20px) 20px 40px 20px;
    gap: 30px;
    min-height: unset;
  }
  .hero-img {
    order: -1;
    margin: 0 auto 20px;
    width: 100%;
    max-width: 240px;
  }
  .hero-content {
    max-width: 100%;
    text-align: center;
  }
}

@media (max-width: 600px) {
  header {
    padding: 0 20px;
  }

  .nav-links {
    flex-direction: column;
    gap: 8px;
    background: rgba(13, 17, 23, 0.96);
    backdrop-filter: blur(10px);
    position: absolute;
    top: var(--header-h);
    right: 0;
    width: 220px;
    padding: 20px;
    border-radius: 0 0 0 12px;
    border-left: 1px solid rgba(0, 212, 255, 0.15);
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    display: none;
  }
  .nav-links.active {
    display: flex;
  }
  .hamburger {
    display: flex;
  }

  .project-grid,
  .videos-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: calc(var(--header-h) + 10px) 20px 30px 20px;
    gap: 20px;
  }
  .hero-img {
    margin: 0 auto 16px;
    max-width: 180px;
  }
  .hero-content h1 {
    font-size: 1.8rem;
  }
  .hero-content p {
    font-size: 1rem;
  }

  .publication-content {
    text-align: center;
  }
  .publication-content h3 {
    font-size: 1rem;
    margin-bottom: 8px;
  }
}
