/* Lotus Analytica - Modern Japanese Corporate Styling */
/* Apple-inspired Design System */

:root {
  /* Light Mode - Apple-inspired */
  --primary: #007AFF;
  --primary-light: #5AC8FA;
  --primary-dark: #0051a8;
  --accent: #FF2D55;
  --accent-light: #FF6482;
  --accent-soft: #fff0f3;

  /* Semantic Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f7;
  --bg-tertiary: #e8e8ed;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);

  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --border-color: rgba(0, 0, 0, 0.1);
  --border-color-strong: rgba(0, 0, 0, 0.2);

  /* Surfaces */
  --surface-overlay: rgba(255, 255, 255, 0.95);
  --header-bg: rgba(255, 255, 255, 0.8);
  --footer-bg: #1d1d1f;
  --footer-text: #f5f5f7;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

  /* Typography */
  --font-jp: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  --font-en: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", monospace;

  /* Spacing */
  --section-padding: 120px;
  --container-width: 1200px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;

  /* CTA Section */
  --cta-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Dark Mode - Soft Grey Theme */
[data-theme="dark"] {
  --primary: #60a5fa;
  --primary-light: #93c5fd;
  --primary-dark: #3b82f6;
  --accent: #f472b6;
  --accent-light: #f9a8d4;
  --accent-soft: #2d2235;

  --bg-primary: #18181b;
  --bg-secondary: #27272a;
  --bg-tertiary: #3f3f46;
  --bg-elevated: #27272a;
  --bg-card: rgba(39, 39, 42, 0.9);

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-strong: rgba(255, 255, 255, 0.15);

  --surface-overlay: rgba(39, 39, 42, 0.95);
  --header-bg: rgba(24, 24, 27, 0.85);
  --footer-bg: #18181b;
  --footer-text: #fafafa;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

  --cta-bg: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --primary-dark: #3b82f6;
    --accent: #f472b6;
    --accent-light: #f9a8d4;
    --accent-soft: #2d2235;

    --bg-primary: #18181b;
    --bg-secondary: #27272a;
    --bg-tertiary: #3f3f46;
    --bg-elevated: #27272a;
    --bg-card: rgba(39, 39, 42, 0.9);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-strong: rgba(255, 255, 255, 0.15);

    --surface-overlay: rgba(39, 39, 42, 0.95);
    --header-bg: rgba(24, 24, 27, 0.85);
    --footer-bg: #18181b;
    --footer-text: #fafafa;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);

    --cta-bg: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
  }
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent images from causing overflow */
img {
  max-width: 100%;
  height: auto;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-en);
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* All sections and backgrounds */
.section {
  background: var(--bg-primary);
  transition: background-color 0.4s ease;
}

.section[style*="background: var(--gray-50)"],
.section[style*="background:var(--gray-50)"] {
  background: var(--bg-secondary) !important;
}

body.ja {
  font-family: var(--font-jp);
}

/*
 * Japanese Typography - Prevent mid-word breaks
 * Uses word-break: keep-all as the primary method
 */
body.ja {
  word-break: keep-all;
  line-break: strict;
  overflow-wrap: break-word;
}

/* For paragraphs and text content, allow breaks at natural points only */
body.ja p,
body.ja li,
body.ja h1,
body.ja h2,
body.ja h3,
body.ja h4,
body.ja td,
body.ja .hero-subtitle,
body.ja .team-bio,
body.ja .feature-card p,
body.ja .research-content p,
body.ja .cta-content p,
body.ja .section-header p {
  word-break: keep-all;
  line-break: strict;
  overflow-wrap: break-word;
}

/* Buttons and nav links should never break */
body.ja .btn,
body.ja .nav-link,
body.ja .lang-btn,
body.ja .section-label,
body.ja .tag,
body.ja .timeline-date,
body.ja .research-meta span,
body.ja .footer-title,
body.ja .form-label,
body.ja option {
  white-space: nowrap;
}

/* No-wrap utility - text inside CANNOT break (desktop only) */
.nowrap {
  display: inline !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  line-break: strict !important;
}

/* Higher specificity for Japanese pages */
body.ja .nowrap,
body.ja p .nowrap,
body.ja li .nowrap,
body.ja h1 .nowrap,
body.ja h2 .nowrap,
body.ja h3 .nowrap,
body.ja h4 .nowrap,
body.ja td .nowrap {
  display: inline !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  line-break: strict !important;
}

/* On mobile, allow nowrap spans to wrap to prevent overflow */
@media (max-width: 768px) {
  .nowrap {
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
  }

  body.ja .nowrap,
  body.ja p .nowrap,
  body.ja li .nowrap,
  body.ja h1 .nowrap,
  body.ja h2 .nowrap,
  body.ja h3 .nowrap,
  body.ja h4 .nowrap,
  body.ja td .nowrap {
    white-space: normal !important;
    word-break: keep-all !important;
    overflow-wrap: break-word !important;
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--primary-dark);
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw, 2rem); }
h4 { font-size: clamp(1.25rem, 2vw, 1.5rem); }

p {
  margin-bottom: 1.5rem;
  color: var(--gray-600);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent);
}

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

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.4s ease;
}

.header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--primary-dark);
}

.logo img {
  height: 60px;
  width: auto;
}

.logo-mark {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.25rem;
}

.logo-icon {
  width: 75px;
  height: 75px;
  object-fit: contain;
}

/* Navigation */
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  border-radius: 6px;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #c026d3, #06b6d4);
  transition: all 0.3s ease;
  transform: translateX(-50%);
  border-radius: 2px;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: calc(100% - 16px);
}

.nav-link:hover {
  color: var(--primary);
  background: transparent;
}

.nav-link.active {
  color: var(--primary);
  background: transparent;
}

/* Language Switcher */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 16px;
  padding: 4px;
  background: var(--gray-100);
  border-radius: 8px;
}

.lang-btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  color: var(--gray-700);
}

.lang-btn.active {
  color: var(--primary);
  background: var(--bg-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Dark Mode Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 12px;
  background: var(--gray-100);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--gray-200);
  transform: rotate(15deg);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--gray-600);
  transition: all var(--transition-fast);
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun-icon {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .moon-icon {
    display: none;
  }
}

/* Mobile Menu */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gray-700);
  transition: all var(--transition-fast);
}

/* Hero Section */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  background: linear-gradient(-45deg, #0f172a, #1e1b4b, #312e81, #1e3a5f, #0f172a);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  position: relative;
  overflow: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 150%;
  background: radial-gradient(ellipse at center, rgba(192, 38, 211, 0.3) 0%, transparent 70%);
  opacity: 0.8;
  pointer-events: none;
  animation: floatGlow 8s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 60%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
  opacity: 0.8;
  pointer-events: none;
  animation: floatGlow 10s ease-in-out infinite reverse;
}

@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.1); }
}

/* Floating Lotus Petals */
.petal-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.floating-petal {
  position: absolute;
  top: -50px;
  background: linear-gradient(135deg, rgba(192, 38, 211, 0.6) 0%, rgba(147, 51, 234, 0.3) 100%);
  border-radius: 50% 0 50% 50%;
  opacity: 0.4;
  animation: floatDown linear infinite;
  filter: blur(1px);
  box-shadow: 0 0 10px rgba(192, 38, 211, 0.3);
}

.floating-petal:nth-child(odd) {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.5) 0%, rgba(34, 211, 238, 0.2) 100%);
  border-radius: 0 50% 50% 50%;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.floating-petal:nth-child(3n) {
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.5) 0%, rgba(236, 72, 153, 0.2) 100%);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.3);
}

@keyframes floatDown {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 0.4;
  }
  90% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(110vh) rotate(calc(var(--rotation, 360deg) + 720deg)) scale(0.5);
    opacity: 0;
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
}

.hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #c026d3;
  border-radius: 50%;
  animation: pulse 2s infinite;
  box-shadow: 0 0 10px #c026d3;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.2); }
}

.hero h1 {
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 80px rgba(192, 38, 211, 0.5);
}

.hero-subtitle {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 40px;
  max-width: 600px;
}

.hero-subtitle strong {
  color: #22d3ee;
  font-weight: 600;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #c026d3 0%, #9333ea 100%);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(192, 38, 211, 0.4);
  position: relative;
  overflow: hidden;
}

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

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

.btn-primary:hover {
  background: linear-gradient(135deg, #d946ef 0%, #a855f7 100%);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(192, 38, 211, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white);
  transform: translateY(-3px);
}

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

.btn-accent:hover {
  background: var(--accent-light);
  color: var(--white);
  transform: translateY(-2px);
}

/* Sections */
.section {
  padding: var(--section-padding) 0;
}

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

.section-label {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.section-header h2 {
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, #6366f1 50%, #c026d3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-header p {
  font-size: 1.1rem;
}

/* Feature Cards */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: 32px;
}

.feature-card {
  padding: 40px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transition: left 0.6s;
}

.feature-card:hover::before {
  left: 100%;
}

.feature-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.12),
    0 0 30px rgba(192, 38, 211, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  border-color: rgba(192, 38, 211, 0.3);
}

.feature-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #c026d3 0%, #6366f1 50%, #06b6d4 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  font-size: 1.5rem;
  color: var(--white);
  box-shadow: 0 8px 20px rgba(192, 38, 211, 0.3);
  transition: all 0.3s ease;
}

.feature-card:hover .feature-icon {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 12px 30px rgba(192, 38, 211, 0.4);
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.feature-card p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Stats Section */
.stats {
  background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
  color: #ffffff;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
}

.stat-item {
  text-align: center;
  padding: 32px 20px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.stat-number {
  font-size: 3.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #c4b5fd 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 8px;
}

/* Research Section */
.research-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 60px;
  background: var(--gray-50);
  border-radius: 24px;
  margin-bottom: 40px;
}

.research-card:nth-child(even) {
  direction: rtl;
}

.research-card:nth-child(even) > * {
  direction: ltr;
}

.research-image {
  aspect-ratio: 16/10;
  background: var(--gray-100);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  font-size: 0.9rem;
  overflow: hidden;
}

.research-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  transition: transform 0.4s ease;
}

.research-card:hover .research-image img {
  transform: scale(1.05);
}

.research-content h3 {
  margin-bottom: 16px;
}

.research-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.research-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-500);
}

.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.tag {
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-600);
}

/* Team Section */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 40px;
}

.team-card {
  text-align: center;
  padding: 40px 30px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.team-card:hover {
  transform: translateY(-12px);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.1),
    0 0 30px rgba(192, 38, 211, 0.1);
}

.team-photo {
  width: 180px;
  height: 180px;
  margin: 0 auto 24px;
  background: linear-gradient(135deg, #c026d3 0%, #6366f1 50%, #06b6d4 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
  position: relative;
  box-shadow: 0 10px 30px rgba(192, 38, 211, 0.3);
  transition: all 0.3s ease;
  overflow: hidden;
  padding: 4px;
}

.team-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.team-card:hover .team-photo {
  transform: scale(1.05);
  box-shadow: 0 15px 40px rgba(192, 38, 211, 0.4);
}

.team-card h4 {
  margin-bottom: 4px;
}

.team-role {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.team-bio {
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* Services */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  overflow: hidden;
}

.service-item {
  padding: 48px 32px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  transition: all var(--transition-base);
}

.service-item:nth-child(3n) {
  border-right: none;
}

.service-item:nth-child(n+4) {
  border-bottom: none;
}

.service-item:hover {
  background: var(--gray-50);
}

.service-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
}

.service-item h4 {
  margin-bottom: 12px;
}

.service-item p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Clients */
.clients-section {
  background: var(--gray-50);
}

.clients-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 60px;
  flex-wrap: wrap;
}

.client-logo {
  padding: 24px 40px;
  background: var(--white);
  border-radius: 12px;
  color: var(--gray-400);
  font-size: 0.9rem;
  font-weight: 500;
}

/* CTA Section */
.cta {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #ffffff;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.cta-content {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
}

.cta h2 {
  color: #ffffff;
  margin-bottom: 16px;
}

.cta p {
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 32px;
}

/* Footer */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 80px 0 40px;
  transition: background-color 0.4s ease;
}

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

.footer-brand {
  max-width: 300px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.footer-logo img {
  height: 45px;
  width: auto;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-title {
  color: var(--footer-text);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

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

.footer-bottom {
  padding-top: 40px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.footer-social {
  display: flex;
  gap: 16px;
}

.footer-social a {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-800);
  border-radius: 8px;
  color: var(--gray-400);
  transition: all var(--transition-fast);
}

.footer-social a:hover {
  background: var(--primary);
  color: var(--white);
}

/* Contact Page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
}

.contact-info h3 {
  margin-bottom: 24px;
}

.contact-item {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.contact-icon {
  width: 48px;
  height: 48px;
  background: var(--gray-100);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.contact-form {
  padding: 48px;
  background: var(--gray-50);
  border-radius: 20px;
}

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

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  background: var(--white);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26, 54, 93, 0.1);
}

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

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

.animate-on-scroll {
  opacity: 0;
}

.animate-on-scroll.animated {
  animation: fadeInUp 0.6s ease forwards;
}

/* About Page */
.about-hero {
  padding-top: 160px;
  padding-bottom: 80px;
  background: var(--bg-secondary);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  padding-bottom: 40px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -37px;
  top: 4px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
}

.timeline-date {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
}

.timeline-item h4 {
  margin-bottom: 8px;
}

.timeline-item p {
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Code Block Styling */
.code-block {
  background: var(--gray-900);
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  overflow-x: auto;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--gray-300);
  line-height: 1.6;
}

/* Performance Metric */
.metric-highlight {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
}

.metric-unit {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gray-600);
}

/* Responsive */
@media (max-width: 1024px) {
  .research-card {
    grid-template-columns: 1fr;
    padding: 40px;
  }

  .research-card:nth-child(even) {
    direction: ltr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .service-item:nth-child(2n) {
    border-right: none;
  }

  .service-item:nth-child(3) {
    border-right: 1px solid var(--gray-200);
  }
}

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

  /* Prevent horizontal overflow on mobile */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .container {
    padding: 0 16px;
    max-width: 100%;
    overflow-x: hidden;
  }

  .header-inner {
    height: 70px;
  }

  .nav {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--white);
    flex-direction: column;
    padding: 24px;
    gap: 8px;
    border-bottom: 1px solid var(--gray-200);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition-base);
  }

  .nav.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: 12px;
  }

  .lang-switch {
    margin-left: 0;
    margin-top: 16px;
    justify-content: center;
  }

  .menu-toggle {
    display: flex;
  }

  .hero {
    min-height: auto;
    padding: 140px 0 80px;
  }

  .hero-content {
    max-width: 100%;
  }

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

  .feature-card {
    padding: 24px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .stat-number {
    font-size: 2.5rem;
  }

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

  .service-item {
    border-right: none !important;
    border-bottom: 1px solid var(--gray-200) !important;
    padding: 32px 20px;
  }

  .service-item:last-child {
    border-bottom: none !important;
  }

  .contact-grid,
  .about-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .contact-form {
    padding: 24px;
  }

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

  .footer-bottom {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

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

  /* Research card mobile fixes */
  .research-card {
    padding: 24px;
    gap: 24px;
  }

  .research-image {
    max-width: 100%;
  }

  .research-image img {
    max-width: 100%;
    height: auto;
  }

  /* Section header mobile */
  .section-header {
    max-width: 100%;
    padding: 0 8px;
  }

  /* About hero mobile */
  .about-hero {
    padding-top: 120px;
    padding-bottom: 60px;
  }

  /* Team photo mobile */
  .team-photo {
    width: 140px;
    height: 140px;
  }

  .team-card {
    padding: 24px 20px;
  }

  /* CTA content mobile */
  .cta-content {
    max-width: 100%;
    padding: 0 16px;
  }

  /* Hero subtitle mobile */
  .hero-subtitle {
    font-size: 1rem;
  }

  /* Stat items mobile */
  .stat-item {
    padding: 24px 16px;
  }

  /* Timeline mobile */
  .timeline {
    padding-left: 24px;
  }

  /* Clients grid mobile */
  .clients-grid {
    gap: 24px;
  }

  .client-logo {
    padding: 16px 24px;
    font-size: 0.85rem;
  }

  /* Japanese specific mobile fixes */
  body.ja h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }

  body.ja h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  body.ja h3 {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
  }

  body.ja .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.8;
  }

  body.ja p {
    font-size: 0.9rem;
    line-height: 1.8;
  }

  /* Prevent any element from causing horizontal scroll */
  section, div, article, aside, header, footer, main, nav {
    max-width: 100%;
  }

  /* Fix inline styles that might cause overflow */
  [style*="max-width: 900px"] {
    max-width: 100% !important;
  }

  [style*="max-width: 800px"] {
    max-width: 100% !important;
  }
}

/* Ripple Effect */
.btn {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Grain Texture Overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Party Mode / Konami Code Easter Egg */
.party-mode {
  animation: partyBg 0.5s infinite;
}

@keyframes partyBg {
  0%, 100% { filter: hue-rotate(0deg); }
  50% { filter: hue-rotate(30deg); }
}

.confetti {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 10px;
  z-index: 10000;
  pointer-events: none;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.party-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #c026d3 0%, #6366f1 50%, #06b6d4 100%);
  color: white;
  padding: 30px 50px;
  border-radius: 20px;
  font-size: 1.5rem;
  font-weight: 700;
  z-index: 10001;
  text-align: center;
  box-shadow: 0 20px 60px rgba(192, 38, 211, 0.5);
  animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
  0% { transform: translate(-50%, -50%) scale(0); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

/* Fun Footer */
.footer-fun {
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-top: 8px;
  font-style: italic;
  opacity: 0.8;
  transition: all 0.3s ease;
}

.footer-fun:hover {
  opacity: 1;
  color: #c026d3;
}

/* Enhanced Scroll Animations */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered animations for grid items */
.features-grid .animate-on-scroll:nth-child(1) { transition-delay: 0s; }
.features-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.1s; }
.features-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.2s; }
.features-grid .animate-on-scroll:nth-child(4) { transition-delay: 0.3s; }

.team-grid .animate-on-scroll:nth-child(1) { transition-delay: 0s; }
.team-grid .animate-on-scroll:nth-child(2) { transition-delay: 0.15s; }
.team-grid .animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.team-grid .animate-on-scroll:nth-child(4) { transition-delay: 0.45s; }

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden { display: none; }
.visible { visibility: visible; }

/* Print Styles */
@media print {
  .header,
  .footer,
  .lang-switch {
    display: none;
  }

  .section {
    padding: 40px 0;
  }
}

/* ========================================
   COMPREHENSIVE DARK MODE OVERRIDES
   Apple-inspired Dark Theme
   ======================================== */

/* Dark mode helper for system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
  }
}

[data-theme="dark"] {
  color-scheme: dark;
}

/* Nav Links */
[data-theme="dark"] .nav-link,
:root:not([data-theme="light"]) .nav-link {
  color: var(--text-secondary);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active,
:root:not([data-theme="light"]) .nav-link:hover,
:root:not([data-theme="light"]) .nav-link.active {
  color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-link {
    color: var(--text-secondary);
  }
  :root:not([data-theme="light"]) .nav-link:hover,
  :root:not([data-theme="light"]) .nav-link.active {
    color: var(--text-primary);
  }
}

/* Language Switch */
[data-theme="dark"] .lang-switch {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .lang-btn {
  color: var(--text-secondary);
}

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

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lang-switch {
    background: var(--bg-tertiary);
  }
  :root:not([data-theme="light"]) .lang-btn {
    color: var(--text-secondary);
  }
  :root:not([data-theme="light"]) .lang-btn.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
  }
}

/* Theme Toggle Button */
[data-theme="dark"] .theme-toggle {
  background: var(--bg-tertiary);
}

[data-theme="dark"] .theme-toggle svg {
  color: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle {
    background: var(--bg-tertiary);
  }
  :root:not([data-theme="light"]) .theme-toggle svg {
    color: var(--text-primary);
  }
}

/* Feature Cards */
[data-theme="dark"] .feature-card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .feature-card h3,
[data-theme="dark"] .feature-card h4 {
  color: var(--text-primary);
}

[data-theme="dark"] .feature-card p {
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .feature-card {
    background: var(--bg-card);
    border-color: var(--border-color);
  }
  :root:not([data-theme="light"]) .feature-card h3,
  :root:not([data-theme="light"]) .feature-card h4 {
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) .feature-card p {
    color: var(--text-secondary);
  }
}

/* Team Cards */
[data-theme="dark"] .team-card {
  background: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .team-card h4 {
  color: var(--text-primary);
}

[data-theme="dark"] .team-role,
[data-theme="dark"] .team-bio {
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .team-card {
    background: var(--bg-card);
    border-color: var(--border-color);
  }
  :root:not([data-theme="light"]) .team-card h4 {
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) .team-role,
  :root:not([data-theme="light"]) .team-bio {
    color: var(--text-secondary);
  }
}

/* Research Cards */
[data-theme="dark"] .research-card {
  background: var(--bg-elevated);
  border-color: var(--border-color);
}

[data-theme="dark"] .research-content h3 {
  color: var(--text-primary);
}

[data-theme="dark"] .research-content p,
[data-theme="dark"] .research-content li {
  color: var(--text-secondary);
}

[data-theme="dark"] .research-meta span {
  color: var(--text-tertiary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .research-card {
    background: var(--bg-elevated);
    border-color: var(--border-color);
  }
  :root:not([data-theme="light"]) .research-content h3 {
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) .research-content p,
  :root:not([data-theme="light"]) .research-content li {
    color: var(--text-secondary);
  }
  :root:not([data-theme="light"]) .research-meta span {
    color: var(--text-tertiary);
  }
}

/* Tags */
[data-theme="dark"] .tag,
[data-theme="dark"] .research-tags span {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tag,
  :root:not([data-theme="light"]) .research-tags span {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
  }
}

/* Section Headers */
[data-theme="dark"] .section-header h2 {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .section-header p,
[data-theme="dark"] .section-label {
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .section-header h2 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  :root:not([data-theme="light"]) .section-header p,
  :root:not([data-theme="light"]) .section-label {
    color: var(--text-secondary);
  }
}

/* CTA Section */
[data-theme="dark"] .cta-section,
[data-theme="dark"] .cta {
  background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cta-section,
  :root:not([data-theme="light"]) .cta {
    background: linear-gradient(135deg, #312e81 0%, #4c1d95 100%);
  }
}

/* Stats Section */
[data-theme="dark"] .stats {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

[data-theme="dark"] .stat-item {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .stat-number {
  background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 50%, #67e8f9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .stat-label {
  color: rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stats {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  }
  :root:not([data-theme="light"]) .stat-item {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
  }
  :root:not([data-theme="light"]) .stat-number {
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 50%, #67e8f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  :root:not([data-theme="light"]) .stat-label {
    color: rgba(255, 255, 255, 0.8);
  }
}

/* Form Elements */
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-textarea {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

[data-theme="dark"] .form-input::placeholder,
[data-theme="dark"] .form-textarea::placeholder {
  color: var(--text-tertiary);
}

[data-theme="dark"] .form-input:focus,
[data-theme="dark"] .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-input,
  :root:not([data-theme="light"]) .form-textarea {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) .form-input::placeholder,
  :root:not([data-theme="light"]) .form-textarea::placeholder {
    color: var(--text-tertiary);
  }
  :root:not([data-theme="light"]) .form-input:focus,
  :root:not([data-theme="light"]) .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.2);
  }
}

/* Logo in Dark Mode */
[data-theme="dark"] .logo span {
  color: var(--text-primary);
}

[data-theme="dark"] .footer-logo span {
  color: var(--footer-text);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo span {
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) .footer-logo span {
    color: var(--footer-text);
  }
}

/* Research Image Container */
[data-theme="dark"] .research-image {
  background: var(--bg-tertiary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .research-image {
    background: var(--bg-tertiary);
  }
}

/* Google Maps Dark Mode Filter */
[data-theme="dark"] iframe[src*="maps.google.com"],
[data-theme="dark"] iframe[src*="google.com/maps"] {
  filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) iframe[src*="maps.google.com"],
  :root:not([data-theme="light"]) iframe[src*="google.com/maps"] {
    filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
  }
}

/* Mobile Menu Dark Mode */
[data-theme="dark"] .nav.active {
  background: var(--bg-primary);
}

[data-theme="dark"] .menu-toggle span {
  background: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav.active {
    background: var(--bg-primary);
  }
  :root:not([data-theme="light"]) .menu-toggle span {
    background: var(--text-primary);
  }
}

/* Timeline Dark Mode */
[data-theme="dark"] .timeline::before {
  background: var(--border-color);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .timeline::before {
    background: var(--border-color);
  }
}

/* General Text Colors */
[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4 {
  color: var(--text-primary);
}

[data-theme="dark"] p, [data-theme="dark"] li {
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) h1,
  :root:not([data-theme="light"]) h2,
  :root:not([data-theme="light"]) h3,
  :root:not([data-theme="light"]) h4 {
    color: var(--text-primary);
  }
  :root:not([data-theme="light"]) p,
  :root:not([data-theme="light"]) li {
    color: var(--text-secondary);
  }
}

/* Inline style overrides */
[data-theme="dark"] [style*="color: var(--gray-500)"],
[data-theme="dark"] [style*="color: var(--gray-600)"] {
  color: var(--text-secondary) !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [style*="color: var(--gray-500)"],
  :root:not([data-theme="light"]) [style*="color: var(--gray-600)"] {
    color: var(--text-secondary) !important;
  }
}
