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

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --bg-light: #ffffff;
  --bg-dark: #0a0a0a;
  --text-light: #1e293b;
  --text-dark: #f8fafc;
  --gray-light: #f1f5f9;
  --gray-dark: #1e293b;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  background: var(--bg-light);
  color: var(--text-light);
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark {
  background: var(--bg-dark);
  color: var(--text-dark);
}

p {
  text-wrap: pretty;
}

/* Animated Background */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: radial-gradient(
    ellipse 80% 80% at 50% -20%,
    #0ea5e926,
    rgba(255, 255, 255, 0)
  );
}

body.dark .bg-gradient {
  background: radial-gradient(125% 125% at 50% 10%, #000 40%, #06b5d450 100%);
}

/* Floating Header */
header {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: slideDown 0.6s ease-out;
  width: auto;
  max-width: calc(100vw - 2rem);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  border: 1px solid rgba(14, 165, 233, 0.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  flex-wrap: nowrap;
  white-space: nowrap;
}

body.dark nav {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

nav a {
  text-decoration: none;
  color: var(--text-light);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  white-space: nowrap;
}

body.dark nav a {
  color: var(--text-dark);
}

nav a:hover {
  color: var(--primary);
  background: rgba(14, 165, 233, 0.1);
}

nav a.active {
  color: var(--primary);
  background: rgba(14, 165, 233, 0.15);
}

body.dark nav a:hover,
body.dark nav a.active {
  color: var(--accent-light);
  background: rgba(6, 182, 212, 0.15);
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  margin-left: 0.5rem;
}

.theme-toggle:hover {
  background: rgba(14, 165, 233, 0.1);
  transform: rotate(180deg);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-light);
}

body.dark .theme-toggle svg {
  stroke: var(--text-dark);
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8rem 0 4rem;
}

.hero-content {
  max-width: 700px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(
    135deg,
    rgba(34, 211, 238, 0.2),
    rgba(14, 165, 233, 0.2)
  );
  border: 1px solid var(--accent);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--primary-dark);
  margin-bottom: 2rem;
  animation: pulse 2s ease-in-out infinite;
}

body.dark .badge {
  color: var(--accent-light);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
  }
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.dark h1 {
  background: linear-gradient(135deg, var(--text-dark), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.25rem;
  color: #64748b;
  margin-bottom: 2rem;
  line-height: 1.8;
}

body.dark .subtitle {
  color: #94a3b8;
}

.subtitle strong {
  color: var(--primary);
  font-weight: 600;
}

body.dark .subtitle strong {
  color: var(--accent-light);
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: #0096e1;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px var(--primary);
}

.btn-secondary {
  background: transparent;
  color: var(--text-light);
  border-color: #e2e8f0;
}

body.dark .btn-secondary {
  color: var(--text-dark);
  border-color: #334155;
}

.btn-secondary:hover {
  background: rgba(14, 165, 233, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
}

/* Section */
section {
  padding: 4rem 0;
  scroll-margin-top: 100px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 3rem;
}

.section-title svg {
  width: 32px;
  height: 32px;
  stroke: var(--primary);
}

body.dark .section-title svg {
  stroke: var(--accent-light);
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 3rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--primary), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid #e2e8f0;
}

body.dark .timeline-item {
  border-bottom-color: #334155;
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -3.5rem;
  top: 0.5rem;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  border: 3px solid var(--bg-light);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

body.dark .timeline-item::before {
  background: var(--accent-light);
  border-color: var(--bg-dark);
}

.timeline-header {
  margin-bottom: 1rem;
}

.timeline-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

body.dark .timeline-title {
  color: var(--accent-light);
}

.timeline-company {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

body.dark .timeline-company {
  color: var(--text-dark);
}

.timeline-date {
  font-size: 0.9rem;
  color: #64748b;
}

.timeline-description {
  color: #64748b;
  line-height: 1.8;
}

body.dark .timeline-description {
  color: #94a3b8;
}

/* Projects Grid */
.projects-grid {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.project-card {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  background: transparent;
  border-radius: 16px;
  overflow: visible;
  transition: all 0.5s ease;
  border: none;
}

body.dark .project-card {
  background: transparent;
  border: none;
}

.project-card:hover .project-image-container {
  transform: translateY(-8px);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.3);
}

body.dark .project-card:hover .project-image-container {
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.6);
}

.project-image-container {
  flex-shrink: 0;
  width: 50%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.15);
  transition: all 0.5s ease;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.dark .project-image-container {
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.4);
}

.project-image {
  width: 100%;
  height: 100%;
  min-height: 300px;
  object-fit: cover;
  display: block;
  transition: all 0.5s ease;
}

.project-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

.project-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-light);
}

body.dark .project-title {
  color: var(--text-dark);
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag {
  padding: 0.25rem 0.75rem;
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

body.dark .tag {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-light);
}

.project-description {
  color: #64748b;
  margin-bottom: 1.5rem;
  line-height: 1.7;
  font-size: 1rem;
}

body.dark .project-description {
  color: #94a3b8;
}

.project-links {
  display: flex;
  gap: 0.75rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--gray-light);
  color: var(--text-light);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

body.dark .project-link {
  background: #334155;
  color: var(--text-dark);
}

.project-link:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* About Section */
.about-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.about-text p {
  margin-bottom: 1rem;
  color: #64748b;
  line-height: 1.8;
}

body.dark .about-text p {
  color: #94a3b8;
}

.about-text strong {
  color: var(--text-light);
  font-weight: 600;
}

body.dark .about-text strong {
  color: var(--text-dark);
}

.about-image {
  position: relative;
  max-width: 350px;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: bottom;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--gray-light);
  border-radius: 50%;
  color: var(--text-light);
  text-decoration: none;
  transition: all 0.3s ease;
}

body.dark .social-link {
  background: #1e293b;
  color: var(--text-dark);
}

.social-link:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-3px);
}

/* Footer */

footer {
  margin-top: 1rem;
}

footer p {
  text-align: center;
  padding: 2rem 0;
  color: #64748b;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    top: 1rem;
    max-width: calc(100vw - 1.5rem);
  }

  nav {
    gap: 0.25rem;
    padding: 0.4rem 0.75rem;
  }

  nav a {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .theme-toggle {
    padding: 0.4rem;
    margin-left: 0.25rem;
  }

  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }

  h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

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

  .about-image {
    max-width: 250px;
    margin: 0 auto;
  }

  .projects-grid {
    gap: 3rem;
  }

  .project-card {
    flex-direction: column;
    gap: 1.5rem;
  }

  .project-image-container {
    width: 100%;
  }

  .project-image {
    min-height: 250px;
  }

  .project-title {
    font-size: 1.5rem;
  }

  .project-description {
    font-size: 0.95rem;
  }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
  header {
    top: 0.75rem;
    max-width: calc(100vw - 1rem);
  }

  nav {
    gap: 0.15rem;
    padding: 0.35rem 0.5rem;
  }

  nav a {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .theme-toggle {
    padding: 0.35rem;
    margin-left: 0.15rem;
  }

  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Icons */
.icon {
  width: 20px;
  height: 20px;
}
