:root {
  /* --- Palette: same brand colors --- */
  --bg-main: #ffffff;
  --bg-surface: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.6);

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-accent: #2563eb;

  /* Brand Colors */
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --secondary: #0ea5e9;

  --grad-main: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  --grad-glow: linear-gradient(135deg, rgba(37,99,235,0.3) 0%, rgba(14,165,233,0.3) 100%);
  --grad-subtle: linear-gradient(135deg, rgba(37,99,235,0.04) 0%, rgba(14,165,233,0.04) 100%);

  /* Borders & Shadows */
  --line: #e2e8f0;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 50px -12px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 30px rgba(37,99,235,0.15), 0 0 60px rgba(14,165,233,0.08);

  /* Spacing & Layout */
  --header-h: 72px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 100px;
  --mw: 1200px;

  /* Fluid spacing */
  --space-section: clamp(4rem, 8vw, 7rem);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

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

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Utils --- */
.container {
  width: 90%;
  max-width: var(--mw);
  margin: 0 auto;
}
.grid {
  display: grid;
  gap: 2rem;
}
@media(min-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

/* Section titles */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-pill);
  background: rgba(37,99,235,0.06);
  border: 1px solid rgba(37,99,235,0.12);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.section-lead {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  color: var(--text-muted);
  max-width: 550px;
  line-height: 1.7;
}

/* --- Header --- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid rgba(226,232,240,0.6);
  display: flex;
  align-items: center;
  transition: background 0.3s, box-shadow 0.3s;
}

.nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.logo a {
  text-decoration: none;
  color: inherit;
}

.logo-badge {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--grad-main);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

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

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
  background: rgba(37,99,235,0.05);
}

/* Language Toggle — collapsible */
.lang-toggle {
  position: relative;
  margin-left: 0.5rem;
}
.lang-toggle .lang-current {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.lang-toggle .lang-current:hover {
  background: var(--bg-surface);
}
.lang-toggle .lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
}
.lang-toggle.open .lang-dropdown {
  display: flex;
}
.lang-toggle .lang-dropdown button {
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  white-space: nowrap;
}
.lang-toggle .lang-dropdown button:hover {
  background: var(--bg-surface);
}
.lang-toggle .lang-dropdown button.active {
  background: rgba(37,99,235,0.08);
}

/* Mobile Toggle */
.mobile-toggle {
  display: none;
  font-size: 1.4rem;
  cursor: pointer;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  place-items: center;
  transition: background 0.2s;
}
.mobile-toggle:hover { background: var(--bg-surface); }

/* --- Hero --- */
.hero {
  padding-top: calc(var(--header-h) + 5rem);
  padding-bottom: var(--space-section);
  position: relative;
  overflow: hidden;
}

/* Decorative mesh gradient background */
.hero::before {
  content: '';
  position: absolute;
  top: -20%; right: -10%;
  width: 60vw; height: 60vw;
  max-width: 800px; max-height: 800px;
  background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -10%; left: -5%;
  width: 40vw; height: 40vw;
  max-width: 500px; max-height: 500px;
  background: radial-gradient(circle, rgba(14,165,233,0.05) 0%, transparent 70%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 4rem;
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 3.8rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.text-gradient {
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.lead {
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 520px;
  line-height: 1.7;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--grad-main);
  color: #fff;
  box-shadow: 0 4px 15px rgba(37,99,235,0.25), 0 1px 3px rgba(0,0,0,0.08);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37,99,235,0.35), 0 2px 6px rgba(0,0,0,0.1);
}

.btn-outline {
  background: var(--bg-main);
  border: 1.5px solid var(--line);
  color: var(--text-main);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37,99,235,0.03);
  transform: translateY(-2px);
}

/* Visual / Code Window */
.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.tech-orb {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 350px; height: 350px;
  background: var(--grad-glow);
  filter: blur(80px);
  opacity: 0.5;
  z-index: -1;
  border-radius: 50%;
  animation: orbPulse 6s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

.code-window {
  width: 100%;
  max-width: 480px;
  background: #0f172a;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
}

.code-header {
  background: rgba(255,255,255,0.04);
  padding: 0.85rem 1.2rem;
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code-dot { width: 12px; height: 12px; border-radius: 50%; }
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.code-body {
  padding: 1.5rem;
  color: #e2e8f0;
}
.code-keyword { color: #c084fc; }
.code-func { color: #60a5fa; }
.code-string { color: #4ade80; }
.code-comment { color: #475569; font-style: italic; display: block; margin-top: 1rem; }

/* --- Services Grid --- */
#servicios {
  padding: var(--space-section) 0;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-main);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grad-subtle);
  opacity: 0;
  transition: opacity 0.35s;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(37,99,235,0.2);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(37,99,235,0.08);
}
.card:hover::before { opacity: 1; }

.service-icon {
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: rgba(37,99,235,0.06);
  margin-bottom: 1.25rem;
  position: relative;
}

.svc h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  font-weight: 700;
  position: relative;
}
.svc p {
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
  position: relative;
}

/* --- Why Section --- */
.why-section {
  padding: var(--space-section) 0;
  background: var(--bg-surface);
  position: relative;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.stat-item {
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-main);
  border-radius: var(--radius-lg);
}
.stat-item h3 {
  font-size: clamp(2rem, 3.5vw, 2.5rem);
  font-weight: 800;
  background: var(--grad-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}
.stat-item p {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* --- Clients Marquee --- */
.clients {
  padding: var(--space-section) 0;
  background: var(--bg-main);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.logos-track {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 140px;
  --slideW: 1200px;
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}

.logos-slide {
  position: absolute;
  top: 0; left: 0;
  display: inline-flex;
  align-items: center;
  gap: 50px;
  will-change: transform;
}

#logosSlideB { left: 100%; }

@keyframes logosScroll {
  from { transform: translateX(0); }
  to { transform: translate3d(-100%, 0, 0); }
}

.logos-slide img {
  display: block;
  height: 80px;
  width: auto;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 14px 22px;
  object-fit: contain;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: grayscale(100%);
  opacity: 0.6;
}

.logos-slide img:hover {
  transform: scale(1.06);
  filter: grayscale(0%);
  opacity: 1;
  background: var(--bg-main);
  box-shadow: var(--shadow-lg);
}

/* --- About --- */
.about {
  padding: var(--space-section) 0;
  background: var(--bg-main);
}
.about .text h2 {
  margin-bottom: 1.5rem;
  font-size: clamp(2rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.about .text p { margin-bottom: 1rem; color: var(--text-muted); line-height: 1.7; }

.framed {
  position: relative;
  padding: 6px;
  background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(14,165,233,0.15));
  border-radius: var(--radius-xl);
}
.framed img {
  border-radius: calc(var(--radius-xl) - 4px);
}

/* --- Contact --- */
#contacto {
  padding: var(--space-section) 0;
  background: var(--bg-surface);
}
.contact-wrapper {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}
.contact-wrapper h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* --- Footer --- */
footer {
  background: #0f172a;
  color: #fff;
  padding: 4rem 0 2rem;
  text-align: center;
}
footer h2 { color: #fff; }
footer p { color: #94a3b8; }
footer small { color: #64748b; }

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  transition: all 0.25s;
}
.social-link:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-2px);
}

/* --- Mobile Nav --- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-grid .hero-content { order: 1; }
  .hero-grid .hero-visual { order: 2; }
  .lead { margin-left: auto; margin-right: auto; }
  .grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2rem, 7vw, 2.8rem); }

  .mobile-toggle { display: grid; }

  .nav-links {
    display: none;
  }

  .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1.5rem;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-xl);
    gap: 0.25rem;
  }

  .nav-links.active a {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
  }
}

/* --- Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.reveal-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-children.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
.reveal-children.is-visible > *:nth-child(2) { transition-delay: 80ms; opacity: 1; transform: translateY(0); }
.reveal-children.is-visible > *:nth-child(3) { transition-delay: 160ms; opacity: 1; transform: translateY(0); }
.reveal-children.is-visible > *:nth-child(4) { transition-delay: 240ms; opacity: 1; transform: translateY(0); }
.reveal-children.is-visible > *:nth-child(5) { transition-delay: 320ms; opacity: 1; transform: translateY(0); }
.reveal-children.is-visible > *:nth-child(6) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }

/* Tech items */
.tech-item:hover {
  transform: translateY(-3px);
  border-color: rgba(37,99,235,0.2);
  box-shadow: var(--shadow-md);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .reveal-children > * { opacity: 1; transform: none; }
}
