:root {
  --bg-color: #f8fafc;
  --text-main: #0f172a;
  --text-muted: #475569;
  --primary: #0061a5;
  --primary-glow: rgba(0, 97, 165, 0.15);
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
  --blob-1: #9fcaff;
  --blob-2: #e2e8f0;
}

[data-theme="dark"] {
  --bg-color: #0b1326;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #9fcaff;
  --primary-glow: rgba(159, 202, 255, 0.15);
  --surface: #1e293b;
  --surface-hover: #2a3b54;
  --border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(11, 19, 38, 0.85);
  --glass-border: rgba(255, 255, 255, 0.05);
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --blob-1: #003259;
  --blob-2: #1e293b;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  position: relative;
}

/* Language Switcher Logic */
html[lang="es"] .lang-en {
  display: none !important;
}

html[lang="en"] .lang-es {
  display: none !important;
}

/* Animated Background Blobs */
.bg-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  filter: blur(100px);
  border-radius: 50%;
  animation: float 20s infinite alternate ease-in-out;
  opacity: 0.6;
}

.blob-1 {
  background: var(--blob-1);
  width: 600px;
  height: 600px;
  top: -200px;
  left: -100px;
  animation-delay: 0s;
}

.blob-2 {
  background: var(--blob-2);
  width: 500px;
  height: 500px;
  bottom: -100px;
  right: -100px;
  animation-delay: -5s;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(100px, 50px) scale(1.1);
  }

  100% {
    transform: translate(-50px, 100px) scale(0.9);
  }
}

/* Typography */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(2rem, 4vw, 2.5rem);
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

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

section {
  padding: 6rem 0;
}

/* Navbar */
header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.3s ease;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 72px;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.nav-links a {
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
}

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

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s ease;
}

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

.icon-btn,
.lang-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background 0.3s ease, color 0.3s ease;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
}

.icon-btn:hover,
.lang-toggle:hover {
  background: var(--surface-hover);
  color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff !important;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

[data-theme="dark"] .btn-primary {
  color: #003259 !important;
}

/* Hero Section */
.hero {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
}

.hero .subtitle {
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: block;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-left: auto;
}

.social-links a {
  color: var(--text-muted);
  font-size: 2rem;
}

.social-links a:hover {
  color: var(--primary);
  transform: scale(1.1);
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
}

.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.bento-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top right, var(--primary-glow), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.bento-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: 0 20px 40px -15px var(--primary-glow);
}

.bento-card:hover::before {
  opacity: 1;
}

/* Experience List */
.exp-list {
  list-style: none;
  padding-left: 0;
}

.exp-item {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.exp-item::before {
  content: "•";
  color: var(--primary);
  font-weight: bold;
  font-size: 1.5rem;
  position: absolute;
  left: 0;
  top: -4px;
}

/* Specific Grid Items */
.col-span-4 {
  grid-column: span 4;
}

.col-span-5 {
  grid-column: span 5;
}

.col-span-7 {
  grid-column: span 7;
}

.col-span-6 {
  grid-column: span 6;
}

.col-span-8 {
  grid-column: span 8;
}

.col-span-12 {
  grid-column: span 12;
}

/* Tablet Breakpoint */
@media (max-width: 900px) {
  .col-span-4,
  .col-span-5,
  .col-span-7,
  .col-span-6,
  .col-span-8 {
    grid-column: span 12;
  }

  .hero .col-span-4 {
    order: -1;
    margin-bottom: 2rem;
  }

  /* Make nav scrollable horizontally on smaller screens instead of hiding */
  .nav-content {
    flex-wrap: wrap;
    height: auto;
    padding: 1rem 0;
    gap: 1rem;
  }
  
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    gap: 1.5rem;
    white-space: nowrap;
    /* Hide scrollbar for cleaner look */
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  .nav-links::-webkit-scrollbar {
    display: none;
  }

  h1 {
    font-size: 2.5rem;
  }

  .social-links {
    margin-left: 0;
    margin-top: 1rem;
    justify-content: center;
    width: 100%;
  }
  
  .bento-card {
    padding: 1.5rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
}

/* Mobile Breakpoint */
@media (max-width: 480px) {
  .container {
    padding: 0 1.25rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .bento-grid {
    gap: 1rem;
  }
  
  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }
  
  .nav-links {
    justify-content: flex-start;
  }
  
  main.container {
    padding-top: 160px !important;
  }
  
  .hero-actions {
    justify-content: center;
  }
}

/* Tech Grid Styles (Large Logos) */
.tech-card {
  text-align: center;
}

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

.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 2rem 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

.tech-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.2s ease;
}

.tech-item:hover {
  transform: translateY(-4px) scale(1.05);
}

.tech-item i {
  font-size: 4rem;
  /* BIG LOGOS */
}

.tech-item span {
  font-size: 0.875rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Projects */
.project-links {
  display: flex;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.project-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

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

/* Articles */
.article-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.article-meta {
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-card p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}

.article-card:hover .read-more {
  color: var(--primary);
  border-color: var(--primary);
}

.article-card:hover .read-more span {
  transform: translateX(4px);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
}

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

/* Scroll Progress */
.progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.1s ease;
}

/* Animations */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

/* Scroll Down Button */
.scroll-down {
  grid-column: span 12;
  justify-self: center;
  margin-top: 2rem;
  color: var(--text-muted);
  animation: bounceY 2s infinite;
  cursor: pointer;
  transition: color 2s ease;
  z-index: 10;
}

.scroll-down:hover {
  color: var(--primary);
}

@keyframes bounceY {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-15px);
  }

  60% {
    transform: translateY(-7px);
  }
}