:root {
  /* Core Palette - Deep Space */
  --bg-deep: #030303;
  --bg-surface: #0a0a0c;
  --bg-glass: rgba(15, 15, 20, 0.7);
  --bg-glass-bright: rgba(255, 255, 255, 0.03);
  
  /* Accents - High Contrast */
  --accent-primary: #d4af37; /* Gold */
  --accent-secondary: #a855f7; /* Purple */
  --accent-tertiary: #00f2ff; /* Cyan/Neon */
  --accent-glow: rgba(212, 175, 55, 0.3);
  
  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  /* Layout */
  --container-max: 1280px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Animation */
  --transition-smooth: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

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

h1, h2, h3, h4, .font-display {
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* --- Layout --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.section-padding {
  padding: 100px 0;
}

/* --- Background Mesh & Parallax --- */
.parallax-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  background: var(--bg-deep);
}

.parallax-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../images/Background.webp');
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  filter: saturate(1.2) brightness(0.8);
  transition: transform 0.1s ease-out;
  will-change: transform;
  transform: scale(1.3); /* Extra scale to prevent gaps */
}

.mesh-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 10% 20%, rgba(168, 85, 247, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 242, 255, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.08) 0%, transparent 50%);
  filter: blur(80px);
  pointer-events: none;
}

/* --- Navigation --- */
nav.glass-nav {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: var(--container-max);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  z-index: 100;
  padding: 0.6rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  gap: 2rem; /* Add gap as a safety measure */
}

nav.glass-nav.scrolled {
  top: 10px;
  width: auto;
  min-width: fit-content; /* Dynamic width based on content */
  background: rgba(10, 10, 12, 0.85);
  padding: 0.4rem 1.5rem;
  border-color: rgba(212, 175, 55, 0.2);
}

.brand-block {
  flex-shrink: 0; /* Prevent brand from squishing */
  margin-right: 1rem;
}

.nav-links {
  display: flex;
  gap: 2.5rem; /* Increased spacing between links */
  flex-grow: 1;
  justify-content: center;
}

@media (max-width: 768px) {
  nav.glass-nav.scrolled {
    width: calc(100% - 20px);
    min-width: unset;
  }
}

.nav-links {
  display: flex;
  gap: 2.5rem; /* Increased spacing between links */
  flex-grow: 1;
  justify-content: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  position: relative;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding-bottom: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-dropdown-toggle i {
  transition: transform 0.3s ease;
}

.nav-dropdown:hover .nav-dropdown-toggle i,
.nav-dropdown:focus-within .nav-dropdown-toggle i {
  transform: rotate(180deg);
}
.nav-dropdown.open .nav-dropdown-toggle i,
.nav-dropdown.open .nav-dropdown-toggle svg {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 180px;
  background: rgba(5, 5, 5, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.5rem 0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 20;
  flex-direction: column;
  gap: 0.25rem;
}

.nav-dropdown-menu a {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color 0.3s ease, background 0.3s ease;
}

.nav-dropdown-menu a:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown-group {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  gap: 0.35rem;
}
.nav-dropdown-group + .nav-dropdown-group {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-dropdown-group-title {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.nav-dropdown-sublist {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.5rem;
}
.nav-dropdown-sublist a {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-primary);
  transition: var(--transition-smooth);
}

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

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

.nav-links.active .nav-dropdown-menu {
  display: none;
  position: static;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  gap: 0;
  margin-top: 0.5rem;
}
.nav-links.active .nav-dropdown.open .nav-dropdown-menu {
  display: flex;
}

.nav-links.active .nav-dropdown-menu a {
  padding: 0.35rem 0;
  text-align: left;
}

.hamburger {
  display: none;
  width: 32px;
  height: 24px;
  border: none;
  background: transparent;
  position: relative;
  cursor: pointer;
}

.hamburger::before,
.hamburger::after,
.hamburger span {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition-smooth);
}

.hamburger::before {
  top: 0;
}

.hamburger::after {
  bottom: 0;
}

.hamburger span {
  top: 50%;
  transform: translateY(-50%);
}

/* --- Hero Section --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 100px;
  position: relative;
}

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

.hero-tag {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.hero-title {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  line-height: 1;
  margin-bottom: 2rem;
  background: linear-gradient(to right, #fff 20%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
  max-width: 600px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 2rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  text-decoration: none;
  border: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-deep);
  box-shadow: 0 10px 20px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 15px 30px rgba(212, 175, 55, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: #fff;
}

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

.ecosystem-slider {
  position: relative;
  overflow: hidden;
  min-height: 380px;
  margin-bottom: 2rem;
  margin-top: -1rem;
}
.ecosystem-track {
  position: relative;
  width: 100%;
  height: clamp(360px, 38vw, 460px);
  perspective: 2200px;
  pointer-events: none;
  --ecosystem-offset: clamp(160px, 12vw, 280px);
}
.ecosystem-track .ecosystem-card {
  position: absolute;
  inset: 0;
  width: clamp(260px, 29vw, 360px);
  height: clamp(320px, 35vw, 420px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
  padding: 2rem;
  transition: transform 0.5s ease, box-shadow 0.5s ease, opacity 0.5s ease;
  overflow: hidden;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
}
.ecosystem-track .ecosystem-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(110% 60% at 20% 10%, rgba(139, 92, 246, 0.2), transparent 60%),
    radial-gradient(110% 60% at 90% 90%, rgba(87, 185, 255, 0.18), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.6;
  filter: blur(2px);
  pointer-events: none;
}
.ecosystem-track .ecosystem-card[data-pos='0'] {
  transform: translate(-50%, -50%) scale(1.08);
  z-index: 5;
  pointer-events: auto;
  background: linear-gradient(180deg, rgba(7, 8, 25, 0.92), rgba(6, 8, 25, 0.82));
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(22px);
}
.ecosystem-track .ecosystem-card[data-pos='1'] {
  transform: translate(-50%, -50%) translateX(calc(var(--ecosystem-offset) * 1.1)) translateZ(5px) rotateY(-18deg) scale(0.9);
  opacity: 0.95;
  z-index: 4;
}
.ecosystem-track .ecosystem-card[data-pos='-1'] {
  transform: translate(-50%, -50%) translateX(calc(var(--ecosystem-offset) * -1.1)) translateZ(5px) rotateY(18deg) scale(0.9);
  opacity: 0.95;
  z-index: 4;
}
.ecosystem-track .ecosystem-card[data-pos='2'] {
  transform: translate(-50%, -50%) translateX(calc(var(--ecosystem-offset) * 2.4)) translateZ(-18px) rotateY(-28deg) scale(0.72);
  opacity: 0.35;
  z-index: 3;
}
.ecosystem-track .ecosystem-card[data-pos='-2'] {
  transform: translate(-50%, -50%) translateX(calc(var(--ecosystem-offset) * -2.4)) translateZ(-18px) rotateY(28deg) scale(0.72);
  opacity: 0.35;
  z-index: 3;
}
.ecosystem-track .ecosystem-card[data-pos]:not([data-pos='0']):not([data-pos='1']):not([data-pos='-1']):not([data-pos='2']):not([data-pos='-2']) {
  opacity: 0;
  pointer-events: none;
}
.ecosystem-track .ecosystem-card .unit-card {
  background: transparent;
  border: none;
  padding: 0;
}
.ecosystem-track .ecosystem-card .unit-icon img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.ecosystem-track .unit-status {
  font-size: 0.75rem;
  letter-spacing: 0.25rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.ecosystem-track .unit-title {
  font-size: 1.35rem;
  margin: 0;
}
.ecosystem-track .unit-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

@media (max-width: 960px) {
  .ecosystem-track {
    height: 360px;
  }
  .ecosystem-track .ecosystem-card {
    width: clamp(240px, 70vw, 320px);
  }
  .ecosystem-track .ecosystem-card[data-pos='1'] {
    transform: translate(calc(50% + 25px), -50%) rotateY(-12deg) scale(0.97);
  }
  .ecosystem-track .ecosystem-card[data-pos='-1'] {
    transform: translate(calc(-50% - 25px), -50%) rotateY(12deg) scale(0.97);
  }
}

@media (max-width: 768px) {
  .ecosystem-slider {
    min-height: 480px;
  }
  .ecosystem-track {
    height: 350px;
  }
  .ecosystem-track .ecosystem-card {
    width: clamp(260px, 82vw, 330px);
    height: clamp(300px, 62vw, 380px);
  }
  .ecosystem-track .ecosystem-card[data-pos='1'],
  .ecosystem-track .ecosystem-card[data-pos='-1'] {
    transform: translate(-50%, -50%) scale(0.92);
  }
  .ecosystem-track .ecosystem-card[data-pos='2'],
  .ecosystem-track .ecosystem-card[data-pos='-2'] {
    opacity: 0;
  }

  .ecosystem-nav {
    top: 42% !important;
  }

  .ecosystem-thumbs {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    margin-top: 0.8rem;
    padding: 0 0.15rem;
  }

  .ecosystem-thumb-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 0.2rem 0.1rem 0.2rem 0;
    min-height: 60px;
  }

  .ecosystem-thumb-track::-webkit-scrollbar {
    display: none;
  }

  .ecosystem-thumb {
    min-width: 58px;
    width: 58px;
    height: 58px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(3, 5, 25, 0.78);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
  }

  .ecosystem-thumb:hover {
    border-color: rgba(212, 175, 55, 0.75);
    color: var(--text-primary);
  }

  .ecosystem-thumb.is-active {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  }

  .ecosystem-thumb img {
    width: 21px;
    height: 21px;
    object-fit: contain;
  }

  .ecosystem-thumb-label {
    font-size: 0.53rem;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    max-width: 50px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ecosystem-thumb-nav {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(5, 5, 5, 0.82);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
  }

  .ecosystem-thumb-nav:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
  }
}

.systems-ops-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-template-rows: auto;
}

.ecosystem-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(5, 5, 5, 0.7);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.ecosystem-nav:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.ecosystem-prev {
  left: 0;
}

.ecosystem-next {
  right: 0;
}

.ecosystem-thumbs {
  display: none;
}

.bento-item {
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.bento-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-10px);
  background: rgba(255, 255, 255, 0.02);
}

.bento-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.08) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

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

/* Custom Spans for Bento */
.span-2 { grid-column: span 2; }
.row-2 { grid-row: span 2; }

/* --- Business Units --- */
.unit-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.unit-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1.5rem;
}

.unit-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.unit-title {
  font-size: 1.125rem;
  margin-bottom: 1rem;
}

.unit-status {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 0.7rem;
  color: var(--accent-tertiary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* --- Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Glass Card */
.glass-card {
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: 3rem;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    flex-direction: column;
    gap: 1rem;
  }
  .nav-links.active { display: flex; }
  .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .hero-title { font-size: 2.25rem; }
  .nav-links.active .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }
  .nav-links.active .nav-dropdown-toggle i,
  .nav-links.active .nav-dropdown-toggle svg {
    padding: 0.2rem;
    flex-shrink: 0;
  }
  
  nav.glass-nav.scrolled {
    width: calc(100% - 20px);
    min-width: auto;
    padding: 0.4rem 1rem;
  }

  .bento-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
  
  .bento-item {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    min-height: auto;
    padding: 1.5rem;
  }

  /* Ocultar imagen decorativa en Areas en móvil para igualar tamaños */
  .bento-item .unit-card img:not(.unit-icon img) {
    display: none;
  }

}
