/* ======================= */
/* Variables y Reset */
/* ======================= */
:root {
  --primary-color: #00d4ff;
  --secondary-color: #ff006e;
  --accent-color: #8b5cf6;
  --tertiary-color: #00ff88;
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.2);
  --text-color: #ffffff;
  --transition-speed: 0.3s;
  --transition-bezier: cubic-bezier(0.4, 0, 0.2, 1);
  --glow-color: rgba(0, 212, 255, 0.4);
  --shadow-light: 0 8px 32px rgba(0, 212, 255, 0.1);
  --shadow-heavy: 0 20px 60px rgba(0, 212, 255, 0.3);
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--bg-primary);
  color: var(--text-color);
  overflow-x: hidden;
  scroll-behavior: smooth;
}

html {
  scroll-behavior: smooth;
}

/* ======================= */
/* Header */
/* ======================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  transition: all var(--transition-speed) var(--transition-bezier);
}

header.header-scrolled {
  padding: 0.5rem 2rem;
  background: rgba(10, 10, 10, 0.95);
  box-shadow: var(--shadow-light);
}

header.header-hidden {
  transform: translateY(-100%);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all var(--transition-speed);
}

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

header nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

header nav a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  position: relative;
  padding: 0.5rem 1rem;
  border-radius: 25px;
  transition: all var(--transition-speed) var(--transition-bezier);
  overflow: hidden;
  cursor: pointer;
}

header nav a::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}

header nav a:hover::before {
  left: 100%;
}

header nav a:hover {
  color: var(--primary-color);
  background: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  transform: translateY(-2px);
}

header nav a.nav-active {
  color: var(--primary-color);
  background: rgba(0, 212, 255, 0.15);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  z-index: 1001;
}

.scroll-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color), var(--secondary-color));
  width: 0%;
  transition: width 0.1s ease;
}

/* Particles Canvas */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ======================= */
/* Hero Section */
/* ======================= */
.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 1;
  background: radial-gradient(circle at 30% 70%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255, 0, 110, 0.1) 0%, transparent 50%);
}

.hero-content {
  max-width: 800px;
  position: relative;
}

.profile-image {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.profile-image img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid transparent;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
  background-clip: padding-box;
  transition: all var(--transition-speed) var(--transition-bezier);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.profile-image::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent-color));
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.profile-image:hover::before {
  opacity: 0.7;
  animation: pulse-ring 2s infinite;
}

.profile-image:hover img {
  transform: scale(1.05);
  box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  margin: 1rem 0;
  background: linear-gradient(45deg, var(--primary-color), var(--text-color), var(--accent-color));
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 3s ease-in-out infinite;
}

.hero-subtitle {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
  font-weight: 500;
}

.hero-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  line-height: 1.6;
  opacity: 0.9;
}

.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.cta-primary,
.cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition-speed) var(--transition-bezier);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}

.cta-primary {
  background: linear-gradient(45deg, var(--primary-color), var(--tertiary-color));
  color: var(--bg-primary);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.cta-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(0, 212, 255, 0.4);
}

.cta-secondary {
  background: transparent;
  color: var(--text-color);
  border: 2px solid var(--secondary-color);
}

.cta-secondary:hover {
  background: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(255, 0, 110, 0.4);
}

/* ======================= */
/* Animations */
/* ======================= */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes pulse-ring {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ======================= */
/* Scroll Animations */
/* ======================= */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--transition-bezier);
  transition-delay: var(--animation-delay, 0s);
}

.animate-on-scroll.animate-in {
  opacity: 1;
  transform: translateY(0);
}

/* ======================= */
/* Sections */
section {
  padding: 5rem 2rem;
  position: relative;
}

section:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 3rem;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
  border-radius: 2px;
}

/* ======================= */
/* Grid & Flex Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

.about-grid,
.skills-grid,
.projects-grid {
  display: grid;
  gap: 2rem;
}

/* Distribución de tarjetas en grid */
.about-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.skills-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.projects-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ======================= */
/* Glass Cards */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(20px);
  transition: all var(--transition-speed) var(--transition-bezier);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s;
}

.glass-card:hover::before {
  left: 100%;
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

/* ======================= */
/* Skills & About */
.skill-category,
.about-card,
.skill-category,
.project-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(20px);
  transition: all var(--transition-speed) var(--transition-bezier);
  position: relative;
  overflow: hidden;
}

.about-card::before,
.skill-category::before,
.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s;
}

.about-card:hover::before,
.skill-category:hover::before,
.project-card:hover::before {
  left: 100%;
}

.about-card:hover,
.skill-category:hover,
.project-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

.about-icon {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  transition: all var(--transition-speed);
}

.about-card:hover .about-icon {
  transform: scale(1.2) rotate(5deg);
  color: var(--accent-color);
}

.skill-category h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.5rem;
  border-radius: 8px;
  transition: all var(--transition-speed);
}

.skill-item:hover {
  background: rgba(0, 212, 255, 0.1);
  transform: translateX(5px);
}

.skill-item i {
  color: var(--primary-color);
  font-size: 1.2rem;
}

/* ======================= */
/* Project Cards */
.project-image {
  width: 100%;
  height: 200px;
  border-radius: 0.8rem;
  overflow: hidden;
  margin-bottom: 1rem;
  position: relative;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all var(--transition-speed) var(--transition-bezier);
}

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

.project-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(0, 212, 255, 0.3), rgba(255, 0, 110, 0.3));
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.project-card:hover .project-image::after {
  opacity: 1;
}

.project-card h3 {
  color: var(--text-color);
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 600;
}

.project-card p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.project-buttons {
  display: flex;
  gap: 1rem;
  margin-top: auto;
}

.project-buttons a {
  padding: 0.6rem 1.2rem;
  border-radius: 25px;
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-speed) var(--transition-bezier);
  font-size: 0.9rem;
  cursor: pointer;
}

.project-buttons .cta-primary {
  background: var(--primary-color);
  color: var(--bg-primary);
}

.project-buttons .cta-primary:hover {
  background: var(--tertiary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 212, 255, 0.3);
}

.project-buttons .cta-secondary {
  background: transparent;
  color: var(--secondary-color);
  border: 2px solid var(--secondary-color);
}

.project-buttons .cta-secondary:hover {
  background: var(--secondary-color);
  color: var(--text-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 0, 110, 0.3);
}

/* ======================= */
/* Contact Section */
.contact-card {
  max-width: 600px;
  margin: 0 auto;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}

.contact-form button {
  width: 100%;
  padding: 0.8rem;
  border: none;
  border-radius: 0.5rem;
  background: var(--primary-color);
  color: #000;
  font-weight: bold;
  cursor: pointer;
  transition: background var(--transition-speed);
}

.contact-form button:hover {
  background: var(--secondary-color);
}

/* ======================= */
/* Footer */
.footer {
  text-align: center;
  padding: 2rem;
  background: var(--bg-secondary);
}

.footer .social-links a {
  margin: 0 0.5rem;
  color: var(--text-color);
  transition: color var(--transition-speed);
}

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

/* ======================= */
/* Advanced Responsive Design */
/* ======================= */

/* Large screens (1200px+) */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }

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

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

/* Medium screens (768px - 1199px) */
@media (max-width: 1199px) and (min-width: 768px) {
  header {
    padding: 1rem 1.5rem;
  }

  .hero {
    padding: 1.5rem;
  }

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

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

/* Small tablets (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
  header {
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }

  header nav {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .hero-description {
    font-size: 1rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
  }

  .projects-grid,
  .about-grid,
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  section {
    padding: 3rem 1.5rem;
  }

  .profile-image img {
    width: 150px;
    height: 150px;
  }
}

/* Mobile phones (max 575px) */
@media (max-width: 575px) {
  header {
    flex-direction: column;
    padding: 0.8rem 1rem;
    gap: 0.8rem;
  }

  header nav {
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
    font-size: 0.9rem;
  }

  header nav a {
    padding: 0.4rem 0.8rem;
  }

  .hero {
    min-height: 90vh;
    padding: 1rem;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }

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

  .hero-description {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .profile-image img {
    width: 120px;
    height: 120px;
  }

  .cta-buttons {
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
  }

  .cta-primary,
  .cta-secondary {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  section {
    padding: 2.5rem 1rem;
  }

  .section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
  }

  .projects-grid,
  .about-grid,
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }

  .about-card,
  .skill-category,
  .project-card {
    padding: 1.5rem;
    min-width: auto;
  }

  .project-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }

  .project-buttons a {
    width: 100%;
    text-align: center;
  }

  .about-icon {
    font-size: 2.5rem;
  }
}

/* Extra small screens (max 360px) */
@media (max-width: 360px) {
  .hero-title {
    font-size: 1.8rem;
  }

  .profile-image img {
    width: 100px;
    height: 100px;
  }

  .about-card,
  .skill-category,
  .project-card {
    padding: 1.2rem;
  }

  section {
    padding: 2rem 0.8rem;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: 100vh;
    padding: 1rem;
  }

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

  .profile-image img {
    width: 120px;
    height: 120px;
  }

  section {
    padding: 2rem 1rem;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .profile-image img {
    image-rendering: -webkit-optimize-contrast;
  }
}
