/* =============================================
   CSS CUSTOM PROPERTIES — 8px baseline system
   ============================================= */
:root {
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;

  --font-sm:  13px;
  --font-md:  15px;
  --font-lg:  17px;
  --font-xl:  18px;
  --font-2xl: 22px;
  --font-3xl: 28px;
  --font-4xl: 42px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);

  --nav-height: 70px;
  --max-width: 1100px;

  /* Light mode colors */
  --bg: #ffffff;
  --bg-subtle: #f0f7ff;
  --bg-light: #f5f8fc;
  --text: #374151;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #dbeafe;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --accent: #ff6b35;
  --nav-bg: #0a1f3d;
}

/* =============================================
   DARK MODE
   ============================================= */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --bg-subtle: #161b27;
    --bg-light: #1a2033;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --text-light: #6b7280;
    --border: #1e2d4a;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --accent: #ff7c4d;
    --nav-bg: #060d1a;
  }
  nav { background: var(--nav-bg); }
  .cap-card { background: var(--bg-subtle); border-color: var(--border); }
  .service-card { background: var(--bg); border-color: var(--border); }
  .about-content { background: var(--bg-subtle); border-color: var(--border); }
  .data-type { background: var(--bg-subtle); border-color: var(--border); }
  .modal { background: var(--bg); }
  footer { background: var(--nav-bg); }
}

/* =============================================
   NEWS TICKER / CAROUSEL
   ============================================= */
.news-ticker-wrap {
  background: var(--nav-bg);
  height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.ticker-label {
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 0 14px;
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 1px;
}
.ticker-track {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.ticker-list {
  display: flex;
  align-items: center;
  animation: ticker-scroll 30s linear infinite;
  width: max-content;
}
.ticker-list:hover { animation-play-state: paused; }
@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-item {
  display: flex;
  align-items: center;
  padding: 0 28px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 200ms;
  height: 44px;
}
.ticker-item:hover { color: #93c5fd; }
.ticker-item .ticker-tag {
  background: var(--primary);
  color: white;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  margin-right: 8px;
  flex-shrink: 0;
}
.ticker-item .ticker-tag.ai    { background: #7c3aed; }
.ticker-item .ticker-tag.tech  { background: #0891b2; }
.ticker-item .ticker-tag.trend { background: #ea580c; }
.ticker-dot {
  width: 4px; height: 4px;
  background: var(--accent);
  border-radius: 50%;
  margin: 0 16px;
  flex-shrink: 0;
}
.ticker-item:focus { outline: 2px solid #93c5fd; outline-offset: -2px; }

/* Force dark mode via data attribute */
[data-theme="dark"] {
  --bg: #0f1117;
  --bg-subtle: #161b27;
  --bg-light: #1a2033;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --border: #1e2d4a;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --accent: #ff7c4d;
  --nav-bg: #060d1a;
}
[data-theme="dark"] nav { background: var(--nav-bg); }
[data-theme="dark"] .cap-card { background: var(--bg-subtle); border-color: var(--border); }
[data-theme="dark"] .service-card { background: var(--bg); border-color: var(--border); }
[data-theme="dark"] .about-content { background: var(--bg-subtle); border-color: var(--border); }
[data-theme="dark"] .data-type { background: var(--bg-subtle); border-color: var(--border); }
[data-theme="dark"] .modal { background: var(--bg); }
[data-theme="dark"] footer { background: var(--nav-bg); }

/* =============================================
   BASE RESET
   ============================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.8;
  background: var(--bg);
  transition: background 300ms var(--ease-in-out), color 300ms var(--ease-in-out);
}

/* =============================================
   ENTRANCE ANIMATIONS (respects reduced motion)
   ============================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* =============================================
   NAVIGATION
   ============================================= */
nav {
  background: var(--nav-bg);
  padding: 0 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 100;
}
.logo { color: white; font-size: 20px; font-weight: bold; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.logo span { color: #93c5fd; }
.logo img { height: 32px; width: auto; }

.nav-links { display: flex; align-items: center; }
.nav-links a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  margin-left: 40px;
  font-size: 15px;
  transition: color 200ms var(--ease-out);
  padding: 4px 0;
}
.nav-links a:hover { color: #93c5fd; }
.nav-links a:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 4px;
  border-radius: 2px;
}

.recruit-btn {
  background: var(--primary);
  color: #ffffff;
  padding: 6px 18px;
  border-radius: 20px;
  font-weight: bold;
  margin-left: 40px;
  text-decoration: none;
  transition: background 200ms var(--ease-out);
  cursor: pointer;
  border: none;
}
.recruit-btn:hover { background: var(--primary-dark); color: #ffffff; }
.recruit-btn:focus-visible { outline: 2px solid #93c5fd; outline-offset: 4px; }

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms var(--ease-in-out), visibility 300ms var(--ease-in-out);
}
.modal-overlay.show {
  display: flex;
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  padding: var(--space-5);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.96);
  transition: transform 300ms var(--ease-out);
}
.modal-overlay.show .modal { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 14px; right: 18px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  background: none;
  border: none;
  line-height: 1;
  padding: 4px;
  transition: color 200ms var(--ease-out);
}
.modal-close:hover { color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

.modal h2 { font-size: var(--font-2xl); color: var(--text); margin-bottom: var(--space-3); }
.modal .tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.modal .tag-item {
  background: var(--bg-subtle);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--font-sm);
  border: 1px solid var(--border);
}
.modal .info-line { font-size: var(--font-md); color: var(--text-muted); margin-bottom: 8px; }
.modal .info-line strong { color: var(--text); }
.modal .phones { font-size: var(--font-xl); color: var(--text); font-weight: bold; margin: var(--space-3) 0; letter-spacing: 1px; }
.modal .cta {
  background: var(--accent);
  color: white;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  font-size: var(--font-md);
  font-weight: bold;
  margin-top: var(--space-3);
  cursor: pointer;
  border: none;
  width: 100%;
  transition: filter 200ms var(--ease-out);
}
.modal .cta:hover { filter: brightness(1.1); }
.modal .cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.modal .source-note { font-size: 12px; color: var(--text-light); margin-top: var(--space-2); }

/* =============================================
   HERO
   ============================================= */
.hero {
  background: linear-gradient(135deg, var(--nav-bg) 0%, #1a3a6b 100%);
  padding: calc(var(--nav-height) + 80px) 60px 80px;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}
/* Subtle background grid pattern */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.hero h1 { font-size: var(--font-4xl); margin-bottom: var(--space-4); letter-spacing: 4px; animation: fadeUp 700ms var(--ease-out) both; }
.hero p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 800px;
  margin: 0 auto 40px;
  line-height: 1.9;
  animation: fadeUp 700ms 100ms var(--ease-out) both;
}
.hero-tags {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeUp 700ms 200ms var(--ease-out) both;
}

.tag {
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: #c7d2fe;
  padding: 8px 22px;
  border-radius: 30px;
  font-size: var(--font-sm);
  transition: background 200ms var(--ease-out);
}
.tag:hover { background: rgba(99, 102, 241, 0.28); }

/* =============================================
   SECTIONS
   ============================================= */
.section { padding: var(--space-10) 60px; }
.section-title { text-align: center; margin-bottom: 60px; }
.section-title h2 { font-size: var(--font-3xl); color: var(--text); margin-bottom: 14px; }
.section-title .line { width: 60px; height: 3px; background: var(--primary); margin: 0 auto; border-radius: 2px; }
.section-title p { color: var(--text-muted); margin-top: 14px; font-size: var(--font-sm); }

/* =============================================
   CAPABILITIES
   ============================================= */
.capabilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  max-width: var(--max-width);
  margin: 0 auto;
}
.cap-card {
  background: var(--bg-subtle);
  border-radius: 14px;
  padding: var(--space-5) var(--space-4);
  text-align: center;
  transition: transform 250ms var(--ease-out), box-shadow 250ms var(--ease-out), background 300ms var(--ease-in-out);
  border: 1px solid var(--border);
}
.cap-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(29, 78, 216, 0.15);
}
.cap-card:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.cap-icon { font-size: 44px; margin-bottom: var(--space-3); }
.cap-card h3 { font-size: var(--font-lg); color: var(--text); margin-bottom: 12px; }
.cap-card p { font-size: var(--font-sm); color: var(--text-muted); }

/* =============================================
   SERVICE GRID
   ============================================= */
.bg-light { background: var(--bg-light); }
.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  max-width: var(--max-width);
  margin: 0 auto;
}
.service-card {
  background: var(--bg);
  border-radius: 12px;
  padding: var(--space-4);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  transition: background 300ms var(--ease-in-out), border-color 300ms var(--ease-in-out);
}
.service-card:hover { border-color: var(--primary); }
.service-card h3 {
  font-size: var(--font-lg);
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}
.service-card p { font-size: var(--font-sm); color: var(--text-muted); }

/* =============================================
   DATA TYPES
   ============================================= */
.data-types {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}
.data-type {
  background: var(--bg);
  border-radius: 10px;
  padding: 18px 32px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: center;
  min-width: 140px;
  border: 1px solid var(--border);
  transition: background 300ms var(--ease-in-out), transform 200ms var(--ease-out);
}
.data-type:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(29, 78, 216, 0.1); }
.data-type .emoji { font-size: 32px; margin-bottom: 8px; }
.data-type .label { font-size: var(--font-sm); color: var(--text); }

/* =============================================
   ABOUT
   ============================================= */
.about-content {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-subtle);
  border-radius: 16px;
  padding: var(--space-8);
  border: 1px solid var(--border);
  transition: background 300ms var(--ease-in-out);
}
.about-content p { font-size: 16px; color: var(--text-muted); margin-bottom: var(--space-3); }
.stats { display: flex; justify-content: space-around; margin-top: 40px; flex-wrap: wrap; gap: var(--space-3); }
.stat { text-align: center; }
.stat .num { font-size: 36px; font-weight: bold; color: var(--primary); }
.stat .desc { font-size: var(--font-sm); color: var(--text-muted); margin-top: 4px; }

/* =============================================
   FOOTER
   ============================================= */
footer {
  background: var(--nav-bg);
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: var(--space-4);
  font-size: var(--font-sm);
}
footer span { color: #93c5fd; }
footer a {
  color: #93c5fd;
  text-decoration: none;
  transition: color 200ms var(--ease-out);
  border-bottom: 1px solid rgba(147, 197, 253, 0.4);
  padding-bottom: 1px;
}
footer a:hover { color: #ffffff; border-bottom-color: #ffffff; }
footer a:focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; border-radius: 2px; }

/* =============================================
   SKIP LINK
   ============================================= */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--primary);
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  text-decoration: none;
  font-weight: bold;
  z-index: 9999;
  transition: top 200ms var(--ease-out);
}
.skip-link:focus { top: 0; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
  .capabilities, .service-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  nav { padding: 0 24px; }
  .hero { padding: calc(var(--nav-height) + 60px) 24px 60px; }
  .hero h1 { font-size: var(--font-3xl); }
  .section { padding: var(--space-8) 24px; }
  .capabilities, .service-grid { grid-template-columns: 1fr; }
  .cap-card:hover { transform: none; }
}