/* ================================
   MONOCHROME DESIGN SYSTEM
   Clean, minimal black & white palette with dark mode
================================ */

:root {
  /* Light Mode - Monochrome */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --bg-accent: #e9ecef;
  
  --text-primary: #000000;
  --text-secondary: #495057;
  --text-tertiary: #868e96;
  
  /* Accent Colors - Grayscale */
  --accent-primary: #212529;
  --accent-hover: #343a40;
  --accent-light: #495057;
  
  --accent-secondary: #6c757d;
  --accent-tertiary: #adb5bd;
  
  /* Borders & Dividers */
  --border-primary: #dee2e6;
  --border-secondary: #ced4da;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.2);
  
  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Font Sizes */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */
  --text-6xl: 3.75rem;     /* 60px */
  
  /* Spacing */
  --space-1: 0.25rem;      /* 4px */
  --space-2: 0.5rem;       /* 8px */
  --space-3: 0.75rem;      /* 12px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-8: 2rem;         /* 32px */
  --space-10: 2.5rem;      /* 40px */
  --space-12: 3rem;        /* 48px */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */
  
  /* Border Radius */
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Layout */
  --max-width: 1280px;
  --nav-height: 80px;
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-secondary: #121212;
  --bg-tertiary: #1a1a1a;
  --bg-accent: #242424;
  
  --text-primary: #ffffff;
  --text-secondary: #b8b8b8;
  --text-tertiary: #8a8a8a;
  
  --accent-primary: #ffffff;
  --accent-hover: #e0e0e0;
  --accent-light: #d0d0d0;
  
  --accent-secondary: #9a9a9a;
  --accent-tertiary: #6a6a6a;
  
  --border-primary: #2a2a2a;
  --border-secondary: #3a3a3a;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* ================================
   RESET & GLOBAL STYLES
================================ */

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

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

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

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

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

button {
  font-family: inherit;
  cursor: pointer;
}

/* Inline icon utilities */
.icon-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.icon-inline svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon-inline--trailing {
  margin-left: 0.35em;
}

.icon-inline--leading {
  margin-right: 0.35em;
}

/* ================================
   TYPOGRAPHY
================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

p {
  margin-bottom: var(--space-4);
}

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

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

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-8);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-12);
  }
}

.section {
  padding: var(--space-16) 0;
}

@media (min-width: 768px) {
  .section {
    padding: var(--space-20) 0;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: var(--space-24) 0;
  }
}

.section--alt {
  background-color: var(--bg-secondary);
}

.section.highlighted {
  background-color: var(--bg-tertiary);
  transition: background-color var(--transition-base);
}

.section--cta {
  background: var(--bg-tertiary);
  transition: background var(--transition-base);
}

/* ================================
   NAVIGATION
================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background-color: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-primary);
  z-index: 1000;
  transition: all var(--transition-base);
}

[data-theme="dark"] .nav {
  background-color: rgba(10, 10, 10, 0.95);
}

.nav__container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .nav__container {
    padding: 0 var(--space-8);
  }
}

@media (min-width: 1024px) {
  .nav__container {
    padding: 0 var(--space-12);
  }
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--text-primary);
  z-index: 1001;
  border-radius: 0;
  overflow: visible;
}

.nav__logo-img {
  width: 40px;
  height: 40px;
  border-radius: 0;
  overflow: visible;
}

.nav__logo-text {
  display: none;
}

@media (min-width: 640px) {
  .nav__logo-text {
    display: block;
  }
}

.nav__toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  padding: var(--space-2);
  z-index: 1001;
  cursor: pointer;
  width: 40px;
  height: 40px;
  justify-content: center;
  align-items: center;
  position: relative;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all var(--transition-base);
  transform-origin: center;
}

/* Hamburger to X animation */
.nav__toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav__toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav__toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (min-width: 768px) {
  .nav__toggle {
    display: none;
  }
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

@media (max-width: 767px) {
  .nav__menu {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
  height: 100vh;
  min-height: 100vh;
    background-color: var(--bg-secondary);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  gap: var(--space-4);
    padding: calc(var(--nav-height) + var(--space-10)) var(--space-6) var(--space-10);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform var(--transition-base);
    z-index: 1000;
    border-left: none;
    overflow-y: auto;
    -ms-overflow-style: none;
  }

  .nav__menu::-webkit-scrollbar {
    width: 0;
    height: 0;
  }
  
  .nav__menu.active {
    transform: translateX(0);
  }
  
  .nav__link {
    font-size: var(--text-lg);
    padding: var(--space-4) var(--space-5);
    text-align: left;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    width: 100%;
    flex: 0 0 auto;
    min-height: 52px;
  }

  .nav__link--cta {
    justify-content: center;
    margin-top: auto;
  }
  
  .nav__link:hover {
    background-color: var(--bg-tertiary);
  }
}

.nav__link {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
}

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

.nav__link--cta {
  padding: var(--space-3) var(--space-5);
  background-color: var(--accent-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

[data-theme="dark"] .nav__link--cta {
  color: var(--bg-primary);
}

.nav__link--cta:hover {
  background-color: var(--accent-hover);
  color: white;
}

/* Dark Mode Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  background-color: var(--bg-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-left: var(--space-4);
}

.theme-toggle:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-secondary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
  transition: transform var(--transition-base);
}

.theme-toggle:hover svg {
  transform: rotate(20deg);
}

@media (max-width: 767px) {
  .nav__container {
    position: relative;
    gap: var(--space-2);
  }

  .nav__actions {
    margin-left: auto;
    order: 2;
  }

  .nav__actions .theme-toggle {
    margin-left: 0;
  }

  /* Fallback for pages without nav__actions */
  .nav__container > .theme-toggle {
    margin-left: auto;
    order: 2;
  }
  
  .nav__toggle {
    order: 3;
    margin-left: var(--space-3);
  }
}

/* Navigation overlay for mobile */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

@media (max-width: 767px) {
  .nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* Prevent body scroll when mobile menu is open */
.no-scroll {
  overflow: hidden;
}

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

.hero {
  padding-top: calc(var(--nav-height) + var(--space-20));
  padding-bottom: var(--space-20);
  background: var(--bg-primary);
  transition: background var(--transition-base);
}

@media (min-width: 768px) {
  .hero {
    padding-top: calc(var(--nav-height) + var(--space-24));
    padding-bottom: var(--space-24);
  }
}

.hero__content {
  max-width: 900px;
}

.hero__title {
  font-size: var(--text-4xl);
  font-weight: 600;
  line-height: 1.15;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .hero__title {
    font-size: var(--text-5xl);
  }
}

@media (min-width: 1024px) {
  .hero__title {
    font-size: var(--text-6xl);
  }
}

.hero__title--accent {
  color: var(--accent-primary);
  display: block;
}

.hero__description {
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  max-width: 700px;
}

@media (min-width: 768px) {
  .hero__description {
    font-size: var(--text-xl);
  }
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
  font-weight: 500;
  border-radius: var(--radius-full);
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn--primary {
  background-color: var(--accent-primary);
  color: var(--bg-primary);
}

.btn--primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

[data-theme="dark"] .btn--primary {
  color: var(--bg-primary);
}

[data-theme="dark"] .btn--primary:hover {
  color: var(--bg-primary);
}

.btn--secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
}

.btn--secondary:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-secondary);
}

.btn--large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* ================================
   SECTION HEADERS
================================ */

.section__header {
  margin-bottom: var(--space-12);
}

.section__header--center {
  text-align: center;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-12);
}

.section__title {
  font-size: var(--text-3xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .section__title {
    font-size: var(--text-4xl);
  }
}

.section__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.7;
}

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

.cards {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  transition: all var(--transition-base), background-color var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-secondary);
}

.card--featured {
  grid-column: 1 / -1;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-secondary);
}

@media (min-width: 768px) {
  .card--featured {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .card--featured {
    grid-column: span 3;
  }
}

.card__label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .card__title {
    font-size: var(--text-2xl);
  }
}

.card__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.tag {
  padding: var(--space-1) var(--space-3);
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--accent-primary);
  transition: all var(--transition-fast);
  text-decoration: none;
  margin-top: var(--space-2);
}

.card__link:hover {
  gap: var(--space-3);
  color: var(--accent-hover);
}

.card__link svg {
  transition: transform var(--transition-fast);
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.card__link:hover svg {
  transform: translateX(4px);
}

/* ================================
   RESEARCH GRID
================================ */

.research-grid {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

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

.research-card {
  text-align: center;
  padding: var(--space-8);
}

.research-card__icon {
  font-size: var(--text-6xl);
  margin-bottom: var(--space-6);
}

.research-card__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

.research-card__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ================================
   ABOUT SECTION
================================ */

.about__content {
  max-width: 800px;
}

.about__text {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: var(--space-12);
}

.about__text p {
  margin-bottom: var(--space-6);
}

/* ================================
   TIMELINE
================================ */

.timeline {
  border-left: 2px solid var(--border-secondary);
  padding-left: 0;
  margin-left: var(--space-4);
}

.timeline__item {
  position: relative;
  padding-left: var(--space-8);
  padding-bottom: var(--space-8);
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-primary);
}

.timeline__year {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.timeline__title {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

.timeline__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
}

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

.cta {
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.cta__title {
  font-size: var(--text-4xl);
  font-weight: 600;
  margin-bottom: var(--space-6);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .cta__title {
    font-size: var(--text-5xl);
  }
}

.cta__description {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

@media (min-width: 768px) {
  .cta__description {
    font-size: var(--text-xl);
  }
}

.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: center;
}

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

.footer {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  padding: var(--space-12) 0;
}

.footer__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  align-items: center;
  text-align: center;
}

@media (min-width: 768px) {
  .footer__content {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer__text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.footer__links {
  display: flex;
  gap: var(--space-6);
}

.footer__link {
  font-size: var(--text-sm);
  color: var(--bg-tertiary);
  transition: color var(--transition-fast);
}

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

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

/* ================================
   UTILITIES
================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Research page specific utilities */
.research-highlight {
  margin: var(--space-8) 0;
}

.cluster-features {
  margin-top: var(--space-4);
}

.cluster-features ul {
  margin-top: var(--space-2);
  color: var(--text-secondary);
}

.insight-features {
  margin-top: var(--space-4);
}

.insight-features ul {
  margin-top: var(--space-2);
  color: var(--text-secondary);
}

/* ================================
   MOBILE-SPECIFIC FIXES
================================ */

/* Fix for research section tags and links on mobile */
@media (max-width: 767px) {
  /* Ensure card links are properly visible and interactive on mobile */
  .card__link {
    min-height: 44px; /* Minimum touch target size */
    padding: var(--space-3) 0;
    display: flex !important;
    align-items: center;
    gap: var(--space-2);
  }
  
  /* Ensure SVG icons are always visible in card links */
  .card__link svg {
    display: block;
    opacity: 1;
    visibility: visible;
    flex-shrink: 0;
  }
  
  /* Fix tag hover states for mobile (use tap/touch highlighting) */
  .tag {
    -webkit-tap-highlight-color: transparent;
    transition: all var(--transition-fast);
  }
  
  /* Active state for tags on touch */
  .tag:active {
    background-color: var(--accent-primary);
    color: var(--bg-primary);
    transform: scale(0.95);
  }
  
  /* Active state for card links on touch */
  .card__link:active {
    color: var(--accent-hover);
    transform: translateX(2px);
  }
  
  .card__link:active svg {
    transform: translateX(4px);
  }
  
  /* Ensure cards are properly highlighted when touched */
  .card:active {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-secondary);
  }
  
  /* Fix for research section highlighting on mobile */
  .section#research:target,
  .section--research.highlighted {
    background-color: var(--bg-tertiary);
    transition: background-color var(--transition-base);
  }
}

/* Additional mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
  /* This targets touch devices specifically */
  .tag:hover {
    /* Reset hover styles on touch devices */
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-primary);
    transform: none;
  }
  
  /* Use focus-visible for better touch accessibility */
  .card__link:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
  }
}
