/* ============================================
   DESIGN TOKENS — Clinical Biotech Grid
   ============================================ */

:root {
  /* Backgrounds – Light Mode */
  --bg-page: #F5F8FF;
  --bg-card: #FFFFFF;
  --border-card: #E2E8F0;
  --grid-line: #E5E7EB;

  /* Backgrounds – Dark Sections */
  --bg-dark: #020617;
  --bg-dark-card: #0B1220;
  --grid-line-dark: #1E293B;

  /* Primary Accents */
  --blue: #2563EB;
  --teal: #0EA5E9;
  --indigo: #4F46E5;

  /* Text – Light */
  --text-headline: #020617;
  --text-body: #1F2933;
  --text-muted: #64748B;

  /* Text – Dark */
  --text-light: #F9FAFB;
  --text-light-muted: #9CA3AF;

  /* Shadows */
  --shadow-card: 0 18px 40px rgba(15, 23, 42, 0.10);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);

  /* Glow */
  --glow-blue: 0 0 0 1px rgba(37, 99, 235, 0.5), 0 0 18px rgba(37, 99, 235, 0.35);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', 'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --container-max: 1200px;
  --section-pad: 100px;
  --card-radius: 16px;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

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

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-page);
  overflow-x: hidden;
  position: relative;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

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

/* ============================================
   BACKGROUND GRID
   ============================================ */

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.35;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(245, 248, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-card);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo__icon {
  width: 32px;
  height: 32px;
}

.logo__text {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-headline);
  letter-spacing: -0.02em;
}

.logo__highlight {
  color: var(--blue);
}

.logo__img {
  height: 60px;
  width: auto;
}

.nav {
  display: flex;
  gap: 32px;
}

.nav__link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav__link:hover {
  color: var(--blue);
}

/* Burger button — hidden on desktop */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 201;
}

.burger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-headline);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Burger active state (X) */
.burger.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger.is-active span:nth-child(2) {
  opacity: 0;
}

.burger.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Body lock when menu is open */
body.menu-open {
  overflow: hidden;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.btn--primary {
  background: var(--blue);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn--primary:hover {
  background: #1D4ED8;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.btn--outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--border-card);
}

.btn--outline:hover {
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.04);
}

.btn--sm {
  padding: 8px 18px;
  font-size: 13px;
}

.btn--lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: 12px;
}

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

.hero {
  position: relative;
  z-index: 1;
  padding-top: calc(80px + 80px);
  padding-bottom: 40px;
  background: linear-gradient(180deg, var(--bg-page) 0%, #EBF1FF 100%);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  min-height: 520px;
}

.hero__title {
  font-size: 52px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text-headline);
  margin-bottom: 20px;
}

.hero__title--accent {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 32px;
}

.hero__actions {
  display: flex;
  gap: 14px;
  margin-bottom: 48px;
}

/* Stats */
.hero__stats {
  display: flex;
  gap: 40px;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.stat__label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Hero Visual */
.hero__visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.molecule {
  position: relative;
  width: 460px;
  height: 460px;
}

#moleculeCanvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.circuit-traces {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Data dots */
.data-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
  animation: pulse-dot 3s ease-in-out infinite;
}

.data-dot--1 { top: 15%; left: 20%; animation-delay: 0s; }
.data-dot--2 { top: 30%; right: 10%; animation-delay: 0.8s; }
.data-dot--3 { bottom: 25%; left: 12%; animation-delay: 1.6s; }
.data-dot--4 { bottom: 15%; right: 22%; animation-delay: 2.4s; }
.data-dot--5 { top: 50%; right: 5%; animation-delay: 0.4s; }

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.6); }
}

/* ============================================
   CARDS SECTION
   ============================================ */

.cards-section {
  position: relative;
  z-index: 1;
  padding: var(--section-pad) 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--card-radius);
  padding: 40px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.card__badge {
  margin-bottom: 20px;
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  background: #EFF6FF;
  padding: 5px 12px;
  border-radius: 6px;
}

.badge--teal {
  color: var(--teal);
  background: #F0FDFA;
}

.badge--dark {
  color: var(--teal);
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
}

.card__title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-headline);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.card__text {
  font-size: 15px;
  color: var(--text-body);
  line-height: 1.75;
  margin-bottom: 14px;
}

.card__text:last-of-type {
  margin-bottom: 20px;
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue);
  transition: gap 0.2s ease;
}

.card__link:hover {
  gap: 10px;
}

/* Steps flow */
.steps {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
}

.step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.step__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.step__icon svg {
  width: 100%;
  height: 100%;
}

.step__label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-headline);
  margin-bottom: 6px;
}

.step__desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.step__arrow {
  display: flex;
  align-items: center;
  padding-top: 14px;
  flex-shrink: 0;
}

/* ============================================
   AGENTS SECTION (DARK)
   ============================================ */

.agents-section {
  position: relative;
  z-index: 1;
  background: var(--bg-dark);
  padding: var(--section-pad) 0 80px;
  overflow: hidden;
}

/* Dark grid overlay */
.agents-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-line-dark) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-dark) 1px, transparent 1px);
  background-size: 80px 80px;
  opacity: 0.5;
  pointer-events: none;
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
  position: relative;
  z-index: 2;
}

.section-title {
  font-size: 40px;
  font-weight: 700;
  color: var(--text-headline);
  letter-spacing: -0.03em;
  margin-top: 16px;
  margin-bottom: 16px;
}

.section-title--light {
  color: var(--text-light);
}

.section-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

.section-subtitle--light {
  color: var(--text-light-muted);
}

/* Agent cards */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  position: relative;
  z-index: 2;
}

.agent-card {
  background: rgba(11, 18, 32, 0.8);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--card-radius);
  padding: 32px;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.agent-card:hover {
  box-shadow: var(--glow-blue);
  border-color: rgba(37, 99, 235, 0.3);
}

.agent-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.agent-card__icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.agent-card__icon svg {
  width: 100%;
  height: 100%;
}

.agent-card__label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--teal);
}

.agent-card__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.agent-card__desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-light-muted);
}

/* Connections */
.agents-connections {
  margin-top: 32px;
  position: relative;
  z-index: 2;
}

.connections-svg {
  width: 100%;
  height: 20px;
}

/* ============================================
   CTA SECTION
   ============================================ */

.cta-section {
  position: relative;
  z-index: 1;
  padding: var(--section-pad) 0;
}

.cta-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  padding: 64px 40px;
  box-shadow: var(--shadow-card);
}

.cta-card__title {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-headline);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.cta-card__text {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.7;
}

.cta-card__actions {
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border-card);
  padding: 60px 0 32px;
  background: var(--bg-page);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 60px;
  margin-bottom: 40px;
}

.footer__tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

.footer__links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.footer__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-headline);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.footer__link {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.footer__link:hover {
  color: var(--blue);
}

.footer__bottom {
  border-top: 1px solid var(--border-card);
  padding-top: 24px;
  text-align: center;
}

.footer__copy {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__content {
  animation: fade-up 0.7s ease-out both;
}

.hero__visual {
  animation: fade-up 0.7s ease-out 0.15s both;
}

.card {
  animation: fade-up 0.6s ease-out both;
}

.card:nth-child(2) {
  animation-delay: 0.1s;
}

.agent-card {
  animation: fade-up 0.6s ease-out both;
}

.agent-card:nth-child(2) {
  animation-delay: 0.1s;
}

.agent-card:nth-child(3) {
  animation-delay: 0.2s;
}

/* ============================================
   CONTACT MODAL
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  background: rgba(2, 6, 23, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.is-open {
  display: flex;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(37, 99, 235, 0.08);
  animation: modal-in 0.3s ease-out;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal__close:hover {
  color: var(--text-headline);
  border-color: var(--text-muted);
  background: var(--bg-page);
}

.modal__header {
  margin-bottom: 28px;
}

.modal__title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-headline);
  letter-spacing: -0.02em;
  margin-top: 14px;
  margin-bottom: 8px;
}

.modal__subtitle {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Form */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-headline);
  margin-bottom: 6px;
}

.form-optional {
  font-weight: 400;
  color: var(--text-muted);
}

.form-input {
  display: block;
  width: 100%;
  font-family: var(--font-primary);
  font-size: 14px;
  color: var(--text-body);
  background: var(--bg-page);
  border: 1.5px solid var(--border-card);
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-input::placeholder {
  color: #94A3B8;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-input.is-error {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.modal__submit {
  width: 100%;
  margin-top: 4px;
}

.modal__submit-loader[hidden] {
  display: none;
}

.modal__submit-loader {
  display: inline-flex;
}

/* Result state (success / error) */
.modal__result {
  text-align: center;
  padding: 20px 0;
}

.modal__result-icon {
  margin-bottom: 16px;
}

.modal__result-icon svg {
  display: inline-block;
}

.modal__result-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-headline);
  margin-bottom: 8px;
}

.modal__result-text {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal__result-btn {
  min-width: 160px;
}

/* Modal mobile */
@media (max-width: 540px) {
  .modal {
    padding: 28px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal__title {
    font-size: 22px;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .hero__subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero__actions {
    justify-content: center;
  }

  .hero__stats {
    justify-content: center;
  }

  .molecule {
    width: 360px;
    height: 360px;
    margin: 0 auto;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .agents-grid {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
  }

  .agents-connections {
    display: none;
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

/* ============================================
   MOBILE — Burger menu + full adaptation
   ============================================ */

@media (max-width: 768px) {
  /* Show burger, hide desktop CTA */
  .burger {
    display: flex;
  }

  .header__cta {
    display: none;
  }

  /* Hide nav by default on mobile */
  .nav {
    display: none;
  }

  /* Expand header to fullscreen when menu is open */
  .header.menu-open {
    height: 100vh;
    height: 100dvh;
  }

  /* Show nav centered inside the fullscreen header */
  .header.menu-open .nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F5F8FF;
  }

  .header.menu-open .nav__link {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-headline);
    padding: 16px 0;
  }

  .header.menu-open .nav__link:hover,
  .header.menu-open .nav__link:active {
    color: var(--blue);
  }
}

@media (max-width: 640px) {
  :root {
    --section-pad: 64px;
  }

  .hero {
    padding-top: calc(80px + 48px);
  }

  .hero__title {
    font-size: 34px;
  }

  .hero__subtitle {
    font-size: 16px;
  }

  .hero__stats {
    flex-direction: column;
    gap: 20px;
    align-items: center;
  }

  .molecule {
    width: 280px;
    height: 280px;
  }

  .card {
    padding: 28px;
  }

  .steps {
    flex-direction: column;
    align-items: center;
  }

  .step__arrow {
    transform: rotate(90deg);
    padding-top: 0;
  }

  .section-title {
    font-size: 30px;
  }

  .section-subtitle {
    font-size: 15px;
  }

  .agent-card {
    padding: 24px;
  }

  .cta-card {
    padding: 40px 24px;
  }

  .cta-card__title {
    font-size: 26px;
  }

  .cta-card__actions {
    flex-direction: column;
    align-items: center;
  }

  .footer__links {
    grid-template-columns: 1fr 1fr;
  }

  .footer__brand {
    text-align: center;
  }
}

@media (max-width: 400px) {
  .hero__title {
    font-size: 28px;
  }

  .hero__actions {
    flex-direction: column;
    align-items: center;
  }

  .hero__actions .btn {
    width: 100%;
  }

  .molecule {
    width: 220px;
    height: 220px;
  }

  .card__title {
    font-size: 20px;
  }

  .footer__links {
    grid-template-columns: 1fr;
  }
}
