/* ================= 全局变量与重置 ================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --bg-light: #f8fafc;
  --bg-dark: #0b1120;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #f1f5f9;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --container-width: 1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-main);
  color: var(--text-main);
  background-color: #fff;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; height: auto; object-fit: cover; }
ul { list-style: none; }
a { text-decoration: none; color: inherit; transition: var(--transition); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section { padding: 5rem 0; }
.section-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  font-weight: 700;
  color: var(--secondary);
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--primary);
  margin: 0.8rem auto 0;
  border-radius: 2px;
}

.btn {
  display: inline-block;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); }
.btn-outline { background: transparent; border: 2px solid #fff; color: #fff; }
.btn-outline:hover { background: #fff; color: var(--secondary); }

/* ================= 滚动叙事动画 ================= */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ================= M01_Header ================= */
#main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 1rem 0;
  transition: var(--transition);
  background: transparent;
}
#main-header.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 0.6rem 0;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
}
#main-header.scrolled .logo { color: var(--secondary); }

.main-nav ul { display: flex; gap: 1.5rem; }
.main-nav a {
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  position: relative;
}
#main-header.scrolled .main-nav a { color: var(--text-main); }
.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--primary);
  transition: var(--transition);
}
.main-nav a:hover::after { width: 100%; }

.menu-toggle { display: none; font-size: 1.5rem; color: #fff; }
#main-header.scrolled .menu-toggle { color: var(--secondary); }

/* ================= M02_Hero ================= */
.hero-section {
  position: relative;
  height: 100vh;
  min-height: 600px;
  overflow: hidden;
  color: #fff;
}
.hero-slider { position: absolute; inset: 0; }
.slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1s ease;
}
.slide.active { opacity: 1; }
.slide::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.7));
}
.slide-content {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 90%;
  max-width: 800px;
}
.slide-content h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 1rem;
  line-height: 1.2;
}
.slide-content p {
  font-size: clamp(1rem, 2vw, 1.25rem);
  margin-bottom: 2rem;
  opacity: 0.9;
}
.slider-dots {
  position: absolute;
  bottom: 2rem; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 0.8rem;
}
.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: var(--transition);
}
.dot.active { background: #fff; transform: scale(1.2); }

/* ================= M03_Services ================= */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}
.service-card {
  background: #fff;
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  text-align: center;
  border: 1px solid var(--border);
}
.service-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-hover); }
.service-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.service-card h3 { margin-bottom: 0.8rem; color: var(--secondary); }
.service-card p { color: var(--text-muted); font-size: 0.95rem; }

/* ================= M04_Portfolio ================= */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 250px;
  gap: 1rem;
}
.portfolio-item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: pointer;
}
.portfolio-item img { width: 100%; height: 100%; transition: transform 0.5s ease; }
.portfolio-item:hover img { transform: scale(1.05); }
.portfolio-item .overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: var(--transition);
}
.portfolio-item:hover .overlay { opacity: 1; }
.portfolio-item .overlay h4 { color: #fff; font-size: 1.2rem; padding: 0 1rem; text-align: center; }

.tall { grid-row: span 2; }
.wide { grid-column: span 2; }

/* ================= M05_Stats ================= */
#stats { background: var(--bg-light); }
.stats-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3rem;
  text-align: center;
}
.stat-item { flex: 1 1 200px; }
.stat-number {
  display: block;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 0.5rem;
}
.stat-label { font-size: 1.1rem; color: var(--text-muted); font-weight: 500; }

/* ================= M06_Clients ================= */
.marquee-wrapper {
  overflow: hidden;
  width: 100%;
  padding: 2rem 0;
  background: #fff;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 25s linear infinite;
}
.client-logo {
  flex: 0 0 auto;
  width: 180px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 2rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-light);
  border-radius: 8px;
  border: 1px solid var(--border);
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ================= M07_News ================= */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.news-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}
.news-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.news-card img { width: 100%; height: 200px; }
.news-content { padding: 1.5rem; }
.news-content time { font-size: 0.85rem; color: var(--primary); font-weight: 600; display: block; margin-bottom: 0.5rem; }
.news-content h3 { font-size: 1.2rem; margin-bottom: 0.8rem; color: var(--secondary); }
.news-content p { color: var(--text-muted); font-size: 0.95rem; }

/* ================= M08_Footer ================= */
#footer { background: var(--bg-dark); color: var(--text-light); padding: 4rem 0 2rem; }
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2.5rem;
  margin-bottom: 3rem;
}
.footer-col h4 { font-size: 1.2rem; margin-bottom: 1.2rem; color: #fff; }
.footer-col p, .footer-col a { color: #94a3b8; font-size: 0.95rem; margin-bottom: 0.6rem; display: block; }
.footer-col a:hover { color: var(--primary); }
.social-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.social-links a { background: rgba(255,255,255,0.1); padding: 0.4rem 0.8rem; border-radius: 4px; }
.social-links a:hover { background: var(--primary); color: #fff; }
.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  color: #64748b;
}

/* ================= 响应式适配 ================= */
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .main-nav {
    position: fixed;
    top: 0; right: -100%;
    width: 75%; max-width: 300px;
    height: 100vh;
    background: #fff;
    padding: 5rem 2rem 2rem;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 999;
  }
  .main-nav.open { right: 0; }
  .main-nav ul { flex-direction: column; gap: 1.5rem; }
  .main-nav a { color: var(--text-main); font-size: 1.1rem; }
  
  .portfolio-grid { grid-auto-rows: 200px; }
  .wide { grid-column: span 1; }
  .tall { grid-row: span 1; }
  
  .stats-grid { gap: 2rem; }
  .stat-item { flex: 1 1 45%; }
}