/* ============================================
   1. VARIABLES & RESET
   ============================================ */
:root {
  --bg-deep: #020c1b;
  --bg-surface: #0b1d2e;
  --accent-cyan: #00f3ff;
  --accent-green: #00ff9d;
  --accent-blue: #1e90ff;
  --text-primary: #e6f1ff;
  --text-secondary: #94a3b8;
  --glass-bg: rgba(15, 30, 50, 0.55);
  --glass-border: rgba(0, 243, 255, 0.15);
  --glass-border-strong: rgba(0, 243, 255, 0.35);
  --font-heading: 'Exo 2', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

html {
  scroll-behavior: smooth;
}

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

/* Ambient background glows */
body::before,
body::after {
  content: '';
  position: fixed;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
}

body::before {
  top: -20%;
  left: -10%;
  background: radial-gradient(circle, rgba(0, 243, 255, 0.07) 0%, transparent 70%);
}

body::after {
  bottom: -20%;
  right: -10%;
  background: radial-gradient(circle, rgba(0, 255, 157, 0.05) 0%, transparent 70%);
}

/* ============================================
   2. UTILITIES & REUSABLE COMPONENTS
   ============================================ */
.container {
  width: 92%;
  max-width: 1200px;
  margin: 0 auto;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  letter-spacing: 0.5px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  color: #00121a;
  box-shadow:
    0 0 24px rgba(0, 243, 255, 0.3),
    0 4px 12px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 36px rgba(0, 243, 255, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.4);
}

.btn-primary:active {
  transform: translateY(-1px);
}

/* Scroll offset for fixed header */
section[id] {
  scroll-margin-top: 80px;
}

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

.navbar.scrolled {
  background: rgba(2, 12, 27, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  padding: 14px 0;
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.5px;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
  color: #00121a;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(0, 243, 255, 0.35);
}

.logo-accent {
  color: var(--accent-cyan);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 36px;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  transition: var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-cyan);
  transition: var(--transition);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

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

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 1002;
}

.hamburger {
  display: block;
  width: 28px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: var(--transition);
}

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

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  top: 8px;
}

body.nav-open {
  overflow: hidden;
}

.nav-open .hamburger {
  background: transparent;
}

.nav-open .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.nav-open .hamburger::after {
  transform: rotate(-45deg);
  top: 0;
}

/* ============================================
   4. HERO SECTION
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-top: 80px;
}

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

.hero-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, var(--bg-deep) 90%);
  z-index: 2;
  pointer-events: none;
}

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

.hero-badge {
  display: inline-block;
  padding: 8px 20px;
  border: 1px solid rgba(0, 255, 157, 0.4);
  border-radius: 100px;
  color: var(--accent-green);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeInUp 1s ease forwards;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  font-weight: 700;
  line-height: 1.08;
  margin-bottom: 26px;
  text-wrap: balance;
  opacity: 0;
  animation: fadeInUp 1s ease 0.2s forwards;
}

.hero-title span {
  color: var(--accent-cyan);
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 44px;
  line-height: 1.6;
  opacity: 0;
  animation: fadeInUp 1s ease 0.4s forwards;
}

.btn-primary {
  opacity: 0;
  animation: fadeInUp 1s ease 0.6s forwards, neonPulse 3s infinite 1.2s;
}

.hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeIn 1s ease 1.2s forwards;
}

.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--accent-cyan), transparent);
  animation: scrollBounce 2.5s infinite;
}

/* ============================================
   5. SECTIONS COMMON
   ============================================ */
.section {
  padding: 120px 0;
  position: relative;
}

.section-header {
  max-width: 720px;
  margin: 0 auto 72px;
  text-align: center;
}

.section-tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--accent-cyan);
  margin-bottom: 18px;
  border: 1px solid rgba(0, 243, 255, 0.3);
  padding: 6px 16px;
  border-radius: 4px;
  background: rgba(0, 243, 255, 0.05);
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 18px;
  background: linear-gradient(90deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.6;
}

/* ============================================
   6. ABOUT & SYSTEMS
   ============================================ */
.about {
  background: linear-gradient(to bottom, var(--bg-deep), var(--bg-surface));
}

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

.system-card {
  padding: 36px;
  transition: var(--transition);
}

.system-card:hover {
  transform: translateY(-8px);
  border-color: var(--glass-border-strong);
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.12);
}

.system-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
  color: var(--accent-cyan);
}

.system-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
}

.system-card h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.system-card p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ============================================
   7. PROGRAMS
   ============================================ */
.programs {
  background: var(--bg-deep);
  position: relative;
}

.programs::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0.4;
}

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

.program-card {
  padding: 44px 32px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.program-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-green));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s ease;
}

.program-card:hover::before {
  transform: scaleX(1);
}

.program-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  border-color: var(--glass-border-strong);
}

.program-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 28px;
  color: var(--accent-green);
}

.program-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.program-card h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.program-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ============================================
   8. LABORATORY GALLERY
   ============================================ */
.lab {
  background: linear-gradient(to bottom, var(--bg-surface), var(--bg-deep));
}

.lab-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
}

.lab-item {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.lab-item:hover {
  transform: scale(1.03);
  border-color: var(--glass-border-strong);
  box-shadow: 0 0 32px rgba(0, 243, 255, 0.18);
}

.lab-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 50%, rgba(0, 243, 255, 0.08), transparent 60%);
}

.lab-visual svg {
  width: 80%;
  height: auto;
  max-height: 150px;
  stroke: currentColor;
  color: var(--accent-cyan);
  filter: drop-shadow(0 0 10px rgba(0, 243, 255, 0.35));
}

.lab-info {
  padding: 20px 26px;
  background: rgba(2, 12, 27, 0.65);
  border-top: 1px solid var(--glass-border);
}

.lab-info h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-weight: 600;
}

.lab-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(0, 243, 255, 0.1);
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: var(--font-heading);
}

/* ============================================
   9. CONTACTS
   ============================================ */
.contacts {
  background: var(--bg-deep);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.contact-card {
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.contact-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00121a;
  box-shadow: 0 0 16px rgba(0, 243, 255, 0.25);
}

.contact-icon svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  fill: none;
}

.contact-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
}

.contact-card a,
.contact-card span {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s;
  line-height: 1.5;
}

.contact-card a:hover {
  color: var(--accent-cyan);
}

/* Map */
.contact-map {
  width: 100%;
  height: 320px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative;
  background: #00121a;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 243, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
}

.map-pin {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-cyan);
  text-align: center;
  animation: mapPulse 2.5s infinite ease-in-out;
}

.map-pin svg {
  width: 44px;
  height: 44px;
  stroke: currentColor;
  fill: none;
  filter: drop-shadow(0 0 12px rgba(0, 243, 255, 0.5));
  margin-bottom: 10px;
}

.map-pin span {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 1px;
  display: block;
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
}

/* ============================================
   10. FOOTER
   ============================================ */
.footer {
  padding: 48px 0;
  text-align: center;
  border-top: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-sub {
  margin-top: 8px;
  opacity: 0.7;
  font-size: 0.8rem;
}

/* ============================================
   11. ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes neonPulse {
  0%,
  100% {
    box-shadow: 0 0 24px rgba(0, 243, 255, 0.3);
  }
  50% {
    box-shadow:
      0 0 40px rgba(0, 243, 255, 0.55),
      0 0 80px rgba(0, 255, 157, 0.25);
  }
}

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

@keyframes mapPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
    opacity: 0.85;
  }
}

/* Scroll reveal utility */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

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

/* ============================================
   12. RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
  .section {
    padding: 100px 0;
  }

  .lab-gallery {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

@media (max-width: 768px) {
  .section {
    padding: 80px 0;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 75%;
    max-width: 320px;
    height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    background: rgba(2, 12, 27, 0.98);
    border-left: 1px solid var(--glass-border);
    transition: right 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  }

  .nav-menu.open {
    right: 0;
  }

  .nav-toggle {
    display: block;
  }

  .nav-link {
    font-size: 1.15rem;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .contact-map {
    height: 260px;
  }
}

@media (max-width: 480px) {
  .btn-primary {
    padding: 14px 28px;
    font-size: 0.9rem;
  }

  .system-card,
  .program-card,
  .contact-card {
    padding: 28px;
  }

  .lab-gallery {
    grid-template-columns: 1fr;
  }

  .section-header {
    margin-bottom: 48px;
  }
}

/* ============================================
   13. ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-canvas {
    display: none;
  }
}