/* =========================================
   VARIABLES & ROOT
   ========================================= */
:root {
  --dark-blue: #020c1b;
  --navy: #0a192f;
  --light-navy: #112240;
  --lightest-navy: #233554;
  --green: #00b894;
  --green-glow: rgba(0, 184, 148, 0.3);
  --cyan: #00d2d3;
  --cyan-glow: rgba(0, 210, 211, 0.4);
  --neon-cyan: #00f2f3;
  --white: #e6f1ff;
  --slate: #8892b0;
  --light-slate: #a8b2d1;
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Orbitron', 'Rajdhani', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  --transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  --border-radius: 12px;
  --container-max: 1200px;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--dark-blue);
  color: var(--white);
  line-height: 1.6;
  overflow-x: hidden;
}

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

img, svg {
  display: block;
  max-width: 100%;
}

address {
  font-style: normal;
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

p {
  color: var(--slate);
}

.text-cyan {
  color: var(--cyan);
}

/* =========================================
   UTILITIES & LAYOUT
   ========================================= */
.container {
  width: min(90%, var(--container-max));
  margin-inline: auto;
}

.section {
  position: relative;
  padding-block: 6rem;
}

.section-header {
  margin-bottom: 3rem;
  text-align: center;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.section-title span {
  text-shadow: 0 0 10px var(--cyan-glow);
}

.section-desc {
  font-size: 1.1rem;
  max-width: 60ch;
  margin-inline: auto;
}

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

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

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 10px var(--cyan-glow); }
  50% { box-shadow: 0 0 25px var(--cyan-glow), 0 0 5px var(--neon-cyan); }
}

@keyframes holoShine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(200%) rotate(45deg); }
}

@keyframes mapPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50% { transform: translateY(8px); opacity: 1; }
}

/* =========================================
   GLASSMORPHISM COMPONENTS
   ========================================= */
.glass-card {
  background: rgba(17, 34, 64, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 210, 211, 0.12);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: var(--transition);
}

.glass-card:hover {
  border-color: rgba(0, 210, 211, 0.35);
  box-shadow: 0 0 20px rgba(0, 210, 211, 0.15);
  transform: translateY(-4px);
}

/* =========================================
   AMBIENT LIGHTING
   ========================================= */
.ambient-light {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

.light-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--cyan-glow), transparent 70%);
  top: -100px; left: -100px;
}

.light-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, var(--green-glow), transparent 70%);
  bottom: -80px; right: -80px;
}

.light-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0, 210, 211, 0.25), transparent 70%);
  top: 10%; right: 5%;
}

.light-4 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(0, 184, 148, 0.2), transparent 70%);
  bottom: 5%; left: -5%;
}

/* =========================================
   NAVIGATION
   ========================================= */
.navbar {
  position: fixed;
  top: 0; left: 0; width: 100%;
  z-index: 100;
  padding: 1.2rem 0;
  transition: var(--transition);
}

.navbar.scrolled {
  background: rgba(2, 12, 27, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 210, 211, 0.1);
  padding: 0.8rem 0;
}

.nav-container {
  width: min(90%, var(--container-max));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-accent {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-glow);
}

.logo-main {
  color: var(--white);
}

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

.nav-link {
  font-family: var(--font-display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--light-slate);
  position: relative;
  padding: 0.25rem 0;
  transition: var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--cyan);
}

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

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 24px; height: 2px;
  background: var(--cyan);
  border-radius: 2px;
  box-shadow: 0 0 5px var(--cyan-glow);
  transition: var(--transition);
}

.hamburger {
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}

.hamburger::before { transform: translateY(-8px); }
.hamburger::after { transform: translateY(8px); }

.nav-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
  box-shadow: none;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg);
}

/* =========================================
   HERO
   ========================================= */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #0d2b4e 0%, var(--dark-blue) 70%);
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 0%, var(--dark-blue) 90%);
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 0 1.5rem;
  max-width: 900px;
}

.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  margin-bottom: 1.5rem;
}

.hero-title .line {
  display: block;
}

.hero-title .highlight {
  background: linear-gradient(90deg, var(--cyan), var(--green));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--light-slate);
  max-width: 55ch;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}

.cta-btn {
  display: inline-block;
  padding: 1rem 2.5rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--navy);
  background: linear-gradient(90deg, var(--green), var(--cyan));
  border-radius: 4px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 0 12px var(--green-glow);
}

.cta-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transition: var(--transition);
}

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

.cta-btn:hover::before {
  left: 100%;
}

.cta-full {
  width: 100%;
  text-align: center;
}

.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 24px; height: 40px;
  border: 2px solid var(--cyan);
  border-radius: 12px;
  opacity: 0.6;
}

.scroll-indicator span {
  display: block;
  width: 4px; height: 8px;
  background: var(--cyan);
  border-radius: 2px;
  margin: 6px auto 0;
  animation: scrollBounce 2s infinite;
}

/* =========================================
   SISTEMAS / DASHBOARD
   ========================================= */
.section-sistemas {
  background: linear-gradient(180deg, var(--dark-blue) 0%, var(--navy) 100%);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.dashboard-panel {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--light-slate);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.panel-value {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--white);
  margin-bottom: 0.25rem;
  text-shadow: 0 0 10px var(--cyan-glow);
}

.unit {
  font-size: 1.2rem;
  color: var(--cyan);
}

.panel-label {
  font-size: 0.85rem;
  color: var(--slate);
  margin-bottom: 1rem;
}

.sparkline {
  width: 100%;
  height: 40px;
  opacity: 0.7;
}

.bar-chart {
  margin-top: auto;
}

.bar-bg {
  background: var(--lightest-navy);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  width: 0;
  transition: width 1.5s ease-out;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--slate);
  margin-top: 0.5rem;
}

.node-map {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.nmap-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--lightest-navy);
  border: 1px solid var(--light-navy);
}

.nmap-dot.active {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan-glow);
  animation: pulse-glow 2s infinite;
}

.gauge {
  width: 100px;
  margin-top: auto;
  align-self: flex-end;
}

/* =========================================
   SOBRE EL INSTITUTO
   ========================================= */
.section-about {
  background: var(--navy);
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
}

.about-card {
  padding: 2.5rem 2rem;
  text-align: center;
}

.about-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: rgba(0, 210, 211, 0.05);
  border: 1px solid rgba(0, 210, 211, 0.15);
  margin-bottom: 1.5rem;
  transition: var(--transition);
}

.about-card:hover .about-icon {
  box-shadow: 0 0 15px var(--cyan-glow);
  border-color: var(--cyan);
}

.about-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  color: var(--white);
}

.about-card p {
  font-size: 0.95rem;
  line-height: 1.55;
}

/* =========================================
   PROGRAMAS
   ========================================= */
.section-programs {
  background: linear-gradient(180deg, var(--navy) 0%, #071221 100%);
}

.programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.program-card {
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.program-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.program-number {
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  color: rgba(0, 210, 211, 0.08);
  position: absolute;
  top: 1.5rem; right: 1.5rem;
}

.program-name {
  font-size: 1.3rem;
  color: var(--white);
  margin-right: 2rem;
  z-index: 1;
}

.program-desc {
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.program-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  z-index: 1;
}

.program-tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-radius: 20px;
  background: rgba(0, 210, 211, 0.08);
  color: var(--cyan);
  border: 1px solid rgba(0, 210, 211, 0.15);
}

/* =========================================
   ENERGY LAB
   ========================================= */
.section-lab {
  background: linear-gradient(180deg, #071221 0%, var(--dark-blue) 100%);
}

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

.holo-panel {
  position: relative;
  background: linear-gradient(135deg, rgba(0,210,211,0.04), rgba(0,184,148,0.04));
  border: 1px solid rgba(0, 210, 211, 0.1);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: var(--transition);
}

.holo-panel::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(60deg, transparent 35%, rgba(0,210,211,0.08) 48%, transparent 60%);
  transform: translateX(-100%) rotate(25deg);
  transition: transform 0.6s;
}

.holo-panel:hover {
  border-color: rgba(0, 210, 211, 0.4);
  transform: translateY(-6px);
  box-shadow: 0 0 25px rgba(0, 210, 211, 0.1);
}

.holo-panel:hover::before {
  transform: translateX(100%) rotate(25deg);
  transition: transform 1.2s ease-in-out;
}

.lab-content {
  position: relative;
  z-index: 2;
  padding: 2.5rem 2rem;
}

.lab-meta {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--green);
  margin-bottom: 0.75rem;
}

.lab-content h3 {
  font-size: 1.5rem;
  color: var(--white);
  margin-bottom: 0.25rem;
}

.lab-plat {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--cyan);
  margin-bottom: 1rem;
}

.lab-innov {
  font-size: 0.95rem;
  color: var(--slate);
  line-height: 1.5;
}

/* =========================================
   CONTACTO
   ========================================= */
.section-contact {
  background: radial-gradient(circle at 50% 50%, #0d2b3e 0%, var(--dark-blue) 60%);
}

.contact-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.contact-form {
  padding: 2.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--light-slate);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.9rem 1rem;
  background: rgba(2, 12, 27, 0.5);
  border: 1px solid var(--lightest-navy);
  border-radius: 6px;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 210, 211, 0.2);
}

.form-group textarea {
  resize: vertical;
}

.form-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  min-height: 1.2rem;
}

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

.info-title {
  font-size: 1.3rem;
  color: var(--white);
  border-bottom: 1px solid var(--lightest-navy);
  padding-bottom: 1rem;
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--cyan);
}

.info-item a,
.info-item address {
  color: var(--light-slate);
  font-size: 1rem;
  transition: var(--transition);
}

.info-item a:hover {
  color: var(--white);
}

.info-map {
  position: relative;
  height: 120px;
  background: rgba(17, 34, 64, 0.3);
  border-radius: 8px;
  border: 1px solid var(--lightest-navy);
  overflow: hidden;
}

.map-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.map-line {
  border-right: 1px solid rgba(35, 53, 84, 0.5);
  border-bottom: 1px solid rgba(35, 53, 84, 0.5);
}

.map-pulse {
  position: absolute;
  top: 50%; left: 50%;
  width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(0, 210, 211, 0.5);
  animation: mapPulse 2s infinite;
}

/* =========================================
   FOOTER
   ========================================= */
.footer {
  padding: 3rem 0;
  border-top: 1px solid var(--light-navy);
  background: var(--dark-blue);
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
  text-align: center;
}

.footer-brand .logo-accent,
.footer-brand .logo-main {
  font-size: 1.5rem;
}

.footer-brand p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.9rem;
}

.footer-links a {
  color: var(--slate);
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--cyan);
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--slate);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    z-index: 110;
  }

  .nav-links {
    position: fixed;
    inset: 0 0 0 auto;
    width: 75%;
    max-width: 320px;
    background: rgba(2, 12, 27, 0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 5rem 2.5rem;
    gap: 2rem;
    transform: translateX(100%);
    transition: transform 0.4s ease;
    border-left: 1px solid rgba(0, 210, 211, 0.1);
  }

  .nav-links.active {
    transform: translateX(0);
  }

  .section {
    padding-block: 4rem;
  }

  .contact-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .about-grid,
  .programs-grid,
  .lab-grid {
    gap: 1.2rem;
  }

  .scroll-indicator {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}