/* ==========================================================================
   Layout, navigation, accessibility, animations
   ========================================================================== */

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  padding: 0.75rem 1rem;
  background: #238636;
  color: #FFFFFF !important;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-full {
  max-width: 100%;
  padding: 0;
}

/* Site header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(22, 27, 34, 0.95);
  border-bottom: 1px solid #30363D;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: #F0F6FC !important;
  flex-shrink: 0;
}

.brand:hover {
  color: #FFFFFF !important;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  vertical-align: middle;
}

.brand-logo--on-light {
  display: none;
}

body.light-mode .brand-logo--on-dark {
  display: none;
}

body.light-mode .brand-logo--on-light {
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  display: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.brand-abbr {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

@media (min-width: 768px) {
  .brand-name {
    display: block;
  }

  .brand-abbr {
    display: none;
  }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-link {
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  color: #C9D1D9 !important;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-link:hover {
  color: #F0F6FC !important;
  background: rgba(88, 166, 255, 0.1);
}

.nav-link.active {
  color: #58A6FF !important;
  background: rgba(88, 166, 255, 0.12);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  margin-left: auto;
  background: none;
  border: 1px solid #30363D;
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #E6EDF3;
  margin: 0 auto;
  border-radius: 1px;
}

.theme-toggle {
  background: none;
  border: 1px solid #30363D;
  border-radius: 8px;
  cursor: pointer;
  color: #E6EDF3;
  padding: 0.45rem 0.65rem;
  line-height: 1;
  margin-left: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  border-color: #58A6FF;
  background: rgba(88, 166, 255, 0.08);
}

.theme-icon-light {
  display: none;
}

body.light-mode .theme-icon-dark {
  display: none;
}

body.light-mode .theme-icon-light {
  display: inline;
}

@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    order: 3;
    padding: 0.75rem 0 0.25rem;
    border-top: 1px solid #30363D;
    margin-left: 0;
    gap: 0.15rem;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-link {
    padding: 0.75rem 0.5rem;
  }

  .theme-toggle {
    margin-left: 0;
    align-self: center;
  }
}

body.light-mode .site-header {
  background: rgba(246, 248, 250, 0.95);
  border-bottom-color: #D0D7DE;
}

body.light-mode .brand {
  color: #1A1F36 !important;
}

body.light-mode .nav-link {
  color: #374151 !important;
}

body.light-mode .nav-link:hover {
  color: #0A58CA !important;
  background: rgba(10, 88, 202, 0.08);
}

body.light-mode .nav-link.active {
  color: #0A58CA !important;
  background: rgba(10, 88, 202, 0.1);
}

body.light-mode .nav-toggle {
  border-color: #D0D7DE;
}

body.light-mode .nav-toggle-bar {
  background: #1A1F36;
}

body.light-mode .theme-toggle {
  color: #1A1F36;
  border-color: #D0D7DE;
}

/* Icons & animations */
.icon {
  margin-right: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    opacity: 0;
    animation: fadeIn 0.8s forwards;
  }

  .fade-in.delay-1 { animation-delay: 0.2s; }
  .fade-in.delay-2 { animation-delay: 0.4s; }
  .fade-in.delay-3 { animation-delay: 0.6s; }

  @keyframes fadeIn {
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in,
  .reveal-target {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Shared page layout */
.page-content,
.wrapper {
  max-width: 100%;
  width: 100%;
}

.page-section {
  padding: 2rem 0 3rem;
}

.page-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #F0F6FC;
  letter-spacing: -0.02em;
}

.page-header h1::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin: 0.85rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #38BDF8, #818CF8);
}

.page-subtitle {
  color: #8B949E;
  font-size: 1.15rem;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

body.light-mode .page-header h1 {
  color: #1A1F36;
}

body.light-mode .page-subtitle {
  color: #4B5563;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  text-align: center;
  color: #F9FAFB;
  position: relative;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 190px;
  height: 60px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18), transparent 70%);
  opacity: 0.7;
  z-index: -1;
}

.section-subtitle {
  text-align: center;
  color: #9CA3AF;
  margin-bottom: 2rem;
}

body.light-mode .section-title {
  color: #0F172A;
}

body.light-mode .section-subtitle {
  color: #4B5563;
}

.section-divider,
.content-divider {
  border: 0;
  border-top: 1px solid #1F2937;
  margin: 3rem 0;
}

body.light-mode .section-divider,
body.light-mode .content-divider {
  border-top-color: #E5E7EB;
}

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

@media (min-width: 900px) {
  .card-grid--3,
  .card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.cap-card {
  position: relative;
  background: #020617;
  border: 1px solid #1F2937;
  padding: 1.8rem;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.7);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  transform: translateY(18px);
  opacity: 0;
}

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

.cap-card h3 {
  color: #E5E7EB;
  margin-bottom: 0.8rem;
}

.cap-card ul {
  color: #CBD5F5;
  line-height: 1.55;
  font-size: 0.97rem;
}

.cap-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.4), transparent, rgba(129, 140, 248, 0.4));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .cap-card:hover::before {
    opacity: 1;
  }

  .cap-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
    border-color: #38BDF8;
  }
}

body.light-mode .cap-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

body.light-mode .cap-card h3 {
  color: #111827;
}

body.light-mode .cap-card ul {
  color: #374151;
}

.service-card,
.team-card {
  position: relative;
  background: #161B22;
  border: 1px solid #30363D;
  border-radius: 14px;
  padding: 1.8rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.service-card::after,
.team-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #38BDF8, #818CF8);
  opacity: 0;
  transition: opacity 0.25s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .service-card:hover,
  .team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    border-color: rgba(56, 189, 248, 0.35);
  }

  .service-card:hover::after,
  .team-card:hover::after {
    opacity: 1;
  }
}

body.light-mode .service-card,
body.light-mode .team-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.service-icon {
  font-size: 2.4rem;
  margin-bottom: 1rem;
  color: #58A6FF;
}

body.light-mode .service-icon {
  color: #0A66C2;
}

.cta-block,
.page-cta,
.services-cta,
.research-cta {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem 0;
}

.page-cta p {
  margin-bottom: 1.25rem;
  color: #C9D1D9;
}

body.light-mode .page-cta p {
  color: #374151;
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding: 2.5rem 1.5rem 2rem;
  border-top: 1px solid #30363D;
  background: #161B22;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-brand strong {
  display: block;
  font-size: 1rem;
  color: #F0F6FC;
  margin-bottom: 0.35rem;
}

.footer-brand p {
  margin: 0;
  font-size: 0.88rem;
  color: #8B949E;
  max-width: 280px;
  line-height: 1.5;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.footer-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: #C9D1D9 !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: #38BDF8 !important;
}

.footer-copy {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid #30363D;
  text-align: center;
  font-size: 0.85rem;
  color: #8B949E;
}

body.light-mode .footer {
  background: #F6F8FA;
  border-top-color: #D0D7DE;
}

body.light-mode .footer-brand strong {
  color: #1A1F36;
}

body.light-mode .footer-brand p,
body.light-mode .footer-copy {
  color: #6B7280;
}

body.light-mode .footer-nav a {
  color: #374151 !important;
}

body.light-mode .footer-nav a:hover {
  color: #0284C7 !important;
}

body.light-mode .footer-copy {
  border-top-color: #E5E7EB;
}

@media (max-width: 640px) {
  .footer-inner {
    flex-direction: column;
    gap: 1.25rem;
  }

  .footer-nav {
    flex-direction: column;
    gap: 0.65rem;
  }
}

/* Focus states */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #38BDF8;
  outline-offset: 2px;
}

body.light-mode a:focus-visible,
body.light-mode button:focus-visible,
body.light-mode input:focus-visible,
body.light-mode textarea:focus-visible {
  outline-color: #0284C7;
}
