/* ============================================
   企业CMS - UI Designer 重构版 v2
   专业级企业官网设计系统
   ============================================ */

/* --- 设计令牌（Design Tokens）--- */
:root {
  /* 主色系 - 深邃靛蓝 */
  --color-primary: #1E3A5F;
  --color-primary-light: #2D5A8A;
  --color-primary-dark: #0F2440;
  --color-primary-bg: rgba(30, 58, 95, 0.06);
  --color-primary-rgb: 30, 58, 95;

  /* 强调色 - 明亮青蓝 */
  --color-accent: #00B4D8;
  --color-accent-light: #48CAE4;
  --color-accent-dark: #0096C7;

  /* 功能色 */
  --color-success: #059669;
  --color-warning: #D97706;
  --color-danger: #DC2626;
  --color-info: #2563EB;

  /* 文字色阶 */
  --color-text-primary: #1F2937;
  --color-text-secondary: #4B5563;
  --color-text-tertiary: #9CA3AF;
  --color-text-inverse: #FFFFFF;
  --color-text-muted: #6B7280;

  /* 背景色阶 */
  --color-bg-primary: #FFFFFF;
  --color-bg-secondary: #F8FAFC;
  --color-bg-tertiary: #F1F5F9;
  --color-bg-warm: #FFFBEB;
  --color-bg-dark: #0F172A;
  --color-bg-dark-card: #1E293B;

  /* 边框 */
  --color-border: #E2E8F0;
  --color-border-light: #F1F5F9;

  /* 字体 */
  --font-display: 'DM Sans', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Inter', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* 字号 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  /* 间距 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* 阴影系统 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.10);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 40px rgba(var(--color-primary-rgb), 0.15);

  /* 圆角 */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* 过渡 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-base: 300ms;
  --duration-slow: 500ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-primary);
  background: var(--color-bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-accent); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary-dark);
}

/* ========== Layout ========== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-5);
}
@media (min-width: 768px) { .container { padding-inline: var(--space-8); } }
@media (min-width: 1024px) { .container { padding-inline: var(--space-6); } }

/* ========== Top Bar ========== */
.top-bar {
  background: var(--color-bg-dark);
  color: rgba(255,255,255,0.75);
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}
.top-bar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.top-bar span + span { margin-left: var(--space-4); }
.top-bar a { color: inherit; opacity: 0.8; }
.top-bar a:hover { opacity: 1; color: #fff; }

/* ========== Header / Navigation ========== */
.header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: box-shadow var(--duration-base) var(--ease-out);
}
.header.scrolled { box-shadow: var(--shadow-sm); }
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* Logo */
.logo { flex-shrink: 0; }
.logo a { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text-primary); }
.logo img { height: 38px; width: auto; }
.logo h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-primary);
  line-height: 1.2;
}
.logo .slogan {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

/* Nav Menu */
.nav { display: flex; align-items: center; }
.main-menu {
  display: flex;
  list-style: none;
  gap: 2px;
}
.main-menu > li { position: relative; }
.main-menu a {
  display: block;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
}
.main-menu a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 16px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: transform var(--duration-fast) var(--ease-out);
}
.main-menu a:hover {
  color: var(--color-primary);
  background: var(--color-primary-bg);
}
.main-menu a:hover::after { transform: translateX(-50%) scaleX(1); }
.main-menu .active a { color: var(--color-primary); background: var(--color-primary-bg); }
.main-menu .active a::after { transform: translateX(-50%) scaleX(1); }

/* Sub Menu */
.menu-item-has-children { position: relative; }
.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) 0;
  z-index: 100;
  animation: fadeInUp 200ms var(--ease-out);
}
.menu-item-has-children:hover .sub-menu { display: block; }
.sub-menu li { margin: 0; }
.sub-menu a {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: 0;
  white-space: nowrap;
}
.sub-menu a::after { display: none; }
.sub-menu a:hover { background: var(--color-bg-tertiary); color: var(--color-primary); }

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

/* Mobile Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: var(--space-2);
  border: none;
  background: transparent;
}
.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: var(--radius-full);
  transition: all var(--duration-base) var(--ease-out);
}
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .nav .main-menu {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: var(--color-bg-primary);
    flex-direction: column;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
  }
  .nav .main-menu.show { display: flex; }
  .sub-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: var(--color-bg-tertiary);
    padding-left: var(--space-4);
    display: block !important;
  }
}

/* ========== Search Bar ========== */
.search-bar {
  background: var(--color-bg-tertiary);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) 0;
}
.search-form {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}
.search-form input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  padding-right: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  transition: all var(--duration-fast) var(--ease-out);
}
.search-form input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1);
}
.search-form button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: none;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast);
}
.search-form button:hover { background: var(--color-primary-light); }

/* ========== HERO SECTION ========== */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 40%, var(--color-primary-light) 70%, var(--color-accent-dark) 100%);
  color: var(--color-text-inverse);
  padding: var(--space-20) 0 var(--space-24);
  overflow: hidden;
  min-height: 520px;
  display: flex;
  align-items: center;
}

/* Decorative elements */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 50%, rgba(0,180,216,0.15) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(255,255,255,0.08) 0%, transparent 40%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to top, var(--color-bg-secondary), transparent);
  pointer-events: none;
}

/* Grid pattern overlay */
.hero .hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero .container {
  position: relative;
  text-align: center;
  z-index: 1;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: var(--space-6);
  text-shadow: 0 2px 20px rgba(0,0,0,0.15);
}
.hero h1 br { display: block; }

.hero p {
  font-size: var(--text-lg);
  opacity: 0.88;
  max-width: 600px;
  margin: 0 auto var(--space-10);
  line-height: 1.7;
  font-weight: 300;
}

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

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  border: 2px solid transparent;
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-bg-dark);
  border-color: var(--color-accent);
}
.btn-accent:hover:not(:disabled) {
  background: var(--color-accent-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-text-inverse);
  border-color: rgba(255,255,255,0.35);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.6);
  transform: translateY(-2px);
}

.btn-white {
  background: var(--color-bg-primary);
  color: var(--color-primary);
  border-color: var(--color-bg-primary);
}
.btn-white:hover:not(:disabled) {
  background: #fff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-primary-bg);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }

/* ========== SECTION COMMON STYLES ========== */
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: var(--space-3);
  letter-spacing: -0.02em;
}
.section-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--text-lg);
  max-width: 560px;
  margin: 0 auto var(--space-16);
  line-height: 1.6;
}

/* Section with alternating backgrounds */
.features { padding: var(--space-20) 0; background: var(--color-bg-primary); }
.products { padding: var(--space-20) 0; background: var(--color-bg-secondary); }
.news { padding: var(--space-20) 0; background: var(--color-bg-primary); }
.contact-brief { padding: var(--space-20) 0; }

/* ========== CARDS ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
}

.card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: transparent;
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}
.card:hover .card-img { transform: scale(1.05); }
.card-img-wrapper { overflow: hidden; }

.card-body {
  padding: var(--space-6);
}
.card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.4;
  transition: color var(--duration-fast);
}
.card:hover .card-title { color: var(--color-primary); }
.card-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* Feature card variant */
.features .card {
  text-align: center;
  padding: var(--space-10) var(--space-6);
  border: none;
  background: var(--color-bg-primary);
  box-shadow: var(--shadow-xs);
}
.features .card:hover {
  box-shadow: var(--shadow-lg);
  border: none;
}
.feature-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-bg);
  border-radius: var(--radius-xl);
  font-size: 1.75rem;
  transition: all var(--duration-base) var(--ease-out);
}
.features .card:hover .feature-icon {
  background: var(--color-primary);
  transform: scale(1.1) rotate(-5deg);
}
.features .card:hover .feature-icon .emoji-icon { filter: brightness(0) invert(1); }

/* News card time badge */
.time-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}
.time-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* Read more link */
.read-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  margin-top: var(--space-4);
  transition: all var(--duration-fast) var(--ease-out);
}
.read-more:hover { gap: var(--space-3); color: var(--color-accent); }

/* Section CTA */
.section-cta {
  text-align: center;
  margin-top: var(--space-14);
}

/* ========== CONTACT BRIEF CTA ========== */
.contact-brief {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-bg-dark) 100%);
  color: var(--color-text-inverse);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.contact-brief::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(0,180,216,0.12) 0%, transparent 50%);
}
.contact-brief .container { position: relative; z-index: 1; }
.contact-brief h2 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
.contact-brief p {
  font-size: var(--text-lg);
  opacity: 0.85;
  max-width: 520px;
  margin: 0 auto var(--space-8);
}
.contact-brief .cta-group { justify-content: center; }

/* ========== FOOTER ========== */
.footer {
  background: var(--color-bg-dark);
  color: rgba(255,255,255,0.65);
  padding: var(--space-16) 0 var(--space-8);
  position: relative;
}
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.footer-widgets {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.widget h3 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-inverse);
  margin-bottom: var(--space-5);
  position: relative;
  padding-bottom: var(--space-3);
}
.widget h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 32px;
  height: 2px;
  background: var(--color-accent);
  border-radius: var(--radius-full);
}

.footer p,
.footer li {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: rgba(255,255,255,0.55);
}
.footer a { color: inherit; transition: color var(--duration-fast); }
.footer a:hover { color: var(--color-accent); }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: var(--space-2); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: var(--space-6);
  text-align: center;
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.35);
}
.footer-bottom p { margin-bottom: var(--space-1); font-size: var(--text-xs); }
.footer-bottom a { color: rgba(255,255,255,0.45); }

/* ========== Back to Top ========== */
.back-to-top {
  position: fixed;
  bottom: var(--space-8);
  right: var(--space-8);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: var(--text-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--duration-base) var(--ease-out);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--color-accent);
  transform: translateY(-3px);
}

/* ========== 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: 0;
}

.text-center { text-align: center; }
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-text-muted); }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .footer-widgets { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
}

@media (max-width: 768px) {
  .hero { padding: var(--space-16) 0 var(--space-20); min-height: 420px; }
  .hero h1 { font-size: var(--text-3xl); }
  .hero p { font-size: var(--text-base); }
  .card-grid { grid-template-columns: 1fr; }
  .section-title { font-size: var(--text-2xl); }
  .section-subtitle { font-size: var(--text-base); margin-bottom: var(--space-10); }
  .features, .products, .news, .contact-brief { padding: var(--space-14) 0; }
  .footer-widgets { grid-template-columns: 1fr; gap: var(--space-8); }
  .back-to-top { bottom: var(--space-4); right: var(--space-4); }
}

@media (max-width: 480px) {
  .hero h1 { font-size: var(--text-2xl); }
  .btn-lg { padding: var(--space-3) var(--space-6); font-size: var(--text-sm); }
  .cta-group { flex-direction: column; align-items: stretch; }
  .cta-group .btn { width: 100%; justify-content: center; }
}

/* ========== Animations ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Scroll-triggered entrance animation classes (JS adds these) */
.fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
