/* ============================================
   Portfolio Website - Design System
   Johann Primera - Full Stack Developer & Graphic Designer
   ============================================ */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
  /* Colors - Dark Theme */
  --color-bg-primary: #0a0a0f;
  --color-bg-secondary: #13131a;
  --color-bg-elevated: rgba(26, 26, 35, 0.85);
  --color-bg-overlay: rgba(10, 10, 15, 0.7);

  /* Gradient */
  --gradient-primary: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
  --gradient-secondary: linear-gradient(135deg, #EC4899 0%, #8B5CF6 100%);
  --gradient-accent: linear-gradient(90deg, #8B5CF6, #3B82F6, #8B5CF6);

  /* Text Colors */
  --color-text-primary: #ffffff;
  --color-text-secondary: #a0a0b8;
  --color-text-muted: #6b6b80;

  /* Accent Colors */
  --color-accent-purple: #8B5CF6;
  --color-accent-blue: #3B82F6;
  --color-accent-pink: #EC4899;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-code: 'Fira Code', 'Courier New', monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --font-size-4xl: 2.5rem;
  --font-size-5xl: 3.5rem;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.3);

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Z-index */
  --z-navbar: 1000;
  --z-modal: 2000;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: transparent;
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Background Image - Visible en toda la página */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('images/3.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 1;
  z-index: -2;
  filter: none;
}

/* Overlay sutil solo para mejorar legibilidad del texto */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 15, 0.3);
  z-index: -1;
  pointer-events: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: var(--color-text-primary);
}

h1 {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--font-size-3xl);
}

h4 {
  font-size: var(--font-size-2xl);
}

p {
  margin-bottom: var(--space-md);
  color: var(--color-text-secondary);
}

a {
  color: var(--color-accent-blue);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-purple);
}

code {
  font-family: var(--font-code);
  background: rgba(19, 19, 26, 0.6);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.9em;
  backdrop-filter: blur(5px);
}

/* ============================================
   Utility Classes
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.section {
  padding: var(--space-3xl) 0;
  position: relative;
  z-index: 2;
  background: transparent;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-navbar);
  padding: var(--space-md) 0;
  transition: background-color var(--transition-base), backdrop-filter var(--transition-base);
}

.navbar.scrolled {
  background: rgba(10, 10, 15, 0.6);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: var(--font-size-xl);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: var(--space-xl);
}

.navbar-nav a {
  color: var(--color-text-secondary);
  font-weight: 500;
  position: relative;
  transition: color var(--transition-fast);
}

.navbar-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--transition-base);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--color-text-primary);
}

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

.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font-size: var(--font-size-2xl);
  cursor: pointer;
  z-index: calc(var(--z-navbar) + 1);
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: visible;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
  animation: float 8s ease-in-out infinite;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
  animation: float 10s ease-in-out infinite reverse;
  z-index: 0;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, 30px);
  }
}

.hero-wrapper {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-2xl);
  align-items: center;
  width: 100%;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
}

.hero-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-accent-purple);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin-bottom: var(--space-lg);
  line-height: 1.2;
  max-width: 100%;
}

.hero-description {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  max-width: 100%;
  margin-bottom: var(--space-xl);
  line-height: 1.6;
}

.hero-3d-object {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
}

.object-3d {
  width: 100%;
  max-width: 400px;
  height: auto;
  filter: drop-shadow(0 0 40px rgba(139, 92, 246, 0.4)) 
          drop-shadow(0 0 80px rgba(59, 130, 246, 0.3));
  animation: float3D 6s ease-in-out infinite;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform var(--transition-slow);
  position: relative;
  z-index: 1;
}

.object-3d:hover {
  animation: float3D 3s ease-in-out infinite, rotate3D 15s linear infinite;
  filter: drop-shadow(0 0 60px rgba(139, 92, 246, 0.6)) 
          drop-shadow(0 0 100px rgba(59, 130, 246, 0.5));
}

@keyframes float3D {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-15px) rotate(2deg) scale(1.02);
  }
  50% {
    transform: translateY(-25px) rotate(0deg) scale(1.05);
  }
  75% {
    transform: translateY(-15px) rotate(-2deg) scale(1.02);
  }
}

@keyframes rotate3D {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(0) rotate(360deg);
  }
}

/* Efecto de brillo pulsante en el objeto 3D */
.hero-3d-object::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150%;
  height: 150%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(60px);
  animation: pulseGlow 3s ease-in-out infinite;
  z-index: -1;
  pointer-events: none;
}

@keyframes pulseGlow {
  0%,
  100% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1);
  }
}


/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
  background: rgba(26, 26, 35, 0.7);
  color: var(--color-text-primary);
  border: 2px solid rgba(139, 92, 246, 0.4);
  backdrop-filter: blur(15px);
}

.btn-secondary:hover {
  border-color: var(--color-accent-purple);
  background: rgba(139, 92, 246, 0.15);
  transform: translateY(-2px);
}

/* ============================================
   About Section
   ============================================ */
.about {
  background: transparent;
  position: relative;
  z-index: 2;
}

.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: center;
}

.about-text {
  font-size: var(--font-size-lg);
  line-height: 1.8;
}

.about-text p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-lg);
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.stat-card {
  background: rgba(26, 26, 35, 0.7);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: blur(15px);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-accent-purple);
  box-shadow: var(--shadow-glow);
}

.stat-number {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* ============================================
   Projects Section
   ============================================ */
.section-header {
  text-align: center;
  margin-bottom: var(--space-3xl);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-accent-purple);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2xl);
}

.project-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  position: relative;
  aspect-ratio: 16 / 10;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.project-card-reverse {
  grid-column: 2;
}

.project-image {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
}

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

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

.project-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 15, 0) 0%,
    rgba(10, 10, 15, 0.7) 70%,
    rgba(10, 10, 15, 0.95) 100%
  );
  display: flex;
  align-items: flex-end;
  padding: var(--space-xl);
  opacity: 0;
  transition: opacity var(--transition-base);
}

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

.project-info {
  width: 100%;
}

.project-title {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-xs);
  color: var(--color-text-primary);
  font-weight: 700;
}

.project-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.project-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}

.tag {
  padding: 0.25rem var(--space-sm);
  background: rgba(139, 92, 246, 0.2);
  color: var(--color-accent-purple);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
  border: 1px solid rgba(139, 92, 246, 0.3);
  backdrop-filter: blur(10px);
}

.project-links {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: var(--font-size-sm);
  padding: var(--space-xs) var(--space-md);
  background: rgba(139, 92, 246, 0.2);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(10px);
  transition: all var(--transition-fast);
}

.project-link:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--color-accent-purple);
  transform: translateY(-2px);
}

/* ============================================
   Contact Section
   ============================================ */
.contact {
  background: transparent;
  text-align: center;
  position: relative;
}

.contact-content {
  max-width: 800px;
  margin: 0 auto;
}

.contact-title {
  margin-bottom: var(--space-lg);
}

.contact-description {
  font-size: var(--font-size-xl);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.7;
}

.contact-cta {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  background: rgba(10, 10, 15, 0.4);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  padding: var(--space-xl) 0;
  position: relative;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-text {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  margin: 0;
}

.social-links {
  display: flex;
  gap: var(--space-lg);
}

.social-link {
  color: var(--color-text-secondary);
  font-size: var(--font-size-xl);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-link:hover {
  color: var(--color-accent-purple);
  transform: translateY(-2px);
}

.social-link svg {
  width: 24px;
  height: 24px;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 968px) {
  .hero-wrapper {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
    text-align: center;
  }

  .hero-content {
    max-width: 100%;
  }

  .hero-3d-object {
    order: -1;
    max-width: 350px;
    margin: 0 auto;
    min-height: 300px;
  }

  .object-3d {
    max-width: 100%;
  }

  .about-content {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .project-card-reverse {
    grid-column: 1;
  }

  .project-overlay {
    opacity: 1;
  }

  .navbar-nav {
    position: fixed;
    top: 70px;
    left: -100%;
    flex-direction: column;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    width: 100%;
    padding: var(--space-xl);
    gap: var(--space-lg);
    transition: left var(--transition-base);
    box-shadow: var(--shadow-lg);
    border-top: 1px solid rgba(139, 92, 246, 0.2);
  }

  .navbar-nav.active {
    left: 0;
  }

  .navbar-toggle {
    display: block;
  }

  h1 {
    font-size: var(--font-size-4xl);
  }

  h2 {
    font-size: var(--font-size-3xl);
  }

  body::before {
    background-attachment: fixed;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-md);
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .project-card {
    aspect-ratio: 16 / 9;
  }

  .hero-cta {
    flex-direction: column;
  }

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

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

  .contact-cta {
    flex-direction: column;
  }

  .contact-cta .btn {
    width: 100%;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-wrapper {
    gap: var(--space-lg);
  }

  .hero-3d-object {
    max-width: 250px;
    min-height: 250px;
  }

  .object-3d {
    max-width: 100%;
    animation: float3D 6s ease-in-out infinite;
  }
}

/* ============================================
   Performance Optimizations
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
