:root {
  --font-main: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-alt: "Space Grotesk", system-ui, sans-serif;

  /* Colores Base (Default / Hybrid) */
  --bg: #0b1120;
  --bg-soft: #1e293b;
  --fg: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --border: rgba(148, 163, 184, 0.2);
  --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  
  /* Gradiente de fondo por defecto */
  --bg-gradient: radial-gradient(circle at top, rgba(56,189,248,0.15), transparent 60%),
                 radial-gradient(circle at bottom, rgba(147,51,234,0.15), transparent 60%),
                 var(--bg);
}

/* ===================== THEMES ===================== */

/* 1. MINIMAL */
body.theme-minimal {
  --bg: #f3f4f6;
  --bg-soft: #ffffff;
  --fg: #020617;
  --muted: #4b5563;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --border: rgba(148,163,184,0.55);
  --shadow-soft: 0 16px 35px rgba(15,23,42,0.16);
  --bg-gradient: #f3f4f6;
}

/* 2. DARK */
body.theme-dark {
  --bg: #020617;
  --bg-soft: #0f172a;
  --fg: #e5e7eb;
  --muted: #9ca3af;
  --accent: #22c55e;
  --accent-soft: rgba(34,197,94,0.2);
  --border: rgba(55,65,81,0.9);
  --shadow-soft: 0 20px 50px rgba(0,0,0,0.75);
  --bg-gradient: #020617;
}

/* 3. NEON */
body.theme-neon {
  --bg: #050505;
  --bg-soft: #111;
  --fg: #e0e0e0;
  --muted: #888;
  --accent: #f472b6;
  --accent-soft: rgba(244,114,182,0.15);
  --border: #333;
  --shadow-soft: 0 0 30px rgba(244,114,182,0.25);
  --bg-gradient: radial-gradient(circle at 50% 50%, rgba(244,114,182,0.05), transparent 70%), #050505;
}

/* 4. 3D (Neumorphism) */
body.theme-3d {
  --bg: #e0e5ec;
  --bg-soft: #e0e5ec;
  --fg: #4d4d4d;
  --muted: #7d8999;
  --accent: #4d4d4d;
  --accent-soft: transparent;
  --border: transparent;
  --shadow-soft: 20px 20px 60px #bebebe, -20px -20px 60px #ffffff;
  --bg-gradient: #e0e5ec;
}

/* 5. HYBRID (Same as root/default but explicit) */
body.theme-hybrid {
  /* Inherits :root values */
}


/* ===================== BASE ===================== */

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

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  background-color: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* ===================== NAVBAR ===================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 8vw; /* Ajustado el padding horizontal */
  background: rgba(var(--bg), 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid var(--border);
  max-width: 1400px; /* Ancho máximo para pantallas grandes */
  margin: 0 auto; /* Centrar el nav */
}

.logo {
  font-family: var(--font-alt);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.nav-links {
  display: flex;
  gap: 2rem; /* Aumentado el gap */
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.95rem;
  transition: color 0.2s;
  position: relative;
  padding-bottom: 0.2rem;
}

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

.nav-links a:hover {
  color: var(--fg);
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.lang-switch {
    display: flex;
    gap: 0.5rem;
}

.lang-switch button {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.lang-switch button:hover {
    background: var(--accent);
    color: var(--bg);
}

#themeSelect {
  background: var(--bg-soft);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  outline: none;
}

/* ===================== HERO ===================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr);
  gap: 2rem;
  padding: 6rem 8vw 4rem;
  align-items: center;
  min-height: 85vh;
}

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

.hero-tag {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
  display: inline-block;
  background: var(--accent-soft);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}

.hero-greeting {
    font-family: var(--font-alt);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--fg);
    margin-bottom: 0.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.hero h1 {
  font-family: var(--font-alt);
  font-size: clamp(2.5rem, 4vw, 3.8rem);
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--fg);
}

.hero-subtitle {
  color: var(--muted);
  max-width: 560px;
  font-size: 1.15rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* ==================== BUTTON RIPPLE ==================== */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff; /* Always white text for consistency */
  font-weight: 600;
  border: 1px solid var(--accent); /* Ensure border matches */
}

/* Removed redundant override */
/* body.theme-minimal .btn-primary {
    color: #fff;
} */

.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Orbit Animation 3D */
.hero-orbit {
  position: relative;
  width: 260px;
  height: 260px;
  margin-inline: auto;
  border-radius: 999px;
  background: radial-gradient(circle at top, rgba(34,211,238,0.32), transparent 60%),
              radial-gradient(circle at bottom, rgba(129,140,248,0.26), transparent 60%);
  box-shadow: var(--shadow-soft);
  display: grid;
  place-items: center;
}

.hero-orbit-inner {
    width: 100%;
    height: 100%;
    border: 1px dashed var(--border);
    border-radius: 50%;
    position: absolute;
    animation: orbit-spin 20s linear infinite;
}

.hero-orbit-inner span {
    position: absolute;
    background: var(--bg-soft);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    white-space: nowrap;
    box-shadow: var(--shadow-soft);
}

/* Positioning orbit items */
.hero-orbit-inner span:nth-child(1) { top: -10px; left: 50%; transform: translateX(-50%); }
.hero-orbit-inner span:nth-child(2) { bottom: -10px; left: 50%; transform: translateX(-50%); }
.hero-orbit-inner span:nth-child(3) { top: 50%; left: -10px; transform: translateY(-50%); }
.hero-orbit-inner span:nth-child(4) { top: 50%; right: -10px; transform: translateY(-50%); }

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===================== SECTIONS ===================== */

.section {
  padding: 6rem 8vw;
}

.section-title {
  font-family: var(--font-alt);
  font-size: 2.5rem;
  margin-bottom: 3rem;
  text-align: center;
  color: var(--fg);
}

/* ===================== SKILLS GRID ===================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.skill-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2rem;
  border-radius: 12px;
  transition: transform 0.3s, border-color 0.3s;
}

.skill-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}

.skill-card h3 {
  color: var(--accent);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.skill-card p {
  color: var(--muted);
  line-height: 1.6;
}

/* ===================== PROJECTS GRID ===================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.project-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.project-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}

.project-stack {
  font-family: var(--font-alt);
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.project-card p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 2rem;
  flex-grow: 1;
}

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

.btn-link {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: all 0.2s;
}

.btn-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ===================== CONTACT SECTION ===================== */

.contact-section {
    position: relative;
    padding-bottom: 8rem;
}

.contact-section .section-text.sub {
    text-align: center;
    color: var(--muted);
    margin-bottom: 3rem;
    font-size: 1.1rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    max-width: 1000px;
    margin: 0 auto;
}

.contact-info-card {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.info-item-new {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.icon-circle {
    width: 48px;
    height: 48px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.info-text h3 {
    font-size: 1rem;
    color: var(--fg);
    margin-bottom: 0.25rem;
}

.info-text p {
    color: var(--muted);
    font-size: 0.95rem;
}

.social-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-row a {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    z-index: 10;
}

.social-row a:hover {
    background: var(--accent) !important;
    color: #fff !important;
    transform: translateY(-3px) scale(1.05);
    border-color: var(--accent) !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.contact-form-new {
    background: var(--bg-soft);
    padding: 2.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.input-group-new {
    margin-bottom: 1.5rem;
}

.input-group-new label {
    display: block;
    font-size: 0.9rem;
    color: var(--fg);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-group-new input,
.input-group-new textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.input-group-new input:focus,
.input-group-new textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-submit-gradient {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    color: #fff;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-submit-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.status {
    margin-top: 1rem;
    font-size: 0.95rem;
    text-align: center;
    min-height: 1.5em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.status.success {
    color: #22c55e; /* Green for success */
}

.status.error {
    color: #ef4444; /* Red for error */
}

/* ===================== FOOTER ===================== */
footer {
  text-align: center;
  padding: 4rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 968px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-top: 8rem;
    gap: 3rem;
  }
  
  .hero-content {
    margin-inline: auto;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .hero-subtitle {
    margin-inline: auto;
  }

  .contact-grid {
      grid-template-columns: 1fr;
      gap: 3rem;
  }
}

@media (max-width: 768px) {
    .nav {
        padding: 1rem 5vw;
    }
    
    .nav-links {
        display: none; /* Simple hiding for mobile, ideally hamburger menu */
    }
    
    .contact-form-new {
        padding: 1.5rem;
    }
}